nanogui: Newbie question--passing events between programs
Subject:
Re: [nanogui] RE: Newbie question--passing events between program s
From:
Alex Holden ####@####.####
Date:
30 Jan 2002 19:39:14 -0000
Message-Id: <3C584B08.30204@linuxhacker.org>
Greg Haerr wrote:
> : Do you mean the whole full fat version with all the complexity of Atoms,
> : proptery types, large properties that need multiple calls to retrieve
> : the value, etc. or do you mean a much simplified version loosely
> : modelled after the X window properties?
> I was thinking of the simpler version.
Ok, how about this:
typedef unsigned char GR_PROP;
/**
* GrChangeProperty:
*
* @wid: the ID of the window the property is attached to
* @property: the name of the property
* @data: the data to be stored in the property
* @len: the length of the data to be stored in the property
*
* Changes the data stored in the specified property attached to the
* specified window. If the property does not already exist, it will be
* created. The property name should be a zero terminated string. To
* create a global property, attach it the root window
* (GR_ROOT_WINDOW_ID). If data is a null pointer but len is 1, the
* property is created with no data block attached to it. If len is 0,
* the property is deleted.
*/
void GrChangeProperty(GR_WINDOW_ID wid, GR_CHAR *property,
GR_PROP *data, GR_COUNT len);
/**
* GrGetWindowProperty:
*
* @wid: the ID of the window the property is attached to
* @property: the name of the property
* @data: pointer to a pointer to hold the address of the returned data
* @Returns: the length of the returned data block
*
* Searches for a property with the specified name in the list of
* properties attached to the specified window and returns the data
* block associated with the property. If no such property is found, the
* length is zero and the a null pointer is stored in the data pointer.
* If the property exists but no data block is associated with it, 1 is
* returned for the length and the data pointer is set to NULL. The data
* block is allocated with malloc() at call time, and it is the callers
* responsibility to free it when no longer needed.
*/
GR_COUNT GrGetWindowProperty(GR_WINDOW_ID wid, GR_CHAR *property,
GR_PROP **data);
These are basically much simplified versions of XChangeProperty() and
XGetWindowProperty(). It's also possible to create an analog of
XDeleteProperty() with just a #define:
#define GrDeleteProperty(wid, property) GrChangeProperty(wid, \
property, NULL, 0)
--
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer