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
This commit is contained in:
Matthias Clasen 2019-11-27 13:16:21 +00:00
commit 56875730d1

View File

@ -5312,6 +5312,8 @@ gdk_win32_window_fullscreen (GdkWindow *window)
FullscreenInfo *fi; FullscreenInfo *fi;
HMONITOR monitor; HMONITOR monitor;
MONITORINFO mi; MONITORINFO mi;
DWORD extra_styles = WS_POPUP;
gint workaround_padding = 0;
g_return_if_fail (GDK_IS_WINDOW (window)); g_return_if_fail (GDK_IS_WINDOW (window));
@ -5348,11 +5350,28 @@ gdk_win32_window_fullscreen (GdkWindow *window)
/* Send state change before configure event */ /* Send state change before configure event */
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN); 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, 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, API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
x, y, width, height, x - workaround_padding,
y - workaround_padding,
width + (workaround_padding * 2),
height + (workaround_padding * 2),
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER)); SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_NOOWNERZORDER));
} }
} }