From 31ed6473bef708a66e29627d523140b10a3d056a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 22 Apr 2008 16:56:31 +0200 Subject: [PATCH] winex11: Moved the ConfigureNotify handler to event.c. --- dlls/winex11.drv/event.c | 64 +++++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/winpos.c | 63 -------------------------------------- dlls/winex11.drv/x11drv.h | 1 - 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index adbf585c993..2cb8cc8fdb3 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -77,6 +77,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *event ); static void X11DRV_FocusOut( HWND hwnd, XEvent *event ); static void X11DRV_Expose( HWND hwnd, XEvent *event ); static void X11DRV_MapNotify( HWND hwnd, XEvent *event ); +static void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event ); static void X11DRV_PropertyNotify( HWND hwnd, XEvent *event ); static void X11DRV_ClientMessage( HWND hwnd, XEvent *event ); @@ -730,6 +731,69 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event ) } +/*********************************************************************** + * X11DRV_ConfigureNotify + */ +void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) +{ + XConfigureEvent *event = &xev->xconfigure; + struct x11drv_win_data *data; + RECT rect; + UINT flags; + int cx, cy, x = event->x, y = event->y; + + if (!hwnd) return; + if (!(data = X11DRV_get_win_data( hwnd ))) return; + if (!data->mapped || data->iconic) return; + + /* Get geometry */ + + if (!event->send_event) /* normal event, need to map coordinates to the root */ + { + Window child; + wine_tsx11_lock(); + XTranslateCoordinates( event->display, data->whole_window, root_window, + 0, 0, &x, &y, &child ); + wine_tsx11_unlock(); + } + rect.left = x; + rect.top = y; + rect.right = x + event->width; + rect.bottom = y + event->height; + OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top ); + TRACE( "win %p new X rect %d,%d,%dx%d (event %d,%d,%dx%d)\n", + hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, + event->x, event->y, event->width, event->height ); + X11DRV_X_to_window_rect( data, &rect ); + + x = rect.left; + y = rect.top; + cx = rect.right - rect.left; + cy = rect.bottom - rect.top; + flags = SWP_NOACTIVATE | SWP_NOZORDER; + + /* Compare what has changed */ + + GetWindowRect( hwnd, &rect ); + if (rect.left == x && rect.top == y) flags |= SWP_NOMOVE; + else + TRACE( "%p moving from (%d,%d) to (%d,%d)\n", + hwnd, rect.left, rect.top, x, y ); + + if ((rect.right - rect.left == cx && rect.bottom - rect.top == cy) || + (IsRectEmpty( &rect ) && event->width == 1 && event->height == 1)) + { + if (flags & SWP_NOMOVE) return; /* if nothing changed, don't do anything */ + flags |= SWP_NOSIZE; + } + else + TRACE( "%p resizing from (%dx%d) to (%dx%d)\n", + hwnd, rect.right - rect.left, rect.bottom - rect.top, cx, cy ); + + SetWindowPos( hwnd, 0, x, y, cx, cy, flags ); +} + + /*********************************************************************** * get_window_wm_state */ diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 2f7ab13968c..5348ec62752 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -534,66 +534,3 @@ void X11DRV_resize_desktop( unsigned int width, unsigned int height ) EnumWindows( update_windows_on_desktop_resize, (LPARAM)&resize_data ); } - - -/*********************************************************************** - * X11DRV_ConfigureNotify - */ -void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) -{ - XConfigureEvent *event = &xev->xconfigure; - struct x11drv_win_data *data; - RECT rect; - UINT flags; - int cx, cy, x = event->x, y = event->y; - - if (!hwnd) return; - if (!(data = X11DRV_get_win_data( hwnd ))) return; - if (!data->mapped || data->iconic) return; - - /* Get geometry */ - - if (!event->send_event) /* normal event, need to map coordinates to the root */ - { - Window child; - wine_tsx11_lock(); - XTranslateCoordinates( event->display, data->whole_window, root_window, - 0, 0, &x, &y, &child ); - wine_tsx11_unlock(); - } - rect.left = x; - rect.top = y; - rect.right = x + event->width; - rect.bottom = y + event->height; - OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top ); - TRACE( "win %p new X rect %d,%d,%dx%d (event %d,%d,%dx%d)\n", - hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, - event->x, event->y, event->width, event->height ); - X11DRV_X_to_window_rect( data, &rect ); - - x = rect.left; - y = rect.top; - cx = rect.right - rect.left; - cy = rect.bottom - rect.top; - flags = SWP_NOACTIVATE | SWP_NOZORDER; - - /* Compare what has changed */ - - GetWindowRect( hwnd, &rect ); - if (rect.left == x && rect.top == y) flags |= SWP_NOMOVE; - else - TRACE( "%p moving from (%d,%d) to (%d,%d)\n", - hwnd, rect.left, rect.top, x, y ); - - if ((rect.right - rect.left == cx && rect.bottom - rect.top == cy) || - (IsRectEmpty( &rect ) && event->width == 1 && event->height == 1)) - { - if (flags & SWP_NOMOVE) return; /* if nothing changed, don't do anything */ - flags |= SWP_NOSIZE; - } - else - TRACE( "%p resizing from (%dx%d) to (%dx%d)\n", - hwnd, rect.right - rect.left, rect.bottom - rect.top, cx, cy ); - - SetWindowPos( hwnd, 0, x, y, cx, cy, flags ); -} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 450153b194a..287acbbb5bf 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -643,7 +643,6 @@ extern void X11DRV_EnterNotify( HWND hwnd, XEvent *event ); extern void X11DRV_KeyEvent( HWND hwnd, XEvent *event ); extern void X11DRV_KeymapNotify( HWND hwnd, XEvent *event ); extern void X11DRV_DestroyNotify( 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 ); extern void X11DRV_MappingNotify( HWND hWnd, XEvent *event );