Add selection_acquire/release to view backend vtable
- WINGsP.h: add selection_acquire/release slots to W_ViewBackend - wview_x11.c: implement via XSetSelectionOwner/XGetSelectionOwner - wview_wl.c: stub that returns True (TODO: wl_data_device) - selection.c: use vtable instead of direct X11 calls
This commit is contained in:
parent
840b00819d
commit
2e631eef15
|
|
@ -333,10 +333,9 @@ void W_HandleSelectionEvent(XEvent * event)
|
|||
Bool WMCreateSelectionHandler(WMView * view, Atom selection, Time timestamp, WMSelectionProcs * procs, void *cdata)
|
||||
{
|
||||
SelectionHandler *handler;
|
||||
Display *dpy = W_VIEW_SCREEN(view)->display;
|
||||
const W_ViewBackend *vb = view->screen->viewBackend;
|
||||
|
||||
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
|
||||
if (XGetSelectionOwner(dpy, selection) != W_VIEW_DRAWABLE(view)) {
|
||||
if (!vb->selection_acquire(view->screen->viewBackendCtx, view, selection, timestamp)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -283,6 +283,18 @@ static WMPoint wl_get_screen_position(void *vctx, W_View *view)
|
|||
return wmkpoint(x, y);
|
||||
}
|
||||
|
||||
static Bool wl_selection_acquire(void *vctx, W_View *view, Atom selection, Time timestamp)
|
||||
{
|
||||
(void)vctx; (void)view; (void)selection; (void)timestamp;
|
||||
/* TODO: implement via wl_data_device */
|
||||
return True;
|
||||
}
|
||||
|
||||
static void wl_selection_release(void *vctx, W_View *view, Atom selection)
|
||||
{
|
||||
(void)vctx; (void)view; (void)selection;
|
||||
}
|
||||
|
||||
const W_ViewBackend W_ViewBackendWL = {
|
||||
.screen_init = wl_screen_init,
|
||||
.screen_fini = wl_screen_fini,
|
||||
|
|
@ -302,4 +314,6 @@ const W_ViewBackend W_ViewBackendWL = {
|
|||
.set_cursor = wl_set_cursor,
|
||||
.redisplay = wl_redisplay,
|
||||
.get_screen_position = wl_get_screen_position,
|
||||
.selection_acquire = wl_selection_acquire,
|
||||
.selection_release = wl_selection_release,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -190,6 +190,19 @@ W_View *W_GetViewForXWindow(Display *display, Window window)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Bool x11_selection_acquire(void *vctx, W_View *view, Atom selection, Time timestamp)
|
||||
{
|
||||
(void)vctx;
|
||||
Display *dpy = view->screen->display;
|
||||
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
|
||||
return (XGetSelectionOwner(dpy, selection) == W_VIEW_DRAWABLE(view));
|
||||
}
|
||||
|
||||
static void x11_selection_release(void *vctx, W_View *view, Atom selection)
|
||||
{
|
||||
(void)vctx; (void)view; (void)selection;
|
||||
}
|
||||
|
||||
const W_ViewBackend W_ViewBackendX11 = {
|
||||
.screen_init = x11_screen_init,
|
||||
.screen_fini = x11_screen_fini,
|
||||
|
|
@ -209,4 +222,6 @@ const W_ViewBackend W_ViewBackendX11 = {
|
|||
.set_cursor = x11_set_cursor,
|
||||
.redisplay = x11_redisplay,
|
||||
.get_screen_position = x11_get_screen_position,
|
||||
.selection_acquire = x11_selection_acquire,
|
||||
.selection_release = x11_selection_release,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue