Alexandre Julliard : winex11: Merge the iconification support into the SetWindowPos driver backend.
Alexandre Julliard
julliard at winehq.org
Fri Feb 29 06:16:49 CST 2008
Module: wine
Branch: master
Commit: 63dd1a02ca401a7f5045c58317984fe2ee3bb5cb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=63dd1a02ca401a7f5045c58317984fe2ee3bb5cb
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Feb 28 17:01:10 2008 +0100
winex11: Merge the iconification support into the SetWindowPos driver backend.
---
dlls/winex11.drv/window.c | 42 ------------------------------------------
dlls/winex11.drv/winpos.c | 39 +++++++++++++++++++++++++--------------
dlls/winex11.drv/x11drv.h | 2 +-
3 files changed, 26 insertions(+), 57 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 59602fc..2b04ec0 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -981,48 +981,6 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
/***********************************************************************
- * X11DRV_set_iconic_state
- *
- * Set the X11 iconic state according to the window style.
- */
-void X11DRV_set_iconic_state( HWND hwnd )
-{
- Display *display = thread_display();
- struct x11drv_win_data *data;
- RECT rect;
- DWORD style = GetWindowLongW( hwnd, GWL_STYLE );
- BOOL iconic = (style & WS_MINIMIZE) != 0;
-
- if (!(data = X11DRV_get_win_data( hwnd ))) return;
- if (!data->whole_window) return;
-
- GetWindowRect( hwnd, &rect );
-
- wine_tsx11_lock();
-
- if (data->wm_hints)
- {
- data->wm_hints->flags |= StateHint | IconPositionHint;
- data->wm_hints->initial_state = iconic ? IconicState : NormalState;
- data->wm_hints->icon_x = rect.left - virtual_screen_rect.left;
- data->wm_hints->icon_y = rect.top - virtual_screen_rect.top;
- XSetWMHints( display, data->whole_window, data->wm_hints );
- }
-
- if (data->mapped)
- {
- if (iconic)
- XIconifyWindow( display, data->whole_window, DefaultScreen(display) );
- else
- if (X11DRV_is_window_rect_mapped( &rect ))
- XMapWindow( display, data->whole_window );
- }
-
- wine_tsx11_unlock();
-}
-
-
-/***********************************************************************
* X11DRV_window_to_X_rect
*
* Convert a rect from client to X window coordinates
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 3e04810..7c28a8d 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -159,6 +159,7 @@ void X11DRV_SetWindowStyle( HWND hwnd, DWORD old_style )
XMapWindow( display, data->whole_window );
wine_tsx11_unlock();
data->mapped = TRUE;
+ data->iconic = (new_style & WS_MINIMIZE) != 0;
}
}
}
@@ -354,8 +355,8 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
SERVER_END_REQ;
}
- TRACE( "win %p window %s client %s style %08x\n",
- hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
+ TRACE( "win %p window %s client %s style %08x flags %08x\n",
+ hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style, swp_flags );
if (!IsRectEmpty( &valid_rects[0] ))
{
@@ -395,12 +396,14 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
data->net_wm_state = 0;
}
- X11DRV_sync_window_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
+ /* don't change position if we are about to minimize a managed window */
+ if (!(data->managed && (swp_flags & SWP_STATECHANGED) && (new_style & WS_MINIMIZE)))
+ X11DRV_sync_window_position( display, data, swp_flags, &old_client_rect, &old_whole_rect );
- if ((new_style & WS_VISIBLE) && !(new_style & WS_MINIMIZE) &&
- X11DRV_is_window_rect_mapped( rectWindow ))
+ if ((new_style & WS_VISIBLE) &&
+ ((new_style & WS_MINIMIZE) || X11DRV_is_window_rect_mapped( rectWindow )))
{
- if (!data->mapped || (swp_flags & SWP_FRAMECHANGED))
+ if (!data->mapped || (swp_flags & (SWP_FRAMECHANGED|SWP_STATECHANGED)))
X11DRV_set_wm_hints( display, data );
if (!data->mapped)
@@ -413,6 +416,18 @@ void X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, UINT swp_flags,
XFlush( display );
wine_tsx11_unlock();
data->mapped = TRUE;
+ data->iconic = (new_style & WS_MINIMIZE) != 0;
+ }
+ else if ((swp_flags & SWP_STATECHANGED) && (!data->iconic != !(new_style & WS_MINIMIZE)))
+ {
+ data->iconic = (new_style & WS_MINIMIZE) != 0;
+ TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic );
+ wine_tsx11_lock();
+ if (data->iconic)
+ XIconifyWindow( display, data->whole_window, DefaultScreen(display) );
+ else if (X11DRV_is_window_rect_mapped( rectWindow ))
+ XMapWindow( display, data->whole_window );
+ wine_tsx11_unlock();
}
update_net_wm_states( display, data );
}
@@ -528,8 +543,6 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
old_style = WIN_SetStyle( hwnd, WS_MINIMIZE, WS_MAXIMIZE );
- X11DRV_set_iconic_state( hwnd );
-
wpl.ptMinPosition = WINPOS_FindIconPos( hwnd, wpl.ptMinPosition );
if (!(old_style & WS_MINIMIZE)) swpFlags |= SWP_STATECHANGED;
@@ -545,11 +558,8 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
WINPOS_GetMinMaxInfo( hwnd, &size, &wpl.ptMaxPosition, NULL, NULL );
old_style = WIN_SetStyle( hwnd, WS_MAXIMIZE, WS_MINIMIZE );
- if (old_style & WS_MINIMIZE)
- {
- WINPOS_ShowIconTitle( hwnd, FALSE );
- X11DRV_set_iconic_state( hwnd );
- }
+ if (old_style & WS_MINIMIZE) WINPOS_ShowIconTitle( hwnd, FALSE );
+
if (!(old_style & WS_MAXIMIZE)) swpFlags |= SWP_STATECHANGED;
SetRect( rect, wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, size.x, size.y );
break;
@@ -563,7 +573,6 @@ UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
BOOL restore_max;
WINPOS_ShowIconTitle( hwnd, FALSE );
- X11DRV_set_iconic_state( hwnd );
if (!(wndPtr = WIN_GetPtr( hwnd )) || wndPtr == WND_OTHER_PROCESS) return 0;
restore_max = (wndPtr->flags & WIN_RESTORE_MAX) != 0;
@@ -764,6 +773,7 @@ void X11DRV_MapNotify( HWND hwnd, XEvent *event )
TRACE( "win %p/%lx ignoring since state=%d\n", hwnd, data->whole_window, state );
return;
}
+ data->iconic = FALSE;
if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) == (WS_VISIBLE|WS_MINIMIZE))
{
@@ -818,6 +828,7 @@ void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
TRACE( "win %p/%lx ignoring since state=%d\n", hwnd, data->whole_window, state );
return;
}
+ data->iconic = TRUE;
if (!(win = WIN_GetPtr( hwnd ))) return;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 20590b3..6ab9f38 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -670,6 +670,7 @@ struct x11drv_win_data
XWMHints *wm_hints; /* window manager hints */
BOOL managed : 1; /* is window managed? */
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
+ BOOL iconic : 1; /* is window in iconic state? */
int wm_state; /* current value of the WM_STATE property */
DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */
unsigned int lock_changes; /* lock count for X11 change requests */
@@ -717,7 +718,6 @@ typedef int (*x11drv_error_callback)( Display *display, XErrorEvent *event, void
extern void X11DRV_expect_error( Display *display, x11drv_error_callback callback, void *arg );
extern int X11DRV_check_error(void);
extern BOOL is_window_managed( HWND hwnd, UINT swp_flags, const RECT *window_rect );
-extern void X11DRV_set_iconic_state( HWND hwnd );
extern void X11DRV_window_to_X_rect( struct x11drv_win_data *data, RECT *rect );
extern void X11DRV_X_to_window_rect( struct x11drv_win_data *data, RECT *rect );
extern void X11DRV_sync_window_style( Display *display, struct x11drv_win_data *data );
More information about the wine-cvs
mailing list