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 which window and position the pointer last was in.
62 * This is useful when we need to synthesize events later.
63 * Note that we track toplevel_under_pointer using enter/leave events,
64 * so in the case of a grab, either with owner_events==FALSE or with the
65 * pointer in no clients window the x/y coordinates may actually be outside
70 GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
71 /* tracked via native events */
72 GdkWindow *window_under_pointer; /* window that last got a normal enter event */
73 gdouble toplevel_x, toplevel_y;
76 GdkDevice *last_slave;
77 } GdkPointerWindowInfo;
81 guint32 button_click_time[2]; /* last 2 button click times */
82 GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
83 gint button_number[2]; /* last 2 buttons to be pressed */
84 gint button_x[2]; /* last 2 button click positions */
86 } GdkMultipleClickInfo;
90 GObject parent_instance;
95 /* Information for determining if the latest button click
96 * is part of a double-click or triple-click
98 GHashTable *multiple_click_info;
99 guint double_click_time; /* Maximum time between clicks in msecs */
100 GdkDevice *core_pointer; /* Core pointer device */
102 guint closed : 1; /* Whether this display has been closed */
103 guint ignore_core_events : 1; /* Don't send core motion and button event */
105 GHashTable *device_grabs;
106 GHashTable *motion_hint_info;
107 GdkDeviceManager *device_manager;
109 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
110 guint32 last_event_time; /* Last reported event time from server */
112 guint double_click_distance; /* Maximum distance between clicks in pixels */
115 struct _GdkDisplayClass
117 GObjectClass parent_class;
119 GType window_type; /* type for native windows for this display, set in class_init */
121 const gchar * (*get_name) (GdkDisplay *display);
122 gint (*get_n_screens) (GdkDisplay *display);
123 GdkScreen * (*get_screen) (GdkDisplay *display,
125 GdkScreen * (*get_default_screen) (GdkDisplay *display);
126 void (*beep) (GdkDisplay *display);
127 void (*sync) (GdkDisplay *display);
128 void (*flush) (GdkDisplay *display);
129 gboolean (*has_pending) (GdkDisplay *display);
130 void (*queue_events) (GdkDisplay *display);
131 GdkWindow * (*get_default_group) (GdkDisplay *display);
132 gboolean (*supports_selection_notification) (GdkDisplay *display);
133 gboolean (*request_selection_notification) (GdkDisplay *display,
135 gboolean (*supports_shapes) (GdkDisplay *display);
136 gboolean (*supports_input_shapes) (GdkDisplay *display);
137 gboolean (*supports_composite) (GdkDisplay *display);
138 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
139 gboolean (*supports_cursor_color) (GdkDisplay *display);
141 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
142 void (*store_clipboard) (GdkDisplay *display,
143 GdkWindow *clipboard_window,
145 const GdkAtom *targets,
148 void (*get_default_cursor_size) (GdkDisplay *display,
151 void (*get_maximal_cursor_size) (GdkDisplay *display,
154 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
156 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
158 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
163 GList * (*list_devices) (GdkDisplay *display);
164 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
166 void (*before_process_all_updates) (GdkDisplay *display);
167 void (*after_process_all_updates) (GdkDisplay *display);
169 gulong (*get_next_serial) (GdkDisplay *display);
171 void (*notify_startup_complete) (GdkDisplay *display,
172 const gchar *startup_id);
173 void (*event_data_copy) (GdkDisplay *display,
174 const GdkEvent *event,
175 GdkEvent *new_event);
176 void (*event_data_free) (GdkDisplay *display,
178 void (*create_window_impl) (GdkDisplay *display,
180 GdkWindow *real_parent,
182 GdkEventMask event_mask,
183 GdkWindowAttr *attributes,
184 gint attributes_mask);
186 GdkKeymap * (*get_keymap) (GdkDisplay *display);
187 void (*push_error_trap) (GdkDisplay *display);
188 gint (*pop_error_trap) (GdkDisplay *display,
191 GdkWindow * (*get_selection_owner) (GdkDisplay *display,
193 gboolean (*set_selection_owner) (GdkDisplay *display,
197 gboolean send_event);
198 void (*send_selection_notify) (GdkDisplay *dispay,
199 GdkWindow *requestor,
204 gint (*get_selection_property) (GdkDisplay *display,
205 GdkWindow *requestor,
209 void (*convert_selection) (GdkDisplay *display,
210 GdkWindow *requestor,
215 gint (*text_property_to_utf8_list) (GdkDisplay *display,
221 gchar * (*utf8_to_string_target) (GdkDisplay *display,
225 void (*closed) (GdkDisplay *display,
230 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
232 GdkPointerWindowInfo *device_info,
235 void _gdk_display_device_grab_update (GdkDisplay *display,
237 GdkDevice *source_device,
238 gulong current_serial);
239 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
241 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
244 GdkWindow *native_window,
245 GdkGrabOwnership grab_ownership,
246 gboolean owner_events,
247 GdkEventMask event_mask,
251 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
254 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
259 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
262 void _gdk_display_enable_motion_hints (GdkDisplay *display,
264 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
266 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
267 GdkDisplayPointerInfoForeach func,
269 gulong _gdk_display_get_next_serial (GdkDisplay *display);
270 void _gdk_display_event_data_copy (GdkDisplay *display,
271 const GdkEvent *event,
272 GdkEvent *new_event);
273 void _gdk_display_event_data_free (GdkDisplay *display,
275 void _gdk_display_create_window_impl (GdkDisplay *display,
277 GdkWindow *real_parent,
279 GdkEventMask event_mask,
280 GdkWindowAttr *attributes,
281 gint attributes_mask);
282 GdkWindow * _gdk_display_create_window (GdkDisplay *display);
286 #endif /* __GDK_DISPLAY_PRIVATE_H__ */