|
|
@ -2,11 +2,6 @@
|
|
|
|
#include "wlr/util/log.h"
|
|
|
|
#include "wlr/util/log.h"
|
|
|
|
#include "xwm.h"
|
|
|
|
#include "xwm.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void xwm_handle_selection_notify(struct wlr_xwm *xwm, xcb_generic_event_t
|
|
|
|
|
|
|
|
*event) {
|
|
|
|
|
|
|
|
wlr_log(L_DEBUG, "TODO: SELECTION NOTIFY");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int xwm_handle_selection_property_notify(struct wlr_xwm *xwm,
|
|
|
|
static int xwm_handle_selection_property_notify(struct wlr_xwm *xwm,
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
xcb_property_notify_event_t *property_notify =
|
|
|
|
xcb_property_notify_event_t *property_notify =
|
|
|
@ -29,6 +24,11 @@ static int xwm_handle_selection_property_notify(struct wlr_xwm *xwm,
|
|
|
|
return 0;
|
|
|
|
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,
|
|
|
|
static void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
wlr_log(L_DEBUG, "TODO: SELECTION REQUEST");
|
|
|
|
wlr_log(L_DEBUG, "TODO: SELECTION REQUEST");
|
|
|
@ -38,6 +38,43 @@ static void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
|
|
|
static int weston_wm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
|
|
|
static int weston_wm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
xcb_generic_event_t *event) {
|
|
|
|
wlr_log(L_DEBUG, "TODO: XFIXES SELECTION NOTIFY");
|
|
|
|
wlr_log(L_DEBUG, "TODO: XFIXES SELECTION NOTIFY");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xcb_xfixes_selection_notify_event_t *xfixes_selection_notify =
|
|
|
|
|
|
|
|
(xcb_xfixes_selection_notify_event_t *) event;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (xfixes_selection_notify->owner == XCB_WINDOW_NONE) {
|
|
|
|
|
|
|
|
if (xwm->selection_owner != xwm->selection_window) {
|
|
|
|
|
|
|
|
// A real X client selection went away, not our
|
|
|
|
|
|
|
|
// proxy selection
|
|
|
|
|
|
|
|
// TODO: Clear the wayland selection (or not)?
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm->selection_owner = XCB_WINDOW_NONE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We have to use XCB_TIME_CURRENT_TIME when we claim the
|
|
|
|
|
|
|
|
// selection, so grab the actual timestamp here so we can
|
|
|
|
|
|
|
|
// answer TIMESTAMP conversion requests correctly.
|
|
|
|
|
|
|
|
if (xfixes_selection_notify->owner == xwm->selection_window) {
|
|
|
|
|
|
|
|
xwm->selection_timestamp = xfixes_selection_notify->timestamp;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm->selection_owner = xfixes_selection_notify->owner;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xwm->incr = 0;
|
|
|
|
|
|
|
|
// doing this will give a selection notify where we actually handle the sync
|
|
|
|
|
|
|
|
xcb_convert_selection(xwm->xcb_conn, xwm->selection_window,
|
|
|
|
|
|
|
|
xwm->atoms[CLIPBOARD],
|
|
|
|
|
|
|
|
xwm->atoms[TARGETS],
|
|
|
|
|
|
|
|
xwm->atoms[WL_SELECTION],
|
|
|
|
|
|
|
|
xfixes_selection_notify->timestamp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xcb_flush(xwm->xcb_conn);
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -57,6 +94,7 @@ int xwm_handle_selection_event(struct wlr_xwm *xwm,
|
|
|
|
|
|
|
|
|
|
|
|
switch (event->response_type - xwm->xfixes->first_event) {
|
|
|
|
switch (event->response_type - xwm->xfixes->first_event) {
|
|
|
|
case XCB_XFIXES_SELECTION_NOTIFY:
|
|
|
|
case XCB_XFIXES_SELECTION_NOTIFY:
|
|
|
|
|
|
|
|
// an X11 window has copied something to the clipboard
|
|
|
|
return weston_wm_handle_xfixes_selection_notify(xwm, event);
|
|
|
|
return weston_wm_handle_xfixes_selection_notify(xwm, event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|