Commit abfed909 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Move the window resizing support to mouse.c.

parent 002f85a2
......@@ -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 )
......
......@@ -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;
}
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment