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 */
55 GdkGrabOwnership ownership;
58 guint implicit_ungrab : 1;
59 guint owner_events : 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 GHashTable *device_grabs;
107 GHashTable *motion_hint_info;
108 GdkDeviceManager *device_manager;
110 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
111 guint32 last_event_time; /* Last reported event time from server */
113 guint double_click_distance; /* Maximum distance between clicks in pixels */
116 struct _GdkDisplayClass
118 GObjectClass parent_class;
120 GType window_type; /* type for native windows for this display, set in class_init */
122 const gchar * (*get_name) (GdkDisplay *display);
123 gint (*get_n_screens) (GdkDisplay *display);
124 GdkScreen * (*get_screen) (GdkDisplay *display,
126 GdkScreen * (*get_default_screen) (GdkDisplay *display);
127 void (*beep) (GdkDisplay *display);
128 void (*sync) (GdkDisplay *display);
129 void (*flush) (GdkDisplay *display);
130 gboolean (*has_pending) (GdkDisplay *display);
131 void (*queue_events) (GdkDisplay *display);
132 GdkWindow * (*get_default_group) (GdkDisplay *display);
133 gboolean (*supports_selection_notification) (GdkDisplay *display);
134 gboolean (*request_selection_notification) (GdkDisplay *display,
136 gboolean (*supports_shapes) (GdkDisplay *display);
137 gboolean (*supports_input_shapes) (GdkDisplay *display);
138 gboolean (*supports_composite) (GdkDisplay *display);
139 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
140 gboolean (*supports_cursor_color) (GdkDisplay *display);
142 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
143 void (*store_clipboard) (GdkDisplay *display,
144 GdkWindow *clipboard_window,
146 const GdkAtom *targets,
149 void (*get_default_cursor_size) (GdkDisplay *display,
152 void (*get_maximal_cursor_size) (GdkDisplay *display,
155 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
157 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
159 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
164 GList * (*list_devices) (GdkDisplay *display);
165 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
167 void (*before_process_all_updates) (GdkDisplay *display);
168 void (*after_process_all_updates) (GdkDisplay *display);
170 gulong (*get_next_serial) (GdkDisplay *display);
172 void (*notify_startup_complete) (GdkDisplay *display,
173 const gchar *startup_id);
174 void (*event_data_copy) (GdkDisplay *display,
175 const GdkEvent *event,
176 GdkEvent *new_event);
177 void (*event_data_free) (GdkDisplay *display,
179 void (*create_window_impl) (GdkDisplay *display,
181 GdkWindow *real_parent,
183 GdkEventMask event_mask,
184 GdkWindowAttr *attributes,
185 gint attributes_mask);
187 GdkKeymap * (*get_keymap) (GdkDisplay *display);
188 void (*push_error_trap) (GdkDisplay *display);
189 gint (*pop_error_trap) (GdkDisplay *display,
192 GdkWindow * (*get_selection_owner) (GdkDisplay *display,
194 gboolean (*set_selection_owner) (GdkDisplay *display,
198 gboolean send_event);
199 void (*send_selection_notify) (GdkDisplay *dispay,
200 GdkWindow *requestor,
205 gint (*get_selection_property) (GdkDisplay *display,
206 GdkWindow *requestor,
210 void (*convert_selection) (GdkDisplay *display,
211 GdkWindow *requestor,
216 gint (*text_property_to_utf8_list) (GdkDisplay *display,
222 gchar * (*utf8_to_string_target) (GdkDisplay *display,
226 void (*closed) (GdkDisplay *display,
231 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
233 GdkPointerWindowInfo *device_info,
236 void _gdk_display_device_grab_update (GdkDisplay *display,
238 GdkDevice *source_device,
239 gulong current_serial);
240 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
242 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
245 GdkWindow *native_window,
246 GdkGrabOwnership grab_ownership,
247 gboolean owner_events,
248 GdkEventMask event_mask,
252 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
255 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
260 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
263 void _gdk_display_enable_motion_hints (GdkDisplay *display,
265 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
267 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
268 GdkDisplayPointerInfoForeach func,
270 gulong _gdk_display_get_next_serial (GdkDisplay *display);
271 void _gdk_display_event_data_copy (GdkDisplay *display,
272 const GdkEvent *event,
273 GdkEvent *new_event);
274 void _gdk_display_event_data_free (GdkDisplay *display,
276 void _gdk_display_create_window_impl (GdkDisplay *display,
278 GdkWindow *real_parent,
280 GdkEventMask event_mask,
281 GdkWindowAttr *attributes,
282 gint attributes_mask);
283 GdkWindow * _gdk_display_create_window (GdkDisplay *display);
287 #endif /* __GDK_DISPLAY_PRIVATE_H__ */