aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xwayland/selection.c32
-rw-r--r--xwayland/xwm.h2
2 files changed, 25 insertions, 9 deletions
diff --git a/xwayland/selection.c b/xwayland/selection.c
index 08091fe1..1c9fcf13 100644
--- a/xwayland/selection.c
+++ b/xwayland/selection.c
@@ -24,21 +24,36 @@ static int xwm_handle_selection_property_notify(struct wlr_xwm *xwm,
return 0;
}
-static void xwm_handle_selection_notify(struct wlr_xwm *xwm,
- xcb_generic_event_t *event) {
- wlr_log(L_DEBUG, "TODO: SELECTION NOTIFY");
-}
-
static void xwm_handle_selection_request(struct wlr_xwm *xwm,
xcb_generic_event_t *event) {
wlr_log(L_DEBUG, "TODO: SELECTION REQUEST");
return;
}
-static int weston_wm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
+static void xwm_get_selection_targets(struct wlr_xwm *xwm) {
+ wlr_log(L_DEBUG, "TODO: GET SELECTION TARGETS");
+}
+
+static void xwm_get_selection_data(struct wlr_xwm *xwm) {
+ wlr_log(L_DEBUG, "TODO: GET SELECTION DATA");
+}
+
+static void xwm_handle_selection_notify(struct wlr_xwm *xwm,
xcb_generic_event_t *event) {
- wlr_log(L_DEBUG, "TODO: XFIXES SELECTION NOTIFY");
+ xcb_selection_notify_event_t *selection_notify =
+ (xcb_selection_notify_event_t *) event;
+
+ if (selection_notify->property == XCB_ATOM_NONE) {
+ wlr_log(L_DEBUG, "TODO: convert selection failed");
+ } else if (selection_notify->target == xwm->atoms[TARGETS]) {
+ xwm_get_selection_targets(xwm);
+ } else {
+ xwm_get_selection_data(xwm);
+ }
+}
+static int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
+ xcb_generic_event_t *event) {
xcb_xfixes_selection_notify_event_t *xfixes_selection_notify =
(xcb_xfixes_selection_notify_event_t *) event;
@@ -60,6 +75,7 @@ static int weston_wm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
// answer TIMESTAMP conversion requests correctly.
if (xfixes_selection_notify->owner == xwm->selection_window) {
xwm->selection_timestamp = xfixes_selection_notify->timestamp;
+ wlr_log(L_DEBUG, "TODO: our window");
return 1;
}
@@ -95,7 +111,7 @@ int xwm_handle_selection_event(struct wlr_xwm *xwm,
switch (event->response_type - xwm->xfixes->first_event) {
case XCB_XFIXES_SELECTION_NOTIFY:
// an X11 window has copied something to the clipboard
- return weston_wm_handle_xfixes_selection_notify(xwm, event);
+ return xwm_handle_xfixes_selection_notify(xwm, event);
}
return 0;
diff --git a/xwayland/xwm.h b/xwayland/xwm.h
index 59a26725..ea1edc65 100644
--- a/xwayland/xwm.h
+++ b/xwayland/xwm.h
@@ -32,9 +32,9 @@ enum atom_name {
_NET_WM_STATE_MAXIMIZED_HORZ,
WM_STATE,
CLIPBOARD,
- CLIPBOARD_MANAGER,
WL_SELECTION,
TARGETS,
+ CLIPBOARD_MANAGER,
ATOM_LAST,
};