Name
Selections -- functions for transfering data via the X selection mechanism.
Synopsis
#include <gdk/gdk.h>
enum GdkSelection;
enum GdkSelectionType;
enum GdkTarget;
gint gdk_selection_owner_set (GdkWindow *owner,
GdkAtom selection,
guint32 time,
gint send_event);
GdkWindow* gdk_selection_owner_get (GdkAtom selection);
void gdk_selection_convert (GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time);
gint gdk_selection_property_get (GdkWindow *requestor,
guchar **data,
GdkAtom *prop_type,
gint *prop_format);
void gdk_selection_send_notify (guint32 requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time); |
Description
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
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).
Details
enum GdkSelection
typedef enum
{
GDK_SELECTION_PRIMARY = 1,
GDK_SELECTION_SECONDARY = 2
} GdkSelection; |
The GdkSelection enumeration contains predefined
atom values for several common selections.
enum GdkSelectionType
typedef enum
{
GDK_SELECTION_TYPE_ATOM = 4,
GDK_SELECTION_TYPE_BITMAP = 5,
GDK_SELECTION_TYPE_COLORMAP = 7,
GDK_SELECTION_TYPE_DRAWABLE = 17,
GDK_SELECTION_TYPE_INTEGER = 19,
GDK_SELECTION_TYPE_PIXMAP = 20,
GDK_SELECTION_TYPE_WINDOW = 33,
GDK_SELECTION_TYPE_STRING = 31
} GdkSelectionType; |
The GdkSelectionType enumeration contains predefined
atom values used to represent the types of data transferred
in response to a request for a target. See the
ICCCM for details about what data should be transferred
for each of these types. Other atoms can be used,
and the recommended practice for GTK+ is to to use mime
types for this purpose. However, supporting these types
may be useful for compatibility with older programs.
enum GdkTarget
typedef enum
{
GDK_TARGET_BITMAP = 5,
GDK_TARGET_COLORMAP = 7,
GDK_TARGET_DRAWABLE = 17,
GDK_TARGET_PIXMAP = 20,
GDK_TARGET_STRING = 31
} GdkTarget; |
The GdkTarget enumeration contains predefined atom values which are
used to describe possible targets for a selection. Other atoms can be
used, and the recommended practice for GTK+ is to to use mime types
for this purpose. However, supporting these types may be useful for
compatibility with older programs.
gdk_selection_owner_set ()
Set the owner of the given selection.
gdk_selection_owner_get ()
Determine the owner of the given selection.
gdk_selection_convert ()
Retrieve the contents of a selection in a given
form.
gdk_selection_property_get ()
Retrieve selection data that was stored by the selection
data in response to a call to gdk_selection_convert()
gdk_selection_send_notify ()
Send a response to SelectionRequest event.