diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-04-11 17:04:25 -0700 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-05-13 02:39:59 -0400 |
commit | c1efc4ad7b4472a9a2f8eb0426638c502e470116 (patch) | |
tree | 899c730490baeea2d4f5e1102237db2f19db7ee0 /gdk/gdkevents.c | |
parent | 807f0aa74795816e59088838343c7557b921fa62 (diff) | |
download | gtk+-c1efc4ad7b4472a9a2f8eb0426638c502e470116.tar.gz |
gdk: Add new _gdk_set_window_state
Wayland's mechanism tells us all of our new states, rather than
telling us which ones were added and removed. Add a new private
interface so that we can simply specify the new states as a
bitfield directly rather than having to compute which ones were
added and removed.
Diffstat (limited to 'gdk/gdkevents.c')
-rw-r--r-- | gdk/gdkevents.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 54ac136838..fb785cfe46 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -2092,35 +2092,32 @@ _gdk_event_button_generate (GdkDisplay *display, } void -gdk_synthesize_window_state (GdkWindow *window, - GdkWindowState unset_flags, - GdkWindowState set_flags) +_gdk_set_window_state (GdkWindow *window, + GdkWindowState new_state) { GdkEvent temp_event; GdkWindowState old; - + g_return_if_fail (window != NULL); - + temp_event.window_state.window = window; temp_event.window_state.type = GDK_WINDOW_STATE; temp_event.window_state.send_event = FALSE; - - old = temp_event.window_state.window->state; - - temp_event.window_state.new_window_state = old; - temp_event.window_state.new_window_state |= set_flags; - temp_event.window_state.new_window_state &= ~unset_flags; - temp_event.window_state.changed_mask = temp_event.window_state.new_window_state ^ old; + temp_event.window_state.new_window_state = new_state; + + old = window->state; if (temp_event.window_state.new_window_state == old) return; /* No actual work to do, nothing changed. */ + temp_event.window_state.changed_mask = new_state ^ old; + /* 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 = temp_event.window_state.new_window_state; + + window->state = new_state; if (temp_event.window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN) _gdk_window_update_viewable (window); @@ -2136,7 +2133,6 @@ gdk_synthesize_window_state (GdkWindow *window, case GDK_WINDOW_TEMP: /* ? */ gdk_display_put_event (gdk_window_get_display (window), &temp_event); break; - case GDK_WINDOW_FOREIGN: case GDK_WINDOW_ROOT: case GDK_WINDOW_CHILD: @@ -2144,6 +2140,16 @@ gdk_synthesize_window_state (GdkWindow *window, } } +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); +} + /** * gdk_display_set_double_click_time: * @display: a #GdkDisplay |