Skip to content

Commit d0dc389

Browse files
committed
Merge pull request #96714 from Riteo/dont-ask-me-why-they-are-different
Wayland: Make primary selection logic consistent with main clipboard
2 parents d0c9023 + 26d89bc commit d0dc389

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

platform/linuxbsd/wayland/wayland_thread.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,13 @@ Vector<uint8_t> WaylandThread::_wp_primary_selection_offer_read(struct wl_displa
169169

170170
int fds[2];
171171
if (pipe(fds) == 0) {
172-
// This function expects to return a string, so we can only ask for a MIME of
173-
// "text/plain"
174172
zwp_primary_selection_offer_v1_receive(p_offer, p_mime, fds[1]);
175173

176-
// Wait for the compositor to know about the pipe.
177-
wl_display_roundtrip(p_display);
174+
// NOTE: It's important to just flush and not roundtrip here as we would risk
175+
// running some cleanup event, like for example `wl_data_device::leave`. We're
176+
// going to wait for the message anyways as the read will probably block if
177+
// the compositor doesn't read from the other end of the pipe.
178+
wl_display_flush(p_display);
178179

179180
// Close the write end of the pipe, which we don't need and would otherwise
180181
// just stall our next `read`s.

0 commit comments

Comments
 (0)