x11: Add X11 selection input/output streams

These are rip off of GTK+ ones, with some adaptions to integrate them in
mutter event dispatching code and make them easier to use in future
commits.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/320
This commit is contained in:
Carlos Garnacho
2018-11-18 10:49:36 +01:00
parent 736cac43e9
commit 156980eff9
7 changed files with 1298 additions and 1 deletions

View File

@ -38,8 +38,10 @@
#include "core/workspace-private.h"
#include "meta/meta-backend.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
#include "x11/meta-startup-notification-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/meta-x11-selection-input-stream-private.h"
#include "x11/meta-x11-selection-output-stream-private.h"
#include "x11/window-x11.h"
#include "x11/xprops.h"
@ -1717,6 +1719,22 @@ window_has_xwindow (MetaWindow *window,
return FALSE;
}
static gboolean
process_selection_event (MetaX11Display *x11_display,
XEvent *event)
{
gboolean handled = FALSE;
GList *l;
for (l = x11_display->selection.input_streams; l && !handled; l = l->next)
handled |= meta_x11_selection_input_stream_xevent (l->data, event);
for (l = x11_display->selection.output_streams; l && !handled; l = l->next)
handled |= meta_x11_selection_output_stream_xevent (l->data, event);
return handled;
}
/**
* meta_display_handle_xevent:
* @display: The MetaDisplay that events are coming from
@ -1760,6 +1778,12 @@ meta_x11_display_handle_xevent (MetaX11Display *x11_display,
}
#endif
if (process_selection_event (x11_display, event))
{
bypass_gtk = bypass_compositor = TRUE;
goto out;
}
display->current_time = event_get_time (x11_display, event);
if (META_IS_BACKEND_X11 (backend))