Name
Properties and Atoms -- functions to manipulate properties on windows.
Synopsis
#include <gdk/gdk.h>
typedef GdkAtom;
#define GDK_NONE
gint gdk_text_property_to_text_list (GdkAtom encoding,
gint format,
guchar *text,
gint length,
gchar ***list);
void gdk_free_text_list (gchar **list);
gint gdk_string_to_compound_text (gchar *str,
GdkAtom *encoding,
gint *format,
guchar **ctext,
gint *length);
void gdk_free_compound_text (guchar *ctext);
GdkAtom gdk_atom_intern (const gchar *atom_name,
gint only_if_exists);
gchar* gdk_atom_name (GdkAtom atom);
gint gdk_property_get (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gulong offset,
gulong length,
gint pdelete,
GdkAtom *actual_property_type,
gint *actual_format,
gint *actual_length,
guchar **data);
void gdk_property_change (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gint format,
GdkPropMode mode,
guchar *data,
gint nelements);
enum GdkPropMode;
void gdk_property_delete (GdkWindow *window,
GdkAtom property); |
Description
Each window under X can have any number of associated
properties attached to it.
Properties are arbitrary chunks of data identified by
atoms. (An atom
is a numeric index into a string table on the X server. They are used
to transfer strings efficiently between clients without
having to transfer the entire string.) A property
has an associated type, which is also identified
using an atom.
A property has an associated format,
an integer describing how many bits are in each unit
of data inside the property. It must be 8, 16, or 32.
When data is transfered between the server and client,
if they are of different endianesses it will be byteswapped
as necessary according to the format of the property.
Note that on the client side, properties of format 32
will be stored with one unit per long,
even if a long integer has more than 32 bits on the platform.
(This decision was apparently made for Xlib to maintain
compatibility with programs that assumed longs were 32
bits, at the expense of programs that knew better.)
The functions in this section are used to add, remove
and change properties on windows, to convert atoms
to and from strings and to manipulate some types of
data commonly stored in X window properties.
Details
GdkAtom
A numeric type representing a string as an index into a table
of strings on the X server.
gdk_text_property_to_text_list ()
Convert a text string from the encoding as it is stored in
a property into an array of strings in the encoding of
the current local. (The elements of the array represent
the null-separated elements of the original text string.)
gdk_string_to_compound_text ()
Convert a string from the encoding of the current locale
into a form suitable for storing in a window property.
gdk_atom_intern ()
Find or create an atom corresponding to a given string.
gdk_atom_name ()
Determine the string corresponding to an atom.
gdk_property_get ()
Retrieves a portion of the contents of a property. If the
property does not exist, then the function returns FALSE,
and GDK_NONE will be stored in actual_property_type.
Note: the XGetWindowProperty()
function that gdk_property_get()
uses has a very confusing and complicated set of semantics.
Unfortunately, gdk_property_get() makes the situation
worse instead of better (the semantics should be considered
undefined), and also prints warnings to stderr in cases where it
should return a useful error to the program. You are advised to use
XGetWindowProperty()
directly until a replacement function for gdk_property_get()
is provided.
gdk_property_change ()
Change the contents of a property on a window.
enum GdkPropMode
typedef enum
{
GDK_PROP_MODE_REPLACE,
GDK_PROP_MODE_PREPEND,
GDK_PROP_MODE_APPEND
} GdkPropMode; |
Describes how existing data is combined with new data when
using gdk_property_change().
gdk_property_delete ()
Delete a property from a window.