adji

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

commit: a5bdb3ea9ea9ad475a14f0ea7af1c50132e92097
parent: 7bf4ee8fa095be083bdbd4978a657b7fbdd6b47a
author: Chris Noxz <chris@noxz.tech>
date:   Fri, 5 May 2023 14:57:14 +0200
regain lost focus while clicking a tab

This won't work if the cursor is dragged while a button is pressed. One pseudo
solution for this would be to subscribe to event-after (specifically the
GDK_ENTER_NOTIFY event type) on tab HID events. However, this only works if the
selected tab is hovered while a button is released and would also cause the
corresponding web view for any hovering tab to grab focus (effectively stealing
focus from the current web view or the entry when not desirable).
Mbrowser.c12++++++++++++
1 file changed, 12 insertions(+)
diff --git a/browser.c b/browser.c
@@ -574,6 +574,18 @@ key_tab(struct Client                          *c,
 			gtk_notebook_prev_page(GTK_NOTEBOOK(mw.nb));
 		return TRUE;
 	}
+
+	/* regain lost focus while clicking a tab (not a perfect solution)
+	 * note: this won't work if the cursor is dragged while a button is
+	 *   pressed. One pseudo solution for this would be to subscribe to
+	 *   event-after (specifically the GDK_ENTER_NOTIFY event type) on tab hid
+	 *   events, however this only works if the selected tab is hovered while a
+	 *   button is released and would also cause the corresponding web view for
+	 *   any hovering tab to grab focus (effectively stealing focus from the
+	 *   current web view or the entry when not desirable). */
+	gtk_widget_grab_focus(c->wv);
+	gtk_editable_set_position(GTK_EDITABLE(c->entry), -1);
+
 	return FALSE;
 }