1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24 
25 #ifndef __GDK_WINDOW_IMPL_H__
26 #define __GDK_WINDOW_IMPL_H__
27 
28 #include <gdk/gdkwindow.h>
29 #include <gdk/gdkproperty.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GDK_TYPE_WINDOW_IMPL           (gdk_window_impl_get_type ())
34 #define GDK_WINDOW_IMPL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
35 #define GDK_WINDOW_IMPL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
36 #define GDK_IS_WINDOW_IMPL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL))
37 #define GDK_IS_WINDOW_IMPL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL))
38 #define GDK_WINDOW_IMPL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
39 
40 typedef struct _GdkWindowImpl       GdkWindowImpl;
41 typedef struct _GdkWindowImplClass  GdkWindowImplClass;
42 
43 struct _GdkWindowImpl
44 {
45   GObject parent;
46 };
47 
48 struct _GdkWindowImplClass
49 {
50   GObjectClass parent_class;
51 
52   cairo_surface_t *
53                (* ref_cairo_surface)    (GdkWindow       *window);
54   cairo_surface_t *
55                (* create_similar_image_surface) (GdkWindow *     window,
56                                                  cairo_format_t  format,
57                                                  int             width,
58                                                  int             height);
59 
60   void         (* show)                 (GdkWindow       *window,
61 					 gboolean         already_mapped);
62   void         (* hide)                 (GdkWindow       *window);
63   void         (* withdraw)             (GdkWindow       *window);
64   void         (* raise)                (GdkWindow       *window);
65   void         (* lower)                (GdkWindow       *window);
66   void         (* restack_under)        (GdkWindow       *window,
67 					 GList           *native_siblings);
68   void         (* restack_toplevel)     (GdkWindow       *window,
69 					 GdkWindow       *sibling,
70 					 gboolean        above);
71 
72   void         (* move_resize)          (GdkWindow       *window,
73                                          gboolean         with_move,
74                                          gint             x,
75                                          gint             y,
76                                          gint             width,
77                                          gint             height);
78   void         (* move_to_rect)         (GdkWindow       *window,
79                                          const GdkRectangle *rect,
80                                          GdkGravity       rect_anchor,
81                                          GdkGravity       window_anchor,
82                                          GdkAnchorHints   anchor_hints,
83                                          gint             rect_anchor_dx,
84                                          gint             rect_anchor_dy);
85   void         (* set_background)       (GdkWindow       *window,
86                                          cairo_pattern_t *pattern);
87 
88   GdkEventMask (* get_events)           (GdkWindow       *window);
89   void         (* set_events)           (GdkWindow       *window,
90                                          GdkEventMask     event_mask);
91 
92   gboolean     (* reparent)             (GdkWindow       *window,
93                                          GdkWindow       *new_parent,
94                                          gint             x,
95                                          gint             y);
96 
97   void         (* set_device_cursor)    (GdkWindow       *window,
98                                          GdkDevice       *device,
99                                          GdkCursor       *cursor);
100 
101   void         (* get_geometry)         (GdkWindow       *window,
102                                          gint            *x,
103                                          gint            *y,
104                                          gint            *width,
105                                          gint            *height);
106   void         (* get_root_coords)      (GdkWindow       *window,
107 					 gint             x,
108 					 gint             y,
109                                          gint            *root_x,
110                                          gint            *root_y);
111   gboolean     (* get_device_state)     (GdkWindow       *window,
112                                          GdkDevice       *device,
113                                          gdouble         *x,
114                                          gdouble         *y,
115                                          GdkModifierType *mask);
116   gboolean    (* begin_paint)           (GdkWindow       *window);
117   void        (* end_paint)             (GdkWindow       *window);
118 
119   cairo_region_t * (* get_shape)        (GdkWindow       *window);
120   cairo_region_t * (* get_input_shape)  (GdkWindow       *window);
121   void         (* shape_combine_region) (GdkWindow       *window,
122                                          const cairo_region_t *shape_region,
123                                          gint             offset_x,
124                                          gint             offset_y);
125   void         (* input_shape_combine_region) (GdkWindow       *window,
126 					       const cairo_region_t *shape_region,
127 					       gint             offset_x,
128 					       gint             offset_y);
129 
130   /* Called before processing updates for a window. This gives the windowing
131    * layer a chance to save the region for later use in avoiding duplicate
132    * exposes.
133    */
134   void     (* queue_antiexpose)     (GdkWindow       *window,
135                                      cairo_region_t  *update_area);
136 
137 /* Called to do the windowing system specific part of gdk_window_destroy(),
138  *
139  * window: The window being destroyed
140  * recursing: If TRUE, then this is being called because a parent
141  *     was destroyed. This generally means that the call to the windowing
142  *     system to destroy the window can be omitted, since it will be
143  *     destroyed as a result of the parent being destroyed.
144  *     Unless @foreign_destroy
145  * foreign_destroy: If TRUE, the window or a parent was destroyed by some
146  *     external agency. The window has already been destroyed and no
147  *     windowing system calls should be made. (This may never happen
148  *     for some windowing systems.)
149  */
150   void         (* destroy)              (GdkWindow       *window,
151 					 gboolean         recursing,
152 					 gboolean         foreign_destroy);
153 
154 
155  /* Called when gdk_window_destroy() is called on a foreign window
156   * or an ancestor of the foreign window. It should generally reparent
157   * the window out of it's current heirarchy, hide it, and then
158   * send a message to the owner requesting that the window be destroyed.
159   */
160   void         (*destroy_foreign)       (GdkWindow       *window);
161 
162   /* optional */
163   gboolean     (* beep)                 (GdkWindow       *window);
164 
165   void         (* focus)                (GdkWindow       *window,
166 					 guint32          timestamp);
167   void         (* set_type_hint)        (GdkWindow       *window,
168 					 GdkWindowTypeHint hint);
169   GdkWindowTypeHint (* get_type_hint)   (GdkWindow       *window);
170   void         (* set_modal_hint)       (GdkWindow *window,
171 					 gboolean   modal);
172   void         (* set_skip_taskbar_hint) (GdkWindow *window,
173 					  gboolean   skips_taskbar);
174   void         (* set_skip_pager_hint)  (GdkWindow *window,
175 					 gboolean   skips_pager);
176   void         (* set_urgency_hint)     (GdkWindow *window,
177 					 gboolean   urgent);
178   void         (* set_geometry_hints)   (GdkWindow         *window,
179 					 const GdkGeometry *geometry,
180 					 GdkWindowHints     geom_mask);
181   void         (* set_title)            (GdkWindow   *window,
182 					 const gchar *title);
183   void         (* set_role)             (GdkWindow   *window,
184 					 const gchar *role);
185   void         (* set_startup_id)       (GdkWindow   *window,
186 					 const gchar *startup_id);
187   void         (* set_transient_for)    (GdkWindow *window,
188 					 GdkWindow *parent);
189   void         (* get_frame_extents)    (GdkWindow    *window,
190 					 GdkRectangle *rect);
191   void         (* set_override_redirect) (GdkWindow *window,
192 					  gboolean override_redirect);
193   void         (* set_accept_focus)     (GdkWindow *window,
194 					 gboolean accept_focus);
195   void         (* set_focus_on_map)     (GdkWindow *window,
196 					 gboolean focus_on_map);
197   void         (* set_icon_list)        (GdkWindow *window,
198 					 GList     *pixbufs);
199   void         (* set_icon_name)        (GdkWindow   *window,
200 					 const gchar *name);
201   void         (* iconify)              (GdkWindow *window);
202   void         (* deiconify)            (GdkWindow *window);
203   void         (* stick)                (GdkWindow *window);
204   void         (* unstick)              (GdkWindow *window);
205   void         (* maximize)             (GdkWindow *window);
206   void         (* unmaximize)           (GdkWindow *window);
207   void         (* fullscreen)           (GdkWindow *window);
208   void         (* fullscreen_on_monitor) (GdkWindow *window, gint monitor);
209   void         (* apply_fullscreen_mode) (GdkWindow *window);
210   void         (* unfullscreen)         (GdkWindow *window);
211   void         (* set_keep_above)       (GdkWindow *window,
212 					 gboolean   setting);
213   void         (* set_keep_below)       (GdkWindow *window,
214 					 gboolean   setting);
215   GdkWindow *  (* get_group)            (GdkWindow *window);
216   void         (* set_group)            (GdkWindow *window,
217 					 GdkWindow *leader);
218   void         (* set_decorations)      (GdkWindow      *window,
219 					 GdkWMDecoration decorations);
220   gboolean     (* get_decorations)      (GdkWindow       *window,
221 					 GdkWMDecoration *decorations);
222   void         (* set_functions)        (GdkWindow    *window,
223 					 GdkWMFunction functions);
224   void         (* begin_resize_drag)    (GdkWindow     *window,
225                                          GdkWindowEdge  edge,
226                                          GdkDevice     *device,
227                                          gint           button,
228                                          gint           root_x,
229                                          gint           root_y,
230                                          guint32        timestamp);
231   void         (* begin_move_drag)      (GdkWindow *window,
232                                          GdkDevice     *device,
233                                          gint       button,
234                                          gint       root_x,
235                                          gint       root_y,
236                                          guint32    timestamp);
237   void         (* enable_synchronized_configure) (GdkWindow *window);
238   void         (* configure_finished)   (GdkWindow *window);
239   void         (* set_opacity)          (GdkWindow *window,
240 					 gdouble    opacity);
241   void         (* set_composited)       (GdkWindow *window,
242                                          gboolean   composited);
243   void         (* destroy_notify)       (GdkWindow *window);
244   GdkDragProtocol (* get_drag_protocol) (GdkWindow *window,
245                                          GdkWindow **target);
246   void         (* register_dnd)         (GdkWindow *window);
247   GdkDragContext * (*drag_begin)        (GdkWindow *window,
248                                          GdkDevice *device,
249                                          GList     *targets,
250                                          gint       x_root,
251                                          gint       y_root);
252 
253   void         (*process_updates_recurse) (GdkWindow      *window,
254                                            cairo_region_t *region);
255 
256   void         (*sync_rendering)          (GdkWindow      *window);
257   gboolean     (*simulate_key)            (GdkWindow      *window,
258                                            gint            x,
259                                            gint            y,
260                                            guint           keyval,
261                                            GdkModifierType modifiers,
262                                            GdkEventType    event_type);
263   gboolean     (*simulate_button)         (GdkWindow      *window,
264                                            gint            x,
265                                            gint            y,
266                                            guint           button,
267                                            GdkModifierType modifiers,
268                                            GdkEventType    event_type);
269 
270   gboolean     (*get_property)            (GdkWindow      *window,
271                                            GdkAtom         property,
272                                            GdkAtom         type,
273                                            gulong          offset,
274                                            gulong          length,
275                                            gint            pdelete,
276                                            GdkAtom        *actual_type,
277                                            gint           *actual_format,
278                                            gint           *actual_length,
279                                            guchar        **data);
280   void         (*change_property)         (GdkWindow      *window,
281                                            GdkAtom         property,
282                                            GdkAtom         type,
283                                            gint            format,
284                                            GdkPropMode     mode,
285                                            const guchar   *data,
286                                            gint            n_elements);
287   void         (*delete_property)         (GdkWindow      *window,
288                                            GdkAtom         property);
289 
290   gint         (* get_scale_factor)       (GdkWindow      *window);
291   void         (* get_unscaled_size)      (GdkWindow      *window,
292                                            int            *unscaled_width,
293                                            int            *unscaled_height);
294 
295   void         (* set_opaque_region)      (GdkWindow      *window,
296                                            cairo_region_t *region);
297   void         (* set_shadow_width)       (GdkWindow      *window,
298                                            gint            left,
299                                            gint            right,
300                                            gint            top,
301                                            gint            bottom);
302   gboolean     (* show_window_menu)       (GdkWindow      *window,
303                                            GdkEvent       *event);
304   GdkGLContext *(*create_gl_context)      (GdkWindow      *window,
305 					   gboolean        attached,
306                                            GdkGLContext   *share,
307                                            GError        **error);
308   gboolean     (* realize_gl_context)     (GdkWindow      *window,
309                                            GdkGLContext   *context,
310                                            GError        **error);
311   void         (*invalidate_for_new_frame)(GdkWindow      *window,
312                                            cairo_region_t *update_area);
313 
314   GdkDrawingContext *(* create_draw_context)  (GdkWindow            *window,
315                                                const cairo_region_t *region);
316   void               (* destroy_draw_context) (GdkWindow            *window,
317                                                GdkDrawingContext    *context);
318 };
319 
320 /* Interface Functions */
321 GType gdk_window_impl_get_type (void) G_GNUC_CONST;
322 
323 G_END_DECLS
324 
325 #endif /* __GDK_WINDOW_IMPL_H__ */
326