cleaned some tabs, add debug option to makefile

This commit is contained in:
fenze 2022-05-15 22:59:53 +02:00
parent 5c0533dc69
commit 76e48c89f9
5 changed files with 11 additions and 20 deletions

View File

@ -18,9 +18,9 @@
#define DARKMODE 2 #define DARKMODE 2
#define SCROLLBARS 3 #define SCROLLBARS 3
#define KEYBINDS static Key keys[] = #define KEYBINDS static inline Key keys[]
#define APPERANCE static int appearance[] = #define APPERANCE static inline int appearance[]
#define OPTIONS static char *options[] = #define OPTIONS static inline char *options[]
typedef struct { typedef struct {
unsigned modkey; unsigned modkey;

View File

@ -25,6 +25,9 @@ rose:
$(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) $(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS)
strip ./rose strip ./rose
debug:
$(CC) -fPIC -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) -Wall -Wextra
config.h: config.h:
[ -f "$@" ] || cp config.def.h $@ [ -f "$@" ] || cp config.def.h $@

1
rose.h
View File

@ -20,4 +20,3 @@ static Atom atoms[AtomLast];
static Display *dpy; static Display *dpy;
const char* getatom(int a); const char* getatom(int a);
void setatom(int a, const char *v); void setatom(int a, const char *v);
static int spair[2];

View File

@ -131,8 +131,6 @@ static void rose_download(const char* uri)
int id = fork(); int id = fork();
if (id == 0) { if (id == 0) {
close(spair[0]);
close(spair[1]);
setsid(); setsid();
char *argv[] = { "/bin/sh", "-c", "st -e /bin/sh -c", "\"aria2c \\", cmd, "\"", NULL }; char *argv[] = { "/bin/sh", "-c", "st -e /bin/sh -c", "\"aria2c \\", cmd, "\"", NULL };
execvp("/bin/sh", argv); execvp("/bin/sh", argv);
@ -141,16 +139,14 @@ static void rose_download(const char* uri)
} }
} }
static void rose_response_reciver(WebKitDownload *download, static void rose_response_reciver(WebKitDownload *download)
GParamSpec *pspec)
{ {
const char *uri = webkit_uri_response_get_uri(webkit_download_get_response(download)); const char *uri = webkit_uri_response_get_uri(webkit_download_get_response(download));
rose_download(uri); rose_download(uri);
} }
static void rose_download_callback(WebKitWebContext *context, static void rose_download_callback(WebKitDownload *download)
WebKitDownload *download)
{ {
g_signal_connect(G_OBJECT(download), "notify::response", g_signal_connect(G_OBJECT(download), "notify::response",
G_CALLBACK(rose_response_reciver), NULL); G_CALLBACK(rose_response_reciver), NULL);
@ -159,7 +155,6 @@ static void rose_download_callback(WebKitWebContext *context,
GtkWidget* rose_webview_new() GtkWidget* rose_webview_new()
{ {
char cookiefile[128]; char cookiefile[128];
WebKitWebView *webview;
WebKitCookieManager *cookiemanager; WebKitCookieManager *cookiemanager;
WebKitUserContentManager *contentmanager; WebKitUserContentManager *contentmanager;

View File

@ -23,8 +23,8 @@ static float zoom = 1.0;
G_DEFINE_TYPE(RoseWindow, rose_window, GTK_TYPE_APPLICATION_WINDOW) G_DEFINE_TYPE(RoseWindow, rose_window, GTK_TYPE_APPLICATION_WINDOW)
static void read_clipboard(GObject *object, static void read_clipboard(GObject *object,
GAsyncResult *res, GAsyncResult *res,
gpointer webview) gpointer webview)
{ {
GdkClipboard *clipboard = GDK_CLIPBOARD(object); GdkClipboard *clipboard = GDK_CLIPBOARD(object);
webkit_web_view_load_uri( webkit_web_view_load_uri(
@ -35,7 +35,7 @@ static void read_clipboard(GObject *object,
static gboolean key_press_callback(RoseWindow *window, static gboolean key_press_callback(RoseWindow *window,
guint keyval, guint keyval,
guint keycode, guint keycode,
GdkModifierType state) GdkModifierType state)
{ {
for (int i = 0; i < LENGTH(keys); i++) { for (int i = 0; i < LENGTH(keys); i++) {
@ -76,8 +76,6 @@ static gboolean key_press_callback(RoseWindow *window,
if (id == 0) { if (id == 0) {
if (dpy) if (dpy)
close(ConnectionNumber(dpy)); close(ConnectionNumber(dpy));
close(spair[0]);
close(spair[1]);
setsid(); setsid();
char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose", NULL}; char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose", NULL};
execvp("/bin/sh", argument_list); execvp("/bin/sh", argument_list);
@ -95,8 +93,6 @@ static gboolean key_press_callback(RoseWindow *window,
if (id == 0) { if (id == 0) {
if (dpy) if (dpy)
close(ConnectionNumber(dpy)); close(ConnectionNumber(dpy));
close(spair[0]);
close(spair[1]);
setsid(); setsid();
char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\tfind", NULL}; char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\tfind", NULL};
execvp("/bin/sh", argument_list); execvp("/bin/sh", argument_list);
@ -166,8 +162,6 @@ static gboolean key_press_callback(RoseWindow *window,
case history: { case history: {
int id = fork(); int id = fork();
if (id == 0) { if (id == 0) {
close(spair[0]);
close(spair[1]);
setsid(); setsid();
char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\thistory", NULL}; char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\thistory", NULL};
execvp("/bin/sh", argument_list); execvp("/bin/sh", argument_list);