[gtk/win32-gl-fullscreen-workaround-gtk3: 630/630] gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/win32-gl-fullscreen-workaround-gtk3: 630/630] gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested
- Date: Fri, 22 Nov 2019 04:05:18 +0000 (UTC)
commit 11e5f2c473fa7fb442c9b5cb6a81bcf0b6eae4d9
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Mar 18 13:13:24 2019 +0800
gdkwindow-win32.c: Set WS_BORDER for fullscreen GL windows if requested
With some GL drivers, it may be the case that menus are not shown
correctly in fullscreen GL windows because DWM is deactivated in the
process.
Force WS_BORDER to be applied to the fullscreen GL window so that we have
a small 1px border when needed (by setting an envvar), so that DWM does
not get deactivated, hence enabling the menus to show. Also, when we
force WS_BORDER to be applied in this situation, we also deliberately
place the window just outside the top lefthand corner of the screen by
1px and make the window 1px larger than the screen size, so that we
effectively hide the 1px border from view.
Fixes issue #1702.
gdk/win32/gdkwindow-win32.c | 25 ++++++++++++++++++++++---
1 file 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));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]