aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/meson.build1
-rw-r--r--xwayland/selection.c47
-rw-r--r--xwayland/xwm.c6
-rw-r--r--xwayland/xwm.h2
4 files changed, 56 insertions, 0 deletions
diff --git a/xwayland/meson.build b/xwayland/meson.build
index e92e042c..de05cfaa 100644
--- a/xwayland/meson.build
+++ b/xwayland/meson.build
@@ -1,6 +1,7 @@
lib_wlr_xwayland = static_library(
'wlr_xwayland',
files(
+ 'selection.c',
'sockets.c',
'xwayland.c',
'xwm.c',
diff --git a/xwayland/selection.c b/xwayland/selection.c
new file mode 100644
index 00000000..a83e206c
--- /dev/null
+++ b/xwayland/selection.c
@@ -0,0 +1,47 @@
+#include <xcb/xfixes.h>
+#include "wlr/util/log.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,
+ xcb_generic_event_t *event) {
+ wlr_log(L_DEBUG, "TODO: SELECTION PROPERTY NOTIFY");
+ return 1;
+}
+
+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,
+ xcb_generic_event_t *event) {
+ wlr_log(L_DEBUG, "TODO: XFIXES SELECTION NOTIFY");
+ return 1;
+}
+
+
+int xwm_handle_selection_event(struct wlr_xwm *xwm, xcb_generic_event_t *event) {
+ switch (event->response_type & ~0x80) {
+ case XCB_SELECTION_NOTIFY:
+ xwm_handle_selection_notify(xwm, event);
+ return 1;
+ case XCB_PROPERTY_NOTIFY:
+ return xwm_handle_selection_property_notify(xwm, event);
+ case XCB_SELECTION_REQUEST:
+ xwm_handle_selection_request(xwm, event);
+ return 1;
+ }
+
+ switch (event->response_type - xwm->xfixes->first_event) {
+ case XCB_XFIXES_SELECTION_NOTIFY:
+ return weston_wm_handle_xfixes_selection_notify(xwm, event);
+ }
+
+ return 0;
+}
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 36722591..c10aab47 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -909,6 +909,12 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
count++;
+
+ if (xwm_handle_selection_event(xwm, event)) {
+ free(event);
+ continue;
+ }
+
switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) {
case XCB_CREATE_NOTIFY:
xwm_handle_create_notify(xwm, (xcb_create_notify_event_t *)event);
diff --git a/xwayland/xwm.h b/xwayland/xwm.h
index c350b6e2..f6bec6c5 100644
--- a/xwayland/xwm.h
+++ b/xwayland/xwm.h
@@ -72,4 +72,6 @@ void xwm_destroy(struct wlr_xwm *xwm);
void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y);
+int xwm_handle_selection_event(struct wlr_xwm *xwm, xcb_generic_event_t *event);
+
#endif