From 343c7e5072fd52093ab36576d4e8f74d468fb606 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 10 May 2001 19:24:48 +0000 Subject: Added changelog --- xsettings/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 xsettings/ChangeLog (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog new file mode 100644 index 0000000..08ae09e --- /dev/null +++ b/xsettings/ChangeLog @@ -0,0 +1,4 @@ +Thu May 10 15:23:50 2001 Owen Taylor + + * xsettings-manager.[ch]: Add xsettings_manager_delete_setting(). + -- cgit v1.2.3-70-g09d2 From 35d9be8ed09b52d5a13dacd9ac98a4b3df139a67 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 9 Oct 2002 18:44:49 +0000 Subject: Tue Oct 8 19:19:37 2002 Owen Taylor * xsettings-common.c (xsettings_setting_free): Fre the setting name. (Anders Carlsson) * xsettings-client.c (xsettings_client_process_event): Be more selective about which manager client events we process. (Anders Carlsson) * xsettings-client.c (fetch_card8): Fix cut-and-paste bug (Jacob Berkman, bugzilla.gnome.org #73585) * xsettings-client.c (parse_settings): Suppress a signed-unsigned warning (David L. Cooper II bugzilla.gnome.org, #85853) * xsettings-client.h (enum): Remove trailing , (Miroslaw Dobrzanski-Neumann, bugzilla.gnome.org #72182) --- xsettings/ChangeLog | 19 +++++++++++++++++++ xsettings/xsettings-client.c | 7 ++++--- xsettings/xsettings-client.h | 2 +- xsettings/xsettings-common.c | 3 +++ 4 files changed, 27 insertions(+), 4 deletions(-) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index 08ae09e..141a909 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,22 @@ +Tue Oct 8 19:19:37 2002 Owen Taylor + + * xsettings-common.c (xsettings_setting_free): Fre + the setting name. (Anders Carlsson) + + * xsettings-client.c (xsettings_client_process_event): + Be more selective about which manager client events + we process. (Anders Carlsson) + + * xsettings-client.c (fetch_card8): Fix cut-and-paste + bug (Jacob Berkman, bugzilla.gnome.org #73585) + + * xsettings-client.c (parse_settings): Suppress + a signed-unsigned warning (David L. Cooper II + bugzilla.gnome.org, #85853) + + * xsettings-client.h (enum): Remove trailing , + (Miroslaw Dobrzanski-Neumann, bugzilla.gnome.org #72182) + Thu May 10 15:23:50 2001 Owen Taylor * xsettings-manager.[ch]: Add xsettings_manager_delete_setting(). diff --git a/xsettings/xsettings-client.c b/xsettings/xsettings-client.c index fc4ef80..7be2dd1 100644 --- a/xsettings/xsettings-client.c +++ b/xsettings/xsettings-client.c @@ -169,7 +169,7 @@ fetch_card8 (XSettingsBuffer *buffer, if (BYTES_LEFT (buffer) < 1) return XSETTINGS_ACCESS; - *result = *(CARD32 *)buffer->pos; + *result = *(CARD8 *)buffer->pos; buffer->pos += 1; return XSETTINGS_SUCCESS; @@ -194,7 +194,7 @@ parse_settings (unsigned char *data, buffer.pos = buffer.data = data; buffer.len = len; - result = fetch_card8 (&buffer, &buffer.byte_order); + result = fetch_card8 (&buffer, (char *)&buffer.byte_order); if (buffer.byte_order != MSBFirst && buffer.byte_order != LSBFirst) { @@ -511,7 +511,8 @@ xsettings_client_process_event (XSettingsClient *client, if (xev->xany.window == RootWindow (client->display, client->screen)) { if (xev->xany.type == ClientMessage && - xev->xclient.message_type == client->manager_atom) + xev->xclient.message_type == client->manager_atom && + xev->xclient.data.l[1] == client->selection_atom) { check_manager_window (client); return True; diff --git a/xsettings/xsettings-client.h b/xsettings/xsettings-client.h index 1201829..1b13fe3 100644 --- a/xsettings/xsettings-client.h +++ b/xsettings/xsettings-client.h @@ -36,7 +36,7 @@ typedef enum { XSETTINGS_ACTION_NEW, XSETTINGS_ACTION_CHANGED, - XSETTINGS_ACTION_DELETED, + XSETTINGS_ACTION_DELETED } XSettingsAction; typedef void (*XSettingsNotifyFunc) (const char *name, diff --git a/xsettings/xsettings-common.c b/xsettings/xsettings-common.c index 7507714..3d74440 100644 --- a/xsettings/xsettings-common.c +++ b/xsettings/xsettings-common.c @@ -147,6 +147,9 @@ xsettings_setting_free (XSettingsSetting *setting) { if (setting->type == XSETTINGS_TYPE_STRING) free (setting->data.v_string); + + if (setting->name) + free (setting->name); free (setting); } -- cgit v1.2.3-70-g09d2 From 2decb51ecd1a22dbcc343dabd3120017a17255a0 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 9 Oct 2002 18:46:45 +0000 Subject: Wed Oct 9 15:32:20 2002 Owen Taylor * xsettings.xml: Add the spec (prior to converting to DocBook XML) --- xsettings/ChangeLog | 5 + xsettings/xsettings.xml | 371 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 376 insertions(+) create mode 100644 xsettings/xsettings.xml (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index 141a909..2bcc683 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,8 @@ +Wed Oct 9 15:32:20 2002 Owen Taylor + + * xsettings.xml: Add the spec (prior to converting + to DocBook XML) + Tue Oct 8 19:19:37 2002 Owen Taylor * xsettings-common.c (xsettings_setting_free): Fre diff --git a/xsettings/xsettings.xml b/xsettings/xsettings.xml new file mode 100644 index 0000000..81e901b --- /dev/null +++ b/xsettings/xsettings.xml @@ -0,0 +1,371 @@ + +
+ + XSETTINGS - cross toolkit configuration proposal + Version 0.5 + 19 March 2001 + + + Owen + Taylor + +
+ otaylor@redhat.com +
+
+
+
+
+ + + Goals + + The intent of this specification is to specify a mechanism to + allow the configuration of settings such as double click timeout, + drag-and-drop threshold, and default foreground and background colors + for all applications running within a desktop. The mechanism should: + + + allow for instant updates to be propagated across all + applications at runtime + perform well, even for remote applications. + + + It is not intended: + + + for the storage of application-specific data + to be able to store large amounts of data + to store complex data types (other than as + strings) + + + + Existing Systems + + The existing systems in this area are the Xrm database, and various + other configuration database systems, mostly specific to particular + desktops. (The kde configuration system, gnome-config, GConf, + libproplist, etc.) + + + The Xrm database is tempting to use for this purpose since it is + very well established and has a universally deployed existing + implementation. However, it has various defects, that make it + not suitable for this purpose. + + + + + The Xrm database merges information from various sources - the + ~/.Xdefaults file on the root window, and a property on the root + window. This means that to programatically configure the Xrm + database in response to a GUI config tool is difficult and + unreliable. + + + + + The Xrm database was not designed for on-the-fly changing of + settings. + + + + + The Xrm database stores all information in a single text + property on the root window. This makes it difficult to + determine what settings have changed; it is necessary to parse + the property and do string comparisons. + + + Additionally, most systems have a large amount of application + specific information in the Xrm database, which further slows + down notification of changes. + + + + + Other configuration databases are more designed for this + task. However, they are sophisticated systems that are not easily + reimplementable. Also, picking one would mean difficulties + integrating with other desktops that use different systems. + + + It is our contention that a system designed specifically for + configuration of a small number of settings being changed at + runtime can, compared to a more general existing system: + + + Be easier to bridge onto each systems native configuration + mechanism. + Be easier to implement in whatever language/library combination + people want to use. + Be more efficient. + + + + Client behavior + + On startup, each client that should identify the settings window by + calling XGetSelectionOwner() for the _XSETTINGS_S[N] selection and select + for notification on the settings window by calling XSelectInput() + with a mask of StructureNotifyMask|PropertyChangeMask. + + + To prevent race conditions a client MUST grab the + server while performing these operations using XGrabServer(). + + + If there is no owner of the _XSETTINGS_S[N] selection, the client can + determine when an owner is established by listening for client + messages sent to root window of the screen with type MANAGER. (See + section 2.8, Manager Selections of the ICCCM.) The format of this + message is: + + + event-mask: StructureNotify + event: ClientMessage + type: MANAGER + format: 32 + data[0]: timestamp + data[1]: _XSETTINGS_S[N] (atom) + data[2]: New owner of the selection + data[3]: 0 (reserved) + + + The client can then proceed to read contents of the _XSETTINGS_SETTINGS + property from the settings window and interpret according to + the information in the "_XSETTINGS_SETTINGS Format" section of this + document. + + + Clients must trap X errors when reading the _XSETTING_SETTINGS property + because it is possible that the selection window may be destroyed + at any time. + + + When the client is notified that the settings window has been + destroyed or discovers that the selection window has been destroyed, + it should reset all settings to their default values and then proceed + as on initial startup. [ See rational section ] + + + When a client receives a PropertyChangeNotify event for the window + it should reread the _XSETTING_SETTINGS property. It can use + the 'serial' field to tell what fields have been changed. The + client must parse the entire property and read in all new values + before taking action on changed settings such as notifying listeners + for those settings to avoid using a mix of old and new data. + + + + _XSETTINGS_SETTINGS Format + + The _XSETTINGS_SETTINGS property is of form 8 and type _XSETTINGS_SETTINGS. +The contents are a + + + 1 CARD8 byte-order + 3 unused + 4 CARD32 SERIAL + 4 CARD32 N_SETTINGS + + +Followed by N_SETTINGS settings records, which have a header: + + + 1 SETTING_TYPE type + 1 unused + 2 n name-len + n STRING8 name + P unused, p=pad(n) + 4 CARD32 last-change-serial + + +Where SETTING_TYPE is + + + 0 XSettingsTypeInteger + 1 XSettingsTypeString + 2 XSettingsTypeColor + + +followed by the body. If TYPE = XSettingsTypeString the body is: + + + 4 n value-len + n STRING8 value + P unused, p=pad(n) + + + +If TYPE == XSettingsTypeInteger, then the body is: + + + 4 INT32 value + + + + If TYPE == XSettingsTypeColor, then the body is: + + + 2 CARD16 red + 2 CARD16 blue + 2 CARD16 green + 2 CARD16 alpha + + +If the setting does not need the alpha field, it should +be set to 65535. + + + Setting names must be confined to the ascii characters: + + + 'A'-'Z' 'a'-'z' '0'-'9' '_' and '/' + + + With the additional restrictions that '/' cannot appear in + the leading or trailing position, that two occurences of + '/' cannot be consecutive, and that the first character + of the name, and and the first character after a slash + cannot be one of '0'-'9'. Names may not be empty. + + + So, + + + "GTK/colors/background0" + "_background" + "_111" + + + are legitimate names, while + + + "/" + "_background/" + "GTK//colors" + "" + + + Are not legitimate names. + + + The names, types, contents, and default values of standard settings + will be separately agreed upon. + + + + Names beginning with 'Net/' and case variants of that string are + reserved and must not be used without prior agreement. + + + The 'serial' field and and the 'last-change-serial' field of the each + settings record can be used to tell which settings have changed since + the last time a client retrieved the _XSETTINGS_SETTINGS property. Each + time the client retrieves the contents of the _XSETTINGS_SETTINGS + property it should store the contents of the 'serial' field. When + it next retrieves the property, any settings whose 'last-change-serial' + is greater than the stored value. + + + + (Careful clients will make provisions for wrap-around of the serial + field. This is, however, not expected to happen in practice.) + + + + Settings Manager behavior + + The _XSETTING_S[N] selection is managed as a manager selection + according to section 2.8 of the ICCCM and the handling of the + selections window, the _XSETTING_S[N] window and MANAGER client + messages must conform to that specification. + + + The settings manager changes the contents of the _XSETTINGS_SETTINGS + property of the root window whenever the source it derives them + from changes, taking care to increment the 'serial' field at each + increment and set the 'last-change-serial' fields appropriately. + + + + Rational and Discussion + + The reasons why an existing configuration mechanism, and in particular, + the Xrm database, was not used is discussed above. Various other + design decisions are discussed below: + + + Why aren't the contents of the property stored in XML? + + The data format is designed to be space efficient and to be easily + and efficiently parsed with minimal code. These are not things + XML does well. Flexibility of structure, things that XML + does well are not needed here. If needed, XML can be used for + the contents of individual settings. + + + + Why is the settings property screen specific? + + While most settings are expected to be shared across all screens + of a display, some settings, such as font sizes will be screen + specific, and it is considered easier to let the settings manager + propagate shared resources across screens then to have both + screen-specific and screen-independent resources. + + + + Why does there need to be a "settings manager" process + running? + + Having a process always present as the owner of the _XSETTING + selection ensures that there are no race conditions and is + simpler than trying to create a locking mechanism that can + work without a persistant process. It is also expected that to + properly handle notification of changes to the stored + properties most desktops will want a process running to watch + for changes in any case. In cases of tight resource usage, the + settings manager can be combined with some other function, + such as the window manager or session manager. + + + + Why use a single property for all settings? + + Using a single property has several advantages. First, retrieving + all settings takes only a single round-trip to the server instead + of a round-trip for each settings. Second, it means that when + multiple settings can be changed at once, only a single notification + is received by clients, and clients will see interrelated properties + changed in an atomic fashion. + + + + Why is the _XSETTINGS_SETTINGS property stored in the endianess + of the manager instead of a neutral endianness? + + This conforms to the way many other X mechanisms work. The main reason + for doing it this way is to save conversions for the common case when + the client and manager are on machines of the same endianness. + + + + When the settings manager exits, why should clients reset the + values to the default settings instead of keeping the current + settings? + + Resetting the settings to the default values is preferred to + maintaining the current values because it makes sure that all programs + on the desktop have consistent values for settings whether they were + started before or after the settings manager exited. It is not + expected that changes in the current settings manager will occur + very often. + + + +
+ -- cgit v1.2.3-70-g09d2 From 4ccdf2f6cc4d87fcc3035981f3391561ec09f847 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 9 Oct 2002 19:08:32 +0000 Subject: Wed Oct 9 15:49:03 2002 Owen Taylor * xsettings.xml: Convert to DocBook XML * Makefile: Add a rule for xsettings.html --- xsettings/ChangeLog | 6 ++++++ xsettings/Makefile | 11 ++++++++--- xsettings/xsettings.xml | 9 +++++---- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index 2bcc683..8c9104a 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 9 15:49:03 2002 Owen Taylor + + * xsettings.xml: Convert to DocBook XML + + * Makefile: Add a rule for xsettings.html + Wed Oct 9 15:32:20 2002 Owen Taylor * xsettings.xml: Add the spec (prior to converting diff --git a/xsettings/Makefile b/xsettings/Makefile index cc126f9..44109c8 100644 --- a/xsettings/Makefile +++ b/xsettings/Makefile @@ -5,7 +5,7 @@ manager_objects = manager.o gtk-utils.o xsettings-common.o xsettings-manager.o client_objects = client.o xsettings-common.o xsettings-client.o -all: xsettings-manager xsettings-client +all: xsettings-manager xsettings-client xsettings.html xsettings-manager: $(manager_objects) $(CC) -o $@ $(manager_objects) $(LIBS) @@ -13,6 +13,11 @@ xsettings-manager: $(manager_objects) xsettings-client: $(client_objects) $(CC) -o $@ $(client_objects) $(LIBS) -clean: - rm -f *.o xsettings-manager xsettings-client +xsettings.html: xsettings.xml + xmlto html-nochunks $< + +xsettings.ps: xsettings.xml + docbook2ps xsettings.xml +clean: + rm -f *.o xsettings-manager xsettings-client xsettings.html diff --git a/xsettings/xsettings.xml b/xsettings/xsettings.xml index 81e901b..b621c19 100644 --- a/xsettings/xsettings.xml +++ b/xsettings/xsettings.xml @@ -1,7 +1,9 @@ - +
- + XSETTINGS - cross toolkit configuration proposal Version 0.5 19 March 2001 @@ -16,7 +18,7 @@ - + Goals @@ -368,4 +370,3 @@ be set to 65535.
- -- cgit v1.2.3-70-g09d2 From 174294084fa8b681ea5295693111855e1f11f06a Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 9 Oct 2002 19:12:57 +0000 Subject: Version 0.2 ChangeLog --- xsettings/ChangeLog | 4 ++++ xsettings/Makefile | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index 8c9104a..bb077c6 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,7 @@ +Wed Oct 9 15:57:21 2002 Owen Taylor + + * === Version 0.2 === + Wed Oct 9 15:49:03 2002 Owen Taylor * xsettings.xml: Convert to DocBook XML diff --git a/xsettings/Makefile b/xsettings/Makefile index 44109c8..c7595a1 100644 --- a/xsettings/Makefile +++ b/xsettings/Makefile @@ -1,3 +1,6 @@ +PACKAGE=xsettings +VERSION=0.2 + CFLAGS= -Wall -g `gtk-config --cflags` -g -Wall LIBS=`gtk-config --libs` @@ -21,3 +24,19 @@ xsettings.ps: xsettings.xml clean: rm -f *.o xsettings-manager xsettings-client xsettings.html + +dist: + distdir=$(PACKAGE)-$(VERSION) ; \ + tag=`echo $$distdir | tr a-z.- A-Z__` ; \ + cvs tag -F $$tag && \ + cvs export -r $$tag -d $$distdir $(PACKAGE) && \ + tar cvf - $$distdir | gzip -c --best > $$distdir.tar.gz && \ + rm -rf $$distdir + +distcheck: dist + distdir=$(PACKAGE)-$(VERSION) ; \ + tar xvfz $$distdir.tar.gz && \ + cd $$distdir && \ + make && \ + cd .. && \ + rm -rf $$distdir -- cgit v1.2.3-70-g09d2 From 481e6fef65998dd376084532af878268cd45ae82 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 3 Dec 2002 00:29:41 +0000 Subject: Mon Dec 2 20:24:02 2002 Owen Taylor * xsettings.xml: Fix ordering of color components. (Fredrik H) --- xsettings/ChangeLog | 5 +++++ xsettings/xsettings.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index bb077c6..aa08127 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,8 @@ +Mon Dec 2 20:24:02 2002 Owen Taylor + + * xsettings.xml: Fix ordering of color components. + (Fredrik H) + Wed Oct 9 15:57:21 2002 Owen Taylor * === Version 0.2 === diff --git a/xsettings/xsettings.xml b/xsettings/xsettings.xml index b621c19..df6878d 100644 --- a/xsettings/xsettings.xml +++ b/xsettings/xsettings.xml @@ -213,8 +213,8 @@ If TYPE == XSettingsTypeInteger, then the body is: 2 CARD16 red - 2 CARD16 blue 2 CARD16 green + 2 CARD16 blue 2 CARD16 alpha -- cgit v1.2.3-70-g09d2 From b2e928dc0788f856bcb1e67450a2a0b28962a415 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 27 Feb 2004 01:00:08 +0000 Subject: Thu Feb 26 19:55:29 2004 Owen Taylor * xsettings-client.[ch]: Add xsettings_client_set_grab_func(), xsettings_client_set_ungrab_func() to allow users to control exactly how server grabs are done. (In case the user has a refcounted grab facility, for instance.) (Patch by Soeren Sandmann) * xsettings-client.c: Use XInternAtoms() to reduce roundtrips. * xsettings-client.c: Fix a memory leak for XGetWindowProperty() on type mismatch. --- xsettings/ChangeLog | 15 ++++++++ xsettings/xsettings-client.c | 85 ++++++++++++++++++++++++++++++++------------ xsettings/xsettings-client.h | 28 ++++++++------- 3 files changed, 94 insertions(+), 34 deletions(-) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index aa08127..fe8d039 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,18 @@ +Thu Feb 26 19:55:29 2004 Owen Taylor + + * xsettings-client.[ch]: Add + xsettings_client_set_grab_func(), + xsettings_client_set_ungrab_func() to allow users to + control exactly how server grabs are done. (In case + the user has a refcounted grab facility, for instance.) + (Patch by Soeren Sandmann) + + * xsettings-client.c: Use XInternAtoms() to reduce + roundtrips. + + * xsettings-client.c: Fix a memory leak for + XGetWindowProperty() on type mismatch. + Mon Dec 2 20:24:02 2002 Owen Taylor * xsettings.xml: Fix ordering of color components. diff --git a/xsettings/xsettings-client.c b/xsettings/xsettings-client.c index 7be2dd1..8b81b45 100644 --- a/xsettings/xsettings-client.c +++ b/xsettings/xsettings-client.c @@ -38,6 +38,9 @@ struct _XSettingsClient XSettingsWatchFunc watch; void *cb_data; + XSettingsGrabFunc grab; + XSettingsGrabFunc ungrab; + Window manager_window; Atom manager_atom; Atom selection_atom; @@ -370,24 +373,31 @@ read_settings (XSettingsClient *client) XSettingsList *old_list = client->settings; client->settings = NULL; - - old_handler = XSetErrorHandler (ignore_errors); - result = XGetWindowProperty (client->display, client->manager_window, - client->xsettings_atom, 0, LONG_MAX, - False, client->xsettings_atom, - &type, &format, &n_items, &bytes_after, &data); - XSetErrorHandler (old_handler); - - if (result == Success && type == client->xsettings_atom) + + if (client->manager_window) { - if (format != 8) + old_handler = XSetErrorHandler (ignore_errors); + result = XGetWindowProperty (client->display, client->manager_window, + client->xsettings_atom, 0, LONG_MAX, + False, client->xsettings_atom, + &type, &format, &n_items, &bytes_after, &data); + XSetErrorHandler (old_handler); + + if (result == Success && type != None) { - fprintf (stderr, "Invalid format for XSETTINGS property %d", format); + if (type != client->xsettings_atom) + { + fprintf (stderr, "Invalid type for XSETTINGS property"); + } + eles if (format != 8) + { + fprintf (stderr, "Invalid format for XSETTINGS property %d", format); + } + else + client->settings = parse_settings (data, n_items); + + XFree (data); } - else - client->settings = parse_settings (data, n_items); - - XFree (data); } notify_changes (client, old_list); @@ -410,8 +420,11 @@ check_manager_window (XSettingsClient *client) { if (client->manager_window && client->watch) client->watch (client->manager_window, False, 0, client->cb_data); - - XGrabServer (client->display); + + if (client->grab) + client->grab (client->display); + else + XGrabServer (client->display); client->manager_window = XGetSelectionOwner (client->display, client->selection_atom); @@ -419,7 +432,11 @@ check_manager_window (XSettingsClient *client) XSelectInput (client->display, client->manager_window, PropertyChangeMask | StructureNotifyMask); - XUngrabServer (client->display); + if (client->ungrab) + client->ungrab (client->display); + else + XUngrabServer (client->display); + XFlush (client->display); if (client->manager_window && client->watch) @@ -439,7 +456,9 @@ xsettings_client_new (Display *display, { XSettingsClient *client; char buffer[256]; - + char *atom_names[3]; + Atom atoms[3]; + client = malloc (sizeof *client); if (!client) return NULL; @@ -449,14 +468,22 @@ xsettings_client_new (Display *display, client->notify = notify; client->watch = watch; client->cb_data = cb_data; + client->grab = NULL; + client->ungrab = NULL; client->manager_window = None; client->settings = NULL; sprintf(buffer, "_XSETTINGS_S%d", screen); - client->selection_atom = XInternAtom (display, buffer, False); - client->xsettings_atom = XInternAtom (display, "_XSETTINGS_SETTINGS", False); - client->manager_atom = XInternAtom (display, "MANAGER", False); + atom_names[0] = buffer; + atom_names[1] = "_XSETTINGS_SETTINGS"; + atom_names[2] = "MANAGER"; + + XInternAtoms (display, atom_names, 3, False, atoms); + + client->selection_atom = atoms[0]; + client->xsettings_atom = atoms[1]; + client->manager_atom = atoms[2]; /* Select on StructureNotify so we get MANAGER events */ @@ -471,6 +498,20 @@ xsettings_client_new (Display *display, return client; } +void +xsettings_client_set_grab_func (XSettingsClient *client, + XSettingsGrabFunc grab) +{ + client->grab = grab; +} + +void +xsettings_client_set_ungrab_func (XSettingsClient *client, + XSettingsGrabFunc ungrab) +{ + client->ungrab = ungrab; +} + void xsettings_client_destroy (XSettingsClient *client) { diff --git a/xsettings/xsettings-client.h b/xsettings/xsettings-client.h index 1b13fe3..b916eba 100644 --- a/xsettings/xsettings-client.h +++ b/xsettings/xsettings-client.h @@ -47,19 +47,23 @@ typedef void (*XSettingsWatchFunc) (Window window, Bool is_start, long mask, void *cb_data); +typedef void (*XSettingsGrabFunc) (Display *display); -XSettingsClient *xsettings_client_new (Display *display, - int screen, - XSettingsNotifyFunc notify, - XSettingsWatchFunc watch, - void *cb_data); -void xsettings_client_destroy (XSettingsClient *client); -Bool xsettings_client_process_event (XSettingsClient *client, - XEvent *xev); - -XSettingsResult xsettings_client_get_setting (XSettingsClient *client, - const char *name, - XSettingsSetting **setting); +XSettingsClient *xsettings_client_new (Display *display, + int screen, + XSettingsNotifyFunc notify, + XSettingsWatchFunc watch, + void *cb_data); +void xsettings_client_set_grab_func (XSettingsClient *client, + XSettingsGrabFunc grab); +void xsettings_client_set_ungrab_func (XSettingsClient *client, + XSettingsGrabFunc ungrab); +void xsettings_client_destroy (XSettingsClient *client); +Bool xsettings_client_process_event (XSettingsClient *client, + XEvent *xev); +XSettingsResult xsettings_client_get_setting (XSettingsClient *client, + const char *name, + XSettingsSetting **setting); #ifdef __cplusplus } -- cgit v1.2.3-70-g09d2 From ad0b97a062a77226a56f1966a8665d2742dce1f7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 9 Aug 2005 15:43:45 +0000 Subject: 2005-08-09 Owen Taylor * xsettings-client.c (read_settings): Fix a typo (Travis Spencer) --- xsettings/ChangeLog | 4 ++++ xsettings/xsettings-client.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'xsettings/ChangeLog') diff --git a/xsettings/ChangeLog b/xsettings/ChangeLog index fe8d039..14a5351 100644 --- a/xsettings/ChangeLog +++ b/xsettings/ChangeLog @@ -1,3 +1,7 @@ +2005-08-09 Owen Taylor + + * xsettings-client.c (read_settings): Fix a typo (Travis Spencer) + Thu Feb 26 19:55:29 2004 Owen Taylor * xsettings-client.[ch]: Add diff --git a/xsettings/xsettings-client.c b/xsettings/xsettings-client.c index 8b81b45..50c33ce 100644 --- a/xsettings/xsettings-client.c +++ b/xsettings/xsettings-client.c @@ -389,7 +389,7 @@ read_settings (XSettingsClient *client) { fprintf (stderr, "Invalid type for XSETTINGS property"); } - eles if (format != 8) + else if (format != 8) { fprintf (stderr, "Invalid format for XSETTINGS property %d", format); } -- cgit v1.2.3-70-g09d2