mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-30 04:48:36 +00:00
win32u: Deduce monitor device flags from their adapter.
This commit is contained in:
parent
e628eb2c6f
commit
e4ff578bcc
|
@ -143,14 +143,6 @@ static const WCHAR devpropkey_monitor_output_idW[] =
|
|||
'\\','0','0','0','2'
|
||||
};
|
||||
|
||||
static const WCHAR wine_devpropkey_monitor_stateflagsW[] =
|
||||
{
|
||||
'P','r','o','p','e','r','t','i','e','s','\\',
|
||||
'{','2','3','3','a','9','e','f','3','-','a','f','c','4','-','4','a','b','d',
|
||||
'-','b','5','6','4','-','c','3','2','f','2','1','f','1','5','3','5','b','}',
|
||||
'\\','0','0','0','2'
|
||||
};
|
||||
|
||||
static const WCHAR wine_devpropkey_monitor_rcmonitorW[] =
|
||||
{
|
||||
'P','r','o','p','e','r','t','i','e','s','\\',
|
||||
|
@ -817,12 +809,13 @@ static BOOL read_display_adapter_settings( unsigned int index, struct adapter *i
|
|||
static BOOL read_monitor_settings( struct adapter *adapter, UINT index, struct monitor *monitor )
|
||||
{
|
||||
char buffer[4096];
|
||||
BOOL is_primary = !!(adapter->dev.state_flags & DISPLAY_DEVICE_PRIMARY_DEVICE);
|
||||
KEY_VALUE_PARTIAL_INFORMATION *value = (void *)buffer;
|
||||
WCHAR *device_name, *value_str = (WCHAR *)value->Data, *ptr;
|
||||
HKEY hkey, subkey;
|
||||
DWORD size, len;
|
||||
|
||||
monitor->flags = adapter->id ? 0 : MONITORINFOF_PRIMARY;
|
||||
monitor->flags = is_primary ? MONITORINFOF_PRIMARY : 0;
|
||||
|
||||
/* DeviceName */
|
||||
sprintf( buffer, "\\\\.\\DISPLAY%d\\Monitor%d", adapter->id + 1, index );
|
||||
|
@ -851,17 +844,6 @@ static BOOL read_monitor_settings( struct adapter *adapter, UINT index, struct m
|
|||
if (!(hkey = reg_open_key( enum_key, value_str, value->DataLength - sizeof(WCHAR) )))
|
||||
return FALSE;
|
||||
|
||||
/* StateFlags, WINE_DEVPROPKEY_MONITOR_STATEFLAGS */
|
||||
size = query_reg_subkey_value( hkey, wine_devpropkey_monitor_stateflagsW,
|
||||
sizeof(wine_devpropkey_monitor_stateflagsW),
|
||||
value, sizeof(buffer) );
|
||||
if (size != sizeof(monitor->dev.state_flags))
|
||||
{
|
||||
NtClose( hkey );
|
||||
return FALSE;
|
||||
}
|
||||
monitor->dev.state_flags = *(const DWORD *)value->Data;
|
||||
|
||||
/* Output ID */
|
||||
size = query_reg_subkey_value( hkey, devpropkey_monitor_output_idW,
|
||||
sizeof(devpropkey_monitor_output_idW),
|
||||
|
@ -1545,15 +1527,6 @@ static void add_monitor( const struct gdi_monitor *monitor, void *param )
|
|||
NtClose( subkey );
|
||||
}
|
||||
|
||||
/* StateFlags */
|
||||
if ((subkey = reg_create_key( hkey, wine_devpropkey_monitor_stateflagsW,
|
||||
sizeof(wine_devpropkey_monitor_stateflagsW), 0, NULL )))
|
||||
{
|
||||
set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_UINT32, &monitor->state_flags,
|
||||
sizeof(monitor->state_flags) );
|
||||
NtClose( subkey );
|
||||
}
|
||||
|
||||
/* WINE_DEVPROPKEY_MONITOR_RCMONITOR */
|
||||
if ((subkey = reg_create_key( hkey, wine_devpropkey_monitor_rcmonitorW,
|
||||
sizeof(wine_devpropkey_monitor_rcmonitorW), 0, NULL )))
|
||||
|
@ -1769,6 +1742,12 @@ static BOOL update_display_cache_from_registry(void)
|
|||
monitor->id = monitor_id;
|
||||
monitor->adapter = adapter_acquire( adapter );
|
||||
|
||||
monitor->dev.state_flags |= DISPLAY_DEVICE_ATTACHED;
|
||||
if (adapter->dev.state_flags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
|
||||
{
|
||||
if (!IsRectEmpty(&monitor->rc_monitor)) monitor->dev.state_flags |= DISPLAY_DEVICE_ACTIVE;
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY(monitor2, &monitors, struct monitor, entry)
|
||||
{
|
||||
if (EqualRect(&monitor2->rc_monitor, &monitor->rc_monitor))
|
||||
|
@ -1878,10 +1857,7 @@ static BOOL default_update_display_devices( const struct gdi_device_manager *man
|
|||
{
|
||||
.state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE,
|
||||
};
|
||||
struct gdi_monitor monitor =
|
||||
{
|
||||
.state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED,
|
||||
};
|
||||
struct gdi_monitor monitor = {0};
|
||||
DEVMODEW mode = {{0}};
|
||||
UINT i;
|
||||
|
||||
|
@ -1990,10 +1966,7 @@ static BOOL desktop_update_display_devices( BOOL force, struct device_manager_ct
|
|||
{
|
||||
.state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE,
|
||||
};
|
||||
struct gdi_monitor monitor =
|
||||
{
|
||||
.state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED,
|
||||
};
|
||||
struct gdi_monitor monitor = {0};
|
||||
static struct screen_size
|
||||
{
|
||||
unsigned int width;
|
||||
|
|
|
@ -282,7 +282,6 @@ BOOL ANDROID_UpdateDisplayDevices( const struct gdi_device_manager *device_manag
|
|||
{
|
||||
.rc_monitor = virtual_screen_rect,
|
||||
.rc_work = monitor_rc_work,
|
||||
.state_flags = DISPLAY_DEVICE_ACTIVE | DISPLAY_DEVICE_ATTACHED,
|
||||
};
|
||||
const DEVMODEW mode =
|
||||
{
|
||||
|
|
|
@ -707,7 +707,6 @@ int macdrv_get_monitors(uint32_t adapter_id, struct macdrv_monitor** new_monitor
|
|||
if (j == 0)
|
||||
primary_index = monitor_count;
|
||||
|
||||
monitors[monitor_count].state_flags = DISPLAY_DEVICE_ATTACHED | DISPLAY_DEVICE_ACTIVE;
|
||||
monitors[monitor_count].rc_monitor = displays[j].frame;
|
||||
monitors[monitor_count].rc_work = displays[j].work_frame;
|
||||
monitor_count++;
|
||||
|
|
|
@ -1195,7 +1195,6 @@ BOOL macdrv_UpdateDisplayDevices( const struct gdi_device_manager *device_manage
|
|||
{
|
||||
.rc_monitor = rect_from_cgrect(monitor->rc_monitor),
|
||||
.rc_work = rect_from_cgrect(monitor->rc_work),
|
||||
.state_flags = monitor->state_flags,
|
||||
};
|
||||
device_manager->add_monitor( &gdi_monitor, param );
|
||||
}
|
||||
|
|
|
@ -251,9 +251,6 @@ static inline CGPoint cgpoint_win_from_mac(CGPoint point)
|
|||
/* Used DISPLAY_DEVICE.StateFlags for adapters */
|
||||
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001
|
||||
#define DISPLAY_DEVICE_PRIMARY_DEVICE 0x00000004
|
||||
/* Used DISPLAY_DEVICE.StateFlags for monitors */
|
||||
#define DISPLAY_DEVICE_ACTIVE 0x00000001
|
||||
#define DISPLAY_DEVICE_ATTACHED 0x00000002
|
||||
|
||||
/* Represent a physical GPU in the PCI slots */
|
||||
struct macdrv_gpu
|
||||
|
@ -285,8 +282,6 @@ static inline CGPoint cgpoint_win_from_mac(CGPoint point)
|
|||
CGRect rc_monitor;
|
||||
/* as RcWork in MONITORINFO struct after conversion by rect_from_cgrect */
|
||||
CGRect rc_work;
|
||||
/* StateFlags in DISPLAY_DEVICE struct */
|
||||
uint32_t state_flags;
|
||||
};
|
||||
|
||||
extern int macdrv_get_displays(struct macdrv_display** displays, int* count);
|
||||
|
|
|
@ -237,11 +237,8 @@ static void wayland_add_device_monitor(const struct gdi_device_manager *device_m
|
|||
/* We don't have a direct way to get the work area in Wayland. */
|
||||
monitor.rc_work = monitor.rc_monitor;
|
||||
|
||||
monitor.state_flags = DISPLAY_DEVICE_ATTACHED | DISPLAY_DEVICE_ACTIVE;
|
||||
|
||||
TRACE("name=%s rc_monitor=rc_work=%s state_flags=0x%x\n",
|
||||
output_info->output->name, wine_dbgstr_rect(&monitor.rc_monitor),
|
||||
(UINT)monitor.state_flags);
|
||||
TRACE("name=%s rc_monitor=rc_work=%s\n",
|
||||
output_info->output->name, wine_dbgstr_rect(&monitor.rc_monitor));
|
||||
|
||||
device_manager->add_monitor(&monitor, param);
|
||||
}
|
||||
|
|
|
@ -319,11 +319,8 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
|
|||
monitor[index].rc_monitor = monitors[i].rcMonitor;
|
||||
monitor[index].rc_work = monitors[i].rcWork;
|
||||
/* Xinerama only reports monitors already attached */
|
||||
monitor[index].state_flags = DISPLAY_DEVICE_ATTACHED;
|
||||
monitor[index].edid_len = 0;
|
||||
monitor[index].edid = NULL;
|
||||
if (!IsRectEmpty( &monitors[i].rcMonitor ))
|
||||
monitor[index].state_flags |= DISPLAY_DEVICE_ACTIVE;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
|
|
@ -1066,7 +1066,6 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
|
|||
/* Inactive but attached monitor, no need to check for mirrored/replica monitors */
|
||||
if (!output_info->crtc || !crtc_info->mode)
|
||||
{
|
||||
monitors[monitor_count].state_flags = DISPLAY_DEVICE_ATTACHED;
|
||||
monitors[monitor_count].edid_len = get_edid( adapter_id, &monitors[monitor_count].edid );
|
||||
monitor_count = 1;
|
||||
}
|
||||
|
@ -1114,10 +1113,6 @@ static BOOL xrandr14_get_monitors( ULONG_PTR adapter_id, struct gdi_monitor **ne
|
|||
crtc_info->x + crtc_info->width, crtc_info->y + crtc_info->height );
|
||||
monitors[monitor_count].rc_work = get_work_area( &monitors[monitor_count].rc_monitor );
|
||||
|
||||
monitors[monitor_count].state_flags = DISPLAY_DEVICE_ATTACHED;
|
||||
if (!IsRectEmpty( &monitors[monitor_count].rc_monitor ))
|
||||
monitors[monitor_count].state_flags |= DISPLAY_DEVICE_ACTIVE;
|
||||
|
||||
if (is_crtc_primary( primary_rect, crtc_info ))
|
||||
primary_index = monitor_count;
|
||||
|
||||
|
|
|
@ -264,7 +264,6 @@ struct gdi_monitor
|
|||
{
|
||||
RECT rc_monitor; /* RcMonitor in MONITORINFO struct */
|
||||
RECT rc_work; /* RcWork in MONITORINFO struct */
|
||||
DWORD state_flags; /* StateFlags in DISPLAY_DEVICE struct */
|
||||
unsigned char *edid; /* Extended Device Identification Data */
|
||||
UINT edid_len;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue