/* VisibilityNotify */
/* CreateNotify */
{ DestroyNotify, X11DRV_DestroyNotify },
- { UnmapNotify, X11DRV_UnmapNotify },
+ /* UnmapNotify */
{ MapNotify, X11DRV_MapNotify },
/* MapRequest */
/* ReparentNotify */
{ MappingNotify, X11DRV_MappingNotify },
};
-static int nb_event_handlers = 19; /* change this if you add handlers above */
+static int nb_event_handlers = 18; /* change this if you add handlers above */
/* return the name of an X event */
*
* Handle a PropertyNotify for WM_STATE.
*/
-static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent *event )
+static void handle_wm_state_notify( struct x11drv_win_data *data, XPropertyEvent *event,
+ BOOL update_window )
{
switch(event->state)
{
}
break;
}
+
+ if (!update_window || !data->managed || !data->mapped) return;
+
+ if (data->iconic && data->wm_state == NormalState) /* restore window */
+ {
+ int x, y;
+ unsigned int width, height, border, depth;
+ Window root, top;
+ WINDOWPLACEMENT wp;
+ RECT rect;
+
+ /* FIXME: hack */
+ wine_tsx11_lock();
+ XGetGeometry( event->display, data->whole_window, &root, &x, &y, &width, &height,
+ &border, &depth );
+ XTranslateCoordinates( event->display, data->whole_window, root, 0, 0, &x, &y, &top );
+ wine_tsx11_unlock();
+ rect.left = x;
+ rect.top = y;
+ rect.right = x + width;
+ rect.bottom = y + height;
+ OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top );
+ X11DRV_X_to_window_rect( data, &rect );
+
+ wp.length = sizeof(wp);
+ GetWindowPlacement( data->hwnd, &wp );
+ wp.flags = 0;
+ wp.showCmd = SW_RESTORE;
+ wp.rcNormalPosition = rect;
+
+ TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window );
+ data->iconic = FALSE;
+ data->lock_changes++;
+ SetWindowPlacement( data->hwnd, &wp );
+ data->lock_changes--;
+ }
+ else if (!data->iconic && data->wm_state == IconicState)
+ {
+ TRACE( "minimizing win %p/%lx\n", data->hwnd, data->whole_window );
+ data->iconic = TRUE;
+ data->lock_changes++;
+ ShowWindow( data->hwnd, SW_MINIMIZE );
+ data->lock_changes--;
+ }
}
if (!hwnd) return;
if (!(data = X11DRV_get_win_data( hwnd ))) return;
- if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( data, event );
+ if (event->atom == x11drv_atom(WM_STATE)) handle_wm_state_notify( data, event, TRUE );
}
else
{
wine_tsx11_unlock();
- handle_wm_state_notify( data, &event.xproperty );
+ handle_wm_state_notify( data, &event.xproperty, FALSE );
wine_tsx11_lock();
}
}
void X11DRV_MapNotify( HWND hwnd, XEvent *event )
{
struct x11drv_win_data *data;
- int state;
if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (!data->mapped) return;
{
HWND hwndFocus = GetFocus();
if (hwndFocus && IsChild( hwnd, hwndFocus )) X11DRV_SetFocus(hwndFocus); /* FIXME */
- return;
}
- if (!data->iconic) return;
-
- state = get_window_wm_state( event->xmap.display, data );
- if (state == NormalState)
- {
- int x, y;
- unsigned int width, height, border, depth;
- Window root, top;
- WINDOWPLACEMENT wp;
- RECT rect;
-
- /* FIXME: hack */
- wine_tsx11_lock();
- XGetGeometry( event->xmap.display, data->whole_window, &root, &x, &y, &width, &height,
- &border, &depth );
- XTranslateCoordinates( event->xmap.display, data->whole_window, root, 0, 0, &x, &y, &top );
- wine_tsx11_unlock();
- rect.left = x;
- rect.top = y;
- rect.right = x + width;
- rect.bottom = y + height;
- OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top );
- X11DRV_X_to_window_rect( data, &rect );
-
- wp.length = sizeof(wp);
- GetWindowPlacement( hwnd, &wp );
- wp.flags = 0;
- wp.showCmd = SW_RESTORE;
- wp.rcNormalPosition = rect;
-
- TRACE( "restoring win %p/%lx\n", hwnd, data->whole_window );
- data->iconic = FALSE;
- data->lock_changes++;
- SetWindowPlacement( hwnd, &wp );
- data->lock_changes--;
- }
- else TRACE( "win %p/%lx ignoring since state=%d\n", hwnd, data->whole_window, state );
}
-/**********************************************************************
- * X11DRV_UnmapNotify
- */
-void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
-{
- struct x11drv_win_data *data;
- int state;
-
- if (!(data = X11DRV_get_win_data( hwnd ))) return;
- if (!data->managed || !data->mapped || data->iconic) return;
-
- state = get_window_wm_state( event->xunmap.display, data );
- if (state == IconicState)
- {
- TRACE( "minimizing win %p/%lx\n", hwnd, data->whole_window );
- data->iconic = TRUE;
- data->lock_changes++;
- ShowWindow( hwnd, SW_MINIMIZE );
- data->lock_changes--;
- }
- else TRACE( "win %p/%lx ignoring since state=%d\n", hwnd, data->whole_window, state );
-}
-
struct desktop_resize_data
{
RECT old_screen_rect;
extern void X11DRV_Expose( HWND hwnd, XEvent *event );
extern void X11DRV_DestroyNotify( HWND hwnd, XEvent *event );
extern void X11DRV_MapNotify( HWND hwnd, XEvent *event );
-extern void X11DRV_UnmapNotify( HWND hwnd, XEvent *event );
extern void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event );
extern void X11DRV_SelectionRequest( HWND hWnd, XEvent *event );
extern void X11DRV_SelectionClear( HWND hWnd, XEvent *event );