]> Pileus Git - ~andy/gtk/blob - gdk/gdkdisplayprivate.h
Add a vfunc for gdk_selection_send_notify_for_display
[~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 "gdkwindow.h"
25 #include "gdkcursor.h"
26
27 G_BEGIN_DECLS
28
29 typedef struct _GdkDisplayClass GdkDisplayClass;
30
31 /* Tracks information about the keyboard grab on this display */
32 typedef struct
33 {
34   GdkWindow *window;
35   GdkWindow *native_window;
36   gulong serial;
37   gboolean owner_events;
38   guint32 time;
39 } GdkKeyboardGrabInfo;
40
41 /* Tracks information about the pointer grab on this display */
42 typedef struct
43 {
44   GdkWindow *window;
45   GdkWindow *native_window;
46   gulong serial_start;
47   gulong serial_end; /* exclusive, i.e. not active on serial_end */
48   gboolean owner_events;
49   guint event_mask;
50   gboolean implicit;
51   guint32 time;
52   GdkGrabOwnership ownership;
53
54   guint activated : 1;
55   guint implicit_ungrab : 1;
56 } GdkDeviceGrabInfo;
57
58 /* Tracks information about which window and position the pointer last was in.
59  * This is useful when we need to synthesize events later.
60  * Note that we track toplevel_under_pointer using enter/leave events,
61  * so in the case of a grab, either with owner_events==FALSE or with the
62  * pointer in no clients window the x/y coordinates may actually be outside
63  * the window.
64  */
65 typedef struct
66 {
67   GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
68                                      /* tracked via native events */
69   GdkWindow *window_under_pointer;   /* window that last got a normal enter event */
70   gdouble toplevel_x, toplevel_y;
71   guint32 state;
72   guint32 button;
73 } GdkPointerWindowInfo;
74
75 typedef struct
76 {
77   guint32 button_click_time[2]; /* last 2 button click times */
78   GdkWindow *button_window[2];  /* last 2 windows to receive button presses */
79   gint button_number[2];        /* last 2 buttons to be pressed */
80   gint button_x[2];             /* last 2 button click positions */
81   gint button_y[2];
82 } GdkMultipleClickInfo;
83
84 struct _GdkDisplay
85 {
86   GObject parent_instance;
87
88   GList *queued_events;
89   GList *queued_tail;
90
91   /* Information for determining if the latest button click
92    * is part of a double-click or triple-click
93    */
94   GHashTable *multiple_click_info;
95   guint double_click_time;  /* Maximum time between clicks in msecs */
96   GdkDevice *core_pointer;  /* Core pointer device */
97
98   const GdkDisplayDeviceHooks *device_hooks; /* Hooks for querying pointer */
99
100   guint closed             : 1;  /* Whether this display has been closed */
101   guint ignore_core_events : 1;  /* Don't send core motion and button event */
102
103   guint double_click_distance;   /* Maximum distance between clicks in pixels */
104
105   GHashTable *device_grabs;
106   GHashTable *motion_hint_info;
107
108   GHashTable *pointers_info;  /* GdkPointerWindowInfo for each device */
109   guint32 last_event_time;    /* Last reported event time from server */
110
111   GdkDeviceManager *device_manager;
112 };
113
114 struct _GdkDisplayClass
115 {
116   GObjectClass parent_class;
117
118   G_CONST_RETURN gchar *     (*get_name)           (GdkDisplay *display);
119   gint                       (*get_n_screens)      (GdkDisplay *display);
120   GdkScreen *                (*get_screen)         (GdkDisplay *display,
121                                                     gint        screen_num);
122   GdkScreen *                (*get_default_screen) (GdkDisplay *display);
123   void                       (*beep)               (GdkDisplay *display);
124   void                       (*sync)               (GdkDisplay *display);
125   void                       (*flush)              (GdkDisplay *display);
126   gboolean                   (*has_pending)        (GdkDisplay *display);
127   void                       (*queue_events)       (GdkDisplay *display);
128   GdkWindow *                (*get_default_group)  (GdkDisplay *display);
129   gboolean                   (*supports_selection_notification) (GdkDisplay *display);
130   gboolean                   (*request_selection_notification)  (GdkDisplay *display,
131                                                                  GdkAtom     selection);
132   gboolean                   (*supports_shapes)       (GdkDisplay *display);
133   gboolean                   (*supports_input_shapes) (GdkDisplay *display);
134   gboolean                   (*supports_composite)    (GdkDisplay *display);
135   gboolean                   (*supports_cursor_alpha) (GdkDisplay *display);
136   gboolean                   (*supports_cursor_color) (GdkDisplay *display);
137
138   gboolean                   (*supports_clipboard_persistence)  (GdkDisplay *display);
139   void                       (*store_clipboard)    (GdkDisplay    *display,
140                                                     GdkWindow     *clipboard_window,
141                                                     guint32        time_,
142                                                     const GdkAtom *targets,
143                                                     gint           n_targets);
144
145   void                       (*get_default_cursor_size) (GdkDisplay *display,
146                                                          guint      *width,
147                                                          guint      *height);
148   void                       (*get_maximal_cursor_size) (GdkDisplay *display,
149                                                          guint      *width,
150                                                          guint      *height);
151   GdkCursor *                (*get_cursor_for_type)     (GdkDisplay    *display,
152                                                          GdkCursorType  type);
153   GdkCursor *                (*get_cursor_for_name)     (GdkDisplay    *display,
154                                                          const gchar   *name);
155   GdkCursor *                (*get_cursor_for_pixbuf)   (GdkDisplay    *display,
156                                                          GdkPixbuf     *pixbuf,
157                                                          gint           x,
158                                                          gint           y);
159
160   GList *                    (*list_devices)       (GdkDisplay *display);
161   gboolean                   (*send_client_message) (GdkDisplay     *display,
162                                                      GdkEvent       *event,
163                                                      GdkNativeWindow winid);
164   void                       (*add_client_message_filter) (GdkDisplay   *display,
165                                                            GdkAtom       message_type,
166                                                            GdkFilterFunc func,
167                                                            gpointer      data);
168   GdkAppLaunchContext *      (*get_app_launch_context) (GdkDisplay *display);
169   GdkNativeWindow            (*get_drag_protocol)      (GdkDisplay      *display,
170                                                         GdkNativeWindow  winid,
171                                                         GdkDragProtocol *protocol,
172                                                         guint           *version);
173
174   void                       (*before_process_all_updates) (GdkDisplay *display);
175   void                       (*after_process_all_updates)  (GdkDisplay *display);
176
177   gulong                     (*get_next_serial) (GdkDisplay *display);
178
179   void                       (*notify_startup_complete) (GdkDisplay  *display,
180                                                          const gchar *startup_id);
181   void                       (*event_data_copy) (GdkDisplay     *display,
182                                                  const GdkEvent *event,
183                                                  GdkEvent       *new_event);
184   void                       (*event_data_free) (GdkDisplay     *display,
185                                                  GdkEvent       *event);
186   void                       (*create_window_impl) (GdkDisplay    *display,
187                                                     GdkWindow     *window,
188                                                     GdkWindow     *real_parent,
189                                                     GdkScreen     *screen,
190                                                     GdkEventMask   event_mask,
191                                                     GdkWindowAttr *attributes,
192                                                     gint           attributes_mask);
193
194   GdkKeymap *                (*get_keymap)         (GdkDisplay    *display);
195   void                       (*push_error_trap)    (GdkDisplay    *display);
196   gint                       (*pop_error_trap)     (GdkDisplay    *display,
197                                                     gboolean       ignore);
198
199   GdkWindow *                (*get_selection_owner) (GdkDisplay   *display,
200                                                      GdkAtom       selection);
201   gboolean                   (*set_selection_owner) (GdkDisplay   *display,
202                                                      GdkWindow    *owner,
203                                                      GdkAtom       selection,
204                                                      guint32       time,
205                                                      gboolean      send_event);
206   void                       (*send_selection_notify) (GdkDisplay *dispay,
207                                                        GdkNativeWindow  requestor,
208                                                        GdkAtom          selection,
209                                                        GdkAtom          target,
210                                                        GdkAtom          property,
211                                                        guint32          time_);
212
213   /* Signals */
214   void (*closed) (GdkDisplay *display,
215                   gboolean    is_error);
216 };
217
218
219 typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay           *display,
220                                                GdkDevice            *device,
221                                                GdkPointerWindowInfo *device_info,
222                                                gpointer              user_data);
223
224 void                _gdk_display_device_grab_update   (GdkDisplay *display,
225                                                        GdkDevice  *device,
226                                                        GdkDevice  *source_device,
227                                                        gulong      current_serial);
228 GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
229                                                        GdkDevice  *device);
230 GdkDeviceGrabInfo * _gdk_display_add_device_grab      (GdkDisplay       *display,
231                                                        GdkDevice        *device,
232                                                        GdkWindow        *window,
233                                                        GdkWindow        *native_window,
234                                                        GdkGrabOwnership  grab_ownership,
235                                                        gboolean          owner_events,
236                                                        GdkEventMask      event_mask,
237                                                        gulong            serial_start,
238                                                        guint32           time,
239                                                        gboolean          implicit);
240 GdkDeviceGrabInfo * _gdk_display_has_device_grab      (GdkDisplay       *display,
241                                                        GdkDevice        *device,
242                                                        gulong            serial);
243 gboolean            _gdk_display_end_device_grab      (GdkDisplay       *display,
244                                                        GdkDevice        *device,
245                                                        gulong            serial,
246                                                        GdkWindow        *if_child,
247                                                        gboolean          implicit);
248 gboolean            _gdk_display_check_grab_ownership (GdkDisplay       *display,
249                                                        GdkDevice        *device,
250                                                        gulong            serial);
251 void                _gdk_display_enable_motion_hints  (GdkDisplay       *display,
252                                                        GdkDevice        *device);
253 GdkPointerWindowInfo * _gdk_display_get_pointer_info  (GdkDisplay       *display,
254                                                        GdkDevice        *device);
255 void                _gdk_display_pointer_info_foreach (GdkDisplay       *display,
256                                                        GdkDisplayPointerInfoForeach func,
257                                                        gpointer          user_data);
258 gulong              _gdk_display_get_next_serial      (GdkDisplay       *display);
259 void                _gdk_display_event_data_copy      (GdkDisplay       *display,
260                                                        const GdkEvent   *event,
261                                                        GdkEvent         *new_event);
262 void                _gdk_display_event_data_free      (GdkDisplay       *display,
263                                                        GdkEvent         *event);
264 void                _gdk_display_create_window_impl   (GdkDisplay       *display,
265                                                        GdkWindow        *window,
266                                                        GdkWindow        *real_parent,
267                                                        GdkScreen        *screen,
268                                                        GdkEventMask      event_mask,
269                                                        GdkWindowAttr    *attributes,
270                                                        gint              attributes_mask);
271
272 G_END_DECLS
273
274 #endif  /* __GDK_DISPLAY_PRIVATE_H__ */