Commit 9b6030a3 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Add an xsettings manager.

2007-10-25  William Jon McCann  <mccann@jhu.edu>

	* configure.ac:
	* gui/settings-daemon/plugins/xsettings/Makefile.am:
	* gui/settings-daemon/plugins/xsettings/gdm-xsettings-manager.c:
	(translate_bool_int), (translate_int_int),
	(translate_string_string), (translate_string_string_toolbar),
	(dpi_from_pixels_and_mm), (get_dpi_from_x_server),
	(get_dpi_from_gconf_or_x_server), (xft_settings_get),
	(xft_settings_set_xsettings), (write_all), (child_watch_cb),
	(spawn_with_input), (xft_settings_set_xresources),
	(update_xft_settings), (xft_callback), (type_to_string),
	(process_value), (gdm_xsettings_manager_start),
	(gdm_xsettings_manager_stop), (gdm_xsettings_manager_set_property),
	(gdm_xsettings_manager_get_property),
	(gdm_xsettings_manager_constructor),
	(gdm_xsettings_manager_dispose),
	(gdm_xsettings_manager_class_init), (find_translation_entry),
	(xsettings_callback), (register_config_callback), (terminate_cb),
	(gdm_xsettings_manager_init), (gdm_xsettings_manager_finalize),
	(gdm_xsettings_manager_new):
	* gui/settings-daemon/plugins/xsettings/gdm-xsettings-manager.h:
	* gui/settings-daemon/plugins/xsettings/gdm-xsettings-plugin.c:
	(gdm_xsettings_plugin_init), (gdm_xsettings_plugin_finalize),
	(impl_activate), (impl_deactivate),
	(gdm_xsettings_plugin_class_init):
	* gui/settings-daemon/plugins/xsettings/xsettings-common.c:
	(xsettings_setting_copy), (xsettings_list_copy),
	(xsettings_setting_equal), (xsettings_setting_free),
	(xsettings_list_free), (xsettings_list_insert),
	(xsettings_list_delete), (xsettings_list_lookup),
	(xsettings_byte_order):
	* gui/settings-daemon/plugins/xsettings/xsettings-common.h:
	* gui/settings-daemon/plugins/xsettings/xsettings-manager.c:
	(timestamp_predicate), (get_server_time),
	(xsettings_manager_check_running), (xsettings_manager_new),
	(xsettings_manager_destroy), (xsettings_manager_get_window),
	(xsettings_manager_process_event),
	(xsettings_manager_delete_setting),
	(xsettings_manager_set_setting), (xsettings_manager_set_int),
	(xsettings_manager_set_string), (xsettings_manager_set_color),
	(setting_length), (setting_store), (xsettings_manager_notify):
	* gui/settings-daemon/plugins/xsettings/xsettings-manager.h:
	Add an xsettings manager.


svn path=/trunk/; revision=5415
parent 831f6f00
2007-10-25 William Jon McCann <mccann@jhu.edu>
* configure.ac:
* gui/settings-daemon/plugins/xsettings/Makefile.am:
* gui/settings-daemon/plugins/xsettings/gdm-xsettings-manager.c:
(translate_bool_int), (translate_int_int),
(translate_string_string), (translate_string_string_toolbar),
(dpi_from_pixels_and_mm), (get_dpi_from_x_server),
(get_dpi_from_gconf_or_x_server), (xft_settings_get),
(xft_settings_set_xsettings), (write_all), (child_watch_cb),
(spawn_with_input), (xft_settings_set_xresources),
(update_xft_settings), (xft_callback), (type_to_string),
(process_value), (gdm_xsettings_manager_start),
(gdm_xsettings_manager_stop), (gdm_xsettings_manager_set_property),
(gdm_xsettings_manager_get_property),
(gdm_xsettings_manager_constructor),
(gdm_xsettings_manager_dispose),
(gdm_xsettings_manager_class_init), (find_translation_entry),
(xsettings_callback), (register_config_callback), (terminate_cb),
(gdm_xsettings_manager_init), (gdm_xsettings_manager_finalize),
(gdm_xsettings_manager_new):
* gui/settings-daemon/plugins/xsettings/gdm-xsettings-manager.h:
* gui/settings-daemon/plugins/xsettings/gdm-xsettings-plugin.c:
(gdm_xsettings_plugin_init), (gdm_xsettings_plugin_finalize),
(impl_activate), (impl_deactivate),
(gdm_xsettings_plugin_class_init):
* gui/settings-daemon/plugins/xsettings/xsettings-common.c:
(xsettings_setting_copy), (xsettings_list_copy),
(xsettings_setting_equal), (xsettings_setting_free),
(xsettings_list_free), (xsettings_list_insert),
(xsettings_list_delete), (xsettings_list_lookup),
(xsettings_byte_order):
* gui/settings-daemon/plugins/xsettings/xsettings-common.h:
* gui/settings-daemon/plugins/xsettings/xsettings-manager.c:
(timestamp_predicate), (get_server_time),
(xsettings_manager_check_running), (xsettings_manager_new),
(xsettings_manager_destroy), (xsettings_manager_get_window),
(xsettings_manager_process_event),
(xsettings_manager_delete_setting),
(xsettings_manager_set_setting), (xsettings_manager_set_int),
(xsettings_manager_set_string), (xsettings_manager_set_color),
(setting_length), (setting_store), (xsettings_manager_notify):
* gui/settings-daemon/plugins/xsettings/xsettings-manager.h:
Add an xsettings manager.
2007-10-25 William Jon McCann <mccann@jhu.edu>
* gui/simple-greeter/gdm-user-manager.c (gdm_user_manager_init):
......
......@@ -47,6 +47,7 @@ GNOME_VFS_REQUIRED_VERSION=2.18.0
PANGO_REQUIRED_VERSION=1.3.0
LIBGLADE_REQUIRED_VERSION=1.99.2
SCROLLKEEPER_REQUIRED_VERSION=0.1.4
GCONF_REQUIRED_VERSION=2.6.1
EXTRA_COMPILE_WARNINGS(yes)
......@@ -98,6 +99,7 @@ AC_SUBST(SETTINGS_DAEMON_LIBS)
PKG_CHECK_MODULES(SETTINGS_PLUGIN,
gtk+-2.0 >= $GTK_REQUIRED_VERSION
gconf-2.0 >= $GCONF_REQUIRED_VERSION
)
AC_SUBST(SETTINGS_PLUGIN_CFLAGS)
AC_SUBST(SETTINGS_PLUGIN_LIBS)
......@@ -651,6 +653,16 @@ fi
AC_SUBST(LIBWRAP_LIBS)
dnl ---------------------------------------------------------------------------
dnl - Check for XFT2 (for gdm-settings-daemon)
dnl ---------------------------------------------------------------------------
if $PKG_CONFIG --exists xft ; then
AC_DEFINE(HAVE_XFT2,,[Define if Xft functionality is available])
fi
dnl ---------------------------------------------------------------------------
dnl - Check for Xinput
dnl ---------------------------------------------------------------------------
......
......@@ -18,6 +18,12 @@ plugin_LTLIBRARIES = \
libxsettings_la_SOURCES = \
gdm-xsettings-plugin.h \
gdm-xsettings-plugin.c \
gdm-xsettings-manager.h \
gdm-xsettings-manager.c \
xsettings-common.h \
xsettings-common.c \
xsettings-manager.h \
xsettings-manager.c \
$(NULL)
libxsettings_la_LDFLAGS = \
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_XSETTINGS_MANAGER_H
#define __GDM_XSETTINGS_MANAGER_H
#include <glib-object.h>
G_BEGIN_DECLS
#define GDM_TYPE_XSETTINGS_MANAGER (gdm_xsettings_manager_get_type ())
#define GDM_XSETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_XSETTINGS_MANAGER, GdmXsettingsManager))
#define GDM_XSETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_XSETTINGS_MANAGER, GdmXsettingsManagerClass))
#define GDM_IS_XSETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_XSETTINGS_MANAGER))
#define GDM_IS_XSETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_XSETTINGS_MANAGER))
#define GDM_XSETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_XSETTINGS_MANAGER, GdmXsettingsManagerClass))
typedef struct GdmXsettingsManagerPrivate GdmXsettingsManagerPrivate;
#define GDM_XSETTINGS_ALL_LEVELS (GDM_XSETTINGS_LEVEL_STARTUP | GDM_XSETTINGS_LEVEL_CONFIGURATION | GDM_XSETTINGS_LEVEL_LOGIN_WINDOW | GDM_XSETTINGS_LEVEL_HOST_CHOOSER | GDM_XSETTINGS_LEVEL_REMOTE_HOST | GDM_XSETTINGS_LEVEL_SHUTDOWN)
typedef struct
{
GObject parent;
GdmXsettingsManagerPrivate *priv;
} GdmXsettingsManager;
typedef struct
{
GObjectClass parent_class;
} GdmXsettingsManagerClass;
GType gdm_xsettings_manager_get_type (void);
GdmXsettingsManager * gdm_xsettings_manager_new (void);
gboolean gdm_xsettings_manager_start (GdmXsettingsManager *manager,
GError **error);
void gdm_xsettings_manager_stop (GdmXsettingsManager *manager);
G_END_DECLS
#endif /* __GDM_XSETTINGS_MANAGER_H */
......@@ -20,11 +20,16 @@
#include "config.h"
#include <glib/gi18n-lib.h>
#include <gmodule.h>
#include "gdm-settings-plugin.h"
#include "gdm-xsettings-plugin.h"
#include "gdm-xsettings-manager.h"
#include <glib/gi18n-lib.h>
#include <gmodule.h>
struct GdmXsettingsPluginPrivate {
GdmXsettingsManager *manager;
};
#define GDM_XSETTINGS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GDM_TYPE_XSETTINGS_PLUGIN, GdmXsettingsPluginPrivate))
......@@ -33,27 +38,54 @@ GDM_SETTINGS_PLUGIN_REGISTER (GdmXsettingsPlugin, gdm_xsettings_plugin)
static void
gdm_xsettings_plugin_init (GdmXsettingsPlugin *plugin)
{
plugin->priv = GDM_XSETTINGS_PLUGIN_GET_PRIVATE (plugin);
g_debug ("GdmXsettingsPlugin initializing");
plugin->priv->manager = gdm_xsettings_manager_new ();
}
static void
gdm_xsettings_plugin_finalize (GObject *object)
{
GdmXsettingsPlugin *plugin;
g_return_if_fail (object != NULL);
g_return_if_fail (GDM_IS_XSETTINGS_PLUGIN (object));
g_debug ("GdmXsettingsPlugin finalizing");
plugin = GDM_XSETTINGS_PLUGIN (object);
g_return_if_fail (plugin->priv != NULL);
if (plugin->priv->manager != NULL) {
g_object_unref (plugin->priv->manager);
}
G_OBJECT_CLASS (gdm_xsettings_plugin_parent_class)->finalize (object);
}
static void
impl_activate (GdmSettingsPlugin *plugin)
{
g_debug ("Activating plugin");
gboolean res;
GError *error;
g_debug ("Activating xsettings plugin");
error = NULL;
res = gdm_xsettings_manager_start (GDM_XSETTINGS_PLUGIN (plugin)->priv->manager, &error);
if (! res) {
g_warning ("Unable to start xsettings manager: %s", error->message);
g_error_free (error);
}
}
static void
impl_deactivate (GdmSettingsPlugin *plugin)
{
g_debug ("Deactivating plugin");
g_debug ("Deactivating xsettings plugin");
}
static void
......@@ -66,4 +98,6 @@ gdm_xsettings_plugin_class_init (GdmXsettingsPluginClass *klass)
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
g_type_class_add_private (klass, sizeof (GdmXsettingsPluginPrivate));
}
/*
* Copyright © 2001 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Owen Taylor, Red Hat, Inc.
*/
#include "string.h"
#include "stdlib.h"
#include <X11/Xlib.h>
#include <X11/Xmd.h> /* For CARD32 */
#include "xsettings-common.h"
XSettingsSetting *
xsettings_setting_copy (XSettingsSetting *setting)
{
XSettingsSetting *result;
size_t str_len;
result = malloc (sizeof *result);
if (!result)
return NULL;
str_len = strlen (setting->name);
result->name = malloc (str_len + 1);
if (!result->name)
goto err;
memcpy (result->name, setting->name, str_len + 1);
result->type = setting->type;
switch (setting->type)
{
case XSETTINGS_TYPE_INT:
result->data.v_int = setting->data.v_int;
break;
case XSETTINGS_TYPE_COLOR:
result->data.v_color = setting->data.v_color;
break;
case XSETTINGS_TYPE_STRING:
str_len = strlen (setting->data.v_string);
result->data.v_string = malloc (str_len + 1);
if (!result->data.v_string)
goto err;
memcpy (result->data.v_string, setting->data.v_string, str_len + 1);
break;
}
result->last_change_serial = setting->last_change_serial;
return result;
err:
if (result->name)
free (result->name);
free (result);
return NULL;
}
XSettingsList *
xsettings_list_copy (XSettingsList *list)
{
XSettingsList *new = NULL;
XSettingsList *old_iter = list;
XSettingsList *new_iter = NULL;
while (old_iter)
{
XSettingsList *new_node;
new_node = malloc (sizeof *new_node);
if (!new_node)
goto error;
new_node->setting = xsettings_setting_copy (old_iter->setting);
if (!new_node->setting)
{
free (new_node);
goto error;
}
if (new_iter)
new_iter->next = new_node;
else
new = new_node;
new_iter = new_node;
old_iter = old_iter->next;
}
return new;
error:
xsettings_list_free (new);
return NULL;
}
int
xsettings_setting_equal (XSettingsSetting *setting_a,
XSettingsSetting *setting_b)
{
if (setting_a->type != setting_b->type)
return 0;
if (strcmp (setting_a->name, setting_b->name) != 0)
return 0;
switch (setting_a->type)
{
case XSETTINGS_TYPE_INT:
return setting_a->data.v_int == setting_b->data.v_int;
case XSETTINGS_TYPE_COLOR:
return (setting_a->data.v_color.red == setting_b->data.v_color.red &&
setting_a->data.v_color.green == setting_b->data.v_color.green &&
setting_a->data.v_color.blue == setting_b->data.v_color.blue &&
setting_a->data.v_color.alpha == setting_b->data.v_color.alpha);
case XSETTINGS_TYPE_STRING:
return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0;
}
return 0;
}
void
xsettings_setting_free (XSettingsSetting *setting)
{
if (setting->type == XSETTINGS_TYPE_STRING)
free (setting->data.v_string);
if (setting->name)
free (setting->name);
free (setting);
}
void
xsettings_list_free (XSettingsList *list)
{
while (list)
{
XSettingsList *next = list->next;
xsettings_setting_free (list->setting);
free (list);
list = next;
}
}
XSettingsResult
xsettings_list_insert (XSettingsList **list,
XSettingsSetting *setting)
{
XSettingsList *node;
XSettingsList *iter;
XSettingsList *last = NULL;
node = malloc (sizeof *node);
if (!node)
return XSETTINGS_NO_MEM;
node->setting = setting;
iter = *list;
while (iter)
{
int cmp = strcmp (setting->name, iter->setting->name);
if (cmp < 0)
break;
else if (cmp == 0)
{
free (node);
return XSETTINGS_DUPLICATE_ENTRY;
}
last = iter;
iter = iter->next;
}
if (last)
last->next = node;
else
*list = node;
node->next = iter;
return XSETTINGS_SUCCESS;
}
XSettingsResult
xsettings_list_delete (XSettingsList **list,
const char *name)
{
XSettingsList *iter;
XSettingsList *last = NULL;
iter = *list;
while (iter)
{
if (strcmp (name, iter->setting->name) == 0)
{
if (last)
last->next = iter->next;
else
*list = iter->next;
xsettings_setting_free (iter->setting);
free (iter);
return XSETTINGS_SUCCESS;
}
last = iter;
iter = iter->next;
}
return XSETTINGS_FAILED;
}
XSettingsSetting *
xsettings_list_lookup (XSettingsList *list,
const char *name)
{
XSettingsList *iter;
iter = list;
while (iter)
{
if (strcmp (name, iter->setting->name) == 0)
return iter->setting;
iter = iter->next;
}
return NULL;
}
char
xsettings_byte_order (void)
{
CARD32 myint = 0x01020304;
return (*(char *)&myint == 1) ? MSBFirst : LSBFirst;
}
/*
* Copyright © 2001 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Owen Taylor, Red Hat, Inc.
*/
#ifndef XSETTINGS_COMMON_H
#define XSETTINGS_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _XSettingsBuffer XSettingsBuffer;
typedef struct _XSettingsColor XSettingsColor;
typedef struct _XSettingsList XSettingsList;
typedef struct _XSettingsSetting XSettingsSetting;
/* Types of settings possible. Enum values correspond to
* protocol values.
*/
typedef enum
{
XSETTINGS_TYPE_INT = 0,
XSETTINGS_TYPE_STRING = 1,
XSETTINGS_TYPE_COLOR = 2
} XSettingsType;
typedef enum
{
XSETTINGS_SUCCESS,
XSETTINGS_NO_MEM,
XSETTINGS_ACCESS,
XSETTINGS_FAILED,
XSETTINGS_NO_ENTRY,
XSETTINGS_DUPLICATE_ENTRY
} XSettingsResult;
struct _XSettingsBuffer
{
char byte_order;
size_t len;
unsigned char *data;
unsigned char *pos;
};
struct _XSettingsColor
{
unsigned short red, green, blue, alpha;
};
struct _XSettingsList
{
XSettingsSetting *setting;
XSettingsList *next;
};
struct _XSettingsSetting
{
char *name;
XSettingsType type;
union {
int v_int;
char *v_string;
XSettingsColor v_color;
} data;
unsigned long last_change_serial;
};
XSettingsSetting *xsettings_setting_copy (XSettingsSetting *setting);
void xsettings_setting_free (XSettingsSetting *setting);
int xsettings_setting_equal (XSettingsSetting *setting_a,
XSettingsSetting *setting_b);
void xsettings_list_free (XSettingsList *list);
XSettingsList *xsettings_list_copy (XSettingsList *list);
XSettingsResult xsettings_list_insert (XSettingsList **list,
XSettingsSetting *setting);
XSettingsSetting *xsettings_list_lookup (XSettingsList *list,
const char *name);
XSettingsResult xsettings_list_delete (XSettingsList **list,
const char *name);
char xsettings_byte_order (void);
#define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* XSETTINGS_COMMON_H */
/*
* Copyright © 2001 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Owen Taylor, Red Hat, Inc.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xmd.h> /* For CARD16 */
#include "xsettings-manager.h"
struct _XSettingsManager
{
Display *display;
int screen;
Window window;
Atom manager_atom;
Atom selection_atom;
Atom xsettings_atom;
XSettingsTerminateFunc terminate;
void *cb_data;
XSettingsList *settings;
unsigned long serial;
};
static XSettingsList *settings;
typedef struct
{
Window window;
Atom timestamp_prop_atom;
} TimeStampInfo;
static Bool
timestamp_predicate (Display *display,
XEvent *xevent,
XPointer arg)
{
TimeStampInfo *info = (TimeStampInfo *)arg;
if (xevent->type == PropertyNotify &&
xevent->xproperty.window == info->window &&
xevent->xproperty.atom == info->timestamp_prop_atom)
return True;
return False;
}
/**
* get_server_time:
* @display: display from which to get the time
* @window: a #Window, used for communication with the server.
* The window must have PropertyChangeMask in its
* events mask or a hang will result.
*
* Routine to get the current X server time stamp.
*
* Return value: the time stamp.
**/
static Time
get_server_time (Display *display,
Window window)
{
unsigned char c = 'a';
XEvent xevent;
TimeStampInfo info;
info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", False);
info.window = window;
XChangeProperty (display, window,
info.timestamp_prop_atom, info.timestamp_prop_atom,
8, PropModeReplace, &c, 1);
XIfEvent (display, &xevent,
timestamp_predicate, (XPointer)&info);
return xevent.xproperty.time;
}
Bool
xsettings_manager_check_running (Display *display,
int screen)
{
char buffer[256];
Atom selection_atom;
sprintf(buffer, "_XSETTINGS_S%d", screen);