]> Pileus Git - ~andy/gtk/blob - gdk/x11/xsettings-client.h
x11: Clean up xsettings header
[~andy/gtk] / gdk / x11 / xsettings-client.h
1 /*
2  * Copyright © 2001, 2007 Red Hat, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and its
5  * documentation for any purpose is hereby granted without fee, provided that
6  * the above copyright notice appear in all copies and that both that
7  * copyright notice and this permission notice appear in supporting
8  * documentation, and that the name of Red Hat not be used in advertising or
9  * publicity pertaining to distribution of the software without specific,
10  * written prior permission.  Red Hat makes no representations about the
11  * suitability of this software for any purpose.  It is provided "as is"
12  * without express or implied warranty.
13  *
14  * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
16  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  * Author:  Owen Taylor, Red Hat, Inc.
22  */
23 #ifndef XSETTINGS_CLIENT_H
24 #define XSETTINGS_CLIENT_H
25
26 #include <gdk/gdkscreen.h>
27 #include <X11/Xlib.h>
28
29 /* Renames for GDK inclusion */
30
31 #define xsettings_client_destroy         _gdk_x11_xsettings_client_destroy
32 #define xsettings_client_get_setting     _gdk_x11_xsettings_client_get_setting
33 #define xsettings_client_new             _gdk_x11_xsettings_client_new
34 #define xsettings_client_process_event   _gdk_x11_xsettings_client_process_event
35 #define xsettings_setting_equal          _gdk_x11_xsettings_setting_equal
36 #define xsettings_setting_free           _gdk_x11_xsettings_setting_free
37
38 typedef struct _XSettingsColor   XSettingsColor;
39 typedef struct _XSettingsSetting XSettingsSetting;
40 typedef struct _XSettingsClient XSettingsClient;
41
42 /* Types of settings possible. Enum values correspond to
43  * protocol values.
44  */
45 typedef enum 
46 {
47   XSETTINGS_TYPE_INT     = 0,
48   XSETTINGS_TYPE_STRING  = 1,
49   XSETTINGS_TYPE_COLOR   = 2
50 } XSettingsType;
51
52 typedef enum 
53 {
54   XSETTINGS_ACTION_NEW,
55   XSETTINGS_ACTION_CHANGED,
56   XSETTINGS_ACTION_DELETED
57 } XSettingsAction;
58
59 struct _XSettingsColor
60 {
61   unsigned short red, green, blue, alpha;
62 };
63
64 struct _XSettingsSetting
65 {
66   char *name;
67   XSettingsType type;
68   
69   union {
70     int v_int;
71     char *v_string;
72     XSettingsColor v_color;
73   } data;
74 };
75
76 typedef void (*XSettingsNotifyFunc) (const char       *name,
77                                      XSettingsAction   action,
78                                      XSettingsSetting *setting,
79                                      void             *cb_data);
80 typedef Bool (*XSettingsWatchFunc)  (Window            window,
81                                      Bool              is_start,
82                                      long              mask,
83                                      void             *cb_data);
84
85 void              xsettings_setting_free          (XSettingsSetting    *setting);
86 int               xsettings_setting_equal         (XSettingsSetting    *setting_a,
87                                                    XSettingsSetting    *setting_b);
88
89 XSettingsClient *xsettings_client_new             (GdkScreen           *screen,
90                                                    XSettingsNotifyFunc  notify,
91                                                    XSettingsWatchFunc   watch,
92                                                    void                *cb_data);
93 void             xsettings_client_destroy         (XSettingsClient     *client);
94 Bool             xsettings_client_process_event   (XSettingsClient     *client,
95                                                    XEvent              *xev);
96 const XSettingsSetting *
97                  xsettings_client_get_setting     (XSettingsClient     *client,
98                                                    const char          *name);
99
100 #endif /* XSETTINGS_CLIENT_H */