1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team.
26 * GTK+ DirectFB backend
27 * Copyright (C) 2001-2002 convergence integrated media GmbH
28 * Copyright (C) 2002-2004 convergence GmbH
29 * Written by Denis Oliver Kropp <dok@convergence.de> and
30 * Sven Neumann <sven@convergence.de>
33 #ifndef __GDK_PRIVATE_DIRECTFB_H__
34 #define __GDK_PRIVATE_DIRECTFB_H__
36 //#include <gdk/gdk.h>
37 #include <gdk/gdkprivate.h>
38 #include "gdkinternals.h"
39 #include "gdkcursor.h"
40 #include "gdkdisplay-directfb.h"
41 #include "gdkregion-generic.h"
46 #include <directfb_util.h>
49 #define GDK_TYPE_DRAWABLE_IMPL_DIRECTFB (gdk_drawable_impl_directfb_get_type ())
50 #define GDK_DRAWABLE_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_DIRECTFB, GdkDrawableImplDirectFB))
51 #define GDK_IS_DRAWABLE_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_DIRECTFB))
53 #define GDK_TYPE_WINDOW_IMPL_DIRECTFB (gdk_window_impl_directfb_get_type ())
54 #define GDK_WINDOW_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_DIRECTFB, GdkWindowImplDirectFB))
55 #define GDK_IS_WINDOW_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_DIRECTFB))
57 #define GDK_TYPE_PIXMAP_IMPL_DIRECTFB (gdk_pixmap_impl_directfb_get_type ())
58 #define GDK_PIXMAP_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL_DIRECTFB, GdkPixmapImplDirectFB))
59 #define GDK_IS_PIXMAP_IMPL_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL_DIRECTFB))
62 typedef struct _GdkDrawableImplDirectFB GdkDrawableImplDirectFB;
63 typedef struct _GdkWindowImplDirectFB GdkWindowImplDirectFB;
64 typedef struct _GdkPixmapImplDirectFB GdkPixmapImplDirectFB;
67 struct _GdkDrawableImplDirectFB
69 GdkDrawable parent_object;
75 GdkRegion paint_region;
82 GdkRegion clip_region;
84 GdkColormap *colormap;
86 IDirectFBSurface *surface;
87 DFBSurfacePixelFormat format;
88 cairo_surface_t * cairo_surface;
94 GdkDrawableClass parent_class;
95 } GdkDrawableImplDirectFBClass;
97 GType gdk_drawable_impl_directfb_get_type (void);
99 GdkEvent * gdk_directfb_event_make (GdkWindow *window,
107 struct _GdkPixmapImplDirectFB
109 GdkDrawableImplDirectFB parent_instance;
114 GdkDrawableImplDirectFBClass parent_class;
115 } GdkPixmapImplDirectFBClass;
117 GType gdk_pixmap_impl_directfb_get_type (void);
134 struct _GdkWindowImplDirectFB
136 GdkDrawableImplDirectFB drawable;
137 GdkWindow *gdkWindow;
139 IDirectFBWindow *window;
144 GHashTable *properties;
148 GdkWindowTypeHint type_hint;
151 DFBRegion flip_regions[4];
156 GdkDrawableImplDirectFBClass parent_class;
157 } GdkWindowImplDirectFBClass;
159 GType gdk_window_impl_directfb_get_type (void);
161 void gdk_directfb_window_send_crossing_events (GdkWindow *src,
163 GdkCrossingMode mode);
165 void _gdk_directfb_calc_abs (GdkWindow *window);
167 GdkWindow * gdk_directfb_window_find_toplevel (GdkWindow *window);
170 void gdk_directfb_window_id_table_insert (DFBWindowID dfb_id,
172 void gdk_directfb_window_id_table_remove (DFBWindowID dfb_id);
173 GdkWindow * gdk_directfb_window_id_table_lookup (DFBWindowID dfb_id);
175 void _gdk_directfb_window_get_offsets (GdkWindow *window,
178 void _gdk_directfb_window_scroll (GdkWindow *window,
181 void _gdk_directfb_window_move_region (GdkWindow *window,
182 const GdkRegion *region,
193 IDirectFBSurface *shape;
199 DFBSurfacePixelFormat format;
204 IDirectFBSurface *surface;
208 #define GDK_TYPE_GC_DIRECTFB (_gdk_gc_directfb_get_type ())
209 #define GDK_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_DIRECTFB, GdkGCDirectFB))
210 #define GDK_IS_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_DIRECTFB))
214 GdkGC parent_instance;
216 GdkRegion clip_region;
218 GdkGCValuesMask values_mask;
224 GdkGCClass parent_class;
225 } GdkGCDirectFBClass;
227 GType _gdk_gc_directfb_get_type (void);
229 GdkGC * _gdk_directfb_gc_new (GdkDrawable *drawable,
231 GdkGCValuesMask values_mask);
233 GdkImage* _gdk_directfb_copy_to_image (GdkDrawable *drawable,
242 void gdk_directfb_event_windows_add (GdkWindow *window);
243 void gdk_directfb_event_windows_remove (GdkWindow *window);
245 GdkGrabStatus gdk_directfb_keyboard_grab (GdkDisplay *display,
250 void gdk_directfb_keyboard_ungrab(GdkDisplay *display,
253 GdkGrabStatus gdk_directfb_pointer_grab (GdkWindow *window,
255 GdkEventMask event_mask,
256 GdkWindow *confine_to,
259 gboolean implicit_grab);
260 void gdk_directfb_pointer_ungrab (guint32 time,
261 gboolean implicit_grab);
263 guint32 gdk_directfb_get_time (void);
265 GdkWindow * gdk_directfb_pointer_event_window (GdkWindow *window,
267 GdkWindow * gdk_directfb_keyboard_event_window (GdkWindow *window,
269 GdkWindow * gdk_directfb_other_event_window (GdkWindow *window,
271 void _gdk_selection_window_destroyed (GdkWindow *window);
273 void _gdk_directfb_move_resize_child (GdkWindow *window,
279 GdkWindow * gdk_directfb_child_at (GdkWindow *window,
283 GdkWindow * gdk_directfb_window_find_focus (void);
285 void gdk_directfb_change_focus (GdkWindow *new_focus_window);
287 void gdk_directfb_mouse_get_info (gint *x,
289 GdkModifierType *mask);
291 /**********************/
292 /* Global variables */
293 /**********************/
295 extern GdkDisplayDFB *_gdk_display;
297 /* Pointer grab info */
298 extern GdkWindow * _gdk_directfb_pointer_grab_window;
299 extern gboolean _gdk_directfb_pointer_grab_owner_events;
300 extern GdkWindow * _gdk_directfb_pointer_grab_confine;
301 extern GdkEventMask _gdk_directfb_pointer_grab_events;
302 extern GdkCursor * _gdk_directfb_pointer_grab_cursor;
304 /* Keyboard grab info */
305 extern GdkWindow * _gdk_directfb_keyboard_grab_window;
306 extern GdkEventMask _gdk_directfb_keyboard_grab_events;
307 extern gboolean _gdk_directfb_keyboard_grab_owner_events;
309 extern GdkScreen * _gdk_screen;
311 extern GdkAtom _gdk_selection_property;
314 IDirectFBPalette * gdk_directfb_colormap_get_palette (GdkColormap *colormap);
317 /* these are Linux-FB specific functions used for window decorations */
319 typedef gboolean (* GdkWindowChildChanged) (GdkWindow *window,
325 typedef void (* GdkWindowChildGetPos) (GdkWindow *window,
330 void gdk_fb_window_set_child_handler (GdkWindow *window,
331 GdkWindowChildChanged changed,
332 GdkWindowChildGetPos get_pos,
335 void gdk_directfb_clip_region (GdkDrawable *drawable,
337 GdkRectangle *draw_rect,
338 GdkRegion *ret_clip);
341 /* Utilities for avoiding mallocs */
344 temp_region_init_copy( GdkRegion *region,
345 const GdkRegion *source)
347 if (region != source) /* don't want to copy to itself */
349 if (region->size < source->numRects)
351 if (region->rects && region->rects != ®ion->extents)
352 g_free( region->rects );
354 region->rects = g_new (GdkRegionBox, source->numRects);
355 region->size = source->numRects;
358 region->numRects = source->numRects;
359 region->extents = source->extents;
361 memcpy( region->rects, source->rects, source->numRects * sizeof (GdkRegionBox) );
366 temp_region_init_rectangle( GdkRegion *region,
367 const GdkRectangle *rect )
369 region->numRects = 1;
370 region->rects = ®ion->extents;
371 region->extents.x1 = rect->x;
372 region->extents.y1 = rect->y;
373 region->extents.x2 = rect->x + rect->width;
374 region->extents.y2 = rect->y + rect->height;
379 temp_region_init_rectangle_vals( GdkRegion *region,
385 region->numRects = 1;
386 region->rects = ®ion->extents;
387 region->extents.x1 = x;
388 region->extents.y1 = y;
389 region->extents.x2 = x + w;
390 region->extents.y2 = y + h;
395 temp_region_reset( GdkRegion *region )
397 if (region->size > 32 && region->rects && region->rects != ®ion->extents) {
398 g_free( region->rects );
401 region->rects = ®ion->extents;
404 region->numRects = 0;
408 temp_region_deinit( GdkRegion *region )
410 if (region->rects && region->rects != ®ion->extents) {
411 g_free( region->rects );
412 region->rects = NULL;
415 region->numRects = 0;
419 #define GDKDFB_RECTANGLE_VALS_FROM_BOX(s) (s)->x1, (s)->y1, (s)->x2-(s)->x1, (s)->y2-(s)->y1
422 #endif /* __GDK_PRIVATE_DIRECTFB_H__ */