diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-07-15 19:52:28 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-07-15 20:23:45 -0400 |
commit | 7a1073c3ae89e4cdf35d95afec564d48f776774f (patch) | |
tree | 2c3c4eb8f3d942362297923c48e80807211e5e5a /gdk | |
parent | e2fd33f78a5bcd461139a32957abfeaa45fa3d2e (diff) | |
download | gtk+-7a1073c3ae89e4cdf35d95afec564d48f776774f.tar.gz |
Revert "gdk: Drop configure events"
This reverts commit a8926c9d873ce968353a2eb1d3930c4f1ac79c94.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkevents.c | 10 | ||||
-rw-r--r-- | gdk/gdkevents.h | 4 | ||||
-rw-r--r-- | gdk/gdkeventsprivate.h | 22 | ||||
-rw-r--r-- | gdk/gdksurface.c | 20 | ||||
-rw-r--r-- | gdk/wayland/gdksurface-wayland.c | 13 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 32 |
6 files changed, 66 insertions, 35 deletions
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index b53c146943..02c61f389a 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -817,6 +817,7 @@ gdk_event_get_time (const GdkEvent *event) return event->pad_axis.time; case GDK_PAD_GROUP_MODE: return event->pad_group_mode.time; + case GDK_CONFIGURE: case GDK_FOCUS_CHANGE: case GDK_NOTHING: case GDK_DELETE: @@ -883,6 +884,7 @@ gdk_event_get_state (const GdkEvent *event, case GDK_LEAVE_NOTIFY: *state = event->crossing.state; return TRUE; + case GDK_CONFIGURE: case GDK_FOCUS_CHANGE: case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: @@ -931,6 +933,10 @@ gdk_event_get_coords (const GdkEvent *event, switch ((guint) event->any.type) { + case GDK_CONFIGURE: + x = event->configure.x; + y = event->configure.y; + break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: x = event->crossing.x; @@ -1061,6 +1067,10 @@ gdk_event_set_coords (GdkEvent *event, switch ((guint) event->any.type) { + case GDK_CONFIGURE: + event->configure.x = x; + event->configure.y = y; + break; case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: event->crossing.x = x; diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index d725abf28c..291b6d34f8 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -111,6 +111,7 @@ typedef struct _GdkEventScroll GdkEventScroll; typedef struct _GdkEventKey GdkEventKey; typedef struct _GdkEventFocus GdkEventFocus; typedef struct _GdkEventCrossing GdkEventCrossing; +typedef struct _GdkEventConfigure GdkEventConfigure; typedef struct _GdkEventProximity GdkEventProximity; typedef struct _GdkEventDND GdkEventDND; typedef struct _GdkEventSetting GdkEventSetting; @@ -151,6 +152,8 @@ typedef void (*GdkEventFunc) (GdkEvent *event, * @GDK_ENTER_NOTIFY: the pointer has entered the surface. * @GDK_LEAVE_NOTIFY: the pointer has left the surface. * @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface. + * @GDK_CONFIGURE: the size, position or stacking order of the surface has changed. + * Note that GTK+ discards these events for %GDK_SURFACE_CHILD surfaces. * @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing * surface (e.g. a touchscreen or graphics tablet). * @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing @@ -206,6 +209,7 @@ typedef enum GDK_ENTER_NOTIFY, GDK_LEAVE_NOTIFY, GDK_FOCUS_CHANGE, + GDK_CONFIGURE, GDK_PROXIMITY_IN, GDK_PROXIMITY_OUT, GDK_DRAG_ENTER, diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h index 21f3518fbd..f4d15507e7 100644 --- a/gdk/gdkeventsprivate.h +++ b/gdk/gdkeventsprivate.h @@ -335,6 +335,26 @@ struct _GdkEventFocus }; /* + * GdkEventConfigure: + * @type: the type of the event (%GDK_CONFIGURE). + * @surface: the surface which received the event. + * @send_event: %TRUE if the event was sent explicitly. + * @x: the new x coordinate of the surface, relative to its parent. + * @y: the new y coordinate of the surface, relative to its parent. + * @width: the new width of the surface. + * @height: the new height of the surface. + * + * Generated when a surface size or position has changed. + */ +struct _GdkEventConfigure +{ + GdkEventAny any; + gint x, y; + gint width; + gint height; +}; + +/* * GdkEventProximity: * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT). * @surface: the surface which received the event. @@ -563,6 +583,7 @@ struct _GdkEventPadGroupMode { * @key: a #GdkEventKey * @crossing: a #GdkEventCrossing * @focus_change: a #GdkEventFocus + * @configure: a #GdkEventConfigure * @proximity: a #GdkEventProximity * @dnd: a #GdkEventDND * @grab_broken: a #GdkEventGrabBroken @@ -613,6 +634,7 @@ union _GdkEvent GdkEventKey key; GdkEventCrossing crossing; GdkEventFocus focus_change; + GdkEventConfigure configure; GdkEventProximity proximity; GdkEventDND dnd; GdkEventGrabBroken grab_broken; diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c index da5d0c65f3..7140f9c251 100644 --- a/gdk/gdksurface.c +++ b/gdk/gdksurface.c @@ -2639,7 +2639,6 @@ gdk_surface_move_resize_internal (GdkSurface *surface, { cairo_region_t *old_region, *new_region; gboolean expose; - gboolean size_changed; g_return_if_fail (GDK_IS_SURFACE (surface)); @@ -2668,7 +2667,6 @@ gdk_surface_move_resize_internal (GdkSurface *surface, /* Handle child surfaces */ expose = FALSE; - size_changed = FALSE; old_region = NULL; if (gdk_surface_is_viewable (surface) && @@ -2694,16 +2692,8 @@ gdk_surface_move_resize_internal (GdkSurface *surface, } if (!(width < 0 && height < 0)) { - if (surface->width != width) - { - surface->width = width; - size_changed = TRUE; - } - if (surface->height != height) - { - surface->height = height; - size_changed = TRUE; - } + surface->width = width; + surface->height = height; } recompute_visible_regions (surface, FALSE); @@ -2726,11 +2716,10 @@ gdk_surface_move_resize_internal (GdkSurface *surface, cairo_region_destroy (old_region); cairo_region_destroy (new_region); } - - if (size_changed) - g_signal_emit (surface, signals[SIZE_CHANGED], 0, width, height); } + + /** * gdk_surface_move: * @surface: a #GdkSurface @@ -3895,6 +3884,7 @@ _gdk_make_event (GdkSurface *surface, break; case GDK_FOCUS_CHANGE: + case GDK_CONFIGURE: case GDK_DELETE: case GDK_DESTROY: default: diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index ce0b5d773d..51eca561df 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -698,9 +698,20 @@ gdk_wayland_surface_configure (GdkSurface *surface, int height, int scale) { + GdkDisplay *display; + GdkEvent *event; + + event = gdk_event_new (GDK_CONFIGURE); + event->any.surface = g_object_ref (surface); + event->any.send_event = FALSE; + event->configure.width = width; + event->configure.height = height; + gdk_wayland_surface_update_size (surface, width, height, scale); _gdk_surface_update_size (surface); - g_signal_emit_by_name (surface, "size-changed", width, height); + + display = gdk_surface_get_display (surface); + _gdk_wayland_display_deliver_event (display, event); } static gboolean diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 72ead44bbb..3dc613fc82 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -958,12 +958,11 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, return_val = FALSE; else { - int x, y, width, height; + event->any.type = GDK_CONFIGURE; + event->any.surface = surface; + event->configure.width = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale; + event->configure.height = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale; - x = 0; - y = 0; - width = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale; - height = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale; if (!xevent->xconfigure.send_event && !xevent->xconfigure.override_redirect && !GDK_SURFACE_DESTROYED (surface)) @@ -980,34 +979,31 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, &tx, &ty, &child_window)) { - x = tx / surface_impl->surface_scale; - y = ty / surface_impl->surface_scale; + event->configure.x = tx / surface_impl->surface_scale; + event->configure.y = ty / surface_impl->surface_scale; } gdk_x11_display_error_trap_pop_ignored (display); } else { - x = xevent->xconfigure.x / surface_impl->surface_scale; - y = xevent->xconfigure.y / surface_impl->surface_scale; + event->configure.x = xevent->xconfigure.x / surface_impl->surface_scale; + event->configure.y = xevent->xconfigure.y / surface_impl->surface_scale; } - if (!is_substructure) { - surface->x = x; - surface->y = y; + surface->x = event->configure.x; + surface->y = event->configure.y; if (surface_impl->unscaled_width != xevent->xconfigure.width || surface_impl->unscaled_height != xevent->xconfigure.height) { surface_impl->unscaled_width = xevent->xconfigure.width; surface_impl->unscaled_height = xevent->xconfigure.height; - surface->width = width; - surface->height = height; + surface->width = event->configure.width; + surface->height = event->configure.height; _gdk_surface_update_size (surface); _gdk_x11_surface_update_size (surface_impl); - - g_signal_emit_by_name (surface, "size-changed", width, height); } if (surface->resize_count >= 1) @@ -1016,10 +1012,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, if (surface->resize_count == 0) _gdk_x11_moveresize_configure_done (display, surface); - } + } } - - return_val = FALSE; } break; |