Only SetSelectionOwner when syncing selections
When a client becomes the selection owner, and sets the selection, an XFixes event is raised, and gamescope responds by retrieving the contents of the selection, and re-setting ourWindow as the owner of the selection. We don't need to call XChangeProperty when syncing across Xwayland instances, as that gets called when a client makes a SelectionRequest.
This commit is contained in:
parent
a883f133a3
commit
a64a5a8653
1 changed files with 4 additions and 8 deletions
|
@ -4748,7 +4748,7 @@ handle_client_message(xwayland_ctx_t *ctx, XClientMessageEvent *ev)
|
|||
}
|
||||
}
|
||||
|
||||
static void x11_set_selection(xwayland_ctx_t *ctx, std::string contents, int selectionTarget)
|
||||
static void x11_set_selection_owner(xwayland_ctx_t *ctx, std::string contents, int selectionTarget)
|
||||
{
|
||||
Atom target;
|
||||
if (selectionTarget == CLIPBOARD)
|
||||
|
@ -4765,9 +4765,6 @@ static void x11_set_selection(xwayland_ctx_t *ctx, std::string contents, int sel
|
|||
}
|
||||
|
||||
XSetSelectionOwner(ctx->dpy, target, ctx->ourWindow, CurrentTime);
|
||||
XChangeProperty(ctx->dpy, ctx->ourWindow, target, ctx->atoms.utf8StringAtom, 8, PropModeReplace,
|
||||
(unsigned char *)contents.c_str(), contents.length());
|
||||
XFlush(ctx->dpy);
|
||||
}
|
||||
|
||||
void gamescope_set_selection(std::string contents, int selection)
|
||||
|
@ -4781,11 +4778,10 @@ void gamescope_set_selection(std::string contents, int selection)
|
|||
primarySelection = contents;
|
||||
}
|
||||
|
||||
for (int i = 0; i < g_nXWaylandCount; i++)
|
||||
gamescope_xwayland_server_t *server = NULL;
|
||||
for (int i = 0; (server = wlserver_get_xwayland_server(i)); i++)
|
||||
{
|
||||
gamescope_xwayland_server_t *server = wlserver_get_xwayland_server(i);
|
||||
xwayland_ctx_t *ctx = server->ctx.get();
|
||||
x11_set_selection(ctx, contents, selection);
|
||||
x11_set_selection_owner(server->ctx.get(), contents, selection);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue