1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2010 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef __GDK_DISPLAY_PRIVATE_H__
19 #define __GDK_DISPLAY_PRIVATE_H__
21 #include "gdkdisplay.h"
22 #include "gdkwindow.h"
23 #include "gdkcursor.h"
27 #define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
28 #define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
29 #define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
32 typedef struct _GdkDisplayClass GdkDisplayClass;
34 /* Tracks information about the keyboard grab on this display */
38 GdkWindow *native_window;
40 gboolean owner_events;
42 } GdkKeyboardGrabInfo;
44 /* Tracks information about the pointer grab on this display */
48 GdkWindow *native_window;
50 gulong serial_end; /* exclusive, i.e. not active on serial_end */
53 GdkGrabOwnership ownership;
56 guint implicit_ungrab : 1;
57 guint owner_events : 1;
61 /* Tracks information about a touch implicit grab on this display */
65 GdkEventSequence *sequence;
68 GdkWindow *native_window;
74 /* Tracks information about which window and position the pointer last was in.
75 * This is useful when we need to synthesize events later.
76 * Note that we track toplevel_under_pointer using enter/leave events,
77 * so in the case of a grab, either with owner_events==FALSE or with the
78 * pointer in no clients window the x/y coordinates may actually be outside
83 GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
84 /* tracked via native events */
85 GdkWindow *window_under_pointer; /* window that last got a normal enter event */
86 gdouble toplevel_x, toplevel_y;
89 GdkDevice *last_slave;
90 guint need_touch_press_enter : 1;
91 } GdkPointerWindowInfo;
95 guint32 button_click_time[2]; /* last 2 button click times */
96 GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
97 gint button_number[2]; /* last 2 buttons to be pressed */
98 gint button_x[2]; /* last 2 button click positions */
100 } GdkMultipleClickInfo;
104 GObject parent_instance;
106 GList *queued_events;
109 /* Information for determining if the latest button click
110 * is part of a double-click or triple-click
112 GHashTable *multiple_click_info;
113 guint double_click_time; /* Maximum time between clicks in msecs */
114 GdkDevice *core_pointer; /* Core pointer device */
116 guint event_pause_count; /* How many times events are blocked */
118 guint closed : 1; /* Whether this display has been closed */
119 guint flushing_events : 1; /* Inside gdk_display_flush_events */
121 GArray *touch_implicit_grabs;
122 GHashTable *device_grabs;
123 GHashTable *motion_hint_info;
124 GdkDeviceManager *device_manager;
126 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
127 guint32 last_event_time; /* Last reported event time from server */
129 guint double_click_distance; /* Maximum distance between clicks in pixels */
132 struct _GdkDisplayClass
134 GObjectClass parent_class;
136 GType window_type; /* type for native windows for this display, set in class_init */
138 const gchar * (*get_name) (GdkDisplay *display);
139 gint (*get_n_screens) (GdkDisplay *display);
140 GdkScreen * (*get_screen) (GdkDisplay *display,
142 GdkScreen * (*get_default_screen) (GdkDisplay *display);
143 void (*beep) (GdkDisplay *display);
144 void (*sync) (GdkDisplay *display);
145 void (*flush) (GdkDisplay *display);
146 gboolean (*has_pending) (GdkDisplay *display);
147 void (*queue_events) (GdkDisplay *display);
148 GdkWindow * (*get_default_group) (GdkDisplay *display);
149 gboolean (*supports_selection_notification) (GdkDisplay *display);
150 gboolean (*request_selection_notification) (GdkDisplay *display,
152 gboolean (*supports_shapes) (GdkDisplay *display);
153 gboolean (*supports_input_shapes) (GdkDisplay *display);
154 gboolean (*supports_composite) (GdkDisplay *display);
155 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
156 gboolean (*supports_cursor_color) (GdkDisplay *display);
158 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
159 void (*store_clipboard) (GdkDisplay *display,
160 GdkWindow *clipboard_window,
162 const GdkAtom *targets,
165 void (*get_default_cursor_size) (GdkDisplay *display,
168 void (*get_maximal_cursor_size) (GdkDisplay *display,
171 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
173 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
175 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
180 GList * (*list_devices) (GdkDisplay *display);
181 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
183 void (*before_process_all_updates) (GdkDisplay *display);
184 void (*after_process_all_updates) (GdkDisplay *display);
186 gulong (*get_next_serial) (GdkDisplay *display);
188 void (*notify_startup_complete) (GdkDisplay *display,
189 const gchar *startup_id);
190 void (*event_data_copy) (GdkDisplay *display,
191 const GdkEvent *event,
192 GdkEvent *new_event);
193 void (*event_data_free) (GdkDisplay *display,
195 void (*create_window_impl) (GdkDisplay *display,
197 GdkWindow *real_parent,
199 GdkEventMask event_mask,
200 GdkWindowAttr *attributes,
201 gint attributes_mask);
203 GdkKeymap * (*get_keymap) (GdkDisplay *display);
204 void (*push_error_trap) (GdkDisplay *display);
205 gint (*pop_error_trap) (GdkDisplay *display,
208 GdkWindow * (*get_selection_owner) (GdkDisplay *display,
210 gboolean (*set_selection_owner) (GdkDisplay *display,
214 gboolean send_event);
215 void (*send_selection_notify) (GdkDisplay *dispay,
216 GdkWindow *requestor,
221 gint (*get_selection_property) (GdkDisplay *display,
222 GdkWindow *requestor,
226 void (*convert_selection) (GdkDisplay *display,
227 GdkWindow *requestor,
232 gint (*text_property_to_utf8_list) (GdkDisplay *display,
238 gchar * (*utf8_to_string_target) (GdkDisplay *display,
242 void (*closed) (GdkDisplay *display,
247 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
249 GdkPointerWindowInfo *device_info,
252 void _gdk_display_device_grab_update (GdkDisplay *display,
254 GdkDevice *source_device,
255 gulong current_serial);
256 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
258 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
261 GdkWindow *native_window,
262 GdkGrabOwnership grab_ownership,
263 gboolean owner_events,
264 GdkEventMask event_mask,
268 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
271 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
276 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
279 void _gdk_display_add_touch_grab (GdkDisplay *display,
281 GdkEventSequence *sequence,
283 GdkWindow *native_window,
284 GdkEventMask event_mask,
285 unsigned long serial_start,
287 GdkTouchGrabInfo * _gdk_display_has_touch_grab (GdkDisplay *display,
289 GdkEventSequence *sequence,
291 gboolean _gdk_display_end_touch_grab (GdkDisplay *display,
293 GdkEventSequence *sequence);
294 void _gdk_display_enable_motion_hints (GdkDisplay *display,
296 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
298 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
299 GdkDisplayPointerInfoForeach func,
301 gulong _gdk_display_get_next_serial (GdkDisplay *display);
302 void _gdk_display_pause_events (GdkDisplay *display);
303 void _gdk_display_unpause_events (GdkDisplay *display);
304 void _gdk_display_flush_events (GdkDisplay *display);
305 void _gdk_display_event_data_copy (GdkDisplay *display,
306 const GdkEvent *event,
307 GdkEvent *new_event);
308 void _gdk_display_event_data_free (GdkDisplay *display,
310 void _gdk_display_create_window_impl (GdkDisplay *display,
312 GdkWindow *real_parent,
314 GdkEventMask event_mask,
315 GdkWindowAttr *attributes,
316 gint attributes_mask);
317 GdkWindow * _gdk_display_create_window (GdkDisplay *display);
321 #endif /* __GDK_DISPLAY_PRIVATE_H__ */