Commit ee405dd8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move is_window_rect_full_screen implementation from winex11.

parent 78222062
......@@ -1547,6 +1547,27 @@ RECT get_virtual_screen_rect( UINT dpi )
return rect;
}
static BOOL is_window_rect_full_screen( const RECT *rect )
{
struct monitor *monitor;
BOOL ret = FALSE;
if (!lock_display_devices()) return FALSE;
LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry )
{
if (rect->left <= monitor->rc_monitor.left && rect->right >= monitor->rc_monitor.right &&
rect->top <= monitor->rc_monitor.top && rect->bottom >= monitor->rc_monitor.bottom)
{
ret = TRUE;
break;
}
}
unlock_display_devices();
return ret;
}
RECT get_display_rect( const WCHAR *display )
{
struct monitor *monitor;
......@@ -4698,6 +4719,9 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
case NtUserCallOneParam_GetSysColor:
return get_sys_color( arg );
case NtUserCallOneParam_IsWindowRectFullScreen:
return is_window_rect_full_screen( (const RECT *)arg );
case NtUserCallOneParam_RealizePalette:
return realize_palette( UlongToHandle(arg) );
......
......@@ -1156,7 +1156,7 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
data->window_rect.bottom - data->window_rect.top, cx, cy );
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE );
if ((style & WS_CAPTION) == WS_CAPTION || !is_window_rect_full_screen( &data->whole_rect ))
if ((style & WS_CAPTION) == WS_CAPTION || !NtUserIsWindowRectFullScreen( &data->whole_rect ))
{
read_net_wm_states( event->display, data );
if ((data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)))
......
......@@ -549,7 +549,7 @@ BOOL clip_fullscreen_window( HWND hwnd, BOOL reset )
/* maximized windows don't count as full screen */
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) return FALSE;
if (!(data = get_win_data( hwnd ))) return FALSE;
fullscreen = is_window_rect_full_screen( &data->whole_rect );
fullscreen = NtUserIsWindowRectFullScreen( &data->whole_rect );
release_win_data( data );
if (!fullscreen) return FALSE;
if (!(thread_data = x11drv_thread_data())) return FALSE;
......
......@@ -281,35 +281,7 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
{
if (style & WS_THICKFRAME) return TRUE;
/* Metacity needs the window to be resizable to make it fullscreen */
return is_window_rect_full_screen( &data->whole_rect );
}
struct monitor_info
{
const RECT *rect;
BOOL full_screen;
};
static BOOL CALLBACK enum_monitor_proc( HMONITOR monitor, HDC hdc, RECT *monitor_rect, LPARAM lparam )
{
struct monitor_info *info = (struct monitor_info *)lparam;
if (info->rect->left <= monitor_rect->left && info->rect->right >= monitor_rect->right &&
info->rect->top <= monitor_rect->top && info->rect->bottom >= monitor_rect->bottom)
{
info->full_screen = TRUE;
return FALSE;
}
return TRUE;
}
BOOL is_window_rect_full_screen( const RECT *rect )
{
struct monitor_info info = {rect, FALSE};
EnumDisplayMonitors( NULL, NULL, enum_monitor_proc, (LPARAM)&info );
return info.full_screen;
return NtUserIsWindowRectFullScreen( &data->whole_rect );
}
/***********************************************************************
......@@ -992,7 +964,7 @@ void update_net_wm_states( struct x11drv_win_data *data )
style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE );
if (style & WS_MINIMIZE)
new_state |= data->net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED));
if (is_window_rect_full_screen( &data->whole_rect ))
if (NtUserIsWindowRectFullScreen( &data->whole_rect ))
{
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
new_state |= (1 << NET_WM_STATE_MAXIMIZED);
......@@ -2511,7 +2483,7 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
{
release_win_data( data );
unmap_window( hwnd );
if (is_window_rect_full_screen( &old_window_rect )) reset_clipping_window();
if (NtUserIsWindowRectFullScreen( &old_window_rect )) reset_clipping_window();
if (!(data = get_win_data( hwnd ))) return;
}
}
......
......@@ -694,7 +694,6 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg ) DECLSPEC_HIDDEN;
extern int X11DRV_check_error(void) DECLSPEC_HIDDEN;
extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect, int x, int y, int cx, int cy ) DECLSPEC_HIDDEN;
extern BOOL is_window_rect_full_screen( const RECT *rect ) DECLSPEC_HIDDEN;
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_host_primary_monitor_rect(void) DECLSPEC_HIDDEN;
......
......@@ -642,6 +642,7 @@ enum
NtUserCallOneParam_GetSysColorPen,
NtUserCallOneParam_GetSystemMetrics,
NtUserCallOneParam_GetVirtualScreenRect,
NtUserCallOneParam_IsWindowRectFullScreen,
NtUserCallOneParam_MessageBeep,
NtUserCallOneParam_RealizePalette,
/* temporary exports */
......@@ -732,6 +733,11 @@ static inline RECT NtUserGetVirtualScreenRect(void)
return virtual;
}
static inline BOOL NtUserIsWindowRectFullScreen( const RECT *rect )
{
return NtUserCallOneParam( (UINT_PTR)rect, NtUserCallOneParam_IsWindowRectFullScreen );
}
static inline BOOL NtUserMessageBeep( UINT i )
{
return NtUserCallOneParam( i, NtUserCallOneParam_MessageBeep );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment