wayland: Don't use the default display
Pass a display in so that multi-display technology works.
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "gdkwayland.h"
|
||||
#include "gdkprivate-wayland.h"
|
||||
#include "gdkdisplay-wayland.h"
|
||||
#include "gdkdndprivate.h"
|
||||
#include "gdkselection.h"
|
||||
#include "gdkproperty.h"
|
||||
#include "gdkprivate.h"
|
||||
@ -320,9 +321,9 @@ static const struct wl_data_offer_listener data_offer_listener = {
|
||||
};
|
||||
|
||||
void
|
||||
gdk_wayland_selection_set_offer (struct wl_data_offer *wl_offer)
|
||||
gdk_wayland_selection_set_offer (GdkDisplay *display,
|
||||
struct wl_data_offer *wl_offer)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
if (selection->offer == wl_offer)
|
||||
@ -345,18 +346,16 @@ gdk_wayland_selection_set_offer (struct wl_data_offer *wl_offer)
|
||||
}
|
||||
|
||||
struct wl_data_offer *
|
||||
gdk_wayland_selection_get_offer (void)
|
||||
gdk_wayland_selection_get_offer (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
return selection->offer;
|
||||
}
|
||||
|
||||
GList *
|
||||
gdk_wayland_selection_get_targets (void)
|
||||
gdk_wayland_selection_get_targets (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
return selection->targets;
|
||||
@ -476,7 +475,7 @@ gdk_wayland_selection_store (GdkWindow *window,
|
||||
const guchar *data,
|
||||
gint len)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
GArray *array;
|
||||
|
||||
@ -526,7 +525,7 @@ gdk_wayland_selection_store (GdkWindow *window,
|
||||
static SelectionBuffer *
|
||||
gdk_wayland_selection_lookup_requestor_buffer (GdkWindow *requestor)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkDisplay *display = gdk_window_get_display (requestor);
|
||||
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
|
||||
SelectionBuffer *buffer_data;
|
||||
GHashTableIter iter;
|
||||
@ -662,16 +661,18 @@ data_source_cancelled (void *data,
|
||||
{
|
||||
GdkWaylandSelection *wayland_selection = data;
|
||||
GdkDragContext *context;
|
||||
GdkDisplay *display;
|
||||
|
||||
g_debug (G_STRLOC ": %s source = %p",
|
||||
G_STRFUNC, source);
|
||||
|
||||
context = gdk_wayland_drag_context_lookup_by_data_source (source);
|
||||
display = gdk_window_get_display (context->source_window);
|
||||
|
||||
if (source == wayland_selection->dnd_source)
|
||||
gdk_wayland_selection_unset_data_source (atoms[ATOM_DND]);
|
||||
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]);
|
||||
else if (source == wayland_selection->clipboard_source)
|
||||
gdk_wayland_selection_unset_data_source (atoms[ATOM_CLIPBOARD]);
|
||||
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]);
|
||||
|
||||
if (context)
|
||||
gdk_wayland_drag_context_undo_grab (context);
|
||||
@ -687,7 +688,7 @@ struct wl_data_source *
|
||||
gdk_wayland_selection_get_data_source (GdkWindow *owner,
|
||||
GdkAtom selection)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkDisplay *display = gdk_window_get_display (owner);
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
struct wl_data_source *source = NULL;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
@ -741,18 +742,15 @@ gdk_wayland_selection_get_data_source (GdkWindow *owner,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_unset_data_source (GdkAtom selection)
|
||||
gdk_wayland_selection_unset_data_source (GdkDisplay *display, GdkAtom selection)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
if (selection == atoms[ATOM_CLIPBOARD])
|
||||
{
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
device = gdk_device_manager_get_client_pointer (device_manager);
|
||||
|
||||
@ -1023,7 +1021,7 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
display = gdk_window_get_display (window);
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
device = gdk_device_manager_get_client_pointer (device_manager);
|
||||
gdk_wayland_device_set_selection (device, data_source);
|
||||
@ -1031,7 +1029,7 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_clear_targets (GdkAtom selection)
|
||||
gdk_wayland_selection_clear_targets (GdkDisplay *display, GdkAtom selection)
|
||||
{
|
||||
gdk_wayland_selection_unset_data_source (selection);
|
||||
gdk_wayland_selection_unset_data_source (display, selection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user