summaryrefslogtreecommitdiff
path: root/gdk/win32
diff options
context:
space:
mode:
authorРуслан Ижбулатов <lrn1986@gmail.com>2016-12-25 17:48:20 +0000
committerРуслан Ижбулатов <lrn1986@gmail.com>2017-01-09 14:17:32 +0000
commit3326fba524ab5b81e1b997be2fd4405c00a767eb (patch)
treed9a54e96a91b75a3bb621672defe0bd4b5c1202f /gdk/win32
parent51645b585123de193da0360d3a69f767a3c4fa59 (diff)
downloadgtk+-3326fba524ab5b81e1b997be2fd4405c00a767eb.tar.gz
GDK W32: Change WM_SYSMENU style switch logic
Instead of checking for window state and giving it extra styles that fit, just give it all styles that it is missing. It turned out that otherwise it is impossible to, for example, restore a maximized window via sysmenu. Also, be more flexible towards GDK/WM window state mismatches and consider the window minimized/maximized if *either* GDK or WM thinks so. https://bugzilla.gnome.org/show_bug.cgi?id=776485
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/gdkevents-win32.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 1b160d8bcc..8d88631af2 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -1939,22 +1939,28 @@ handle_wm_sysmenu (GdkWindow *window, MSG *msg, gint *ret_valp)
style = GetWindowLongPtr (msg->hwnd, GWL_STYLE);
- maximized = IsZoomed (msg->hwnd);
- minimized = IsIconic (msg->hwnd);
+ maximized = IsZoomed (msg->hwnd) || (style & WS_MAXIMIZE);
+ minimized = IsIconic (msg->hwnd) || (style & WS_MINIMIZE);
additional_styles = 0;
if (!(style & WS_SYSMENU))
additional_styles |= WS_SYSMENU;
- if (!maximized && !(style & WS_MAXIMIZEBOX))
+ if (!(style & WS_MAXIMIZEBOX))
additional_styles |= WS_MAXIMIZEBOX;
- if (!minimized && !(style & WS_MINIMIZEBOX))
+ if (!(style & WS_MINIMIZEBOX))
additional_styles |= WS_MINIMIZEBOX;
- if (!minimized && !maximized && !(style & WS_SIZEBOX))
+ if (!(style & WS_SIZEBOX))
additional_styles |= WS_SIZEBOX;
+ if (!(style & WS_DLGFRAME))
+ additional_styles |= WS_DLGFRAME;
+
+ if (!(style & WS_BORDER))
+ additional_styles |= WS_BORDER;
+
if (additional_styles == 0)
/* The caller will eventually pass this to DefWindowProc (),
* only without the style dance, which isn't needed, as it turns out.