From 76e48c89f9b6da8772de8312a61f665d3cb28166 Mon Sep 17 00:00:00 2001 From: fenze Date: Sun, 15 May 2022 22:59:53 +0200 Subject: [PATCH] cleaned some tabs, add debug option to makefile --- keyconf.h | 6 +++--- makefile | 3 +++ rose.h | 1 - webview.c | 9 ++------- window.c | 12 +++--------- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/keyconf.h b/keyconf.h index c1e1880..26a124c 100644 --- a/keyconf.h +++ b/keyconf.h @@ -18,9 +18,9 @@ #define DARKMODE 2 #define SCROLLBARS 3 -#define KEYBINDS static Key keys[] = -#define APPERANCE static int appearance[] = -#define OPTIONS static char *options[] = +#define KEYBINDS static inline Key keys[] +#define APPERANCE static inline int appearance[] +#define OPTIONS static inline char *options[] typedef struct { unsigned modkey; diff --git a/makefile b/makefile index e044b73..33e5f0b 100644 --- a/makefile +++ b/makefile @@ -25,6 +25,9 @@ rose: $(CC) -fPIC -O3 -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) strip ./rose +debug: + $(CC) -fPIC -o rose *.c $(CFLAGS) $(LIBS) $(OPTIONS) -Wall -Wextra + config.h: [ -f "$@" ] || cp config.def.h $@ diff --git a/rose.h b/rose.h index 2c0c48b..99ea26c 100644 --- a/rose.h +++ b/rose.h @@ -20,4 +20,3 @@ static Atom atoms[AtomLast]; static Display *dpy; const char* getatom(int a); void setatom(int a, const char *v); -static int spair[2]; diff --git a/webview.c b/webview.c index 659dc6e..4697bbc 100644 --- a/webview.c +++ b/webview.c @@ -131,8 +131,6 @@ static void rose_download(const char* uri) int id = fork(); if (id == 0) { - close(spair[0]); - close(spair[1]); setsid(); char *argv[] = { "/bin/sh", "-c", "st -e /bin/sh -c", "\"aria2c \\", cmd, "\"", NULL }; execvp("/bin/sh", argv); @@ -141,16 +139,14 @@ static void rose_download(const char* uri) } } -static void rose_response_reciver(WebKitDownload *download, - GParamSpec *pspec) +static void rose_response_reciver(WebKitDownload *download) { const char *uri = webkit_uri_response_get_uri(webkit_download_get_response(download)); rose_download(uri); } -static void rose_download_callback(WebKitWebContext *context, - WebKitDownload *download) +static void rose_download_callback(WebKitDownload *download) { g_signal_connect(G_OBJECT(download), "notify::response", G_CALLBACK(rose_response_reciver), NULL); @@ -159,7 +155,6 @@ static void rose_download_callback(WebKitWebContext *context, GtkWidget* rose_webview_new() { char cookiefile[128]; - WebKitWebView *webview; WebKitCookieManager *cookiemanager; WebKitUserContentManager *contentmanager; diff --git a/window.c b/window.c index fe920b4..364f20e 100644 --- a/window.c +++ b/window.c @@ -23,8 +23,8 @@ static float zoom = 1.0; G_DEFINE_TYPE(RoseWindow, rose_window, GTK_TYPE_APPLICATION_WINDOW) static void read_clipboard(GObject *object, - GAsyncResult *res, - gpointer webview) + GAsyncResult *res, + gpointer webview) { GdkClipboard *clipboard = GDK_CLIPBOARD(object); webkit_web_view_load_uri( @@ -35,7 +35,7 @@ static void read_clipboard(GObject *object, static gboolean key_press_callback(RoseWindow *window, guint keyval, - guint keycode, + guint keycode, GdkModifierType state) { for (int i = 0; i < LENGTH(keys); i++) { @@ -76,8 +76,6 @@ static gboolean key_press_callback(RoseWindow *window, if (id == 0) { if (dpy) close(ConnectionNumber(dpy)); - close(spair[0]); - close(spair[1]); setsid(); char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose", NULL}; execvp("/bin/sh", argument_list); @@ -95,8 +93,6 @@ static gboolean key_press_callback(RoseWindow *window, if (id == 0) { if (dpy) close(ConnectionNumber(dpy)); - close(spair[0]); - close(spair[1]); setsid(); char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\tfind", NULL}; execvp("/bin/sh", argument_list); @@ -166,8 +162,6 @@ static gboolean key_press_callback(RoseWindow *window, case history: { int id = fork(); if (id == 0) { - close(spair[0]); - close(spair[1]); setsid(); char* argument_list[] = { "/bin/sh", "-c", "dmenu_rose\thistory", NULL}; execvp("/bin/sh", argument_list);