From bcf570cc16f1fca8d2ab986f59f66e9c39ba395d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 14 Dec 2017 22:35:27 -0500 Subject: [PATCH] Move code around gdk_window_set_state is now an ordinary (private) setter, so it should live in gdkwindow.c. --- gdk/gdkevents.c | 50 --------------------------------- gdk/gdkinternals.h | 4 +-- gdk/gdkwindow.c | 45 +++++++++++++++++++++++++++++ gdk/wayland/gdkwindow-wayland.c | 2 +- 4 files changed, 48 insertions(+), 53 deletions(-) diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 3145b6560c..3339f7f906 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -1937,56 +1937,6 @@ gdk_get_show_events (void) return (_gdk_debug_flags & GDK_DEBUG_EVENTS) != 0; } -void -_gdk_set_window_state (GdkWindow *window, - GdkWindowState new_state) -{ - GdkDisplay *display = gdk_window_get_display (window); - GdkWindowState old; - - g_return_if_fail (window != NULL); - - if (new_state == window->state) - return; /* No actual work to do, nothing changed. */ - - /* Actually update the field in GdkWindow, this is sort of an odd - * place to do it, but seems like the safest since it ensures we expose no - * inconsistent state to the user. - */ - - window->state = new_state; - - _gdk_window_update_viewable (window); - - /* We only really send the event to toplevels, since - * all the window states don't apply to non-toplevels. - * Non-toplevels do use the GDK_WINDOW_STATE_WITHDRAWN flag - * internally so we needed to update window->state. - */ - switch (window->window_type) - { - case GDK_WINDOW_TOPLEVEL: - case GDK_WINDOW_TEMP: /* ? */ - g_object_notify (G_OBJECT (window), "state"); - break; - case GDK_WINDOW_FOREIGN: - case GDK_WINDOW_ROOT: - case GDK_WINDOW_CHILD: - default: - break; - } -} - -void -gdk_synthesize_window_state (GdkWindow *window, - GdkWindowState unset_flags, - GdkWindowState set_flags) -{ - g_return_if_fail (window != NULL); - - _gdk_set_window_state (window, (window->state | set_flags) & ~unset_flags); -} - static GdkEventSequence * gdk_event_sequence_copy (GdkEventSequence *sequence) { diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index 46a08867cd..dde2c539e2 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -311,8 +311,8 @@ void _gdk_windowing_event_data_copy (const GdkEvent *src, GdkEvent *dst); void _gdk_windowing_event_data_free (GdkEvent *event); -void _gdk_set_window_state (GdkWindow *window, - GdkWindowState new_state); +void gdk_window_set_state (GdkWindow *window, + GdkWindowState new_state); gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface, GdkRectangle *extents); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 931079d577..6ba2c896c6 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -7230,3 +7230,48 @@ gdk_window_supports_edge_constraints (GdkWindow *window) else return FALSE; } + +void +gdk_window_set_state (GdkWindow *window, + GdkWindowState new_state) +{ + g_return_if_fail (GDK_IS_WINDOW (window)); + + if (new_state == window->state) + return; /* No actual work to do, nothing changed. */ + + /* Actually update the field in GdkWindow, this is sort of an odd + * place to do it, but seems like the safest since it ensures we expose no + * inconsistent state to the user. + */ + + window->state = new_state; + + _gdk_window_update_viewable (window); + + /* We only really send the event to toplevels, since + * all the window states don't apply to non-toplevels. + * Non-toplevels do use the GDK_WINDOW_STATE_WITHDRAWN flag + * internally so we needed to update window->state. + */ + switch (window->window_type) + { + case GDK_WINDOW_TOPLEVEL: + case GDK_WINDOW_TEMP: /* ? */ + g_object_notify (G_OBJECT (window), "state"); + break; + case GDK_WINDOW_FOREIGN: + case GDK_WINDOW_ROOT: + case GDK_WINDOW_CHILD: + default: + break; + } +} + +void +gdk_synthesize_window_state (GdkWindow *window, + GdkWindowState unset_flags, + GdkWindowState set_flags) +{ + gdk_window_set_state (window, (window->state | set_flags) & ~unset_flags); +} diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 60a56a0597..e02bac8d10 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -1385,7 +1385,7 @@ xdg_surface_configure (void *data, (new_state & GDK_WINDOW_STATE_FOCUSED) ? " focused" : "", (new_state & GDK_WINDOW_STATE_TILED) ? " tiled" : "")); - _gdk_set_window_state (window, new_state); + gdk_window_set_state (window, new_state); zxdg_surface_v6_ack_configure (xdg_surface, serial); if (impl->hint != GDK_WINDOW_TYPE_HINT_DIALOG && new_state & GDK_WINDOW_STATE_FOCUSED)