winex11: Export a couple of helper functions for window rectangles.

This commit is contained in:
Alexandre Julliard 2011-05-11 12:09:12 +02:00
parent a28722f531
commit a07b8411fc
2 changed files with 14 additions and 22 deletions

View File

@ -224,24 +224,6 @@ static BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rec
} }
/***********************************************************************
* is_window_rect_mapped
*
* Check if the X whole window should be mapped based on its rectangle
*/
static BOOL is_window_rect_mapped( const RECT *rect )
{
/* don't map if rect is off-screen */
if (rect->left >= virtual_screen_rect.right ||
rect->top >= virtual_screen_rect.bottom ||
rect->right <= virtual_screen_rect.left ||
rect->bottom <= virtual_screen_rect.top)
return FALSE;
return TRUE;
}
/*********************************************************************** /***********************************************************************
* is_window_resizable * is_window_resizable
* *
@ -251,8 +233,7 @@ static inline BOOL is_window_resizable( struct x11drv_win_data *data, DWORD styl
{ {
if (style & WS_THICKFRAME) return TRUE; if (style & WS_THICKFRAME) return TRUE;
/* Metacity needs the window to be resizable to make it fullscreen */ /* Metacity needs the window to be resizable to make it fullscreen */
return (data->whole_rect.left <= 0 && data->whole_rect.right >= screen_width && return is_window_rect_fullscreen( &data->whole_rect );
data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height);
} }
@ -1271,8 +1252,7 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
if (data->whole_window == root_window) return; if (data->whole_window == root_window) return;
style = GetWindowLongW( data->hwnd, GWL_STYLE ); style = GetWindowLongW( data->hwnd, GWL_STYLE );
if (data->whole_rect.left <= 0 && data->whole_rect.right >= screen_width && if (is_window_rect_fullscreen( &data->whole_rect ))
data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height)
{ {
if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
new_state |= (1 << NET_WM_STATE_MAXIMIZED); new_state |= (1 << NET_WM_STATE_MAXIMIZED);

View File

@ -819,6 +819,18 @@ static inline void mirror_rect( const RECT *window_rect, RECT *rect )
rect->right = width - tmp; rect->right = width - tmp;
} }
static inline BOOL is_window_rect_mapped( const RECT *rect )
{
return (rect->left < virtual_screen_rect.right && rect->top < virtual_screen_rect.bottom &&
rect->right > virtual_screen_rect.left && rect->bottom > virtual_screen_rect.top);
}
static inline BOOL is_window_rect_fullscreen( const RECT *rect )
{
return (rect->left <= 0 && rect->right >= screen_width &&
rect->top <= 0 && rect->bottom >= screen_height);
}
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
extern XContext winContext; extern XContext winContext;