Move code around

gdk_window_set_state is now an ordinary (private) setter,
so it should live in gdkwindow.c.
This commit is contained in:
Matthias Clasen 2017-12-14 22:35:27 -05:00
parent 11a946df39
commit bcf570cc16
4 changed files with 48 additions and 53 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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)