xwayland/dnd: Handle stage to protocol transformations
We'd send stage coordinates via the Xdnd X11 protocol, but X11 clients expect X11 protocol coordinates. Make sure to transform these accordingly. The same applies to the size of our DND cover window, which needs to be move/resize:ed in protocol coordinates. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3815 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4169>
This commit is contained in:
parent
796ee28b1c
commit
fbe00573d7
@ -341,10 +341,12 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
|
||||
int y)
|
||||
{
|
||||
MetaWaylandCompositor *compositor = dnd->manager->compositor;
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
MetaWaylandDataSource *source = compositor->seat->data_device.dnd_data_source;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = x11_display->xdisplay;
|
||||
uint32_t action = 0, user_action, actions;
|
||||
int protocol_x, protocol_y;
|
||||
XEvent xev = { 0 };
|
||||
|
||||
user_action = meta_wayland_data_source_get_user_action (source);
|
||||
@ -360,9 +362,13 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
|
||||
xev.xclient.format = 32;
|
||||
xev.xclient.window = dest;
|
||||
|
||||
meta_xwayland_stage_to_protocol_point (manager,
|
||||
x, y,
|
||||
&protocol_x, &protocol_y);
|
||||
|
||||
xev.xclient.data.l[0] = x11_display->selection.xwindow;
|
||||
xev.xclient.data.l[1] = 0;
|
||||
xev.xclient.data.l[2] = (x << 16) | y;
|
||||
xev.xclient.data.l[2] = (protocol_x << 16) | protocol_y;
|
||||
xev.xclient.data.l[3] = time;
|
||||
xev.xclient.data.l[4] = action_to_atom (action);
|
||||
|
||||
@ -800,11 +806,11 @@ repick_drop_surface (MetaWaylandCompositor *compositor,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
|
||||
MetaXWaylandManager *manager = &compositor->xwayland_manager;
|
||||
MetaX11Display *x11_display = x11_display_from_dnd (dnd);
|
||||
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
|
||||
MetaWaylandSurface *focus = NULL;
|
||||
MetaWindow *focus_window;
|
||||
MtkRectangle frame_rect;
|
||||
|
||||
focus = pick_drop_surface (compositor, event);
|
||||
if (dnd->focus_surface == focus)
|
||||
@ -821,12 +827,18 @@ repick_drop_surface (MetaWaylandCompositor *compositor,
|
||||
focus_window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
|
||||
{
|
||||
Window dnd_window;
|
||||
MtkRectangle frame_rect;
|
||||
|
||||
hide_dnd_window (dnd, x11_display, dnd->current_dnd_window);
|
||||
dnd_window = next_dnd_window (dnd);
|
||||
|
||||
XMapRaised (xdisplay, dnd_window);
|
||||
|
||||
frame_rect = meta_window_config_get_rect (focus_window->config);
|
||||
meta_xwayland_stage_to_protocol_rect (manager,
|
||||
&frame_rect,
|
||||
&frame_rect);
|
||||
|
||||
XMoveResizeWindow (xdisplay, dnd_window,
|
||||
frame_rect.x,
|
||||
frame_rect.y,
|
||||
|
Loading…
x
Reference in New Issue
Block a user