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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GDK_DISPLAY_PRIVATE_H__
21 #define __GDK_DISPLAY_PRIVATE_H__
23 #include "gdkdisplay.h"
24 #include "gdkwindow.h"
25 #include "gdkcursor.h"
29 #define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
30 #define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
31 #define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
34 typedef struct _GdkDisplayClass GdkDisplayClass;
36 /* Tracks information about the keyboard grab on this display */
40 GdkWindow *native_window;
42 gboolean owner_events;
44 } GdkKeyboardGrabInfo;
46 /* Tracks information about the pointer grab on this display */
50 GdkWindow *native_window;
52 gulong serial_end; /* exclusive, i.e. not active on serial_end */
53 gboolean owner_events;
57 GdkGrabOwnership ownership;
60 guint implicit_ungrab : 1;
63 /* Tracks information about which window and position the pointer last was in.
64 * This is useful when we need to synthesize events later.
65 * Note that we track toplevel_under_pointer using enter/leave events,
66 * so in the case of a grab, either with owner_events==FALSE or with the
67 * pointer in no clients window the x/y coordinates may actually be outside
72 GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
73 /* tracked via native events */
74 GdkWindow *window_under_pointer; /* window that last got a normal enter event */
75 gdouble toplevel_x, toplevel_y;
78 } GdkPointerWindowInfo;
82 guint32 button_click_time[2]; /* last 2 button click times */
83 GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
84 gint button_number[2]; /* last 2 buttons to be pressed */
85 gint button_x[2]; /* last 2 button click positions */
87 } GdkMultipleClickInfo;
91 GObject parent_instance;
96 /* Information for determining if the latest button click
97 * is part of a double-click or triple-click
99 GHashTable *multiple_click_info;
100 guint double_click_time; /* Maximum time between clicks in msecs */
101 GdkDevice *core_pointer; /* Core pointer device */
103 guint closed : 1; /* Whether this display has been closed */
104 guint ignore_core_events : 1; /* Don't send core motion and button event */
106 guint double_click_distance; /* Maximum distance between clicks in pixels */
108 GHashTable *device_grabs;
109 GHashTable *motion_hint_info;
111 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
112 guint32 last_event_time; /* Last reported event time from server */
114 GdkDeviceManager *device_manager;
117 struct _GdkDisplayClass
119 GObjectClass parent_class;
121 GType window_type; /* type for native windows for this display, set in class_init */
123 G_CONST_RETURN gchar * (*get_name) (GdkDisplay *display);
124 gint (*get_n_screens) (GdkDisplay *display);
125 GdkScreen * (*get_screen) (GdkDisplay *display,
127 GdkScreen * (*get_default_screen) (GdkDisplay *display);
128 void (*beep) (GdkDisplay *display);
129 void (*sync) (GdkDisplay *display);
130 void (*flush) (GdkDisplay *display);
131 gboolean (*has_pending) (GdkDisplay *display);
132 void (*queue_events) (GdkDisplay *display);
133 GdkWindow * (*get_default_group) (GdkDisplay *display);
134 gboolean (*supports_selection_notification) (GdkDisplay *display);
135 gboolean (*request_selection_notification) (GdkDisplay *display,
137 gboolean (*supports_shapes) (GdkDisplay *display);
138 gboolean (*supports_input_shapes) (GdkDisplay *display);
139 gboolean (*supports_composite) (GdkDisplay *display);
140 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
141 gboolean (*supports_cursor_color) (GdkDisplay *display);
143 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
144 void (*store_clipboard) (GdkDisplay *display,
145 GdkWindow *clipboard_window,
147 const GdkAtom *targets,
150 void (*get_default_cursor_size) (GdkDisplay *display,
153 void (*get_maximal_cursor_size) (GdkDisplay *display,
156 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
158 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
160 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
165 GList * (*list_devices) (GdkDisplay *display);
166 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
167 GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
168 GdkNativeWindow winid,
169 GdkDragProtocol *protocol,
172 void (*before_process_all_updates) (GdkDisplay *display);
173 void (*after_process_all_updates) (GdkDisplay *display);
175 gulong (*get_next_serial) (GdkDisplay *display);
177 void (*notify_startup_complete) (GdkDisplay *display,
178 const gchar *startup_id);
179 void (*event_data_copy) (GdkDisplay *display,
180 const GdkEvent *event,
181 GdkEvent *new_event);
182 void (*event_data_free) (GdkDisplay *display,
184 void (*create_window_impl) (GdkDisplay *display,
186 GdkWindow *real_parent,
188 GdkEventMask event_mask,
189 GdkWindowAttr *attributes,
190 gint attributes_mask);
192 GdkKeymap * (*get_keymap) (GdkDisplay *display);
193 void (*push_error_trap) (GdkDisplay *display);
194 gint (*pop_error_trap) (GdkDisplay *display,
197 GdkWindow * (*get_selection_owner) (GdkDisplay *display,
199 gboolean (*set_selection_owner) (GdkDisplay *display,
203 gboolean send_event);
204 void (*send_selection_notify) (GdkDisplay *dispay,
205 GdkNativeWindow requestor,
210 gint (*get_selection_property) (GdkDisplay *display,
211 GdkWindow *requestor,
215 void (*convert_selection) (GdkDisplay *display,
216 GdkWindow *requestor,
221 gint (*text_property_to_utf8_list) (GdkDisplay *display,
227 gchar * (*utf8_to_string_target) (GdkDisplay *display,
231 void (*closed) (GdkDisplay *display,
236 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
238 GdkPointerWindowInfo *device_info,
241 void _gdk_display_device_grab_update (GdkDisplay *display,
243 GdkDevice *source_device,
244 gulong current_serial);
245 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
247 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
250 GdkWindow *native_window,
251 GdkGrabOwnership grab_ownership,
252 gboolean owner_events,
253 GdkEventMask event_mask,
257 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
260 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
265 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
268 void _gdk_display_enable_motion_hints (GdkDisplay *display,
270 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
272 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
273 GdkDisplayPointerInfoForeach func,
275 gulong _gdk_display_get_next_serial (GdkDisplay *display);
276 void _gdk_display_event_data_copy (GdkDisplay *display,
277 const GdkEvent *event,
278 GdkEvent *new_event);
279 void _gdk_display_event_data_free (GdkDisplay *display,
281 void _gdk_display_create_window_impl (GdkDisplay *display,
283 GdkWindow *real_parent,
285 GdkEventMask event_mask,
286 GdkWindowAttr *attributes,
287 gint attributes_mask);
288 GdkWindow * _gdk_display_create_window (GdkDisplay *display);
292 #endif /* __GDK_DISPLAY_PRIVATE_H__ */