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 "gdkcursor.h"
28 typedef struct _GdkDisplayClass GdkDisplayClass;
30 /* Tracks information about the keyboard grab on this display */
34 GdkWindow *native_window;
36 gboolean owner_events;
38 } GdkKeyboardGrabInfo;
40 /* Tracks information about the pointer grab on this display */
44 GdkWindow *native_window;
46 gulong serial_end; /* exclusive, i.e. not active on serial_end */
47 gboolean owner_events;
51 GdkGrabOwnership ownership;
54 guint implicit_ungrab : 1;
57 /* Tracks information about which window and position the pointer last was in.
58 * This is useful when we need to synthesize events later.
59 * Note that we track toplevel_under_pointer using enter/leave events,
60 * so in the case of a grab, either with owner_events==FALSE or with the
61 * pointer in no clients window the x/y coordinates may actually be outside
66 GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
67 /* tracked via native events */
68 GdkWindow *window_under_pointer; /* window that last got a normal enter event */
69 gdouble toplevel_x, toplevel_y;
72 } GdkPointerWindowInfo;
76 guint32 button_click_time[2]; /* last 2 button click times */
77 GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
78 gint button_number[2]; /* last 2 buttons to be pressed */
79 gint button_x[2]; /* last 2 button click positions */
81 } GdkMultipleClickInfo;
85 GObject parent_instance;
90 /* Information for determining if the latest button click
91 * is part of a double-click or triple-click
93 GHashTable *multiple_click_info;
94 guint double_click_time; /* Maximum time between clicks in msecs */
95 GdkDevice *core_pointer; /* Core pointer device */
97 const GdkDisplayDeviceHooks *device_hooks; /* Hooks for querying pointer */
99 guint closed : 1; /* Whether this display has been closed */
100 guint ignore_core_events : 1; /* Don't send core motion and button event */
102 guint double_click_distance; /* Maximum distance between clicks in pixels */
104 GHashTable *device_grabs;
105 GHashTable *motion_hint_info;
107 GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
108 guint32 last_event_time; /* Last reported event time from server */
110 GdkDeviceManager *device_manager;
113 struct _GdkDisplayClass
115 GObjectClass parent_class;
117 G_CONST_RETURN gchar * (*get_name) (GdkDisplay *display);
118 gint (*get_n_screens) (GdkDisplay *display);
119 GdkScreen * (*get_screen) (GdkDisplay *display,
121 GdkScreen * (*get_default_screen) (GdkDisplay *display);
122 void (*beep) (GdkDisplay *display);
123 void (*sync) (GdkDisplay *display);
124 void (*flush) (GdkDisplay *display);
125 gboolean (*has_pending) (GdkDisplay *display);
126 void (*queue_events) (GdkDisplay *display);
127 GdkWindow * (*get_default_group) (GdkDisplay *display);
128 gboolean (*supports_selection_notification) (GdkDisplay *display);
129 gboolean (*request_selection_notification) (GdkDisplay *display,
131 gboolean (*supports_shapes) (GdkDisplay *display);
132 gboolean (*supports_input_shapes) (GdkDisplay *display);
133 gboolean (*supports_composite) (GdkDisplay *display);
134 gboolean (*supports_cursor_alpha) (GdkDisplay *display);
135 gboolean (*supports_cursor_color) (GdkDisplay *display);
137 gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
138 void (*store_clipboard) (GdkDisplay *display,
139 GdkWindow *clipboard_window,
141 const GdkAtom *targets,
144 void (*get_default_cursor_size) (GdkDisplay *display,
147 void (*get_maximal_cursor_size) (GdkDisplay *display,
150 GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
152 GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
154 GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
159 GList * (*list_devices) (GdkDisplay *display);
160 gboolean (*send_client_message) (GdkDisplay *display,
162 GdkNativeWindow winid);
163 void (*add_client_message_filter) (GdkDisplay *display,
164 GdkAtom message_type,
167 GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
168 GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
169 GdkNativeWindow winid,
170 GdkDragProtocol *protocol,
173 void (*before_process_all_updates) (GdkDisplay *display);
174 void (*after_process_all_updates) (GdkDisplay *display);
176 gulong (*get_next_serial) (GdkDisplay *display);
178 void (*notify_startup_complete) (GdkDisplay *display,
179 const gchar *startup_id);
182 void (*closed) (GdkDisplay *display,
187 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
189 GdkPointerWindowInfo *device_info,
192 void _gdk_display_device_grab_update (GdkDisplay *display,
194 GdkDevice *source_device,
195 gulong current_serial);
196 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
198 GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
201 GdkWindow *native_window,
202 GdkGrabOwnership grab_ownership,
203 gboolean owner_events,
204 GdkEventMask event_mask,
208 GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
211 gboolean _gdk_display_end_device_grab (GdkDisplay *display,
216 gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
219 void _gdk_display_enable_motion_hints (GdkDisplay *display,
221 GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
223 void _gdk_display_pointer_info_foreach (GdkDisplay *display,
224 GdkDisplayPointerInfoForeach func,
226 gulong _gdk_display_get_next_serial (GdkDisplay *display);
230 #endif /* __GDK_DISPLAY_PRIVATE_H__ */