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)); } }