forked from AuroraMiddleware/gtk
selection: Remove #ifdef WAYLAND
Instead, turn the functions into backend API: gdk_broadway_display_add_selection_targets() gdk_broadway_display_clear_selection_targets() Remove the old per-backend functions, too.
This commit is contained in:
parent
13ca03efb1
commit
fb94f79094
@ -357,6 +357,8 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
display_class->set_selection_owner = _gdk_broadway_display_set_selection_owner;
|
||||
display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify;
|
||||
display_class->get_selection_property = _gdk_broadway_display_get_selection_property;
|
||||
display_class->clear_selection_targets = gdk_broadway_display_clear_selection_targets;
|
||||
display_class->add_selection_targets = gdk_broadway_display_add_selection_targets;
|
||||
display_class->convert_selection = _gdk_broadway_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;
|
||||
|
@ -130,6 +130,13 @@ gint _gdk_broadway_display_get_selection_property (GdkDisplay *display,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void gdk_broadway_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
void gdk_broadway_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets);
|
||||
void _gdk_broadway_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
|
@ -158,6 +158,21 @@ _gdk_broadway_display_get_selection_property (GdkDisplay *display,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_broadway_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_broadway_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
|
@ -186,6 +186,13 @@ struct _GdkDisplayClass
|
||||
guchar **data,
|
||||
GdkAtom *type,
|
||||
gint *format);
|
||||
void (*clear_selection_targets)(GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
void (*add_selection_targets) (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets);
|
||||
void (*convert_selection) (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
|
@ -329,3 +329,24 @@ gdk_utf8_to_string_target (const gchar *str)
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->utf8_to_string_target (display, str);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_selection_clear_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_selection_add_targets (GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint n_targets)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
GDK_DISPLAY_GET_CLASS (display)->add_selection_targets (display, window, selection, targets, n_targets);
|
||||
}
|
||||
|
@ -209,6 +209,16 @@ void gdk_selection_send_notify_for_display (GdkDisplay *display,
|
||||
GdkAtom property,
|
||||
guint32 time_);
|
||||
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
void gdk_selection_clear_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
void gdk_selection_add_targets (GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint n_targets);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_SELECTION_H__ */
|
||||
|
@ -280,6 +280,8 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
|
||||
display_class->get_selection_owner = _gdk_quartz_display_get_selection_owner;
|
||||
display_class->set_selection_owner = _gdk_quartz_display_set_selection_owner;
|
||||
display_class->get_selection_property = _gdk_quartz_display_get_selection_property;
|
||||
display_class->clear_selection_targets = gdk_quartz_display_clear_selection_targets;
|
||||
display_class->add_selection_targets = gdk_quartz_display_add_selection_targets;
|
||||
display_class->convert_selection = _gdk_quartz_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_quartz_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_quartz_display_utf8_to_string_target;
|
||||
|
@ -1043,6 +1043,8 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->set_selection_owner = _gdk_wayland_display_set_selection_owner;
|
||||
display_class->send_selection_notify = _gdk_wayland_display_send_selection_notify;
|
||||
display_class->get_selection_property = _gdk_wayland_display_get_selection_property;
|
||||
display_class->clear_selection_targets = gdk_wayland_display_clear_selection_targets;
|
||||
display_class->add_selection_targets = gdk_wayland_display_add_selection_targets;
|
||||
display_class->convert_selection = _gdk_wayland_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_wayland_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_wayland_display_utf8_to_string_target;
|
||||
|
@ -149,6 +149,13 @@ gint _gdk_wayland_display_get_selection_property (GdkDisplay *display,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void gdk_wayland_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
void gdk_wayland_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets);
|
||||
void _gdk_wayland_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
|
@ -966,7 +966,7 @@ data_source_dnd_finished (void *data,
|
||||
|
||||
g_signal_emit_by_name (context, "dnd-finished");
|
||||
gdk_selection_owner_set (NULL, atoms[ATOM_DND], GDK_CURRENT_TIME, TRUE);
|
||||
gdk_wayland_selection_clear_targets (display, atoms[ATOM_DND]);
|
||||
gdk_wayland_display_clear_selection_targets (display, atoms[ATOM_DND]);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1486,12 +1486,12 @@ _gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
guint ntargets,
|
||||
GdkAtom *targets)
|
||||
gdk_wayland_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
gpointer data_source;
|
||||
guint i;
|
||||
@ -1532,8 +1532,8 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_selection_clear_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
gdk_wayland_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <gdk/wayland/gdkwaylanddevice.h>
|
||||
#include <gdk/wayland/gdkwaylanddisplay.h>
|
||||
#include <gdk/wayland/gdkwaylandmonitor.h>
|
||||
#include <gdk/wayland/gdkwaylandselection.h>
|
||||
#include <gdk/wayland/gdkwaylandwindow.h>
|
||||
#include <gdk/wayland/gdkwaylandglcontext.h>
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_WAYLAND_SELECTION_H__
|
||||
#define __GDK_WAYLAND_SELECTION_H__
|
||||
|
||||
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdkwayland.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#if defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
|
||||
#define gdk_wayland_selection_add_targets gdk_wayland_selection_add_targets_libgtk_only
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void
|
||||
gdk_wayland_selection_add_targets (GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
guint ntargets,
|
||||
GdkAtom *targets);
|
||||
|
||||
#define gdk_wayland_selection_clear_targets gdk_wayland_selection_clear_targets_libgtk_only
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void
|
||||
gdk_wayland_selection_clear_targets (GdkDisplay *display, GdkAtom selection);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WAYLAND_SELECTION_H__ */
|
@ -19,7 +19,6 @@ gdk_wayland_public_headers = files([
|
||||
'gdkwaylanddisplay.h',
|
||||
'gdkwaylandglcontext.h',
|
||||
'gdkwaylandmonitor.h',
|
||||
'gdkwaylandselection.h',
|
||||
'gdkwaylandwindow.h'
|
||||
])
|
||||
|
||||
|
@ -1268,6 +1268,8 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->set_selection_owner = _gdk_win32_display_set_selection_owner;
|
||||
display_class->send_selection_notify = _gdk_win32_display_send_selection_notify;
|
||||
display_class->get_selection_property = _gdk_win32_display_get_selection_property;
|
||||
display_class->clear_selection_targets = gdk_win32_display_clear_selection_targets;
|
||||
display_class->add_selection_targets = gdk_win32_display_add_selection_targets;
|
||||
display_class->convert_selection = _gdk_win32_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_win32_display_utf8_to_string_target;
|
||||
|
@ -439,6 +439,13 @@ gint _gdk_win32_display_get_selection_property (GdkDisplay *display,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void gdk_win32_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
void gdk_win32_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets);
|
||||
void _gdk_win32_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
|
@ -1134,6 +1134,12 @@ gdk_free_compound_text (guchar *ctext)
|
||||
g_return_if_fail (ctext == NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_win32_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
}
|
||||
|
||||
/* This function is called from gtk_selection_add_target() and
|
||||
* gtk_selection_add_targets() in gtkselection.c. It is this function
|
||||
* that takes care of setting those clipboard formats for which we use
|
||||
@ -1142,10 +1148,11 @@ gdk_free_compound_text (guchar *ctext)
|
||||
*/
|
||||
|
||||
void
|
||||
gdk_win32_selection_add_targets (GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
gint n_targets,
|
||||
GdkAtom *targets)
|
||||
gdk_win32_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets)
|
||||
{
|
||||
HWND hwnd = NULL;
|
||||
gboolean has_image = FALSE;
|
||||
|
@ -81,12 +81,6 @@ gpointer gdk_win32_handle_table_lookup (HWND handle);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
HGDIOBJ gdk_win32_window_get_handle (GdkWindow *window);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_win32_selection_add_targets (GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
gint n_targets,
|
||||
GdkAtom *targets);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkWindow * gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
HWND anid);
|
||||
|
@ -3193,6 +3193,8 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
display_class->set_selection_owner = _gdk_x11_display_set_selection_owner;
|
||||
display_class->send_selection_notify = _gdk_x11_display_send_selection_notify;
|
||||
display_class->get_selection_property = _gdk_x11_display_get_selection_property;
|
||||
display_class->clear_selection_targets = gdk_x11_display_clear_selection_targets;
|
||||
display_class->add_selection_targets = gdk_x11_display_add_selection_targets;
|
||||
display_class->convert_selection = _gdk_x11_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = _gdk_x11_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = _gdk_x11_display_utf8_to_string_target;
|
||||
|
@ -171,6 +171,13 @@ gint _gdk_x11_display_get_selection_property (GdkDisplay *display,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void gdk_x11_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
void gdk_x11_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets);
|
||||
void _gdk_x11_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
|
@ -312,6 +312,21 @@ _gdk_x11_display_get_selection_property (GdkDisplay *display,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_x11_display_clear_selection_targets (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
gdk_x11_display_add_selection_targets (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkAtom selection,
|
||||
GdkAtom *targets,
|
||||
guint ntargets)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
|
@ -878,10 +878,7 @@ gtk_selection_clear_targets (GtkWidget *widget,
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (selection != GDK_NONE);
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||
gdk_wayland_selection_clear_targets (gtk_widget_get_display (widget), selection);
|
||||
#endif
|
||||
gdk_selection_clear_targets (gtk_widget_get_display (widget), selection);
|
||||
|
||||
lists = g_object_get_data (G_OBJECT (widget), gtk_selection_handler_key);
|
||||
|
||||
@ -927,13 +924,7 @@ gtk_selection_add_target (GtkWidget *widget,
|
||||
|
||||
list = gtk_selection_target_list_get (widget, selection);
|
||||
gtk_target_list_add (list, target, 0, info);
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||
gdk_wayland_selection_add_targets (gtk_widget_get_window (widget), selection, 1, &target);
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
gdk_win32_selection_add_targets (gtk_widget_get_window (widget), selection, 1, &target);
|
||||
#endif
|
||||
gdk_selection_add_targets (gtk_widget_get_window (widget), selection, &target, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -953,6 +944,8 @@ gtk_selection_add_targets (GtkWidget *widget,
|
||||
guint ntargets)
|
||||
{
|
||||
GtkTargetList *list;
|
||||
GdkAtom *atoms = g_new (GdkAtom, ntargets);
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (selection != GDK_NONE);
|
||||
@ -961,31 +954,11 @@ gtk_selection_add_targets (GtkWidget *widget,
|
||||
list = gtk_selection_target_list_get (widget, selection);
|
||||
gtk_target_list_add_table (list, targets, ntargets);
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
if (GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
|
||||
{
|
||||
GdkAtom *atoms = g_new (GdkAtom, ntargets);
|
||||
guint i;
|
||||
for (i = 0; i < ntargets; i++)
|
||||
atoms[i] = gdk_atom_intern (targets[i].target, FALSE);
|
||||
|
||||
for (i = 0; i < ntargets; i++)
|
||||
atoms[i] = gdk_atom_intern (targets[i].target, FALSE);
|
||||
|
||||
gdk_wayland_selection_add_targets (gtk_widget_get_window (widget), selection, ntargets, atoms);
|
||||
g_free (atoms);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
{
|
||||
int i;
|
||||
GdkAtom *atoms = g_new (GdkAtom, ntargets);
|
||||
|
||||
for (i = 0; i < ntargets; ++i)
|
||||
atoms[i] = gdk_atom_intern (targets[i].target, FALSE);
|
||||
gdk_win32_selection_add_targets (gtk_widget_get_window (widget), selection, ntargets, atoms);
|
||||
g_free (atoms);
|
||||
}
|
||||
#endif
|
||||
gdk_selection_add_targets (gtk_widget_get_window (widget), selection, atoms, ntargets);
|
||||
g_free (atoms);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user