Next: , Previous: Drag and Drop, Up: Top

23 Properties and Atoms

Functions to manipulate properties on windows

23.1 Overview

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 transferred 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.

23.2 Usage

— Class: <gdk-atom>

Opaque pointer.

This class defines no direct slots.

— Function: gdk-atom-intern (atom_name mchars) (only_if_exists bool) ⇒  (ret <gdk-atom>)

Finds or creates an atom corresponding to a given string.

a string.
if ‘#t’, GDK is allowed to not create a new atom, but just return ‘GDK_NONE’ if the requested atom doesn't already exists. Currently, the flag is ignored, since checking the existance of an atom is as expensive as creating it.
the atom corresponding to atom-name.
— Function: gdk-atom-name (atom <gdk-atom>) ⇒  (ret mchars)

Determines the string corresponding to an atom.

a <gdk-atom>.
a newly-allocated string containing the string corresponding to atom. When you are done with the return value, you should free it using g-free.
— Function: gdk-property-delete (window <gdk-window>) (property <gdk-atom>)

Deletes a property from a window.

a <gdk-window>.
the property to delete.