]> Pileus Git - ~andy/gtk/blob - gdk/gdkdisplayprivate.h
Add a vfunc for gdk_notify_startup_complete
[~andy/gtk] / gdk / gdkdisplayprivate.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 2010 Red Hat, Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #ifndef __GDK_DISPLAY_PRIVATE_H__
21 #define __GDK_DISPLAY_PRIVATE_H__
22
23 #include "gdkdisplay.h"
24 #include "gdkcursor.h"
25
26 G_BEGIN_DECLS
27
28 typedef struct _GdkDisplayClass GdkDisplayClass;
29
30 /* Tracks information about the keyboard grab on this display */
31 typedef struct
32 {
33   GdkWindow *window;
34   GdkWindow *native_window;
35   gulong serial;
36   gboolean owner_events;
37   guint32 time;
38 } GdkKeyboardGrabInfo;
39
40 /* Tracks information about the pointer grab on this display */
41 typedef struct
42 {
43   GdkWindow *window;
44   GdkWindow *native_window;
45   gulong serial_start;
46   gulong serial_end; /* exclusive, i.e. not active on serial_end */
47   gboolean owner_events;
48   guint event_mask;
49   gboolean implicit;
50   guint32 time;
51   GdkGrabOwnership ownership;
52
53   guint activated : 1;
54   guint implicit_ungrab : 1;
55 } GdkDeviceGrabInfo;
56
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
62  * the window.
63  */
64 typedef struct
65 {
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;
70   guint32 state;
71   guint32 button;
72 } GdkPointerWindowInfo;
73
74 typedef struct
75 {
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 */
80   gint button_y[2];
81 } GdkMultipleClickInfo;
82
83 struct _GdkDisplay
84 {
85   GObject parent_instance;
86
87   GList *queued_events;
88   GList *queued_tail;
89
90   /* Information for determining if the latest button click
91    * is part of a double-click or triple-click
92    */
93   GHashTable *multiple_click_info;
94   guint double_click_time;  /* Maximum time between clicks in msecs */
95   GdkDevice *core_pointer;  /* Core pointer device */
96
97   const GdkDisplayDeviceHooks *device_hooks; /* Hooks for querying pointer */
98
99   guint closed             : 1;  /* Whether this display has been closed */
100   guint ignore_core_events : 1;  /* Don't send core motion and button event */
101
102   guint double_click_distance;   /* Maximum distance between clicks in pixels */
103
104   GHashTable *device_grabs;
105   GHashTable *motion_hint_info;
106
107   GHashTable *pointers_info;  /* GdkPointerWindowInfo for each device */
108   guint32 last_event_time;    /* Last reported event time from server */
109
110   GdkDeviceManager *device_manager;
111 };
112
113 struct _GdkDisplayClass
114 {
115   GObjectClass parent_class;
116
117   G_CONST_RETURN gchar *     (*get_name)           (GdkDisplay *display);
118   gint                       (*get_n_screens)      (GdkDisplay *display);
119   GdkScreen *                (*get_screen)         (GdkDisplay *display,
120                                                     gint        screen_num);
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,
130                                                                  GdkAtom     selection);
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);
136
137   gboolean                   (*supports_clipboard_persistence)  (GdkDisplay *display);
138   void                       (*store_clipboard)    (GdkDisplay    *display,
139                                                     GdkWindow     *clipboard_window,
140                                                     guint32        time_,
141                                                     const GdkAtom *targets,
142                                                     gint           n_targets);
143
144   void                       (*get_default_cursor_size) (GdkDisplay *display,
145                                                          guint      *width,
146                                                          guint      *height);
147   void                       (*get_maximal_cursor_size) (GdkDisplay *display,
148                                                          guint      *width,
149                                                          guint      *height);
150   GdkCursor *                (*get_cursor_for_type)     (GdkDisplay    *display,
151                                                          GdkCursorType  type);
152   GdkCursor *                (*get_cursor_for_name)     (GdkDisplay    *display,
153                                                          const gchar   *name);
154   GdkCursor *                (*get_cursor_for_pixbuf)   (GdkDisplay    *display,
155                                                          GdkPixbuf     *pixbuf,
156                                                          gint           x,
157                                                          gint           y);
158
159   GList *                    (*list_devices)       (GdkDisplay *display);
160   gboolean                   (*send_client_message) (GdkDisplay     *display,
161                                                      GdkEvent       *event,
162                                                      GdkNativeWindow winid);
163   void                       (*add_client_message_filter) (GdkDisplay   *display,
164                                                            GdkAtom       message_type,
165                                                            GdkFilterFunc func,
166                                                            gpointer      data);
167   GdkAppLaunchContext *      (*get_app_launch_context) (GdkDisplay *display);
168   GdkNativeWindow            (*get_drag_protocol)      (GdkDisplay      *display,
169                                                         GdkNativeWindow  winid,
170                                                         GdkDragProtocol *protocol,
171                                                         guint           *version);
172
173   void                       (*before_process_all_updates) (GdkDisplay *display);
174   void                       (*after_process_all_updates)  (GdkDisplay *display);
175
176   gulong                     (*get_next_serial) (GdkDisplay *display);
177
178   void                       (*notify_startup_complete) (GdkDisplay  *display,
179                                                          const gchar *startup_id);
180
181   /* Signals */
182   void (*closed) (GdkDisplay *display,
183                   gboolean    is_error);
184 };
185
186
187 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay           *display,
188                                                GdkDevice            *device,
189                                                GdkPointerWindowInfo *device_info,
190                                                gpointer              user_data);
191
192 void                _gdk_display_device_grab_update   (GdkDisplay *display,
193                                                        GdkDevice  *device,
194                                                        GdkDevice  *source_device,
195                                                        gulong      current_serial);
196 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
197                                                        GdkDevice  *device);
198 GdkDeviceGrabInfo * _gdk_display_add_device_grab      (GdkDisplay       *display,
199                                                        GdkDevice        *device,
200                                                        GdkWindow        *window,
201                                                        GdkWindow        *native_window,
202                                                        GdkGrabOwnership  grab_ownership,
203                                                        gboolean          owner_events,
204                                                        GdkEventMask      event_mask,
205                                                        gulong            serial_start,
206                                                        guint32           time,
207                                                        gboolean          implicit);
208 GdkDeviceGrabInfo * _gdk_display_has_device_grab      (GdkDisplay       *display,
209                                                        GdkDevice        *device,
210                                                        gulong            serial);
211 gboolean            _gdk_display_end_device_grab      (GdkDisplay       *display,
212                                                        GdkDevice        *device,
213                                                        gulong            serial,
214                                                        GdkWindow        *if_child,
215                                                        gboolean          implicit);
216 gboolean            _gdk_display_check_grab_ownership (GdkDisplay       *display,
217                                                        GdkDevice        *device,
218                                                        gulong            serial);
219 void                _gdk_display_enable_motion_hints  (GdkDisplay       *display,
220                                                        GdkDevice        *device);
221 GdkPointerWindowInfo * _gdk_display_get_pointer_info  (GdkDisplay       *display,
222                                                        GdkDevice        *device);
223 void                _gdk_display_pointer_info_foreach (GdkDisplay       *display,
224                                                        GdkDisplayPointerInfoForeach func,
225                                                        gpointer          user_data);
226 gulong              _gdk_display_get_next_serial      (GdkDisplay       *display);
227
228 G_END_DECLS
229
230 #endif  /* __GDK_DISPLAY_PRIVATE_H__ */