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

Alexandre Julliard julliard at winehq.org
Wed May 11 13:02:55 CDT 2011


Module: wine
Branch: master
Commit: a07b8411fcfe4261da3941a7cb7dcfc3c5736c11
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a07b8411fcfe4261da3941a7cb7dcfc3c5736c11

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 11 12:09:12 2011 +0200

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

---

 dlls/winex11.drv/window.c |   24 ++----------------------
 dlls/winex11.drv/x11drv.h |   12 ++++++++++++
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 32a3f4c..9e67612 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -225,24 +225,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
  *
  * Check if window should be made resizable by the window manager
@@ -251,8 +233,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 (data->whole_rect.left <= 0 && data->whole_rect.right >= screen_width &&
-            data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height);
+    return is_window_rect_fullscreen( &data->whole_rect );
 }
 
 
@@ -1271,8 +1252,7 @@ void update_net_wm_states( Display *display, struct x11drv_win_data *data )
     if (data->whole_window == root_window) return;
 
     style = GetWindowLongW( data->hwnd, GWL_STYLE );
-    if (data->whole_rect.left <= 0 && data->whole_rect.right >= screen_width &&
-        data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height)
+    if (is_window_rect_fullscreen( &data->whole_rect ))
     {
         if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION)
             new_state |= (1 << NET_WM_STATE_MAXIMIZED);
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index a924e06..8e756b2 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -819,6 +819,18 @@ static inline void mirror_rect( const RECT *window_rect, RECT *rect )
     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 */
 extern XContext winContext;
 




More information about the wine-cvs mailing list