Commit da36d050 authored by Matthias Clasen's avatar Matthias Clasen

window: Actually listen for focus change

Same as the previous commit: We need a bubble
phase key controller to receive focus change
events.
parent bf56f1a8
......@@ -1872,15 +1872,20 @@ gtk_window_init (GtkWindow *window)
controller = gtk_event_controller_key_new ();
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
gtk_event_controller_set_name (controller, "window mnemonics");
g_signal_connect_swapped (controller, "key-pressed",
G_CALLBACK (gtk_window_key_pressed), window);
g_signal_connect_swapped (controller, "key-released",
G_CALLBACK (gtk_window_key_released), window);
gtk_widget_add_controller (widget, controller);
controller = gtk_event_controller_key_new ();
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
gtk_event_controller_set_name (controller, "window focus");
g_signal_connect_swapped (controller, "focus-in",
G_CALLBACK (gtk_window_focus_in), window);
g_signal_connect_swapped (controller, "focus-out",
G_CALLBACK (gtk_window_focus_out), window);
g_signal_connect_swapped (controller, "key-pressed",
G_CALLBACK (gtk_window_key_pressed), window);
g_signal_connect_swapped (controller, "key-released",
G_CALLBACK (gtk_window_key_released), window);
gtk_widget_add_controller (widget, controller);
controller = gtk_shortcut_controller_new ();
......@@ -6072,7 +6077,6 @@ gtk_window_set_focus (GtkWindow *window,
g_return_if_fail (GTK_IS_WINDOW (window));
g_print ("window set focus: %s\n", focus ? gtk_widget_get_name (focus):"");
if (focus && !gtk_widget_is_sensitive (focus))
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment