Merge pull request #487 from emersion/xwm-selection

xwm clipboard sync, 2nd edition
This commit is contained in:
Drew DeVault 2017-12-17 20:03:26 -05:00 committed by GitHub
commit 10c72f4bf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 780 additions and 9 deletions

View file

@ -28,4 +28,6 @@ struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
bool input_view_has_focus(struct roots_input *input, struct roots_view *view);
struct roots_seat *input_get_seat(struct roots_input *input, char *name);
#endif

View file

@ -4,6 +4,7 @@
#include <time.h>
#include <stdbool.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_seat.h>
#include <xcb/xcb.h>
#ifdef HAS_XCB_ICCCM
@ -20,6 +21,7 @@ struct wlr_xwayland {
struct wl_client *client;
struct wl_display *wl_display;
struct wlr_compositor *compositor;
struct wlr_seat *seat;
time_t server_start;
struct wl_event_source *sigusr1_source;
@ -175,4 +177,7 @@ void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
bool fullscreen);
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
struct wlr_seat *seat);
#endif

View file

@ -31,6 +31,13 @@ enum atom_name {
_NET_WM_STATE_MAXIMIZED_VERT,
_NET_WM_STATE_MAXIMIZED_HORZ,
WM_STATE,
CLIPBOARD,
WL_SELECTION,
TARGETS,
CLIPBOARD_MANAGER,
INCR,
TEXT,
TIMESTAMP,
ATOM_LAST,
};
@ -45,6 +52,7 @@ enum net_wm_state_action {
struct wlr_xwm {
struct wlr_xwayland *xwayland;
struct wl_event_source *event_source;
struct wlr_seat *seat;
xcb_atom_t atoms[ATOM_LAST];
xcb_connection_t *xcb_conn;
@ -55,6 +63,21 @@ struct wlr_xwm {
xcb_render_pictformat_t render_format_id;
xcb_cursor_t cursor;
// selection properties
xcb_window_t selection_window;
xcb_selection_request_event_t selection_request;
xcb_window_t selection_owner;
xcb_timestamp_t selection_timestamp;
int incr;
int data_source_fd;
int property_start;
xcb_get_property_reply_t *property_reply;
struct wl_event_source *property_source;
int flush_property_on_delete;
struct wl_array source_data;
xcb_atom_t selection_target;
bool selection_property_set;
struct wlr_xwayland_surface *focus_surface;
struct wl_list surfaces; // wlr_xwayland_surface::link
@ -63,6 +86,7 @@ struct wlr_xwm {
const xcb_query_extension_reply_t *xfixes;
struct wl_listener compositor_surface_create;
struct wl_listener seat_selection_change;
};
struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland);
@ -72,4 +96,10 @@ 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);
void xwm_selection_init(struct wlr_xwm *xwm);
void xwm_set_seat(struct wlr_xwm *xwm, struct wlr_seat *seat);
#endif