http://bugs.winehq.org/show_bug.cgi?id=15252
Summary: moving/resizing undecorated windows broken in dual- screen setups Product: Wine Version: 1.1.4 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winex11.drv AssignedTo: wine-bugs@winehq.org ReportedBy: dima@gmail.com
I have a second monitor attached, so my first monitor's top left corner is at (1280, 300). If I try to move/resize a window that has custom decorations, wine gives wrong pointer coordinates to the window manager, and the window jumps down and to the right.
The problem seems to be in X11DRV_SysCommand, dlls/winex11.drv/window.c. It uses GetMessagePos to get the pointer coordinates - which returns the values relative to the first screen. Then it sends _NET_WM_MOVERESIZE to the window manager - which expects absolute coordinates.
I'm not sure what the right solution is, but I have a work-around: subtract the value returned by GetWindowRect, then translate to the coordinates in the root window using XTranslateCoordinates. (I've never used win32 or Xlib, so please excuse my code.)
--- dlls/winex11.drv/window.c 2008-09-05 08:28:27.000000000 -0700 +++ dlls/winex11.drv/window.c.new 2008-09-12 01:23:32.000000000 -0700 @@ -2197,6 +2197,8 @@ XEvent xev; Display *display = thread_display(); struct x11drv_win_data *data; + RECT rect; + Window dummy_child;
if (!(data = X11DRV_get_win_data( hwnd ))) return -1; if (!data->whole_window || !data->managed || !data->mapped) return -1; @@ -2252,6 +2254,12 @@
TRACE("hwnd %p, x %d, y %d, dir %d\n", hwnd, x, y, dir);
+ GetWindowRect(hwnd, &rect); + wine_tsx11_lock(); + XTranslateCoordinates(display, X11DRV_get_whole_window(hwnd), + root_window, x - rect.left, y - rect.top, &x, &y, &dummy_child); + wine_tsx11_unlock(); + xev.xclient.type = ClientMessage; xev.xclient.window = X11DRV_get_whole_window(hwnd); xev.xclient.message_type = x11drv_atom(_NET_WM_MOVERESIZE);