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 closed : 1; /* Whether this display has been closed */
118 GArray *touch_implicit_grabs;
119 GHashTable *device_grabs;
120 GHashTable *motion_hint_info;
121 GdkDeviceManager *device_manager;
123 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
124 guint32 last_event_time; /* Last reported event time from server */
126 guint double_click_distance; /* Maximum distance between clicks in pixels */
129 struct _GdkDisplayClass
131 GObjectClass parent_class;
133 GType window_type; /* type for native windows for this display, set in class_init */
135 const gchar * (*get_name) (GdkDisplay *display);
136 gint (*get_n_screens) (GdkDisplay *display);
137 GdkScreen * (*get_screen) (GdkDisplay *display,
139 GdkScreen * (*get_default_screen) (GdkDisplay *display);
140 void (*beep) (GdkDisplay *display);
141 void (*sync) (GdkDisplay *display);
142 void (*flush) (GdkDisplay *display);
143 gboolean (*has_pending) (GdkDisplay *display);
144 void (*queue_events) (GdkDisplay *display);
145 GdkWindow * (*get_default_group) (GdkDisplay *display);
146 gboolean (*supports_selection_notification) (GdkDisplay *display);
147 gboolean (*request_selection_notification) (GdkDisplay *display,
149 gboolean (*supports_shapes) (GdkDisplay *display);
150 gboolean (*supports_input_shapes) (GdkDisplay *display);
151 gboolean (*supports_composite) (GdkDisplay *display);
152 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
153 gboolean (*supports_cursor_color) (GdkDisplay *display);
155 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
156 void (*store_clipboard) (GdkDisplay *display,
157 GdkWindow *clipboard_window,
159 const GdkAtom *targets,
162 void (*get_default_cursor_size) (GdkDisplay *display,
165 void (*get_maximal_cursor_size) (GdkDisplay *display,
168 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
170 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
172 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
177 GList * (*list_devices) (GdkDisplay *display);
178 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
180 void (*before_process_all_updates) (GdkDisplay *display);
181 void (*after_process_all_updates) (GdkDisplay *display);
183 gulong (*get_next_serial) (GdkDisplay *display);
185 void (*notify_startup_complete) (GdkDisplay *display,
186 const gchar *startup_id);
187 void (*event_data_copy) (GdkDisplay *display,
188 const GdkEvent *event,
189 GdkEvent *new_event);
190 void (*event_data_free) (GdkDisplay *display,
192 void (*create_window_impl) (GdkDisplay *display,
194 GdkWindow *real_parent,
196 GdkEventMask event_mask,
197 GdkWindowAttr *attributes,
198 gint attributes_mask);
200 GdkKeymap * (*get_keymap) (GdkDisplay *display);
201 void (*push_error_trap) (GdkDisplay *display);
202 gint (*pop_error_trap) (GdkDisplay *display,
205 GdkWindow * (*get_selection_owner) (GdkDisplay *display,
207 gboolean (*set_selection_owner) (GdkDisplay *display,
211 gboolean send_event);
212 void (*send_selection_notify) (GdkDisplay *dispay,
213 GdkWindow *requestor,
218 gint (*get_selection_property) (GdkDisplay *display,
219 GdkWindow *requestor,
223 void (*convert_selection) (GdkDisplay *display,
224 GdkWindow *requestor,
229 gint (*text_property_to_utf8_list) (GdkDisplay *display,
235 gchar * (*utf8_to_string_target) (GdkDisplay *display,
239 void (*closed) (GdkDisplay *display,
244 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
246 GdkPointerWindowInfo *device_info,
249 void _gdk_display_device_grab_update (GdkDisplay *display,
251 GdkDevice *source_device,
252 gulong current_serial);
253 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
255 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
258 GdkWindow *native_window,
259 GdkGrabOwnership grab_ownership,
260 gboolean owner_events,
261 GdkEventMask event_mask,
265 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
268 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
273 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
276 void _gdk_display_add_touch_grab (GdkDisplay *display,
278 GdkEventSequence *sequence,
280 GdkWindow *native_window,
281 GdkEventMask event_mask,
282 unsigned long serial_start,
284 GdkTouchGrabInfo * _gdk_display_has_touch_grab (GdkDisplay *display,
286 GdkEventSequence *sequence,
288 gboolean _gdk_display_end_touch_grab (GdkDisplay *display,
290 GdkEventSequence *sequence);
291 void _gdk_display_enable_motion_hints (GdkDisplay *display,
293 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
295 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
296 GdkDisplayPointerInfoForeach func,
298 gulong _gdk_display_get_next_serial (GdkDisplay *display);
299 void _gdk_display_event_data_copy (GdkDisplay *display,
300 const GdkEvent *event,
301 GdkEvent *new_event);
302 void _gdk_display_event_data_free (GdkDisplay *display,
304 void _gdk_display_create_window_impl (GdkDisplay *display,
306 GdkWindow *real_parent,
308 GdkEventMask event_mask,
309 GdkWindowAttr *attributes,
310 gint attributes_mask);
311 GdkWindow * _gdk_display_create_window (GdkDisplay *display);
315 #endif /* __GDK_DISPLAY_PRIVATE_H__ */