mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 05:10:36 +00:00
winex11.drv: Get virtual desktop size limit from the host primary display.
After25167fb286
, get_primary_monitor_rect() maybe invalid before display device initialization or returns the desktop rectangle after desktop initialization in virtual desktop mode, which is wrong. The desktop size limit should come from host system. This fixes a regression fromefbbe66669
. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47815 Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
914b5519b1
commit
acf03ed9da
|
@ -238,12 +238,14 @@ static void X11DRV_desktop_free_monitors( struct x11drv_monitor *monitors )
|
|||
*/
|
||||
void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
|
||||
{
|
||||
RECT primary_rect;
|
||||
RECT primary_rect = get_host_primary_monitor_rect();
|
||||
|
||||
root_window = win;
|
||||
managed_mode = FALSE; /* no managed windows in desktop mode */
|
||||
desktop_width = width;
|
||||
desktop_height = height;
|
||||
max_width = primary_rect.right;
|
||||
max_height = primary_rect.bottom;
|
||||
|
||||
/* Initialize virtual desktop mode display device handler */
|
||||
desktop_handler.name = "Virtual Desktop";
|
||||
|
@ -257,10 +259,6 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height )
|
|||
TRACE("Display device functions are now handled by: Virtual Desktop\n");
|
||||
X11DRV_DisplayDevices_Init( TRUE );
|
||||
|
||||
primary_rect = get_primary_monitor_rect();
|
||||
max_width = primary_rect.right - primary_rect.left;
|
||||
max_height = primary_rect.bottom - primary_rect.top;
|
||||
|
||||
/* initialize the available resolutions */
|
||||
dd_modes = X11DRV_Settings_SetHandlers("desktop",
|
||||
X11DRV_desktop_GetCurrentMode,
|
||||
|
|
|
@ -233,6 +233,27 @@ RECT get_primary_monitor_rect(void)
|
|||
return primary;
|
||||
}
|
||||
|
||||
/* Get the primary monitor rect from the host system */
|
||||
RECT get_host_primary_monitor_rect(void)
|
||||
{
|
||||
INT gpu_count, adapter_count, monitor_count;
|
||||
struct x11drv_gpu *gpus = NULL;
|
||||
struct x11drv_adapter *adapters = NULL;
|
||||
struct x11drv_monitor *monitors = NULL;
|
||||
RECT rect = {0};
|
||||
|
||||
/* The first monitor is always primary */
|
||||
if (host_handler.get_gpus(&gpus, &gpu_count) && gpu_count &&
|
||||
host_handler.get_adapters(gpus[0].id, &adapters, &adapter_count) && adapter_count &&
|
||||
host_handler.get_monitors(adapters[0].id, &monitors, &monitor_count) && monitor_count)
|
||||
rect = monitors[0].rc_monitor;
|
||||
|
||||
if (gpus) host_handler.free_gpus(gpus);
|
||||
if (adapters) host_handler.free_adapters(adapters);
|
||||
if (monitors) host_handler.free_monitors(monitors);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *new_handler)
|
||||
{
|
||||
if (new_handler->priority > host_handler.priority)
|
||||
|
|
|
@ -643,6 +643,7 @@ extern POINT virtual_screen_to_root( INT x, INT y ) DECLSPEC_HIDDEN;
|
|||
extern POINT root_to_virtual_screen( INT x, INT y ) DECLSPEC_HIDDEN;
|
||||
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
|
||||
extern RECT get_primary_monitor_rect(void) DECLSPEC_HIDDEN;
|
||||
extern RECT get_host_primary_monitor_rect(void) DECLSPEC_HIDDEN;
|
||||
extern void query_work_area( RECT *rc_work ) DECLSPEC_HIDDEN;
|
||||
extern void xinerama_init( unsigned int width, unsigned int height ) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
Loading…
Reference in a new issue