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, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __GDK_X11_DISPLAY__
23 #define __GDK_X11_DISPLAY__
24 
25 #include "gdkdisplayprivate.h"
26 #include "gdkkeys.h"
27 #include "gdkwindow.h"
28 #include "gdkinternals.h"
29 #include "gdkmain.h"
30 
31 #include <X11/X.h>
32 #include <X11/Xlib.h>
33 
34 G_BEGIN_DECLS
35 
36 
37 struct _GdkX11Display
38 {
39   GdkDisplay parent_instance;
40   Display *xdisplay;
41   GdkScreen *screen;
42   GList *screens;
43 
44   GSource *event_source;
45 
46   gint grab_count;
47 
48   /* Keyboard related information */
49   gint xkb_event_type;
50   gboolean use_xkb;
51 
52   /* Whether we were able to turn on detectable-autorepeat using
53    * XkbSetDetectableAutorepeat. If FALSE, we'll fall back
54    * to checking the next event with XPending().
55    */
56   gboolean have_xkb_autorepeat;
57 
58   GdkKeymap *keymap;
59   guint      keymap_serial;
60 
61   gboolean have_xfixes;
62   gint xfixes_event_base;
63 
64   gboolean have_xcomposite;
65   gboolean have_xdamage;
66   gint xdamage_event_base;
67 
68   gboolean have_randr12;
69   gboolean have_randr13;
70   gboolean have_randr15;
71   gint xrandr_event_base;
72 
73   /* If the SECURITY extension is in place, whether this client holds
74    * a trusted authorization and so is allowed to make various requests
75    * (grabs, properties etc.) Otherwise always TRUE.
76    */
77   gboolean trusted_client;
78 
79   /* drag and drop information */
80   GdkDragContext *current_dest_drag;
81 
82   /* Mapping to/from virtual atoms */
83   GHashTable *atom_from_virtual;
84   GHashTable *atom_to_virtual;
85 
86   /* Session Management leader window see ICCCM */
87   Window leader_window;
88   GdkWindow *leader_gdk_window;
89   gboolean leader_window_title_set;
90 
91   /* List of functions to go from extension event => X window */
92   GSList *event_types;
93 
94   /* X ID hashtable */
95   GHashTable *xid_ht;
96 
97   /* translation queue */
98   GQueue *translate_queue;
99 
100   /* input GdkWindow list */
101   GList *input_windows;
102 
103   GPtrArray *monitors;
104   int primary_monitor;
105 
106   /* Startup notification */
107   gchar *startup_notification_id;
108 
109   /* Time of most recent user interaction. */
110   gulong user_time;
111 
112   /* Sets of atoms for DND */
113   guint base_dnd_atoms_precached : 1;
114   guint xdnd_atoms_precached : 1;
115   guint motif_atoms_precached : 1;
116   guint use_sync : 1;
117 
118   guint have_shapes : 1;
119   guint have_input_shapes : 1;
120   gint shape_event_base;
121 
122   /* The offscreen window that has the pointer in it (if any) */
123   GdkWindow *active_offscreen_window;
124 
125   GSList *error_traps;
126 
127   gint wm_moveresize_button;
128 
129   /* GLX information */
130   gint glx_version;
131   gint glx_error_base;
132   gint glx_event_base;
133 
134   /* Translation between X server time and system-local monotonic time */
135   gint64 server_time_query_time;
136   gint64 server_time_offset;
137 
138   guint server_time_is_monotonic_time : 1;
139 
140   guint have_glx : 1;
141 
142   /* GLX extensions we check */
143   guint has_glx_swap_interval : 1;
144   guint has_glx_create_context : 1;
145   guint has_glx_texture_from_pixmap : 1;
146   guint has_glx_video_sync : 1;
147   guint has_glx_buffer_age : 1;
148   guint has_glx_sync_control : 1;
149   guint has_glx_multisample : 1;
150   guint has_glx_visual_rating : 1;
151   guint has_glx_create_es2_context : 1;
152 };
153 
154 struct _GdkX11DisplayClass
155 {
156   GdkDisplayClass parent_class;
157 };
158 
159 GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay  *display,
160                                                  Window       xrootwin);
161 void       _gdk_x11_display_error_event         (GdkDisplay  *display,
162                                                  XErrorEvent *error);
163 
164 GdkFilterReturn _gdk_wm_protocols_filter        (GdkXEvent   *xev,
165                                                  GdkEvent    *event,
166                                                  gpointer     data);
167 
168 G_END_DECLS
169 
170 #endif  /* __GDK_X11_DISPLAY__ */
171