[gtk+] Be more careful to change state atomically
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Be more careful to change state atomically
- Date: Sun, 23 Feb 2014 03:24:39 +0000 (UTC)
commit 6dcf6e0f3b06808d1d6a4a928f027657a8742d52
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 22 21:42:05 2014 -0500
Be more careful to change state atomically
This avoids temporary states of maximized+tiled that
we otherwise report.
gdk/x11/gdkdisplay-x11.c | 56 ++++++++++++++-------------------------------
1 files changed, 18 insertions(+), 38 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 0953fcf..1ba4635 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -189,7 +189,7 @@ static void
do_net_wm_state_changes (GdkWindow *window)
{
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
- GdkWindowState old_state;
+ GdkWindowState old_state, set, unset;
if (GDK_WINDOW_DESTROYED (window) ||
gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL)
@@ -197,37 +197,31 @@ do_net_wm_state_changes (GdkWindow *window)
old_state = gdk_window_get_state (window);
+ set = unset = 0;
+
/* For found_sticky to remain TRUE, we have to also be on desktop
* 0xFFFFFFFF
*/
if (old_state & GDK_WINDOW_STATE_STICKY)
{
if (!(toplevel->have_sticky && toplevel->on_all_desktops))
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_STICKY,
- 0);
+ unset |= GDK_WINDOW_STATE_STICKY;
}
else
{
if (toplevel->have_sticky && toplevel->on_all_desktops)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_STICKY);
+ set |= GDK_WINDOW_STATE_STICKY;
}
if (old_state & GDK_WINDOW_STATE_FULLSCREEN)
{
if (!toplevel->have_fullscreen)
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_FULLSCREEN,
- 0);
+ unset |= GDK_WINDOW_STATE_FULLSCREEN;
}
else
{
if (toplevel->have_fullscreen)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_FULLSCREEN);
+ set |= GDK_WINDOW_STATE_FULLSCREEN;
}
/* Our "maximized" means both vertical and horizontal; if only one,
@@ -236,16 +230,12 @@ do_net_wm_state_changes (GdkWindow *window)
if (old_state & GDK_WINDOW_STATE_MAXIMIZED)
{
if (!(toplevel->have_maxvert && toplevel->have_maxhorz))
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_MAXIMIZED,
- 0);
+ unset |= GDK_WINDOW_STATE_MAXIMIZED;
}
else
{
if (toplevel->have_maxvert && toplevel->have_maxhorz)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_MAXIMIZED);
+ set |= GDK_WINDOW_STATE_MAXIMIZED;
}
/* FIXME: we rely on implementation details of mutter here:
@@ -255,47 +245,37 @@ do_net_wm_state_changes (GdkWindow *window)
if (old_state & GDK_WINDOW_STATE_TILED)
{
if (!toplevel->have_maxvert)
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_TILED,
- 0);
+ unset |= GDK_WINDOW_STATE_TILED;
}
else
{
- if (toplevel->have_maxvert)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_TILED);
+ if (toplevel->have_maxvert && !toplevel->have_maxhorz)
+ set |= GDK_WINDOW_STATE_TILED;
}
if (old_state & GDK_WINDOW_STATE_FOCUSED)
{
if (!toplevel->have_focused)
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_FOCUSED,
- 0);
+ unset |= GDK_WINDOW_STATE_FOCUSED;
}
else
{
if (toplevel->have_focused)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_FOCUSED);
+ set |= GDK_WINDOW_STATE_FOCUSED;
}
if (old_state & GDK_WINDOW_STATE_ICONIFIED)
{
if (!toplevel->have_hidden)
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_ICONIFIED,
- 0);
+ unset |= GDK_WINDOW_STATE_ICONIFIED;
}
else
{
if (toplevel->have_hidden)
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_ICONIFIED);
+ set |= GDK_WINDOW_STATE_ICONIFIED;
}
+
+ gdk_synthesize_window_state (window, unset, set);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]