mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Merge branch 'win32-monitors' into 'main'
GdkWin32Monitor fixes See merge request GNOME/gtk!6015
This commit is contained in:
commit
21c53a1969
@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
if (!w32_ex_monitor->remove)
|
||||
continue;
|
||||
|
||||
w32_ex_monitor->hmonitor = NULL;
|
||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||
gdk_monitor_invalidate (ex_monitor);
|
||||
}
|
||||
|
@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
char *path, *path_lower;
|
||||
DISPLAYCONFIG_RATIONAL *refresh;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
continue;
|
||||
|
||||
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
|
||||
tdn.header.size = sizeof (tdn);
|
||||
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
|
||||
@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
|
||||
{
|
||||
w32mon->remove = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
mon = GDK_MONITOR (w32mon);
|
||||
|
||||
if (!tdn.flags.friendlyNameForced)
|
||||
@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
|
||||
|
||||
if (w32mon == NULL)
|
||||
continue;
|
||||
|
||||
w32mon->hmonitor = hmonitor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,6 +35,9 @@ struct _GdkWin32Monitor
|
||||
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
|
||||
char *instance_path;
|
||||
|
||||
/* MOnitor handle (used to fullscreen windows on monitors) */
|
||||
HMONITOR hmonitor;
|
||||
|
||||
/* TRUE if monitor is made up by us
|
||||
* (this happens when system has logical monitors, but no physical ones).
|
||||
*/
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkcairocontext-win32.h"
|
||||
#include "gdkmonitor-win32.h"
|
||||
|
||||
#include <cairo-win32.h>
|
||||
#include <dwmapi.h>
|
||||
@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window);
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor);
|
||||
|
||||
static void
|
||||
show_window_internal (GdkSurface *window,
|
||||
@ -789,11 +791,7 @@ show_window_internal (GdkSurface *window,
|
||||
}
|
||||
|
||||
|
||||
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
|
||||
{
|
||||
gdk_win32_surface_fullscreen (window);
|
||||
}
|
||||
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
|
||||
{
|
||||
GtkShowWindow (window, SW_MAXIMIZE);
|
||||
}
|
||||
@ -4008,11 +4006,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
gdk_win32_surface_fullscreen (GdkSurface *window,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
int x, y, width, height;
|
||||
FullscreenInfo *fi;
|
||||
HMONITOR monitor;
|
||||
HMONITOR hmonitor = NULL;
|
||||
MONITORINFO mi;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
@ -4025,9 +4024,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
{
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
|
||||
|
||||
monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
if (monitor && GDK_IS_WIN32_MONITOR (monitor))
|
||||
hmonitor = GDK_WIN32_MONITOR (monitor)->hmonitor;
|
||||
|
||||
if (!hmonitor)
|
||||
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
mi.cbSize = sizeof (mi);
|
||||
if (monitor && GetMonitorInfo (monitor, &mi))
|
||||
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
|
||||
{
|
||||
x = mi.rcMonitor.left;
|
||||
y = mi.rcMonitor.top;
|
||||
@ -4869,9 +4873,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
|
||||
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
gdk_win32_surface_fullscreen (surface);
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
|
||||
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
||||
gdk_win32_surface_fullscreen (surface, monitor);
|
||||
}
|
||||
else
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
{
|
||||
gdk_win32_surface_unfullscreen (surface);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_win32_surface_show (surface, FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user