mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-03-06 01:40:52 -05:00
xwayland/xwm: implement somewhat asynchronous request flushing
Instead of calling xcb_flush() directly, wait until the FD is writable. Ideally we'd have a non-blocking variant instead of xcb_flush(), but libxcb doesn't have this. Also libxcb blocks when its internal buffer is full, but not much we can do here.
This commit is contained in:
parent
c9fe96102d
commit
6ada67da9b
6 changed files with 39 additions and 23 deletions
|
|
@ -55,7 +55,7 @@ static void xwm_dnd_send_event(struct wlr_xwm *xwm, xcb_atom_t type,
|
|||
XCB_EVENT_MASK_NO_EVENT,
|
||||
&event,
|
||||
sizeof(event));
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
}
|
||||
|
||||
static void xwm_dnd_send_enter(struct wlr_xwm *xwm) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ xwm_selection_transfer_create_incoming(struct wlr_xwm_selection *selection) {
|
|||
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE
|
||||
}
|
||||
);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
|
||||
return transfer;
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ static void xwm_notify_ready_for_next_incr_chunk(
|
|||
wlr_log(WLR_DEBUG, "deleting property");
|
||||
xcb_delete_property(xwm->xcb_conn, transfer->incoming_window,
|
||||
xwm->atoms[WL_SELECTION]);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
|
||||
xwm_selection_transfer_remove_event_source(transfer);
|
||||
xwm_selection_transfer_destroy_property_reply(transfer);
|
||||
|
|
@ -234,7 +234,7 @@ static void source_send(struct wlr_xwm_selection *selection,
|
|||
xwm->atoms[WL_SELECTION],
|
||||
XCB_TIME_CURRENT_TIME);
|
||||
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
|
||||
fcntl(fd, F_SETFL, O_WRONLY | O_NONBLOCK);
|
||||
transfer->wl_client_fd = fd;
|
||||
|
|
@ -533,7 +533,7 @@ int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
|||
xwm->atoms[WL_SELECTION],
|
||||
event->timestamp
|
||||
);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ static void xwm_selection_send_notify(struct wlr_xwm *xwm,
|
|||
XCB_EVENT_MASK_NO_EVENT,
|
||||
&selection_notify,
|
||||
sizeof(selection_notify));
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
}
|
||||
|
||||
static int xwm_selection_flush_source_data(
|
||||
|
|
@ -46,7 +46,7 @@ static int xwm_selection_flush_source_data(
|
|||
8, // format
|
||||
transfer->source_data.size,
|
||||
transfer->source_data.data);
|
||||
xcb_flush(transfer->selection->xwm->xcb_conn);
|
||||
xwm_schedule_flush(transfer->selection->xwm);
|
||||
transfer->property_set = true;
|
||||
size_t length = transfer->source_data.size;
|
||||
transfer->source_data.size = 0;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void xwm_selection_transfer_destroy(
|
|||
if (transfer->incoming_window) {
|
||||
struct wlr_xwm *xwm = transfer->selection->xwm;
|
||||
xcb_destroy_window(xwm->xcb_conn, transfer->incoming_window);
|
||||
xcb_flush(xwm->xcb_conn);
|
||||
xwm_schedule_flush(xwm);
|
||||
}
|
||||
|
||||
wl_list_remove(&transfer->link);
|
||||
|
|
@ -269,14 +269,14 @@ static void xwm_selection_set_owner(struct wlr_xwm_selection *selection,
|
|||
selection->window,
|
||||
selection->atom,
|
||||
XCB_TIME_CURRENT_TIME);
|
||||
xcb_flush(selection->xwm->xcb_conn);
|
||||
xwm_schedule_flush(selection->xwm);
|
||||
} else {
|
||||
if (selection->owner == selection->window) {
|
||||
xcb_set_selection_owner(selection->xwm->xcb_conn,
|
||||
XCB_WINDOW_NONE,
|
||||
selection->atom,
|
||||
selection->timestamp);
|
||||
xcb_flush(selection->xwm->xcb_conn);
|
||||
xwm_schedule_flush(selection->xwm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue