xwm: Move selection proxy setup to selection.c
This commit is contained in:
@@ -651,3 +651,36 @@ weston_wm_set_selection(struct wl_listener *listener, void *data)
|
|||||||
XCB_TIME_CURRENT_TIME);
|
XCB_TIME_CURRENT_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
weston_wm_selection_init(struct weston_wm *wm)
|
||||||
|
{
|
||||||
|
struct wl_seat *seat;
|
||||||
|
uint32_t values[1], mask;
|
||||||
|
|
||||||
|
wm->selection_request.requestor = XCB_NONE;
|
||||||
|
|
||||||
|
values[0] = XCB_EVENT_MASK_PROPERTY_CHANGE;
|
||||||
|
wm->selection_window = xcb_generate_id(wm->conn);
|
||||||
|
xcb_create_window(wm->conn,
|
||||||
|
XCB_COPY_FROM_PARENT,
|
||||||
|
wm->selection_window,
|
||||||
|
wm->screen->root,
|
||||||
|
0, 0,
|
||||||
|
10, 10,
|
||||||
|
0,
|
||||||
|
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
||||||
|
wm->screen->root_visual,
|
||||||
|
XCB_CW_EVENT_MASK, values);
|
||||||
|
|
||||||
|
mask =
|
||||||
|
XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |
|
||||||
|
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |
|
||||||
|
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE;
|
||||||
|
xcb_xfixes_select_selection_input(wm->conn, wm->selection_window,
|
||||||
|
wm->atom.clipboard, mask);
|
||||||
|
|
||||||
|
seat = &wm->server->compositor->seat->seat;
|
||||||
|
wm->selection_listener.notify = weston_wm_set_selection;
|
||||||
|
wl_signal_add(&seat->selection_signal, &wm->selection_listener);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1114,11 +1114,10 @@ weston_wm_create_wm_window(struct weston_wm *wm)
|
|||||||
struct weston_wm *
|
struct weston_wm *
|
||||||
weston_wm_create(struct weston_xserver *wxs)
|
weston_wm_create(struct weston_xserver *wxs)
|
||||||
{
|
{
|
||||||
struct wl_seat *seat;
|
|
||||||
struct weston_wm *wm;
|
struct weston_wm *wm;
|
||||||
struct wl_event_loop *loop;
|
struct wl_event_loop *loop;
|
||||||
xcb_screen_iterator_t s;
|
xcb_screen_iterator_t s;
|
||||||
uint32_t values[1], mask;
|
uint32_t values[1];
|
||||||
int sv[2];
|
int sv[2];
|
||||||
xcb_atom_t supported[1];
|
xcb_atom_t supported[1];
|
||||||
|
|
||||||
@@ -1186,34 +1185,10 @@ weston_wm_create(struct weston_xserver *wxs)
|
|||||||
32, /* format */
|
32, /* format */
|
||||||
ARRAY_LENGTH(supported), supported);
|
ARRAY_LENGTH(supported), supported);
|
||||||
|
|
||||||
wm->selection_request.requestor = XCB_NONE;
|
weston_wm_selection_init(wm);
|
||||||
|
|
||||||
wm->selection_window = xcb_generate_id(wm->conn);
|
|
||||||
xcb_create_window(wm->conn,
|
|
||||||
XCB_COPY_FROM_PARENT,
|
|
||||||
wm->selection_window,
|
|
||||||
wm->screen->root,
|
|
||||||
0, 0,
|
|
||||||
10, 10,
|
|
||||||
0,
|
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT,
|
|
||||||
wm->screen->root_visual,
|
|
||||||
XCB_CW_EVENT_MASK, values);
|
|
||||||
|
|
||||||
mask =
|
|
||||||
XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER |
|
|
||||||
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY |
|
|
||||||
XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE;
|
|
||||||
|
|
||||||
xcb_xfixes_select_selection_input(wm->conn, wm->selection_window,
|
|
||||||
wm->atom.clipboard, mask);
|
|
||||||
|
|
||||||
xcb_flush(wm->conn);
|
xcb_flush(wm->conn);
|
||||||
|
|
||||||
seat = &wxs->compositor->seat->seat;
|
|
||||||
wm->selection_listener.notify = weston_wm_set_selection;
|
|
||||||
wl_signal_add(&seat->selection_signal, &wm->selection_listener);
|
|
||||||
|
|
||||||
wm->activate_listener.notify = weston_wm_window_activate;
|
wm->activate_listener.notify = weston_wm_window_activate;
|
||||||
wl_signal_add(&wxs->compositor->activate_signal,
|
wl_signal_add(&wxs->compositor->activate_signal,
|
||||||
&wm->activate_listener);
|
&wm->activate_listener);
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ read_and_dump_property(struct weston_wm *wm,
|
|||||||
const char *
|
const char *
|
||||||
get_atom_name(xcb_connection_t *c, xcb_atom_t atom);
|
get_atom_name(xcb_connection_t *c, xcb_atom_t atom);
|
||||||
|
|
||||||
|
void
|
||||||
|
weston_wm_selection_init(struct weston_wm *wm);
|
||||||
int
|
int
|
||||||
weston_wm_handle_selection_event(struct weston_wm *wm,
|
weston_wm_handle_selection_event(struct weston_wm *wm,
|
||||||
xcb_generic_event_t *event);
|
xcb_generic_event_t *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user