gdk: Remove selection defines

And with it, remove the selections section from the docs.

So selections are gone for good now.
This commit is contained in:
Benjamin Otte 2017-12-14 01:03:00 +01:00
parent 8993a51893
commit a4b42f0b73
15 changed files with 15 additions and 323 deletions

View File

@ -406,27 +406,6 @@ gdk_file_list_get_type
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>

View File

@ -29,7 +29,6 @@
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include "gdkprivate-broadway.h"
#include "gdkselection.h"
#include <string.h>

View File

@ -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);
}

View File

@ -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>

View File

@ -24,42 +24,11 @@
#include "config.h"
#include "gdkselection.h"
#include "gdkproperty.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:
* @display: a #GdkDisplay

View File

@ -1,157 +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_SELECTION_H__
#define __GDK_SELECTION_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
/* Predefined atoms relating to selections. In general, one will need to use
* gdk_intern_atom
*/
/**
* GDK_SELECTION_PRIMARY:
*
* A #GdkAtom representing the `PRIMARY` selection.
*/
#define GDK_SELECTION_PRIMARY gdk_atom_intern_static_string ("PRIMARY")
/**
* GDK_SELECTION_SECONDARY:
*
* A #GdkAtom representing the `SECONDARY` selection.
*/
#define GDK_SELECTION_SECONDARY gdk_atom_intern_static_string ("SECONDARY")
/**
* GDK_SELECTION_CLIPBOARD:
*
* A #GdkAtom representing the `CLIPBOARD` selection.
*/
#define GDK_SELECTION_CLIPBOARD gdk_atom_intern_static_string ("CLIPBOARD")
/**
* GDK_TARGET_BITMAP:
*
* A #GdkAtom representing the `BITMAP` selection target.
*/
#define GDK_TARGET_BITMAP gdk_atom_intern_static_string ("BITMAP")
/**
* GDK_TARGET_COLORMAP:
*
* A #GdkAtom representing the `COLORMAP` selection target.
*/
#define GDK_TARGET_COLORMAP gdk_atom_intern_static_string ("COLORMAP")
/**
* GDK_TARGET_DRAWABLE:
*
* A #GdkAtom representing the `DRAWABLE` selection target.
*/
#define GDK_TARGET_DRAWABLE gdk_atom_intern_static_string ("DRAWABLE")
/**
* GDK_TARGET_PIXMAP:
*
* A #GdkAtom representing the `PIXMAP` selection target.
*/
#define GDK_TARGET_PIXMAP gdk_atom_intern_static_string ("PIXMAP")
/**
* GDK_TARGET_STRING:
*
* A #GdkAtom representing the `STRING` selection target.
*/
#define GDK_TARGET_STRING gdk_atom_intern_static_string ("STRING")
/**
* GDK_SELECTION_TYPE_ATOM:
*
* A #GdkAtom representing the `ATOM` selection type.
*/
#define GDK_SELECTION_TYPE_ATOM gdk_atom_intern_static_string ("ATOM")
/**
* GDK_SELECTION_TYPE_BITMAP:
*
* A #GdkAtom representing the `BITMAP` selection type.
*/
#define GDK_SELECTION_TYPE_BITMAP gdk_atom_intern_static_string ("BITMAP")
/**
* GDK_SELECTION_TYPE_COLORMAP:
*
* A #GdkAtom representing the `COLORMAP` selection type.
*/
#define GDK_SELECTION_TYPE_COLORMAP gdk_atom_intern_static_string ("COLORMAP")
/**
* GDK_SELECTION_TYPE_DRAWABLE:
*
* A #GdkAtom representing the `DRAWABLE` selection type.
*/
#define GDK_SELECTION_TYPE_DRAWABLE gdk_atom_intern_static_string ("DRAWABLE")
/**
* GDK_SELECTION_TYPE_INTEGER:
*
* A #GdkAtom representing the `INTEGER` selection type.
*/
#define GDK_SELECTION_TYPE_INTEGER gdk_atom_intern_static_string ("INTEGER")
/**
* GDK_SELECTION_TYPE_PIXMAP:
*
* A #GdkAtom representing the `PIXMAP` selection type.
*/
#define GDK_SELECTION_TYPE_PIXMAP gdk_atom_intern_static_string ("PIXMAP")
/**
* GDK_SELECTION_TYPE_WINDOW:
*
* A #GdkAtom representing the `WINDOW` selection type.
*/
#define GDK_SELECTION_TYPE_WINDOW gdk_atom_intern_static_string ("WINDOW")
/**
* GDK_SELECTION_TYPE_STRING:
*
* A #GdkAtom representing the `STRING` selection type.
*/
#define GDK_SELECTION_TYPE_STRING gdk_atom_intern_static_string ("STRING")
/* Selections
*/
G_END_DECLS
#endif /* __GDK_SELECTION_H__ */

View File

@ -75,7 +75,6 @@ gdk_public_headers = files([
'gdkrectangle.h',
'gdkrgba.h',
'gdkseat.h',
'gdkselection.h',
'gdkthreads.h',
'gdktexture.h',
'gdktypes.h',

View File

@ -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);
}

View File

@ -29,7 +29,6 @@
#include "gdkdisplay-wayland.h"
#include "gdkcontentformatsprivate.h"
#include "gdkdndprivate.h"
#include "gdkselection.h"
#include "gdkproperty.h"
#include <string.h>

View File

@ -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);

View File

@ -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);
}

View File

@ -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"

View File

@ -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);
}

View File

@ -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 ||

View File

@ -7031,59 +7031,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
*/