]> Pileus Git - ~andy/gtk/blob - gdk/x11/xsettings-common.h
Add support for disabling middle click paste
[~andy/gtk] / gdk / x11 / xsettings-common.h
1 /*
2  * Copyright © 2001 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_COMMON_H
24 #define XSETTINGS_COMMON_H
25
26 #include <unistd.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 /* Renames for GDK inclusion */
33
34 #define xsettings_byte_order             _gdk_x11_xsettings_byte_order
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_new_with_grab_funcs _gdk_x11_xsettings_client_new_with_grab_funcs
39 #define xsettings_client_set_grab_func   _gdk_x11_xsettings_client_set_grab_func
40 #define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func
41 #define xsettings_client_process_event   _gdk_x11_xsettings_client_process_event
42 #define xsettings_list_copy              _gdk_x11_xsettings_list_copy
43 #define xsettings_list_delete            _gdk_x11_xsettings_list_delete
44 #define xsettings_list_free              _gdk_x11_xsettings_list_free
45 #define xsettings_list_insert            _gdk_x11_xsettings_list_insert
46 #define xsettings_list_lookup            _gdk_x11_xsettings_list_lookup
47 #define xsettings_setting_copy           _gdk_x11_xsettings_setting_copy
48 #define xsettings_setting_equal          _gdk_x11_xsettings_setting_equal
49 #define xsettings_setting_free           _gdk_x11_xsettings_setting_free
50
51
52 typedef struct _XSettingsBuffer  XSettingsBuffer;
53 typedef struct _XSettingsColor   XSettingsColor;
54 typedef struct _XSettingsList    XSettingsList;
55 typedef struct _XSettingsSetting XSettingsSetting;
56
57 /* Types of settings possible. Enum values correspond to
58  * protocol values.
59  */
60 typedef enum 
61 {
62   XSETTINGS_TYPE_INT     = 0,
63   XSETTINGS_TYPE_STRING  = 1,
64   XSETTINGS_TYPE_COLOR   = 2
65 } XSettingsType;
66
67 typedef enum
68 {
69   XSETTINGS_SUCCESS,
70   XSETTINGS_NO_MEM,
71   XSETTINGS_ACCESS,
72   XSETTINGS_FAILED,
73   XSETTINGS_NO_ENTRY,
74   XSETTINGS_DUPLICATE_ENTRY
75 } XSettingsResult;
76
77 struct _XSettingsBuffer
78 {
79   char byte_order;
80   size_t len;
81   unsigned char *data;
82   unsigned char *pos;
83 };
84
85 struct _XSettingsColor
86 {
87   unsigned short red, green, blue, alpha;
88 };
89
90 struct _XSettingsList
91 {
92   XSettingsSetting *setting;
93   XSettingsList *next;
94 };
95
96 struct _XSettingsSetting
97 {
98   char *name;
99   XSettingsType type;
100   
101   union {
102     int v_int;
103     char *v_string;
104     XSettingsColor v_color;
105   } data;
106
107   unsigned long last_change_serial;
108 };
109
110 XSettingsSetting *xsettings_setting_copy  (XSettingsSetting *setting);
111 void              xsettings_setting_free  (XSettingsSetting *setting);
112 int               xsettings_setting_equal (XSettingsSetting *setting_a,
113                                            XSettingsSetting *setting_b);
114
115 void              xsettings_list_free   (XSettingsList     *list);
116 XSettingsList    *xsettings_list_copy   (XSettingsList     *list);
117 XSettingsResult   xsettings_list_insert (XSettingsList    **list,
118                                          XSettingsSetting  *setting);
119 XSettingsSetting *xsettings_list_lookup (XSettingsList     *list,
120                                          const char        *name);
121 XSettingsResult   xsettings_list_delete (XSettingsList    **list,
122                                          const char        *name);
123
124 char xsettings_byte_order (void);
125
126 #define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))
127
128 #ifdef __cplusplus
129 }
130 #endif /* __cplusplus */
131
132 #endif /* XSETTINGS_COMMON_H */