summaryrefslogtreecommitdiff
path: root/gdk/win32
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-11-27 13:16:21 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-11-27 13:16:21 +0000
commit56875730d19602c0dfcc247a6e719d16ca2bf13d (patch)
tree787e1d31e7a4ef41df571509137d9ab0a1724a1f /gdk/win32
parent9d3e3eea7ace3da994f152d3a34500d350697820 (diff)
parent11e5f2c473fa7fb442c9b5cb6a81bcf0b6eae4d9 (diff)
downloadgtk+-56875730d19602c0dfcc247a6e719d16ca2bf13d.tar.gz
Merge branch 'win32-gl-fullscreen-workaround-gtk3' into 'gtk-3-24'
gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested See merge request GNOME/gtk!648
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/gdkwindow-win32.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 3951387e19..cf416d8e2a 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -5312,6 +5312,8 @@ gdk_win32_window_fullscreen (GdkWindow *window)
FullscreenInfo *fi;
HMONITOR monitor;
MONITORINFO mi;
+ DWORD extra_styles = WS_POPUP;
+ gint workaround_padding = 0;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -5348,12 +5350,29 @@ gdk_win32_window_fullscreen (GdkWindow *window)
/* Send state change before configure event */
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
+ /* If we are using GL windows, and we set the envvar GDK_WIN32_GL_FULLSCREEN_WORKAROUND,
+ * set the WS_BORDER style so that DWM will not get deactivated. This is necessary
+ * when menus could not be shown correctly in fullscreen GL windows. To avoid seeing
+ * a border, we intentionally make the window bigger by 1px on all sides and place the
+ * window just 1px outside the top left-hand coordinates outside the screen area.
+ */
+ if (window->gl_paint_context != NULL && g_getenv ("GDK_WIN32_GL_FULLSCREEN_WORKAROUND"))
+ {
+ extra_styles |= WS_BORDER;
+ workaround_padding = 1;
+ GDK_NOTE (MISC, g_print ("GL fullscreen workaround enabled for window [%p]\n",
+ GDK_WINDOW_HWND (window)));
+ }
+
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE,
- (fi->style & ~WS_OVERLAPPEDWINDOW) | WS_POPUP);
+ (fi->style & ~WS_OVERLAPPEDWINDOW) | extra_styles);
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
- x, y, width, height,
- SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
+ x - workaround_padding,
+ y - workaround_padding,
+ width + (workaround_padding * 2),
+ height + (workaround_padding * 2),
+ SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
}
}