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/gdkinternals.h>
34 #include <gdk/gdk.h>		/* For gdk_get_program_class() */
35 
36 G_BEGIN_DECLS
37 
38 typedef struct _GdkDisplayX11 GdkDisplayX11;
39 typedef struct _GdkDisplayX11Class GdkDisplayX11Class;
40 
41 #define GDK_TYPE_DISPLAY_X11              (_gdk_display_x11_get_type())
42 #define GDK_DISPLAY_X11(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_X11, GdkDisplayX11))
43 #define GDK_DISPLAY_X11_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class))
44 #define GDK_IS_DISPLAY_X11(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_X11))
45 #define GDK_IS_DISPLAY_X11_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_X11))
46 #define GDK_DISPLAY_X11_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_X11, GdkDisplayX11Class))
47 
48 typedef enum
49 {
50   GDK_UNKNOWN,
51   GDK_NO,
52   GDK_YES
53 } GdkTristate;
54 
55 struct _GdkDisplayX11
56 {
57   GdkDisplay parent_instance;
58   Display *xdisplay;
59   GdkScreen *default_screen;
60   GdkScreen **screens;
61 
62   GSource *event_source;
63 
64   gint grab_count;
65 
66   /* Keyboard related information */
67 
68   gint xkb_event_type;
69   gboolean use_xkb;
70 
71   /* Whether we were able to turn on detectable-autorepeat using
72    * XkbSetDetectableAutorepeat. If FALSE, we'll fall back
73    * to checking the next event with XPending(). */
74   gboolean have_xkb_autorepeat;
75 
76   GdkKeymap *keymap;
77   guint	    keymap_serial;
78 
79   gboolean use_xshm;
80   gboolean have_shm_pixmaps;
81   GdkTristate have_render;
82   gboolean have_xfixes;
83   gint xfixes_event_base;
84 
85   gboolean have_xcomposite;
86   gboolean have_xdamage;
87   gint xdamage_event_base;
88 
89   gboolean have_randr13;
90   gboolean have_randr15;
91   gint xrandr_event_base;
92 
93   /* If the SECURITY extension is in place, whether this client holds
94    * a trusted authorization and so is allowed to make various requests
95    * (grabs, properties etc.) Otherwise always TRUE. */
96   gboolean trusted_client;
97 
98   /* drag and drop information */
99   GdkDragContext *current_dest_drag;
100 
101   /* data needed for MOTIF DnD */
102 
103   Window motif_drag_window;
104   GdkWindow *motif_drag_gdk_window;
105   GList **motif_target_lists;
106   gint motif_n_target_lists;
107 
108   /* Mapping to/from virtual atoms */
109 
110   GHashTable *atom_from_virtual;
111   GHashTable *atom_to_virtual;
112 
113   /* Session Management leader window see ICCCM */
114   Window leader_window;
115   GdkWindow *leader_gdk_window;
116   gboolean leader_window_title_set;
117 
118   /* list of filters for client messages */
119   GList *client_filters;
120 
121   /* List of functions to go from extension event => X window */
122   GSList *event_types;
123 
124   /* X ID hashtable */
125   GHashTable *xid_ht;
126 
127   /* translation queue */
128   GQueue *translate_queue;
129 
130   /* Input device */
131   /* input GdkDevice list */
132   GList *input_devices;
133 
134   /* input GdkWindow list */
135   GList *input_windows;
136 
137   /* Startup notification */
138   gchar *startup_notification_id;
139 
140   /* Time of most recent user interaction. */
141   gulong user_time;
142 
143   /* Sets of atoms for DND */
144   guint base_dnd_atoms_precached : 1;
145   guint xdnd_atoms_precached : 1;
146   guint motif_atoms_precached : 1;
147   guint use_sync : 1;
148 
149   guint have_shapes : 1;
150   guint have_input_shapes : 1;
151   gint shape_event_base;
152 
153   /* Alpha mask picture format */
154   XRenderPictFormat *mask_format;
155 
156   /* The offscreen window that has the pointer in it (if any) */
157   GdkWindow *active_offscreen_window;
158 };
159 
160 struct _GdkDisplayX11Class
161 {
162   GdkDisplayClass parent_class;
163 };
164 
165 GType      _gdk_display_x11_get_type            (void);
166 GdkScreen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
167 						 Window      xrootwin);
168 
169 G_END_DECLS
170 
171 #endif				/* __GDK_DISPLAY_X11__ */
172