diff options
author | Tudor Brindus <me@tbrindus.ca> | 2021-01-31 12:27:54 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-01-31 19:17:04 +0100 |
commit | dd4c8aa45e7edba468d4ff2dee6fd6f8ce42810b (patch) | |
tree | 54431600a3c00fdc5de6b222198ed88cbf3740fd /xwayland/xwm.c | |
parent | b3d782f81877088da496006892f8522299e40ccb (diff) |
xwayland/selection: make xwm_selection_init take a wlr_xwm_selection *
This makes it consistent with xwm_selection_finish.
Diffstat (limited to 'xwayland/xwm.c')
-rw-r--r-- | xwayland/xwm.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 99417d16..be1436a5 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -1927,7 +1927,57 @@ struct wlr_xwm *xwm_create(struct wlr_xwayland *xwayland, int wm_fd) { xwm_set_net_active_window(xwm, XCB_WINDOW_NONE); - xwm_selection_init(xwm); + // Clipboard and primary selection + xwm->selection_window = xcb_generate_id(xwm->xcb_conn); + xcb_create_window( + xwm->xcb_conn, + XCB_COPY_FROM_PARENT, + xwm->selection_window, + xwm->screen->root, + 0, 0, + 10, 10, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + xwm->screen->root_visual, + XCB_CW_EVENT_MASK, (uint32_t[]){ + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE + } + ); + + xcb_set_selection_owner(xwm->xcb_conn, xwm->selection_window, + xwm->atoms[CLIPBOARD_MANAGER], XCB_TIME_CURRENT_TIME); + + xwm_selection_init(&xwm->clipboard_selection, xwm, xwm->atoms[CLIPBOARD]); + xwm_selection_init(&xwm->primary_selection, xwm, xwm->atoms[PRIMARY]); + + // Drag'n'drop + xwm->dnd_window = xcb_generate_id(xwm->xcb_conn); + xcb_create_window( + xwm->xcb_conn, + XCB_COPY_FROM_PARENT, + xwm->dnd_window, + xwm->screen->root, + 0, 0, + 8192, 8192, + 0, + XCB_WINDOW_CLASS_INPUT_ONLY, + xwm->screen->root_visual, + XCB_CW_EVENT_MASK, (uint32_t[]){ + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE + } + ); + + xcb_change_property( + xwm->xcb_conn, + XCB_PROP_MODE_REPLACE, + xwm->dnd_window, + xwm->atoms[DND_AWARE], + XCB_ATOM_ATOM, + 32, // format + 1, &(uint32_t){XDND_VERSION} + ); + + xwm_selection_init(&xwm->dnd_selection, xwm, xwm->atoms[DND_SELECTION]); xwm->compositor_new_surface.notify = handle_compositor_new_surface; wl_signal_add(&xwayland->compositor->events.new_surface, |