winex11: Moved the ConfigureNotify handler to event.c.

This commit is contained in:
Alexandre Julliard 2008-04-22 16:56:31 +02:00
parent 1a0d28bf02
commit 31ed6473be
3 changed files with 64 additions and 64 deletions

View File

@ -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
*/

View File

@ -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 );
}

View File

@ -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 );