adji

Adji's a Decisive and Joyful Internet browser
git clone https://noxz.tech/git/adji.git
adji

commit: d93ca09078807233810c80803984684f25a373c5
parent: a04b3e456f992a763edac7bfbd4ee4a161a92d1c
author: Chris Noxz <chris@noxz.tech>
date:   Mon, 20 Mar 2023 15:53:24 +0100
update code style for function parameters
Mbrowser.c61++++++---
Mbrowser.h132+++++++++++++-------
2 files changed, 130 insertions(+), 63 deletions(-)
diff --git a/browser.c b/browser.c
@@ -21,8 +21,10 @@
 
 
 struct Client*
-client_create(const gchar *uri, WebKitWebView *related_wv, gboolean show,
-              gboolean focus_tab)
+client_create(const gchar                      *uri,
+              WebKitWebView                    *related_wv,
+              gboolean                          show,
+              gboolean                          focus_tab)
 {
 	struct Client          *c;                  /* client to be */
 	gchar                  *u = NULL;           /* translated uri */
@@ -204,7 +206,8 @@ client_destroy(struct Client *c)
 }
 
 gboolean
-command(struct Client *c, const gchar* t)
+command(struct Client                          *c,
+        const gchar                            *t)
 {
 	if (t[0] == '/') {          /* in-page search */
 		g_free(gl.search_text);
@@ -220,8 +223,9 @@ command(struct Client *c, const gchar* t)
 }
 
 void
-create_context_menu(struct Client *c, WebKitContextMenu *context_menu,
-                    WebKitHitTestResult *hit_test_result)
+create_context_menu(struct Client              *c,
+                    WebKitContextMenu          *context_menu,
+                    WebKitHitTestResult        *hit_test_result)
 {
 	GAction                *a;                  /* context menu item action */
 	guint                   x;                  /* hit test result context */
@@ -274,7 +278,9 @@ die(const char *msg)
 }
 
 gboolean
-ipc_request(GIOChannel *src, GIOCondition condition, gpointer data)
+ipc_request(GIOChannel                         *src,
+            GIOCondition                        condition,
+            gpointer                            data)
 {
 	gchar                  *u = NULL;           /* uri received */
 
@@ -346,7 +352,8 @@ ipc_setup(void)
 }
 
 gboolean
-key_common(struct Client *c, GdkEventKey *event)
+key_common(struct Client                       *c,
+           GdkEventKey                         *event)
 {
 	int                     i,
 	                        m;
@@ -468,7 +475,8 @@ key_common(struct Client *c, GdkEventKey *event)
 }
 
 gboolean
-key_entry(struct Client *c, GdkEventKey *event)
+key_entry(struct Client                        *c,
+          GdkEventKey                          *event)
 {
 	const gchar            *t,
 	                       *l;
@@ -526,7 +534,8 @@ key_entry(struct Client *c, GdkEventKey *event)
 }
 
 gboolean
-key_tab(struct Client *c, GdkEvent *event)
+key_tab(struct Client                          *c,
+        GdkEvent                               *event)
 {
 	GdkScrollDirection      d;
 
@@ -547,7 +556,8 @@ key_tab(struct Client *c, GdkEvent *event)
 }
 
 gboolean
-key_web_view(struct Client *c, GdkEvent *event)
+key_web_view(struct Client                     *c,
+             GdkEvent                          *event)
 {
 	gdouble                 dx,                 /* scroll x-delta */
 	                        dy;                 /* scroll y-delta */
@@ -593,7 +603,8 @@ key_web_view(struct Client *c, GdkEvent *event)
 }
 
 void
-load_changed(struct Client *c, WebKitLoadEvent event_type)
+load_changed(struct Client                     *c,
+             WebKitLoadEvent                    event_type)
 {
 	switch (event_type) {
 	/* when page load starts, reset everything */
@@ -772,7 +783,8 @@ open_external(struct Client *c)
 }
 
 void
-prepare_download(WebKitDownload *d, gchar *suggested_filename)
+prepare_download(WebKitDownload                *d,
+                 gchar                         *suggested_filename)
 {
 	gchar                  *s = g_strdup(suggested_filename),
 	                       *p = NULL,           /* proposed path */
@@ -833,8 +845,10 @@ quit(void)
 }
 
 void
-render_tls_error(struct Client *c, gchar *uri, GTlsCertificate *crt,
-                 GTlsCertificateFlags cert_flags)
+render_tls_error(struct Client                 *c,
+                 gchar                         *uri,
+                 GTlsCertificate               *crt,
+                 GTlsCertificateFlags           cert_flags)
 {
 	GString                *m;                  /* message (error) */
 	gchar                  *h,                  /* html code */
@@ -945,7 +959,8 @@ save_state(void)
 }
 
 void
-search(struct Client *c, enum inpage_search_type type)
+search(struct Client                           *c,
+       enum inpage_search_type                  type)
 {
 	if (gl.search_text == NULL)
 		return;
@@ -986,7 +1001,8 @@ selection_search(struct Client *c)
 }
 
 void
-selection_search_finished(struct Client *c, GAsyncResult *result)
+selection_search_finished(struct Client        *c,
+                          GAsyncResult         *result)
 {
 	WebKitJavascriptResult *r;
 	JSCValue               *v = NULL;
@@ -1041,7 +1057,8 @@ set_default_web_context(void)
 }
 
 void
-set_hover_uri(struct Client *c, WebKitHitTestResult *hit_test_result)
+set_hover_uri(struct Client                    *c,
+              WebKitHitTestResult              *hit_test_result)
 {
 	const char             *t;                  /* entry text holder */
 
@@ -1061,7 +1078,8 @@ set_hover_uri(struct Client *c, WebKitHitTestResult *hit_test_result)
 }
 
 void
-set_javascript_policy(struct Client *c, enum javascript_policy policy)
+set_javascript_policy(struct Client            *c,
+                      enum javascript_policy    policy)
 {
 	webkit_settings_set_enable_javascript(c->settings, policy == JSP_TOGGLE
 	    ? !(webkit_settings_get_enable_javascript(c->settings))
@@ -1166,7 +1184,9 @@ resolve_uri(const gchar *t)
 }
 
 void
-update_download_button(WebKitDownload *d, GtkButton *btn, gboolean done)
+update_download_button(WebKitDownload          *d,
+                       GtkButton               *btn,
+                       gboolean                 done)
 {
 	gdouble                 p,                  /* percent completed */
 	                        l;                  /* responce length (bytes) */
@@ -1297,7 +1317,8 @@ web_view_crashed(struct Client *c)
 }
 
 void
-xdg_open(const gchar *s, const gchar *t)
+xdg_open(const gchar                           *s,
+         const gchar                           *t)
 {
 	char                    b[URI_MAX];         /* command line buffer */
 
diff --git a/browser.h b/browser.h
@@ -272,9 +272,11 @@ static gboolean cb_wv_tls_load_failed(GObject *, gchar *, GTlsCertificate *,
 
 
 gboolean
-cb_context_menu(WebKitWebView *web_view, WebKitContextMenu *context_menu,
-                GdkEvent *event, WebKitHitTestResult *hit_test_result,
-                gpointer data)
+cb_context_menu(WebKitWebView                  *web_view,
+                WebKitContextMenu              *context_menu,
+                GdkEvent                       *event,
+                WebKitHitTestResult            *hit_test_result,
+                gpointer                        data)
 {
 	(void)web_view;
 	(void)event;
@@ -284,7 +286,8 @@ cb_context_menu(WebKitWebView *web_view, WebKitContextMenu *context_menu,
 }
 
 void
-cb_download_cancel(GtkWidget *btn, gpointer data)
+cb_download_cancel(GtkWidget                   *btn,
+                   gpointer                     data)
 {
 	webkit_download_cancel(WEBKIT_DOWNLOAD(data));
 	g_object_unref(WEBKIT_DOWNLOAD(data));
@@ -292,7 +295,9 @@ cb_download_cancel(GtkWidget *btn, gpointer data)
 }
 
 void
-cb_download_changed_progress(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_download_changed_progress(GObject           *obj,
+                             GParamSpec        *pspec,
+                             gpointer           data)
 {
 	(void)pspec;
 
@@ -300,7 +305,8 @@ cb_download_changed_progress(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 void
-cb_download_finished(GObject *obj, gpointer data)
+cb_download_finished(GObject                   *obj,
+                     gpointer                   data)
 {
 	if (!GTK_IS_BUTTON(data))
 		return;
@@ -313,8 +319,9 @@ cb_download_finished(GObject *obj, gpointer data)
 }
 
 gboolean
-cb_download_prepare(WebKitDownload *download, gchar *suggested_filename,
-                    gpointer data)
+cb_download_prepare(WebKitDownload             *download,
+                    gchar                      *suggested_filename,
+                    gpointer                    data)
 {
 	(void)data;
 
@@ -323,8 +330,9 @@ cb_download_prepare(WebKitDownload *download, gchar *suggested_filename,
 }
 
 void
-cb_download_start(WebKitWebView *web_view, WebKitDownload *download,
-                  gpointer data)
+cb_download_start(WebKitWebView                *web_view,
+                  WebKitDownload               *download,
+                  gpointer                      data)
 {
 	(void)web_view;
 
@@ -332,7 +340,9 @@ cb_download_start(WebKitWebView *web_view, WebKitDownload *download,
 }
 
 void
-cb_favicon_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_favicon_changed(GObject                     *obj,
+                   GParamSpec                  *pspec,
+                   gpointer                     data)
 {
 	(void)obj;
 	(void)pspec;
@@ -341,7 +351,9 @@ cb_favicon_changed(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 gboolean
-cb_entry_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
+cb_entry_hid(GtkWidget                         *widget,
+             GdkEvent                          *event,
+             gpointer                           data)
 {
 	(void)widget;
 
@@ -354,22 +366,25 @@ cb_entry_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
 }
 
 void
-cb_entry_icon_hid(GtkEntry *entry, GtkEntryIconPosition icon_pos,
-                  GdkEvent *event, gpointer data)
+cb_entry_icon_hid(GtkEntry                     *entry,
+                  GtkEntryIconPosition          icon_pos,
+                  GdkEvent                     *event,
+                  gpointer                      data)
 {
 	(void)entry;
 	(void)event;
 
-	if (icon_pos == GTK_ENTRY_ICON_PRIMARY) {
+	if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
 		toggle_tls_error_policy((struct Client *)data);
-	} else if (icon_pos == GTK_ENTRY_ICON_SECONDARY) {
+	else if (icon_pos == GTK_ENTRY_ICON_SECONDARY)
 		set_javascript_policy((struct Client *)data, JSP_TOGGLE);
-	}
 }
 
 void
-cb_notebook_modified(GtkNotebook *notebook, GtkWidget *child, guint idx,
-                     gpointer data)
+cb_notebook_modified(GtkNotebook               *notebook,
+                     GtkWidget                 *child,
+                     guint                      idx,
+                     gpointer                   data)
 {
 	(void)notebook;
 	(void)child;
@@ -380,8 +395,10 @@ cb_notebook_modified(GtkNotebook *notebook, GtkWidget *child, guint idx,
 }
 
 void
-cb_notebook_switch_page(GtkNotebook *notebook, GtkWidget *child, guint idx,
-                        gpointer data)
+cb_notebook_switch_page(GtkNotebook            *notebook,
+                        GtkWidget              *child,
+                        guint                   idx,
+                        gpointer                data)
 {
 	(void)notebook;
 	(void)child;
@@ -391,7 +408,9 @@ cb_notebook_switch_page(GtkNotebook *notebook, GtkWidget *child, guint idx,
 }
 
 gboolean
-cb_open_external(GSimpleAction *action, GVariant *parameter, gpointer data)
+cb_open_external(GSimpleAction                 *action,
+                 GVariant                      *parameter,
+                 gpointer                       data)
 {
 	(void)action;
 	(void)parameter;
@@ -401,7 +420,8 @@ cb_open_external(GSimpleAction *action, GVariant *parameter, gpointer data)
 }
 
 void
-cb_quit(GObject *obj, gpointer data)
+cb_quit(GObject                                *obj,
+        gpointer                                data)
 {
 	(void)obj;
 	(void)data;
@@ -410,7 +430,9 @@ cb_quit(GObject *obj, gpointer data)
 }
 
 gboolean
-cb_selection_search(GSimpleAction *action, GVariant *parameter, gpointer data)
+cb_selection_search(GSimpleAction              *action,
+                    GVariant                   *parameter,
+                    gpointer                    data)
 {
 	(void)action;
 	(void)parameter;
@@ -420,8 +442,9 @@ cb_selection_search(GSimpleAction *action, GVariant *parameter, gpointer data)
 }
 
 void
-cb_selection_search_finished(GObject *object, GAsyncResult *result,
-                             gpointer data)
+cb_selection_search_finished(GObject           *object,
+                             GAsyncResult      *result,
+                             gpointer           data)
 {
 	struct Client *c = (struct Client *)data;
 
@@ -431,7 +454,9 @@ cb_selection_search_finished(GObject *object, GAsyncResult *result,
 }
 
 gboolean
-cb_tab_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
+cb_tab_hid(GtkWidget                           *widget,
+           GdkEvent                            *event,
+           gpointer                             data)
 {
 	(void)widget;
 
@@ -439,7 +464,9 @@ cb_tab_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
 }
 
 void
-cb_title_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_title_changed(GObject                       *obj,
+                 GParamSpec                    *pspec,
+                 gpointer                       data)
 {
 	(void)obj;
 	(void)pspec;
@@ -448,7 +475,9 @@ cb_title_changed(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 void
-cb_uri_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_uri_changed(GObject                         *obj,
+               GParamSpec                      *pspec,
+               gpointer                         data)
 {
 	(void)obj;
 	(void)pspec;
@@ -457,7 +486,8 @@ cb_uri_changed(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 void
-cb_wv_close(GtkWidget *widget, gpointer data)
+cb_wv_close(GtkWidget                          *widget,
+            gpointer                            data)
 {
 	(void)widget;
 
@@ -465,7 +495,8 @@ cb_wv_close(GtkWidget *widget, gpointer data)
 }
 
 gboolean
-cb_wv_crashed(WebKitWebView *web_view, gpointer data)
+cb_wv_crashed(WebKitWebView                    *web_view,
+              gpointer                          data)
 {
 	(void)web_view;
 
@@ -474,8 +505,9 @@ cb_wv_crashed(WebKitWebView *web_view, gpointer data)
 }
 
 WebKitWebView *
-cb_wv_create(WebKitWebView *web_view,
-             WebKitNavigationAction *navigation_action, gpointer data)
+cb_wv_create(WebKitWebView                     *web_view,
+             WebKitNavigationAction            *navigation_action,
+             gpointer                           data)
 {
 	struct Client *c;
 
@@ -489,8 +521,10 @@ cb_wv_create(WebKitWebView *web_view,
 }
 
 gboolean
-cb_wv_decide_policy(WebKitWebView *web_view, WebKitPolicyDecision *decision,
-                    WebKitPolicyDecisionType type, gpointer data)
+cb_wv_decide_policy(WebKitWebView              *web_view,
+                    WebKitPolicyDecision       *decision,
+                    WebKitPolicyDecisionType    type,
+                    gpointer                    data)
 {
 	(void)web_view;
 	(void)data;
@@ -518,7 +552,9 @@ cb_wv_decide_policy(WebKitWebView *web_view, WebKitPolicyDecision *decision,
 }
 
 gboolean
-cb_wv_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
+cb_wv_hid(GtkWidget                            *widget,
+          GdkEvent                             *event,
+          gpointer                              data)
 {
 	(void)widget;
 
@@ -526,8 +562,10 @@ cb_wv_hid(GtkWidget *widget, GdkEvent *event, gpointer data)
 }
 
 void
-cb_wv_hover(WebKitWebView *web_view, WebKitHitTestResult *hit_test_result,
-            guint modifiers, gpointer data)
+cb_wv_hover(WebKitWebView                      *web_view,
+            WebKitHitTestResult                *hit_test_result,
+            guint                               modifiers,
+            gpointer                            data)
 {
 	(void)web_view;
 	(void)modifiers;
@@ -536,7 +574,9 @@ cb_wv_hover(WebKitWebView *web_view, WebKitHitTestResult *hit_test_result,
 }
 
 void
-cb_wv_load_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_wv_load_changed(GObject                     *obj,
+                   GParamSpec                  *pspec,
+                   gpointer                     data)
 {
 	(void)obj;
 
@@ -544,7 +584,9 @@ cb_wv_load_changed(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 void
-cb_wv_load_progress_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+cb_wv_load_progress_changed(GObject            *obj,
+                            GParamSpec         *pspec,
+                            gpointer            data)
 {
 	(void)obj;
 	(void)pspec;
@@ -553,7 +595,8 @@ cb_wv_load_progress_changed(GObject *obj, GParamSpec *pspec, gpointer data)
 }
 
 void
-cb_wv_show(WebKitWebView *web_view, gpointer data)
+cb_wv_show(WebKitWebView                       *web_view,
+           gpointer                             data)
 {
 	(void)web_view;
 
@@ -561,8 +604,11 @@ cb_wv_show(WebKitWebView *web_view, gpointer data)
 }
 
 gboolean
-cb_wv_tls_load_failed(GObject *obj, gchar *uri, GTlsCertificate *crt,
-                      GTlsCertificateFlags err, gpointer data)
+cb_wv_tls_load_failed(GObject                  *obj,
+                      gchar                    *uri,
+                      GTlsCertificate          *crt,
+                      GTlsCertificateFlags      err,
+                      gpointer                  data)
 {
 	(void)obj;