aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-20 18:45:33 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-20 18:46:38 +0100
commit5ebfebb8fc08c7b5fc7fee85afeca270d712ae13 (patch)
treede46afc7f4888908d9220cce79df671472c14551
parent35500b869755c7cb2b21b8af17eefbfb6712f5aa (diff)
downloadfiv-5ebfebb8fc08c7b5fc7fee85afeca270d712ae13.tar.gz
fiv-5ebfebb8fc08c7b5fc7fee85afeca270d712ae13.tar.xz
fiv-5ebfebb8fc08c7b5fc7fee85afeca270d712ae13.zip
Make the browser grab focus when clicked
-rw-r--r--fastiv-browser.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fastiv-browser.c b/fastiv-browser.c
index 64c9438..d30b4b7 100644
--- a/fastiv-browser.c
+++ b/fastiv-browser.c
@@ -412,9 +412,14 @@ fastiv_browser_draw(GtkWidget *widget, cairo_t *cr)
static gboolean
fastiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
{
+ GTK_WIDGET_CLASS(fastiv_browser_parent_class)
+ ->button_press_event(widget, event);
+
FastivBrowser *self = FASTIV_BROWSER(widget);
if (event->type != GDK_BUTTON_PRESS || event->state != 0)
return FALSE;
+ if (event->button == 1)
+ gtk_widget_grab_focus(widget);
const Entry *entry = entry_at(self, event->x, event->y);
if (!entry)
@@ -437,6 +442,9 @@ fastiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
gboolean
fastiv_browser_motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
{
+ GTK_WIDGET_CLASS(fastiv_browser_parent_class)
+ ->motion_notify_event(widget, event);
+
FastivBrowser *self = FASTIV_BROWSER(widget);
if (event->state != 0)
return FALSE;