Alexandre Julliard : winex11: Set the appropriate _NET_WM_STATE properties for maximized windows.

Alexandre Julliard julliard at winehq.org
Mon Mar 3 06:21:19 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Mar  1 13:30:58 2008 +0100

winex11: Set the appropriate _NET_WM_STATE properties for maximized windows.

---

 dlls/winex11.drv/winpos.c      |   13 +++++++++----
 dlls/winex11.drv/x11drv.h      |    3 +++
 dlls/winex11.drv/x11drv_main.c |    2 ++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 4e96482..1f5d843 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -186,11 +186,12 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data
     {
         XATOM__NET_WM_STATE_FULLSCREEN,
         XATOM__NET_WM_STATE_ABOVE,
+        XATOM__NET_WM_STATE_MAXIMIZED_VERT,
         XATOM__NET_WM_STATE_SKIP_PAGER,
         XATOM__NET_WM_STATE_SKIP_TASKBAR
     };
 
-    DWORD i, ex_style, new_state = 0;
+    DWORD i, style, ex_style, new_state = 0;
     XEvent xev;
 
     if (!data->managed) return;
@@ -200,6 +201,9 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data
         data->whole_rect.top <= 0 && data->whole_rect.bottom >= screen_height)
         new_state |= (1 << NET_WM_STATE_FULLSCREEN);
 
+    style = GetWindowLongW( data->hwnd, GWL_STYLE );
+    if (style & WS_MAXIMIZE) new_state |= (1 << NET_WM_STATE_MAXIMIZED);
+
     ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE );
     if (ex_style & WS_EX_TOPMOST)
         new_state |= (1 << NET_WM_STATE_ABOVE);
@@ -213,7 +217,6 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data
     xev.xclient.display = display;
     xev.xclient.send_event = True;
     xev.xclient.format = 32;
-    xev.xclient.data.l[2] = 0;
     xev.xclient.data.l[3] = 1;
 
     for (i = 0; i < NB_NET_WM_STATES; i++)
@@ -226,6 +229,8 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data
 
         xev.xclient.data.l[0] = (new_state & (1 << i)) ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
         xev.xclient.data.l[1] = X11DRV_Atoms[state_atoms[i] - FIRST_XATOM];
+        xev.xclient.data.l[2] = ((state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ?
+                                 x11drv_atom(_NET_WM_STATE_MAXIMIZED_HORZ) : 0);
         wine_tsx11_lock();
         XSendEvent( display, root_window, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev );
         wine_tsx11_unlock();
@@ -395,8 +400,8 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
         data->net_wm_state = 0;
     }
 
-    /* don't change position if we are about to minimize a managed window */
-    if (!(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & WS_MINIMIZE)))
+    /* don't change position if we are about to minimize or maximize a managed window */
+    if (!(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & (WS_MINIMIZE|WS_MAXIMIZE))))
         X11DRV_sync_window_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
 
     if ((new_style & WS_VISIBLE) &&
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 526408c..7b61d95 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -575,6 +575,8 @@ enum x11drv_atoms
     XATOM__NET_WM_STATE,
     XATOM__NET_WM_STATE_ABOVE,
     XATOM__NET_WM_STATE_FULLSCREEN,
+    XATOM__NET_WM_STATE_MAXIMIZED_HORZ,
+    XATOM__NET_WM_STATE_MAXIMIZED_VERT,
     XATOM__NET_WM_STATE_SKIP_PAGER,
     XATOM__NET_WM_STATE_SKIP_TASKBAR,
     XATOM__NET_WM_WINDOW_TYPE,
@@ -647,6 +649,7 @@ enum x11drv_net_wm_state
 {
     NET_WM_STATE_FULLSCREEN,
     NET_WM_STATE_ABOVE,
+    NET_WM_STATE_MAXIMIZED,
     NET_WM_STATE_SKIP_PAGER,
     NET_WM_STATE_SKIP_TASKBAR,
     NB_NET_WM_STATES
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 8982716..50d4546 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -139,6 +139,8 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
     "_NET_WM_STATE",
     "_NET_WM_STATE_ABOVE",
     "_NET_WM_STATE_FULLSCREEN",
+    "_NET_WM_STATE_MAXIMIZED_HORZ",
+    "_NET_WM_STATE_MAXIMIZED_VERT",
     "_NET_WM_STATE_SKIP_PAGER",
     "_NET_WM_STATE_SKIP_TASKBAR",
     "_NET_WM_WINDOW_TYPE",




More information about the wine-cvs mailing list