winex11.drv: Move the SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE/SC_RESTORE) call after the window extents check.
Dmitry Timoshkov
dmitry at codeweavers.com
Tue Apr 5 04:31:27 CDT 2011
This patch makes the IpTV application from the bug 26599 correctly restore
its window size from fullscreen state.
After ShowWindow(SW_MAXIMIZE) called on a captionless window winex11.drv
makes that window fullscreen. Right after that a WM (Gnome in my case)
sends a ConfigureNotify event to the window with window extents exactly
matching its current (fullscreen) state. Then X11DRV_ConfigureNotify() calls
SendMessage(WM_SYSCOMMAND, SC_RESTORE) which leads to ShowWindow(SW_RESTORE),
which in turn does nothing since X11DRV_ShowWindow() sets passed in rect
to current (fullscreen) extents. So the window extents don't change but
the window loses its maximized state (WS_MAXIMIZE style), and when IsZoomed()
returns FALSE the application thinks it's no more in fullscreen state and
does nothing on a request to leave fullscreen mode.
Another solution is to make is_net_wm_state_maximized() return TRUE also
for windows in fullscreen state.
---
dlls/winex11.drv/event.c | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 6e4225c..ec9d897 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -945,25 +945,6 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
hwnd, data->whole_window, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
event->x, event->y, event->width, event->height );
- if (is_net_wm_state_maximized( event->display, data ))
- {
- if (!IsZoomed( data->hwnd ))
- {
- TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window );
- SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
- return;
- }
- }
- else
- {
- if (IsZoomed( data->hwnd ))
- {
- TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window );
- SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
- return;
- }
- }
-
X11DRV_X_to_window_rect( data, &rect );
if (root_coords) MapWindowPoints( 0, parent, (POINT *)&rect, 2 );
@@ -986,7 +967,11 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
data->window_rect.bottom - data->window_rect.top == cy) ||
(IsRectEmpty( &data->window_rect ) && event->width == 1 && event->height == 1))
{
- if (flags & SWP_NOMOVE) return; /* if nothing changed, don't do anything */
+ if (flags & SWP_NOMOVE) /* if nothing changed, don't do anything */
+ {
+ TRACE( "Nothing has changed, ignoring event\n" );
+ return;
+ }
flags |= SWP_NOSIZE;
}
else
@@ -994,6 +979,25 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
hwnd, data->window_rect.right - data->window_rect.left,
data->window_rect.bottom - data->window_rect.top, cx, cy );
+ if (is_net_wm_state_maximized( event->display, data ))
+ {
+ if (!IsZoomed( data->hwnd ))
+ {
+ TRACE( "win %p/%lx is maximized\n", data->hwnd, data->whole_window );
+ SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
+ return;
+ }
+ }
+ else
+ {
+ if (IsZoomed( data->hwnd ))
+ {
+ TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window );
+ SendMessageW( data->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0 );
+ return;
+ }
+ }
+
SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
}
--
1.7.4.3
More information about the wine-patches
mailing list