]> Pileus Git - ~andy/gtk/blob - gdk/x11/xsettings-client.h
x11: Call grab functions directly
[~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 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33 /* Renames for GDK inclusion */
34
35 #define xsettings_client_destroy         _gdk_x11_xsettings_client_destroy
36 #define xsettings_client_get_setting     _gdk_x11_xsettings_client_get_setting
37 #define xsettings_client_new             _gdk_x11_xsettings_client_new
38 #define xsettings_client_process_event   _gdk_x11_xsettings_client_process_event
39 #define xsettings_setting_equal          _gdk_x11_xsettings_setting_equal
40 #define xsettings_setting_free           _gdk_x11_xsettings_setting_free
41
42 typedef struct _XSettingsBuffer  XSettingsBuffer;
43 typedef struct _XSettingsColor   XSettingsColor;
44 typedef struct _XSettingsSetting XSettingsSetting;
45 typedef struct _XSettingsClient XSettingsClient;
46
47 /* Types of settings possible. Enum values correspond to
48  * protocol values.
49  */
50 typedef enum 
51 {
52   XSETTINGS_TYPE_INT     = 0,
53   XSETTINGS_TYPE_STRING  = 1,
54   XSETTINGS_TYPE_COLOR   = 2
55 } XSettingsType;
56
57 typedef enum 
58 {
59   XSETTINGS_ACTION_NEW,
60   XSETTINGS_ACTION_CHANGED,
61   XSETTINGS_ACTION_DELETED
62 } XSettingsAction;
63
64 typedef enum
65 {
66   XSETTINGS_SUCCESS,
67   XSETTINGS_NO_MEM,
68   XSETTINGS_ACCESS,
69   XSETTINGS_FAILED,
70   XSETTINGS_NO_ENTRY,
71   XSETTINGS_DUPLICATE_ENTRY
72 } XSettingsResult;
73
74 struct _XSettingsBuffer
75 {
76   char byte_order;
77   size_t len;
78   unsigned char *data;
79   unsigned char *pos;
80 };
81
82 struct _XSettingsColor
83 {
84   unsigned short red, green, blue, alpha;
85 };
86
87 struct _XSettingsSetting
88 {
89   char *name;
90   XSettingsType type;
91   
92   union {
93     int v_int;
94     char *v_string;
95     XSettingsColor v_color;
96   } data;
97 };
98
99 typedef void (*XSettingsNotifyFunc) (const char       *name,
100                                      XSettingsAction   action,
101                                      XSettingsSetting *setting,
102                                      void             *cb_data);
103 typedef Bool (*XSettingsWatchFunc)  (Window            window,
104                                      Bool              is_start,
105                                      long              mask,
106                                      void             *cb_data);
107
108 void              xsettings_setting_free          (XSettingsSetting    *setting);
109 int               xsettings_setting_equal         (XSettingsSetting    *setting_a,
110                                                    XSettingsSetting    *setting_b);
111
112 XSettingsClient *xsettings_client_new             (GdkScreen           *screen,
113                                                    XSettingsNotifyFunc  notify,
114                                                    XSettingsWatchFunc   watch,
115                                                    void                *cb_data);
116 void             xsettings_client_destroy         (XSettingsClient     *client);
117 Bool             xsettings_client_process_event   (XSettingsClient     *client,
118                                                    XEvent              *xev);
119 const XSettingsSetting *
120                  xsettings_client_get_setting     (XSettingsClient     *client,
121                                                    const char          *name);
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126
127 #endif /* XSETTINGS_CLIENT_H */