[gtk+] gdk: Remove selection defines
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Remove selection defines
- Date: Thu, 14 Dec 2017 03:13:09 +0000 (UTC)
commit a4b42f0b736943be15924963c8d563c44962225f
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 14 01:03:00 2017 +0100
gdk: Remove selection defines
And with it, remove the selections section from the docs.
So selections are gone for good now.
docs/reference/gdk/gdk4-sections.txt | 21 -----
gdk/broadway/gdkproperty-broadway.c | 1 -
gdk/broadway/gdkselection-broadway.c | 4 +-
gdk/gdk.h | 1 -
gdk/gdkselection.c | 33 +-------
gdk/gdkselection.h | 157 ----------------------------------
gdk/meson.build | 1 -
gdk/quartz/gdkselection-quartz.c | 3 +-
gdk/wayland/gdkselection-wayland.c | 1 -
gdk/win32/gdkproperty-win32.c | 42 +---------
gdk/win32/gdkselection-win32.c | 5 +-
gdk/x11/gdkproperty-x11.c | 1 -
gdk/x11/gdkselection-x11.c | 3 +-
gtk/gtkselection.c | 12 ++--
tests/testgtk.c | 53 ------------
15 files changed, 15 insertions(+), 323 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 7036a07..0132380 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -407,27 +407,6 @@ gdk_content_formats_get_type
</SECTION>
<SECTION>
-<TITLE>Selections</TITLE>
-<FILE>selections</FILE>
-GDK_SELECTION_PRIMARY
-GDK_SELECTION_SECONDARY
-GDK_SELECTION_CLIPBOARD
-GDK_TARGET_BITMAP
-GDK_TARGET_COLORMAP
-GDK_TARGET_DRAWABLE
-GDK_TARGET_PIXMAP
-GDK_TARGET_STRING
-GDK_SELECTION_TYPE_ATOM
-GDK_SELECTION_TYPE_BITMAP
-GDK_SELECTION_TYPE_COLORMAP
-GDK_SELECTION_TYPE_DRAWABLE
-GDK_SELECTION_TYPE_INTEGER
-GDK_SELECTION_TYPE_PIXMAP
-GDK_SELECTION_TYPE_WINDOW
-GDK_SELECTION_TYPE_STRING
-</SECTION>
-
-<SECTION>
<TITLE>Properties and Atoms</TITLE>
<FILE>properties</FILE>
GdkAtom
diff --git a/gdk/broadway/gdkproperty-broadway.c b/gdk/broadway/gdkproperty-broadway.c
index b60488b..0caaf30 100644
--- a/gdk/broadway/gdkproperty-broadway.c
+++ b/gdk/broadway/gdkproperty-broadway.c
@@ -29,7 +29,6 @@
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include "gdkprivate-broadway.h"
-#include "gdkselection.h"
#include <string.h>
diff --git a/gdk/broadway/gdkselection-broadway.c b/gdk/broadway/gdkselection-broadway.c
index 9c5a4ab..cce27a7 100644
--- a/gdk/broadway/gdkselection-broadway.c
+++ b/gdk/broadway/gdkselection-broadway.c
@@ -24,8 +24,6 @@
#include "config.h"
-#include "gdkselection.h"
-
#include "gdkproperty.h"
#include "gdkprivate-broadway.h"
#include "gdkdisplay-broadway.h"
@@ -123,7 +121,7 @@ _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (length >= 0, 0);
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
- if (encoding == GDK_TARGET_STRING)
+ if (encoding == gdk_atom_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 4f0bf80..1515ad4 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -60,7 +60,6 @@
#include <gdk/gdkrectangle.h>
#include <gdk/gdkrgba.h>
#include <gdk/gdkseat.h>
-#include <gdk/gdkselection.h>
#include <gdk/gdktexture.h>
#include <gdk/gdkthreads.h>
#include <gdk/gdktypes.h>
diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c
index 09e4950..23674b7 100644
--- a/gdk/gdkselection.c
+++ b/gdk/gdkselection.c
@@ -24,41 +24,10 @@
#include "config.h"
-#include "gdkselection.h"
-
#include "gdkproperty.h"
-#include "gdkdisplayprivate.h"
+#include "gdkdisplayprivate.h"
-/**
- * SECTION:selections
- * @Short_description: Functions for transfering data via the X selection mechanism
- * @Title: Selections
- *
- * The X selection mechanism provides a way to transfer arbitrary chunks of
- * data between programs. A “selection” is a essentially
- * a named clipboard, identified by a string interned as a #GdkAtom. By
- * claiming ownership of a selection, an application indicates that it will
- * be responsible for supplying its contents. The most common selections are
- * `PRIMARY` and `CLIPBOARD`.
- *
- * The contents of a selection can be represented in a number of formats,
- * called “targets”. Each target is identified by an atom.
- * A list of all possible targets supported by the selection owner can be
- * retrieved by requesting the special target `TARGETS`. When
- * a selection is retrieved, the data is accompanied by a type (an atom), and
- * a format (an integer, representing the number of bits per item).
- * See [Properties and Atoms][gdk3-Properties-and-Atoms]
- * for more information.
- *
- * The functions in this section only contain the lowlevel parts of the
- * selection protocol. A considerably more complicated implementation is needed
- * on top of this. GTK+ contains such an implementation in the functions in
- * `gtkselection.h` and programmers should use those functions
- * instead of the ones presented here. If you plan to implement selection
- * handling directly on top of the functions here, you should refer to the
- * X Inter-client Communication Conventions Manual (ICCCM).
- */
/**
* gdk_text_property_to_utf8_list_for_display:
diff --git a/gdk/meson.build b/gdk/meson.build
index 90f8001..10a4f64 100644
--- a/gdk/meson.build
+++ b/gdk/meson.build
@@ -75,7 +75,6 @@ gdk_public_headers = files([
'gdkrectangle.h',
'gdkrgba.h',
'gdkseat.h',
- 'gdkselection.h',
'gdkthreads.h',
'gdktexture.h',
'gdktypes.h',
diff --git a/gdk/quartz/gdkselection-quartz.c b/gdk/quartz/gdkselection-quartz.c
index 5cc5f68..855dd39 100644
--- a/gdk/quartz/gdkselection-quartz.c
+++ b/gdk/quartz/gdkselection-quartz.c
@@ -20,7 +20,6 @@
#include "config.h"
-#include "gdkselection.h"
#include "gdkproperty.h"
#include "gdkquartz.h"
@@ -110,7 +109,7 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
- if (encoding == GDK_TARGET_STRING)
+ if (encoding == gdk_atom_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
index 233eebb..caec000 100644
--- a/gdk/wayland/gdkselection-wayland.c
+++ b/gdk/wayland/gdkselection-wayland.c
@@ -29,7 +29,6 @@
#include "gdkdisplay-wayland.h"
#include "gdkcontentformatsprivate.h"
#include "gdkdndprivate.h"
-#include "gdkselection.h"
#include "gdkproperty.h"
#include <string.h>
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 16a8db5..4692df5 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -29,7 +29,6 @@
#include <glib/gprintf.h>
#include "gdkproperty.h"
-#include "gdkselection.h"
#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkwin32.h"
@@ -49,33 +48,9 @@ _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
retval = g_hash_table_lookup (atom_hash, atom_name);
if (!retval)
{
- if (strcmp (atom_name, "PRIMARY") == 0)
- retval = GDK_SELECTION_PRIMARY;
- else if (strcmp (atom_name, "SECONDARY") == 0)
- retval = GDK_SELECTION_SECONDARY;
- else if (strcmp (atom_name, "CLIPBOARD") == 0)
- retval = GDK_SELECTION_CLIPBOARD;
- else if (strcmp (atom_name, "ATOM") == 0)
- retval = GDK_SELECTION_TYPE_ATOM;
- else if (strcmp (atom_name, "BITMAP") == 0)
- retval = GDK_SELECTION_TYPE_BITMAP;
- else if (strcmp (atom_name, "COLORMAP") == 0)
- retval = GDK_SELECTION_TYPE_COLORMAP;
- else if (strcmp (atom_name, "DRAWABLE") == 0)
- retval = GDK_SELECTION_TYPE_DRAWABLE;
- else if (strcmp (atom_name, "INTEGER") == 0)
- retval = GDK_SELECTION_TYPE_INTEGER;
- else if (strcmp (atom_name, "PIXMAP") == 0)
- retval = GDK_SELECTION_TYPE_PIXMAP;
- else if (strcmp (atom_name, "WINDOW") == 0)
- retval = GDK_SELECTION_TYPE_WINDOW;
- else if (strcmp (atom_name, "STRING") == 0)
- retval = GDK_SELECTION_TYPE_STRING;
- else
- {
- win32_atom = GlobalAddAtom (atom_name);
- retval = GUINT_TO_POINTER ((guint) win32_atom);
- }
+ win32_atom = GlobalAddAtom (atom_name);
+ retval = GUINT_TO_POINTER ((guint) win32_atom);
+
g_hash_table_insert (atom_hash,
g_strdup (atom_name),
retval);
@@ -92,17 +67,6 @@ _gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
gchar name[256];
if (NULL == atom) return g_strdup ("<none>");
- else if (GDK_SELECTION_PRIMARY == atom) return g_strdup ("PRIMARY");
- else if (GDK_SELECTION_SECONDARY == atom) return g_strdup ("SECONDARY");
- else if (GDK_SELECTION_CLIPBOARD == atom) return g_strdup ("CLIPBOARD");
- else if (GDK_SELECTION_TYPE_ATOM == atom) return g_strdup ("ATOM");
- else if (GDK_SELECTION_TYPE_BITMAP == atom) return g_strdup ("BITMAP");
- else if (GDK_SELECTION_TYPE_COLORMAP == atom) return g_strdup ("COLORMAP");
- else if (GDK_SELECTION_TYPE_DRAWABLE == atom) return g_strdup ("DRAWABLE");
- else if (GDK_SELECTION_TYPE_INTEGER == atom) return g_strdup ("INTEGER");
- else if (GDK_SELECTION_TYPE_PIXMAP == atom) return g_strdup ("PIXMAP");
- else if (GDK_SELECTION_TYPE_WINDOW == atom) return g_strdup ("WINDOW");
- else if (GDK_SELECTION_TYPE_STRING == atom) return g_strdup ("STRING");
win32_atom = GPOINTER_TO_UINT (atom);
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index 18a2859..35ef0be 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -284,7 +284,6 @@ which emits the "drag-data-received" signal for the app.
#include <shlobj.h>
#include "gdkproperty.h"
-#include "gdkselection.h"
#include "gdkdisplay.h"
#include "gdkprivate-win32.h"
#include "gdkselection-win32.h"
@@ -2558,7 +2557,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay *display,
if (!list)
return 0;
- if (encoding == GDK_TARGET_STRING)
+ if (encoding == gdk_atom_intern_static_string ("STRING"))
source_charset = g_strdup ("ISO-8859-1");
else if (encoding == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_UTF8_STRING))
source_charset = g_strdup ("UTF-8");
@@ -2669,7 +2668,7 @@ _gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
- if (encoding == GDK_TARGET_STRING)
+ if (encoding == gdk_atom_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c
index 5528ada..863cd85 100644
--- a/gdk/x11/gdkproperty-x11.c
+++ b/gdk/x11/gdkproperty-x11.c
@@ -26,7 +26,6 @@
#include "gdkproperty.h"
#include "gdkinternals.h"
-#include "gdkselection.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkscreen-x11.h"
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index 6326840..1162f7c 100644
--- a/gdk/x11/gdkselection-x11.c
+++ b/gdk/x11/gdkselection-x11.c
@@ -24,7 +24,6 @@
#include "config.h"
-#include "gdkselection.h"
#include "gdkproperty.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
@@ -200,7 +199,7 @@ _gdk_x11_display_text_property_to_utf8_list (GdkDisplay *display,
gint length,
gchar ***list)
{
- if (encoding == GDK_TARGET_STRING)
+ if (encoding == gdk_atom_intern_static_string ("STRING"))
{
return make_list ((gchar *)text, length, TRUE, list);
}
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 0c7cd56..25c3b0a 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -170,7 +170,7 @@ gtk_content_formats_add_text_targets (GdkContentFormats *list)
gdk_content_formats_builder_add_mime_type (builder, utf8_atom);
gdk_content_formats_builder_add_mime_type (builder, ctext_atom);
gdk_content_formats_builder_add_mime_type (builder, text_atom);
- gdk_content_formats_builder_add_mime_type (builder, GDK_TARGET_STRING);
+ gdk_content_formats_builder_add_mime_type (builder, gdk_atom_intern_static_string ("STRING"));
gdk_content_formats_builder_add_mime_type (builder, text_plain_utf8_atom);
if (!g_get_charset (NULL))
gdk_content_formats_builder_add_mime_type (builder, text_plain_locale_atom);
@@ -479,7 +479,7 @@ selection_set_string (GtkSelectionData *selection_data,
if (latin1)
{
gtk_selection_data_set (selection_data,
- GDK_SELECTION_TYPE_STRING,
+ gdk_atom_intern_static_string ("STRING"),
8, (guchar *) latin1, strlen (latin1));
g_free (latin1);
@@ -702,7 +702,7 @@ gtk_selection_data_set_text (GtkSelectionData *selection_data,
8, (guchar *)str, len);
return TRUE;
}
- else if (selection_data->target == GDK_TARGET_STRING)
+ else if (selection_data->target == gdk_atom_intern_static_string ("STRING"))
{
return selection_set_string (selection_data, str, len);
}
@@ -745,7 +745,7 @@ gtk_selection_data_get_text (const GtkSelectionData *selection_data)
init_atoms ();
if (selection_data->length >= 0 &&
- (selection_data->type == GDK_TARGET_STRING ||
+ (selection_data->type == gdk_atom_intern_static_string ("STRING") ||
selection_data->type == ctext_atom ||
selection_data->type == utf8_atom))
{
@@ -1131,7 +1131,7 @@ gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
if (selection_data->length >= 0 &&
selection_data->format == 32 &&
- selection_data->type == GDK_SELECTION_TYPE_ATOM)
+ selection_data->type == gdk_atom_intern_static_string ("ATOM"))
{
if (targets)
*targets = g_memdup (selection_data->data, selection_data->length);
@@ -1182,7 +1182,7 @@ gtk_targets_include_text (GdkAtom *targets,
{
if (targets[i] == utf8_atom ||
targets[i] == text_atom ||
- targets[i] == GDK_TARGET_STRING ||
+ targets[i] == gdk_atom_intern_static_string ("STRING") ||
targets[i] == ctext_atom ||
targets[i] == text_plain_atom ||
targets[i] == text_plain_utf8_atom ||
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 9a16003..cb017e7 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -7032,59 +7032,6 @@ create_snapshot (GtkWidget *widget)
}
/*
- * Selection Test
- */
-
-void
-selection_test_received (GtkWidget *tree_view,
- GtkSelectionData *selection_data)
-{
- GtkTreeModel *model;
- GtkListStore *store;
- GdkAtom *atoms;
- int i, l;
-
- if (gtk_selection_data_get_length (selection_data) < 0)
- {
- g_print ("Selection retrieval failed\n");
- return;
- }
- if (gtk_selection_data_get_data_type (selection_data) != GDK_SELECTION_TYPE_ATOM)
- {
- g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
- return;
- }
-
- /* Clear out any current list items */
-
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
- store = GTK_LIST_STORE (model);
- gtk_list_store_clear (store);
-
- /* Add new items to list */
-
- gtk_selection_data_get_targets (selection_data,
- &atoms, &l);
-
- for (i = 0; i < l; i++)
- {
- char *name;
- GtkTreeIter iter;
-
- name = gdk_atom_name (atoms[i]);
- if (name != NULL)
- {
- gtk_list_store_insert_with_values (store, &iter, i, 0, name, -1);
- g_free (name);
- }
- else
- gtk_list_store_insert_with_values (store, &iter, i, 0, "(bad atom)", -1);
- }
-
- return;
-}
-
-/*
* Test scrolling
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]