]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkdisplay-x11.h
Make GTK+ work as an untrusted X client. (#136571, Ed Catmur)
[~andy/gtk] / gdk / x11 / gdkdisplay-x11.h
1 /*
2  * gdkdisplay-x11.h
3  * 
4  * Copyright 2001 Sun Microsystems Inc. 
5  *
6  * Erwann Chenede <erwann.chenede@sun.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #ifndef __GDK_DISPLAY_X11__
25 #define __GDK_DISPLAY_X11__
26
27 #include <X11/X.h>
28 #include <X11/Xlib.h>
29 #include <glib.h>
30 #include <gdk/gdkdisplay.h>
31 #include <gdk/gdkkeys.h>
32 #include <gdk/gdkwindow.h>
33 #include <gdk/gdk.h>            /* For gdk_get_program_class() */
34
35 G_BEGIN_DECLS
36
37 typedef struct _GdkDisplayX11 GdkDisplayX11;
38 typedef struct _GdkDisplayX11Class GdkDisplayX11Class;
39
40 #define GDK_TYPE_DISPLAY_X11              (_gdk_display_x11_get_type())
41 #define GDK_DISPLAY_X11(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_X11, GdkDisplayX11))
42 #define GDK_DISPLAY_X11_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class))
43 #define GDK_IS_DISPLAY_X11(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_X11))
44 #define GDK_IS_DISPLAY_X11_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_X11))
45 #define GDK_DISPLAY_X11_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class))
46
47 typedef enum 
48 {
49   GDK_UNKNOWN,
50   GDK_NO,
51   GDK_YES
52 } GdkTristate;
53
54 struct _GdkDisplayX11
55 {
56   GdkDisplay parent_instance;
57   Display *xdisplay;
58   GdkScreen *default_screen;
59   GdkScreen **screens;
60
61   GSource *event_source;
62
63   gint grab_count;
64
65   /* Keyboard related information */
66
67   gint xkb_event_type;
68   gboolean use_xkb;
69   
70   /* Whether we were able to turn on detectable-autorepeat using
71    * XkbSetDetectableAutorepeat. If FALSE, we'll fall back
72    * to checking the next event with XPending(). */
73   gboolean have_xkb_autorepeat;
74
75   GdkKeymap *keymap;
76   guint     keymap_serial;
77
78   gboolean use_xshm;
79   gboolean have_shm_pixmaps;
80   GdkTristate have_render;
81   gboolean have_xfixes;
82   gint xfixes_event_base;
83
84   /* If the SECURITY extension is in place, whether this client holds 
85    * a trusted authorization and so is allowed to make various requests 
86    * (grabs, properties etc.) Otherwise always TRUE. */
87   gboolean trusted_client;
88
89   /* Information about current pointer and keyboard grabs held by this
90    * client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window
91    * window is NULL, then the other associated fields are ignored
92    */
93   GdkWindowObject *pointer_xgrab_window;
94   gulong pointer_xgrab_serial;
95   gboolean pointer_xgrab_owner_events;
96   gboolean pointer_xgrab_implicit;
97   guint32 pointer_xgrab_time;
98
99   GdkWindowObject *keyboard_xgrab_window;
100   gulong keyboard_xgrab_serial;
101   gboolean keyboard_xgrab_owner_events;
102   guint32 keyboard_xgrab_time;
103
104   /* drag and drop information */
105   GdkDragContext *current_dest_drag;
106
107   /* data needed for MOTIF DnD */
108
109   Window motif_drag_window;
110   GdkWindow *motif_drag_gdk_window;
111   GList **motif_target_lists;
112   gint motif_n_target_lists;
113
114   /* Mapping to/from virtual atoms */
115
116   GHashTable *atom_from_virtual;
117   GHashTable *atom_to_virtual;
118
119   /* Session Management leader window see ICCCM */
120   Window leader_window;
121   GdkWindow *leader_gdk_window;
122   gboolean leader_window_title_set;
123   
124   /* list of filters for client messages */
125   GList *client_filters;
126
127   /* List of functions to go from extension event => X window */
128   GSList *event_types;
129   
130   /* X ID hashtable */
131   GHashTable *xid_ht;
132
133   /* translation queue */
134   GQueue *translate_queue;
135
136   /* Input device */
137   /* input GdkDevice list */
138   GList *input_devices;
139
140   /* input GdkWindow list */
141   GList *input_windows;
142
143   gint input_ignore_core;
144   /* information about network port and host for gxid daemon */
145   gchar *input_gxid_host;
146   gint   input_gxid_port;
147
148   /* Startup notification */
149   gchar *startup_notification_id;
150
151   /* Time of most recent user interaction. */
152   gulong user_time;
153
154   /* Sets of atoms for DND */
155   guint base_dnd_atoms_precached : 1;
156   guint xdnd_atoms_precached : 1;
157   guint motif_atoms_precached : 1;
158   guint use_sync : 1;
159
160   guint have_shapes : 1;
161   guint have_input_shapes : 1;
162
163   /* Alpha mask picture format */
164   XRenderPictFormat *mask_format;
165 };
166
167 struct _GdkDisplayX11Class
168 {
169   GdkDisplayClass parent_class;
170 };
171
172 GType      _gdk_display_x11_get_type            (void);
173 GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
174                                                  Window      xrootwin);
175
176 G_END_DECLS
177
178 #endif                          /* __GDK_DISPLAY_X11__ */