Fix further focus issues
This commit is contained in:
parent
97109b1e58
commit
0bec06b55d
@ -614,7 +614,8 @@ fastiv_browser_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
|||||||
FastivBrowser *self = FASTIV_BROWSER(widget);
|
FastivBrowser *self = FASTIV_BROWSER(widget);
|
||||||
if (event->type != GDK_BUTTON_PRESS || event->state != 0)
|
if (event->type != GDK_BUTTON_PRESS || event->state != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (event->button == GDK_BUTTON_PRIMARY)
|
if (event->button == GDK_BUTTON_PRIMARY &&
|
||||||
|
gtk_widget_get_focus_on_click(widget))
|
||||||
gtk_widget_grab_focus(widget);
|
gtk_widget_grab_focus(widget);
|
||||||
|
|
||||||
const Entry *entry = entry_at(self, event->x, event->y);
|
const Entry *entry = entry_at(self, event->x, event->y);
|
||||||
|
@ -276,6 +276,20 @@ fastiv_view_draw(GtkWidget *widget, cairo_t *cr)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
fastiv_view_button_press_event(GtkWidget *widget, GdkEventButton *event)
|
||||||
|
{
|
||||||
|
GTK_WIDGET_CLASS(fastiv_view_parent_class)
|
||||||
|
->button_press_event(widget, event);
|
||||||
|
|
||||||
|
if (event->button == GDK_BUTTON_PRIMARY &&
|
||||||
|
gtk_widget_get_focus_on_click(widget))
|
||||||
|
gtk_widget_grab_focus(widget);
|
||||||
|
|
||||||
|
// TODO(p): Use for left button scroll drag, which may rather be a gesture.
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#define SCALE_STEP 1.4
|
#define SCALE_STEP 1.4
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -361,6 +375,7 @@ fastiv_view_class_init(FastivViewClass *klass)
|
|||||||
widget_class->size_allocate = fastiv_view_size_allocate;
|
widget_class->size_allocate = fastiv_view_size_allocate;
|
||||||
widget_class->realize = fastiv_view_realize;
|
widget_class->realize = fastiv_view_realize;
|
||||||
widget_class->draw = fastiv_view_draw;
|
widget_class->draw = fastiv_view_draw;
|
||||||
|
widget_class->button_press_event = fastiv_view_button_press_event;
|
||||||
widget_class->scroll_event = fastiv_view_scroll_event;
|
widget_class->scroll_event = fastiv_view_scroll_event;
|
||||||
widget_class->key_press_event = fastiv_view_key_press_event;
|
widget_class->key_press_event = fastiv_view_key_press_event;
|
||||||
|
|
||||||
|
1
fastiv.c
1
fastiv.c
@ -120,6 +120,7 @@ switch_to_view(const char *path)
|
|||||||
{
|
{
|
||||||
gtk_window_set_title(GTK_WINDOW(g.window), path);
|
gtk_window_set_title(GTK_WINDOW(g.window), path);
|
||||||
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
|
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
|
||||||
|
gtk_widget_grab_focus(g.view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user