win32u: Introduce get_virtual_screen_rect.
And use it in nulldrv_GetDeviceCaps. Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c4b258eff7
commit
8731afe70f
|
@ -331,25 +331,17 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
|||
return 1;
|
||||
}
|
||||
case DESKTOPHORZRES:
|
||||
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && user_callbacks)
|
||||
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
|
||||
{
|
||||
DPI_AWARENESS_CONTEXT context;
|
||||
UINT ret;
|
||||
context = user_callbacks->pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
|
||||
ret = user_callbacks->pGetSystemMetrics( SM_CXVIRTUALSCREEN );
|
||||
user_callbacks->pSetThreadDpiAwarenessContext( context );
|
||||
if (ret) return ret;
|
||||
RECT rect = get_virtual_screen_rect();
|
||||
return rect.right - rect.left;
|
||||
}
|
||||
return NtGdiGetDeviceCaps( dev->hdc, HORZRES );
|
||||
case DESKTOPVERTRES:
|
||||
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && user_callbacks)
|
||||
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
|
||||
{
|
||||
DPI_AWARENESS_CONTEXT context;
|
||||
UINT ret;
|
||||
context = user_callbacks->pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
|
||||
ret = user_callbacks->pGetSystemMetrics( SM_CYVIRTUALSCREEN );
|
||||
user_callbacks->pSetThreadDpiAwarenessContext( context );
|
||||
if (ret) return ret;
|
||||
RECT rect = get_virtual_screen_rect();
|
||||
return rect.bottom - rect.top;
|
||||
}
|
||||
return NtGdiGetDeviceCaps( dev->hdc, VERTRES );
|
||||
case BLTALIGNMENT: return 0;
|
||||
|
|
|
@ -594,6 +594,30 @@ static inline void reset_bounds( RECT *bounds )
|
|||
bounds->right = bounds->bottom = INT_MIN;
|
||||
}
|
||||
|
||||
static inline void union_rect( RECT *dest, const RECT *src1, const RECT *src2 )
|
||||
{
|
||||
if (is_rect_empty( src1 ))
|
||||
{
|
||||
if (is_rect_empty( src2 ))
|
||||
{
|
||||
reset_bounds( dest );
|
||||
return;
|
||||
}
|
||||
else *dest = *src2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_rect_empty( src2 )) *dest = *src1;
|
||||
else
|
||||
{
|
||||
dest->left = min( src1->left, src2->left );
|
||||
dest->right = max( src1->right, src2->right );
|
||||
dest->top = min( src1->top, src2->top );
|
||||
dest->bottom = max( src1->bottom, src2->bottom );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void add_bounds_rect( RECT *bounds, const RECT *rect )
|
||||
{
|
||||
if (is_rect_empty( rect )) return;
|
||||
|
|
|
@ -1215,6 +1215,22 @@ static void unlock_display_devices(void)
|
|||
pthread_mutex_unlock( &display_lock );
|
||||
}
|
||||
|
||||
RECT get_virtual_screen_rect(void)
|
||||
{
|
||||
struct monitor *monitor;
|
||||
RECT rect = {0};
|
||||
|
||||
if (!lock_display_devices()) return rect;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry )
|
||||
{
|
||||
union_rect( &rect, &rect, &monitor->rc_monitor );
|
||||
}
|
||||
|
||||
unlock_display_devices();
|
||||
return rect;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* NtUserGetDisplayConfigBufferSizes (win32u.@)
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,6 @@ struct user_callbacks
|
|||
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
|
||||
BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM );
|
||||
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
|
||||
DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
|
||||
HWND (WINAPI *pWindowFromDC)( HDC );
|
||||
};
|
||||
|
||||
|
@ -242,6 +241,8 @@ struct unix_funcs
|
|||
UINT WINAPI GDIRealizePalette( HDC hdc );
|
||||
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg );
|
||||
|
||||
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS gdi_init(void) DECLSPEC_HIDDEN;
|
||||
extern NTSTATUS callbacks_init( void *args ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -845,14 +845,6 @@ static BOOL WINAPI call_RedrawWindow( HWND hwnd, const RECT *rect, HRGN rgn, UIN
|
|||
return pRedrawWindow && pRedrawWindow( hwnd, rect, rgn, flags );
|
||||
}
|
||||
|
||||
static DPI_AWARENESS_CONTEXT WINAPI call_SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT ctx )
|
||||
{
|
||||
static DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)( DPI_AWARENESS_CONTEXT );
|
||||
if (!pSetThreadDpiAwarenessContext)
|
||||
pSetThreadDpiAwarenessContext = get_user_proc( "SetThreadDpiAwarenessContext", FALSE );
|
||||
return pSetThreadDpiAwarenessContext ? pSetThreadDpiAwarenessContext( ctx ) : 0;
|
||||
}
|
||||
|
||||
static HWND WINAPI call_WindowFromDC( HDC hdc )
|
||||
{
|
||||
static HWND (WINAPI *pWindowFromDC)( HDC );
|
||||
|
@ -870,7 +862,6 @@ static const struct user_callbacks user_funcs =
|
|||
call_GetWindowRect,
|
||||
call_EnumDisplayMonitors,
|
||||
call_RedrawWindow,
|
||||
call_SetThreadDpiAwarenessContext,
|
||||
call_WindowFromDC,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue