Module: wine Branch: master Commit: abfed909b2d96f8b3fb2acfcb916b6395bb24e30 URL: http://source.winehq.org/git/wine.git/?a=commit;h=abfed909b2d96f8b3fb2acfcb9...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Feb 1 15:46:52 2012 +0100
winex11: Move the window resizing support to mouse.c.
---
dlls/winex11.drv/mouse.c | 42 ++++++++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/window.c | 30 ++---------------------------- dlls/winex11.drv/x11drv.h | 1 + 3 files changed, 45 insertions(+), 28 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 85df63b..060b4c8 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -1327,6 +1327,48 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip ) }
/*********************************************************************** + * move_resize_window + */ +void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ) +{ + DWORD pt; + int x, y, button = 0; + XEvent xev; + + pt = GetMessagePos(); + x = (short)LOWORD( pt ); + y = (short)HIWORD( pt ); + + if (GetKeyState( VK_LBUTTON ) & 0x8000) button = 1; + else if (GetKeyState( VK_MBUTTON ) & 0x8000) button = 2; + else if (GetKeyState( VK_RBUTTON ) & 0x8000) button = 3; + + TRACE( "hwnd %p/%lx, x %d, y %d, dir %d, button %d\n", + data->hwnd, data->whole_window, x, y, dir, button ); + + xev.xclient.type = ClientMessage; + xev.xclient.window = data->whole_window; + xev.xclient.message_type = x11drv_atom(_NET_WM_MOVERESIZE); + xev.xclient.serial = 0; + xev.xclient.display = display; + xev.xclient.send_event = True; + xev.xclient.format = 32; + xev.xclient.data.l[0] = x - virtual_screen_rect.left; /* x coord */ + xev.xclient.data.l[1] = y - virtual_screen_rect.top; /* y coord */ + xev.xclient.data.l[2] = dir; /* direction */ + xev.xclient.data.l[3] = button; /* button */ + xev.xclient.data.l[4] = 0; /* unused */ + + /* need to ungrab the pointer that may have been automatically grabbed + * with a ButtonPress event */ + wine_tsx11_lock(); + XUngrabPointer( display, CurrentTime ); + XSendEvent(display, root_window, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); + wine_tsx11_unlock(); +} + + +/*********************************************************************** * X11DRV_ButtonPress */ void X11DRV_ButtonPress( HWND hwnd, XEvent *xev ) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a172cd2..fa5022b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2779,9 +2779,7 @@ static BOOL is_netwm_supported( Display *display, Atom atom ) LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) { WPARAM hittest = wparam & 0x0f; - DWORD dwPoint; - int x, y, dir; - XEvent xev; + int dir; Display *display = thread_display(); struct x11drv_win_data *data;
@@ -2833,30 +2831,6 @@ LRESULT CDECL X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) return -1; }
- dwPoint = GetMessagePos(); - x = (short)LOWORD(dwPoint); - y = (short)HIWORD(dwPoint); - - TRACE("hwnd %p, x %d, y %d, dir %d\n", hwnd, x, y, dir); - - xev.xclient.type = ClientMessage; - xev.xclient.window = X11DRV_get_whole_window(hwnd); - xev.xclient.message_type = x11drv_atom(_NET_WM_MOVERESIZE); - xev.xclient.serial = 0; - xev.xclient.display = display; - xev.xclient.send_event = True; - xev.xclient.format = 32; - xev.xclient.data.l[0] = x - virtual_screen_rect.left; /* x coord */ - xev.xclient.data.l[1] = y - virtual_screen_rect.top; /* y coord */ - xev.xclient.data.l[2] = dir; /* direction */ - xev.xclient.data.l[3] = 1; /* button */ - xev.xclient.data.l[4] = 0; /* unused */ - - /* need to ungrab the pointer that may have been automatically grabbed - * with a ButtonPress event */ - wine_tsx11_lock(); - XUngrabPointer( display, CurrentTime ); - XSendEvent(display, root_window, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev); - wine_tsx11_unlock(); + move_resize_window( display, data, dir ); return 0; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 78e7cd0..15fac6f 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -674,6 +674,7 @@ extern LRESULT clip_cursor_notify( HWND hwnd, HWND new_clip_hwnd ) DECLSPEC_HIDD extern void ungrab_clipping_window(void) DECLSPEC_HIDDEN; extern void reset_clipping_window(void) DECLSPEC_HIDDEN; extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN; +extern void move_resize_window( Display *display, struct x11drv_win_data *data, int dir ) DECLSPEC_HIDDEN; extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN; extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, DWORD mask, DWORD flags ) DECLSPEC_HIDDEN;