From: Kristian Høgsberg Date: Mon, 4 Jun 2012 14:11:45 +0000 (-0400) Subject: xwm: Claim the CLIPBOARD_MANAGER selection X-Git-Tag: 0.94.90~161 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cba022af3d548643b72e8081195b893860e79e69;p=platform%2Fupstream%2Fweston.git xwm: Claim the CLIPBOARD_MANAGER selection --- diff --git a/src/xwayland/selection.c b/src/xwayland/selection.c index f10032e..579425b 100644 --- a/src/xwayland/selection.c +++ b/src/xwayland/selection.c @@ -521,6 +521,15 @@ weston_wm_handle_selection_request(struct weston_wm *wm, wm->incr = 0; wm->flush_property_on_delete = 0; + if (selection_request->selection == wm->atom.clipboard_manager) { + /* The weston clipboard should already have grabbed + * the first target, so just send selection notify + * now. This isn't synchronized with the clipboard + * finishing getting the data, so there's a race here. */ + weston_wm_send_selection_notify(wm, wm->selection_request.property); + return; + } + if (selection_request->target == wm->atom.targets) { weston_wm_send_targets(wm); } else if (selection_request->target == wm->atom.timestamp) { @@ -673,6 +682,11 @@ weston_wm_selection_init(struct weston_wm *wm) wm->screen->root_visual, XCB_CW_EVENT_MASK, values); + xcb_set_selection_owner(wm->conn, + wm->selection_window, + wm->atom.clipboard_manager, + XCB_TIME_CURRENT_TIME); + mask = XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c index 59e4e3d..273cb1e 100644 --- a/src/xwayland/window-manager.c +++ b/src/xwayland/window-manager.c @@ -1000,6 +1000,7 @@ wxs_wm_get_resources(struct weston_wm *wm) { "_NET_SUPPORTED", F(atom.net_supported) }, { "_MOTIF_WM_HINTS", F(atom.motif_wm_hints) }, { "CLIPBOARD", F(atom.clipboard) }, + { "CLIPBOARD_MANAGER", F(atom.clipboard_manager) }, { "TARGETS", F(atom.targets) }, { "UTF8_STRING", F(atom.utf8_string) }, { "_WL_SELECTION", F(atom.wl_selection) }, diff --git a/src/xwayland/xwayland.h b/src/xwayland/xwayland.h index e2ca4e4..79cbef3 100644 --- a/src/xwayland/xwayland.h +++ b/src/xwayland/xwayland.h @@ -107,6 +107,7 @@ struct weston_wm { xcb_atom_t net_supported; xcb_atom_t motif_wm_hints; xcb_atom_t clipboard; + xcb_atom_t clipboard_manager; xcb_atom_t targets; xcb_atom_t utf8_string; xcb_atom_t wl_selection;