diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-04-15 14:56:32 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-04-15 14:56:32 -0400 |
commit | 8e9406a082574f5a3c74e18c1d4a7f59cfab00aa (patch) | |
tree | 10294aa81883dcd567230890157c9bb3a9455ee3 /gdk | |
parent | 031b248c2093e1b99435080e6c5da2c33a67f510 (diff) | |
download | gtk+-8e9406a082574f5a3c74e18c1d4a7f59cfab00aa.tar.gz |
Move key event rewriting
Stop rewriting key and focus events on the GDK side.
Instead deliver them as they are, and propagate them
from the root on the gtk side, in gtkmain.c. And
stop complaining about focus events on popups - we
can just ignore them if we have no use for them.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdksurface.c | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index f01a77978c..037fca0e40 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -2823,53 +2823,6 @@ check_autohide (GdkEvent *event) return FALSE; } -static gboolean -is_keyboard_event (GdkEvent *event) -{ - switch ((guint) gdk_event_get_event_type (event)) - { - case GDK_KEY_PRESS: - case GDK_KEY_RELEASE: - case GDK_FOCUS_CHANGE: - return TRUE; - default:; - } - - return FALSE; -} - -static GdkEvent * -rewrite_event_for_toplevel (GdkEvent *event) -{ - GdkSurface *surface; - - surface = gdk_event_get_surface (event); - if (!surface->parent) - return gdk_event_ref (event); - - while (surface->parent) - surface = surface->parent; - - if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE) - return gdk_event_focus_new (surface, - gdk_event_get_device (event), - gdk_event_get_source_device (event), - gdk_focus_event_get_in (event)); - else - { - return gdk_event_key_new (gdk_event_get_event_type (event), - surface, - gdk_event_get_device (event), - gdk_event_get_source_device (event), - gdk_event_get_time (event), - gdk_key_event_get_keycode (event), - gdk_event_get_modifier_state (event), - gdk_key_event_is_modifier (event), - &event->key.translated[0], - &event->key.translated[1]); - } -} - static void add_event_mark (GdkEvent *event, gint64 time, @@ -2985,15 +2938,7 @@ gdk_surface_handle_event (GdkEvent *event) } else { - GdkEvent *emitted; - - if (is_keyboard_event (event)) - emitted = rewrite_event_for_toplevel (event); - else - emitted = gdk_event_ref (event); - - g_signal_emit (gdk_event_get_surface (emitted), signals[EVENT], 0, emitted, &handled); - gdk_event_unref (emitted); + g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled); } if (GDK_PROFILER_IS_RUNNING) |