GTKDFB Debugging Patch
- From: Denis Oliver Kropp <dok directfb org>
- To: gtk-devel-list gnome org, directfb-dev <directfb-dev directfb org>
- Subject: GTKDFB Debugging Patch
- Date: Wed, 30 Jan 2008 03:11:52 +0100
Hi,
here's another patch.
It adds debug messages using DirectFB's debugging system which is part of libdirect,
the base library of DirectFB, the dlib, how you like it :-D
I know there's g_log, but if I'm debugging a problem in GdkDirectFB, I need its debug
messages in line with the lower level ones from DirectFB or even Fusion, with thread
name, pid, etc.
Did you know? With libdirect's builtin stack trace support it's even possible (for years)
to have an automatically indented debug output. The thread name is managed by DirectThread,
but any thread, no matter how it was created, can call direct_thread_set_name() at any time.
(-) [Main Thread 6.350] ( 966) GDKDFB/Updates: gdk_window_directfb_process_all_updates()
(-) [Main Thread 6.352] ( 966) GDKDFB/Updates: -> 0x3c4b0 update [ 0, 0- 1x 1] (0 boxes)
(-) [Main Thread 6.354] ( 966) GDKDFB/Paintable: gdk_window_impl_directfb_process_updates( 0x3d1e0, update
children )
(-) [Main Thread 6.355] ( 966) GDKDFB/Paintable: -> update area 0, 0- 154x 57
(-) [Main Thread 6.358] ( 966) GDKDFB/Window: gdk_window_impl_directfb_begin_paint_region( 0x3d1e0 )
<- 0, 0- 154, 57 (1 boxes)
(-) [Main Thread 6.359] ( 966) GDKDFB/DrawClip: gdk_directfb_clip_region( 0x3d1e0, (nil), (nil) )
(-) [Main Thread 6.361] ( 966) GDKDFB/DrawClip: -> draw rectangle == 0, 0 - 154x 57 =
(-) [Main Thread 6.363] ( 966) GDKDFB/DrawClip: => returning clip >> 0, 0 - 154x 57 <<
(1 boxes)
(-) [Main Thread 6.365] ( 966) GDKDFB/Window: -> painting 0, 0- 155x 58 (1 boxes)
(-) [Main Thread 6.366] ( 966) GDKDFB/Window: -> clipped 0, 0- 155x 58 (1 boxes)
(-) [Main Thread 6.368] ( 966) GDKDFB/Window: -> depth is now 1
(-) [Main Thread 6.370] ( 966) GDKDFB/Window: -> [ 0] 0, 0- 154x 57
(-) [Main Thread 6.372] ( 966) GDKDFB/Drawable: _gdk_directfb_draw_rectangle( 0x3d1e0, 0x45ea40,
filled, 0, 0 - 154x 57 )
(-) [Main Thread 6.374] ( 966) GDKDFB/DrawClip: gdk_directfb_clip_region( 0x3d1e0, 0x45ea40,
0xbea71a40 )
(-) [Main Thread 6.376] ( 966) GDKDFB/DrawClip: -> draw rectangle == 0, 0 - 154x 57 =
(-) [Main Thread 6.377] ( 966) GDKDFB/DrawClip: -> buffered region > 0, 0 - 154x 57 <
(1 boxes)
(-) [Main Thread 6.379] ( 966) GDKDFB/DrawClip: -> clipping region > 0, 0 - 154x 57 <
(1 boxes)
(-) [Main Thread 6.381] ( 966) GDKDFB/DrawClip: => returning clip >> 0, 0 - 154x 57 <<
(1 boxes)
(-) [Main Thread 6.387] ( 966) GDKDFB/Drawable: gdk_directfb_draw_pixbuf( 0x3d1e0, 0x45e830, 0x1ee438,
0, 0 -> 3, 6 - 150x50 )
(-) [Main Thread 6.417] ( 966) GDKDFB/Window: gdk_window_impl_directfb_end_paint( 0x3d1e0 )
(-) [Main Thread 6.419] ( 966) GDKDFB/Window: -> queue flip 0, 0- 154x 57 (1 boxes)
(-) [Main Thread 6.421] ( 966) GDKDFB/Updates: -> 0x3c5b8 update [ 0, 0- 1x 1] (0 boxes)
(-) [Main Thread 6.423] ( 966) GDKDFB/Paintable: gdk_window_impl_directfb_process_updates( 0x3d4b0, update
children )
(-) [Main Thread 6.425] ( 966) GDKDFB/Paintable: -> update area 0, 0- 632x 281
(-) [Main Thread 6.427] ( 966) GDKDFB/Window: gdk_window_impl_directfb_begin_paint_region( 0x3d4b0 )
<- 0, 0- 632, 281 (14 boxes)
(-) [Main Thread 6.428] ( 966) GDKDFB/DrawClip: gdk_directfb_clip_region( 0x3d4b0, (nil), (nil) )
(-) [Main Thread 6.430] ( 966) GDKDFB/DrawClip: -> draw rectangle == 0, 0 - 632x 281 =
(-) [Main Thread 6.432] ( 966) GDKDFB/DrawClip: -> clipping child [ 334, 142 - 300x 66 ]
(-) [Main Thread 6.434] ( 966) GDKDFB/DrawClip: -> clipping child [ 334, 72 - 300x 66 ]
(-) [Main Thread 6.436] ( 966) GDKDFB/DrawClip: -> clipping child [ 334, 3 - 300x 65 ]
(-) [Main Thread 6.438] ( 966) GDKDFB/DrawClip: -> clipping child [ 3, 212 - 327x 66 ]
(-) [Main Thread 6.439] ( 966) GDKDFB/DrawClip: -> clipping child [ 3, 142 - 327x 66 ]
(-) [Main Thread 6.441] ( 966) GDKDFB/DrawClip: -> clipping child [ 3, 72 - 327x 66 ]
(-) [Main Thread 6.443] ( 966) GDKDFB/DrawClip: -> clipping child [ 3, 3 - 327x 65 ]
(-) [Main Thread 6.445] ( 966) GDKDFB/DrawClip: -> clipping child [ 486, 212 - 148x 66 ]
(-) [Main Thread 6.447] ( 966) GDKDFB/DrawClip: -> clipping child [ 334, 212 - 148x 66 ]
(-) [Main Thread 6.449] ( 966) GDKDFB/DrawClip: => returning clip >> 0, 0 - 632x 281 <<
(14 boxes)
(-) [Main Thread 6.451] ( 966) GDKDFB/Window: -> painting 0, 0- 633x 282 (14 boxes)
(-) [Main Thread 6.453] ( 966) GDKDFB/Window: -> clipped 0, 0- 633x 282 (14 boxes)
(-) [Main Thread 6.454] ( 966) GDKDFB/Window: -> depth is now 1
(-) [Main Thread 6.456] ( 966) GDKDFB/Window: -> [ 0] 0, 0- 632x 3
(-) [Main Thread 6.458] ( 966) GDKDFB/Window: -> [ 1] 0, 3- 3x 65
(-) [Main Thread 6.459] ( 966) GDKDFB/Window: -> [ 2] 330, 3- 4x 65
(-) [Main Thread 6.461] ( 966) GDKDFB/Window: -> [ 3] 0, 68- 632x 4
(-) [Main Thread 6.463] ( 966) GDKDFB/Window: -> [ 4] 0, 72- 3x 66
(-) [Main Thread 6.464] ( 966) GDKDFB/Window: -> [ 5] 330, 72- 4x 66
(-) [Main Thread 6.466] ( 966) GDKDFB/Window: -> [ 6] 0, 138- 632x 4
(-) [Main Thread 6.468] ( 966) GDKDFB/Window: -> [ 7] 0, 142- 3x 66
(-) [Main Thread 6.470] ( 966) GDKDFB/Window: -> [ 8] 330, 142- 4x 66
(-) [Main Thread 6.471] ( 966) GDKDFB/Window: -> [ 9] 0, 208- 632x 4
(-) [Main Thread 6.473] ( 966) GDKDFB/Window: -> [10] 0, 212- 3x 66
(-) [Main Thread 6.475] ( 966) GDKDFB/Window: -> [11] 330, 212- 4x 66
(-) [Main Thread 6.476] ( 966) GDKDFB/Window: -> [12] 482, 212- 4x 66
(-) [Main Thread 6.478] ( 966) GDKDFB/Window: -> [13] 0, 278- 632x 3
(-) [Main Thread 6.481] ( 966) GDKDFB/Drawable: _gdk_directfb_draw_rectangle( 0x3d4b0, 0x4603b8,
filled, 0, 0 - 632x 281 )
(-) [Main Thread 6.482] ( 966) GDKDFB/DrawClip: gdk_directfb_clip_region( 0x3d4b0, 0x4603b8,
0xbea71a40 )
(-) [Main Thread 6.484] ( 966) GDKDFB/DrawClip: -> draw rectangle == 0, 0 - 632x 281 =
(-) [Main Thread 6.486] ( 966) GDKDFB/DrawClip: -> buffered region > 0, 0 - 632x 281 <
(14 boxes)
(-) [Main Thread 6.487] ( 966) GDKDFB/DrawClip: -> clipping region > 0, 0 - 632x 281 <
(1 boxes)
(-) [Main Thread 6.489] ( 966) GDKDFB/DrawClip: => returning clip >> 0, 0 - 632x 281 <<
(14 boxes)
(-) [Main Thread 6.495] ( 966) GDKDFB/Window: gdk_window_impl_directfb_end_paint( 0x3d4b0 )
(-) [Main Thread 6.496] ( 966) GDKDFB/Window: -> queue flip 4, 119- 632x 281 (14 boxes)
(-) [Main Thread 6.498] ( 966) GDKDFB/Updates: -> 0x3c610 update [ 0, 0- 1x 1] (0 boxes)
(-) [Main Thread 6.500] ( 966) GDKDFB/Paintable: gdk_window_impl_directfb_process_updates( 0x3d5a0, update
children )
(-) [Main Thread 6.502] ( 966) GDKDFB/Paintable: -> update area 0, 0- 148x 66
(-) [Main Thread 6.504] ( 966) GDKDFB/Window: gdk_window_impl_directfb_begin_paint_region( 0x3d5a0 )
<- 0, 0- 148, 66 (4 boxes)
(-) [Main Thread 6.505] ( 966) GDKDFB/DrawClip: gdk_directfb_clip_region( 0x3d5a0, (nil), (nil) )
(-) [Main Thread 6.507] ( 966) GDKDFB/DrawClip: -> draw rectangle == 0, 0 - 148x 66 =
(-) [Main Thread 6.509] ( 966) GDKDFB/DrawClip: -> clipping child [ 4, 4 - 140x 58 ]
(-) [Main Thread 6.511] ( 966) GDKDFB/DrawClip: => returning clip >> 0, 0 - 148x 66 <<
(4 boxes)
[...]
(-) [Main Thread 6.103] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3ca70 ) -> 7, 122
(-) [Main Thread 6.105] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3cac8 ) -> 7, 122
(-) [Main Thread 6.107] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3cb20 ) -> 169, 137
(-) [Main Thread 6.108] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3cb78 ) -> 169, 137
(-) [Main Thread 6.110] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c860 ) -> 490, 331
(-) [Main Thread 6.112] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c8b8 ) -> 494, 335
(-) [Main Thread 6.113] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c968 ) -> 514, 335
(-) [Main Thread 6.115] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c9c0 ) -> 514, 361
(-) [Main Thread 6.117] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3ca18 ) ->
514, 361
(-) [Main Thread 6.118] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c910 ) -> 494, 335
(-) [Main Thread 6.120] ( 966) GDKDFB/Window: _gdk_directfb_calc_abs( 0x3c610 ) -> 338, 331
[...]
Live Stacktrace example (also on error messages, memory leaks etc):
Gdk-CRITICAL **: gdk_drawable_set_colormap: assertion `cmap == NULL || gdk_drawable_get_depth (drawable) ==
cmap->visual->depth' failed
aborting...
(!) [ 9338: 681438.770] --> Caught signal 5 (sent by the kernel) <--
(-) [ 9338: -STACK- ]
#0 0x2b844084ead0 in signal_handler () from /usr/local/lib/libdirect-1.1.so.0 [0x2b8440841000]
#1 0x2b843de3959a in gdk_drawable_set_colormap () from /usr/local/lib/libgdk-directfb-2.0.so.0 [0x2b843de16000]
#2 0x2b843de78dc7 in _gdk_windowing_window_init () from /usr/local/lib/libgdk-directfb-2.0.so.0 [0x2b843de16000]
#3 0x2b843de65598 in IA__gdk_display_open () from /usr/local/lib/libgdk-directfb-2.0.so.0 [0x2b843de16000]
#4 0x2b843de35ce4 in IA__gdk_display_open_default_libgtk_only () from /usr/local/lib/libgdk-directfb-2.0.so.0
[0x2b843de16000]
#5 0x2b843e28e54e in IA__gtk_init_check () from /usr/local/lib/libgtk-directfb-2.0.so.0 [0x2b843e0c0000]
#6 0x2b843e28e5ae in gtk_init () from /usr/local/lib/libgtk-directfb-2.0.so.0 [0x2b843e0c0000]
#7 0x2b843e359250 in gtk_test_init () from /usr/local/lib/libgtk-directfb-2.0.so.0 [0x2b843e0c0000]
#8 0x00403e52 in main () from treeview-scrolling [0x400000]
This requires -finstrument-functions to be used for all code to be traced.
Another patch could add -DDIRECT_ENABLE_DEBUG to CFLAGS when debuging is enabled. An option for
adding -finstrument-functions to CFLAGS would also be good. This allows stacks like above when
libdirect is built with trace support and initialized. Maybe something similar to libdirect's
trace.c could be added to glib. It's such a great help, especially with hard to reproducable issues
in gdb or when the stack is corrupted... I'm seldom starting gdb, because the stack trace and/or
assertion is enough.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
diff -pur gdk/directfb-00/gdkdrawable-directfb.c gdk/directfb/gdkdrawable-directfb.c
--- gdk/directfb-00/gdkdrawable-directfb.c 2008-01-30 02:24:57.000000000 +0100
+++ gdk/directfb/gdkdrawable-directfb.c 2008-01-30 02:35:53.000000000 +0100
@@ -50,6 +50,16 @@
#include "cairo-directfb.h"
+#include <direct/debug.h>
+#include <direct/messages.h>
+
+/*
+ * There can be multiple domains in one file and one domain (same same) in multiple files.
+ */
+D_DEBUG_DOMAIN( GDKDFB_Drawable, "GDKDFB/Drawable", "GDK DirectFB Drawable" );
+D_DEBUG_DOMAIN( GDKDFB_DrawClip, "GDKDFB/DrawClip", "GDK DirectFB Drawable Clip Region" );
+
+
/* From DirectFB's <gfx/generix/duffs_device.h> */
#define DUFF_1() \
case 1:\
@@ -150,6 +160,8 @@ gdk_directfb_set_colormap (GdkDrawable *
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p ) <- old %p\n", __FUNCTION__, drawable, colormap, impl->colormap );
+
if (impl->colormap == colormap)
return;
@@ -223,6 +235,8 @@ gdk_directfb_clip_region (GdkDrawable *
g_return_if_fail (GDK_IS_DRAWABLE_IMPL_DIRECTFB (drawable));
g_return_if_fail (ret_clip != NULL);
+ D_DEBUG_AT( GDKDFB_DrawClip, "%s( %p, %p, %p )\n", __FUNCTION__, drawable, gc, draw_rect );
+
private = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
if (!draw_rect)
@@ -234,11 +248,18 @@ gdk_directfb_clip_region (GdkDrawable *
draw_rect = ▭
}
+ D_DEBUG_AT( GDKDFB_DrawClip, " -> draw rectangle == %4d,%4d - %4dx%4d =\n",
+ draw_rect->x, draw_rect->y, draw_rect->width, draw_rect->height );
temp_region_init_rectangle( ret_clip, draw_rect );
- if (private->buffered)
+ if (private->buffered) {
+ D_DEBUG_AT( GDKDFB_DrawClip, " -> buffered region > %4d,%4d - %4dx%4d < (%ld boxes)\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( &private->paint_region.extents ),
+ private->paint_region.numRects );
+
gdk_region_intersect (ret_clip, &private->paint_region);
+ }
if (gc)
{
@@ -247,6 +268,9 @@ gdk_directfb_clip_region (GdkDrawable *
if (region->numRects)
{
+ D_DEBUG_AT( GDKDFB_DrawClip, " -> clipping region > %4d,%4d - %4dx%4d < (%ld boxes)\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( ®ion->extents ), region->numRects );
+
if (gc->clip_x_origin || gc->clip_y_origin)
{
gdk_region_offset (ret_clip, -gc->clip_x_origin, -gc->clip_y_origin);
@@ -264,8 +288,11 @@ gdk_directfb_clip_region (GdkDrawable *
return;
}
- if (private->buffered)
+ if (private->buffered) {
+ D_DEBUG_AT( GDKDFB_DrawClip, " => returning clip >> %4d,%4d - %4dx%4d << (%ld boxes)\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( &ret_clip->extents ), ret_clip->numRects );
return;
+ }
if (GDK_IS_WINDOW (private->wrapper) &&
GDK_WINDOW_IS_MAPPED (private->wrapper) &&
@@ -297,9 +324,15 @@ gdk_directfb_clip_region (GdkDrawable *
temp.extents.x2 = cur_private->x + cur_impl->width;
temp.extents.y2 = cur_private->y + cur_impl->height;
+ D_DEBUG_AT( GDKDFB_DrawClip, " -> clipping child [ %4d,%4d - %4dx%4d ]\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( &temp.extents ), temp.numRects );
+
gdk_region_subtract (ret_clip, &temp);
}
}
+
+ D_DEBUG_AT( GDKDFB_DrawClip, " => returning clip >> %4d,%4d - %4dx%4d << (%ld boxes)\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( &ret_clip->extents ), ret_clip->numRects );
}
/* Drawing
@@ -402,12 +435,14 @@ _gdk_directfb_draw_rectangle (GdkDrawabl
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %s, %4d,%4d - %4dx%4d )\n", __FUNCTION__,
+ drawable, gc, filled ? " filled" : "outline", x, y, width, height );
+
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
if (!impl->surface)
return;
-
if (gc)
gc_private = GDK_GC_DIRECTFB (gc);
@@ -558,13 +593,15 @@ gdk_directfb_draw_polygon (GdkDrawable *
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %s, %p, %d )\n", __FUNCTION__,
+ drawable, gc, filled ? " filled" : "outline", points, npoints );
+
if (npoints < 3)
return;
if (filled)
{
- if (npoints == 3 ||
- (npoints == 4 &&
+ if (npoints == 3 || (npoints == 4 &&
points[0].x == points[npoints-1].x &&
points[0].y == points[npoints-1].y))
{
@@ -667,6 +704,9 @@ gdk_directfb_draw_drawable (GdkDrawable
DFBRectangle rect = { xsrc, ysrc, width, height };
gint i;
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", __FUNCTION__,
+ drawable, gc, src, xsrc, ysrc, xdest, ydest, width, height );
+
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
if (!impl->surface)
@@ -709,6 +749,8 @@ gdk_directfb_draw_points (GdkDrawable *d
DFBRegion region = { points->x, points->y, points->x, points->y };
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %d )\n", __FUNCTION__, drawable, gc, points, npoints );
+
if (npoints < 1)
return;
@@ -756,6 +798,8 @@ gdk_directfb_draw_segments (GdkDrawable
// DFBRegion region = { segs->x1, segs->y1, segs->x2, segs->y2 };
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %d )\n", __FUNCTION__, drawable, gc, segs, nsegs );
+
if (nsegs < 1)
return;
@@ -834,6 +878,8 @@ gdk_directfb_draw_lines (GdkDrawable *dr
DFBRegion region = { points->x, points->y, points->x, points->y };
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %d )\n", __FUNCTION__, drawable, gc, points, npoints );
+
if (npoints < 2)
return;
@@ -907,6 +953,9 @@ gdk_directfb_draw_image (GdkDrawable *dr
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (image != NULL);
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", __FUNCTION__,
+ drawable, gc, image, xsrc, ysrc, xdest, ydest, width, height );
+
impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
image_private = image->windowing_data;
@@ -1153,6 +1202,9 @@ gdk_directfb_draw_pixbuf (GdkDrawable *
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", __FUNCTION__,
+ drawable, gc, pixbuf, src_x, src_y, dest_x, dest_y, width, height );
+
/* Clip to the drawable; this is required for get_from_drawable() so
* can't be done implicitly
*/
@@ -1420,6 +1472,21 @@ convert_rgb_pixbuf_to_image (guchar *sr
/*
* Object stuff
*/
+static inline const char *
+drawable_impl_type_name( GObject *object )
+{
+ if (GDK_IS_PIXMAP (object))
+ return "PIXMAP";
+
+ if (GDK_IS_WINDOW (object))
+ return "WINDOW";
+
+ if (GDK_IS_DRAWABLE_IMPL_DIRECTFB (object))
+ return "DRAWABLE";
+
+ return "unknown";
+}
+
static void
gdk_drawable_impl_directfb_finalize (GObject *object)
@@ -1427,6 +1494,11 @@ gdk_drawable_impl_directfb_finalize (GOb
GdkDrawableImplDirectFB *impl;
impl = GDK_DRAWABLE_IMPL_DIRECTFB (object);
+ D_DEBUG_AT( GDKDFB_Drawable, "%s( %p ) <- %dx%d (%s at %4d,%4d)\n", __FUNCTION__,
+ object, impl->width, impl->height,
+ drawable_impl_type_name( object ),
+ impl->abs_x, impl->abs_y );
+
gdk_directfb_set_colormap (GDK_DRAWABLE (object), NULL);
if( impl->cairo_surface ) {
cairo_surface_finish(impl->cairo_surface);
Only in gdk/directfb: gdkdrawable-directfb.c.orig
Only in gdk/directfb-00: gdkdrawable-directfb.c.rej
diff -pur gdk/directfb-00/gdkprivate-directfb.h gdk/directfb/gdkprivate-directfb.h
--- gdk/directfb-00/gdkprivate-directfb.h 2008-01-30 02:23:22.000000000 +0100
+++ gdk/directfb/gdkprivate-directfb.h 2008-01-30 02:34:47.000000000 +0100
@@ -410,4 +410,7 @@ temp_region_deinit( GdkRegion *region )
}
+#define GDKDFB_RECTANGLE_VALS_FROM_SEGMENT(s) (s)->x1, (s)->y1, (s)->x2-(s)->x1, (s)->y2-(s)->y1
+
+
#endif /* __GDK_PRIVATE_DIRECTFB_H__ */
diff -pur gdk/directfb-00/gdkwindow-directfb.c gdk/directfb/gdkwindow-directfb.c
--- gdk/directfb-00/gdkwindow-directfb.c 2008-01-30 02:24:57.000000000 +0100
+++ gdk/directfb/gdkwindow-directfb.c 2008-01-30 02:34:47.000000000 +0100
@@ -46,8 +46,20 @@
#include "cairo.h"
#include <assert.h>
+#include <direct/debug.h>
+
#include <directfb_util.h>
+
+
+
+
+D_DEBUG_DOMAIN( GDKDFB_Crossing, "GDKDFB/Crossing", "GDK DirectFB Crossing Events" );
+D_DEBUG_DOMAIN( GDKDFB_Updates, "GDKDFB/Updates", "GDK DirectFB Updates" );
+D_DEBUG_DOMAIN( GDKDFB_Paintable, "GDKDFB/Paintable", "GDK DirectFB Paintable" );
+D_DEBUG_DOMAIN( GDKDFB_Window, "GDKDFB/Window", "GDK DirectFB Window" );
+
+
static GdkRegion * gdk_window_impl_directfb_get_visible_region (GdkDrawable *drawable);
static void gdk_window_impl_directfb_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap);
@@ -71,8 +83,8 @@ static guint update_idle = 0;
static void
gdk_window_directfb_process_all_updates (void)
{
+ GSList *tmp_list;
GSList *old_update_windows = update_windows;
- GSList *tmp_list = update_windows;
if (update_idle)
g_source_remove (update_idle);
@@ -80,52 +92,67 @@ gdk_window_directfb_process_all_updates
update_windows = NULL;
update_idle = 0;
- g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
+ D_DEBUG_AT( GDKDFB_Updates, "%s()\n", __FUNCTION__ );
+ g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
+ tmp_list = old_update_windows;
while (tmp_list)
{
- GdkWindowObject *private = (GdkWindowObject *)tmp_list->data;
+ GdkWindowObject *private = GDK_WINDOW_OBJECT( tmp_list->data );
+ GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB( private->impl );
if (private->update_freeze_count)
- update_windows = g_slist_prepend (update_windows, private);
+ {
+ D_DEBUG_AT( GDKDFB_Updates, " -> %p frozen [%4d,%4d-%4dx%4d] (%d boxes)\n",
+ private, DFB_RECTANGLE_VALS_FROM_REGION( &wimpl->flips.bounding ),
+ wimpl->flips.num_regions );
+ update_windows = g_slist_prepend (update_windows, private);
+ }
else
- gdk_window_process_updates(tmp_list->data,TRUE);
+ {
+ D_DEBUG_AT( GDKDFB_Updates, " -> %p update [%4d,%4d-%4dx%4d] (%d boxes)\n",
+ private, DFB_RECTANGLE_VALS_FROM_REGION( &wimpl->flips.bounding ),
+ wimpl->flips.num_regions );
+ gdk_window_process_updates(tmp_list->data,TRUE);
+ }
g_object_unref (tmp_list->data);
tmp_list = tmp_list->next;
}
-
#ifndef GDK_DIRECTFB_NO_EXPERIMENTS
- tmp_list = old_update_windows;
-
g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
+ tmp_list = old_update_windows;
+ while (tmp_list)
+ {
+ GdkWindowObject *top = GDK_WINDOW_OBJECT( gdk_window_get_toplevel( tmp_list->data ) );
- while (tmp_list) {
- GdkWindowObject *top = GDK_WINDOW_OBJECT( gdk_window_get_toplevel( tmp_list->data ) );
-
- if (top) {
- GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (top->impl);
+ if (top)
+ {
+ GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (top->impl);
- if (wimpl->flips.num_regions) {
- //direct_log_printf( NULL, "Flipping bounding box of paints: %d,%d - %dx%d (top %p, wimpl %p)\n",
- // DFB_RECTANGLE_VALS_FROM_REGION( &wimpl->flips.bounding ), top, wimpl );
+ if (wimpl->flips.num_regions)
+ {
+ D_DEBUG_AT( GDKDFB_Updates, " -> %p flip [%4d,%4d-%4dx%4d] (%d boxes)\n",
+ top, DFB_RECTANGLE_VALS_FROM_REGION( &wimpl->flips.bounding ),
+ wimpl->flips.num_regions );
- wimpl->drawable.surface->Flip( wimpl->drawable.surface, &wimpl->flips.bounding, DSFLIP_NONE );
+ wimpl->drawable.surface->Flip( wimpl->drawable.surface, &wimpl->flips.bounding, DSFLIP_NONE );
- dfb_updates_reset( &wimpl->flips );
+ dfb_updates_reset( &wimpl->flips );
}
- }
-
+ else
+ D_DEBUG_AT( GDKDFB_Updates, " -> %p has no flips!\n", top );
+ }
+ else
+ D_DEBUG_AT( GDKDFB_Updates, " -> %p has no top level window!\n", tmp_list->data );
- g_object_unref (tmp_list->data);
- tmp_list = tmp_list->next;
- }
+ g_object_unref (tmp_list->data);
+ tmp_list = tmp_list->next;
+ }
#endif
-
g_slist_free (old_update_windows);
-
}
static gboolean
@@ -139,13 +166,18 @@ gdk_window_update_idle (gpointer data)
static void
gdk_window_schedule_update (GdkWindow *window)
{
+ D_DEBUG_AT( GDKDFB_Updates, "%s( %p ) <- freeze count %d\n", __FUNCTION__, window,
+ window ? GDK_WINDOW_OBJECT (window)->update_freeze_count : -1 );
+
if (window && GDK_WINDOW_OBJECT (window)->update_freeze_count)
return;
if (!update_idle)
{
+ D_DEBUG_AT( GDKDFB_Updates, " -> adding idle callback\n" );
+
update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
- gdk_window_update_idle, NULL, NULL);
+ gdk_window_update_idle, NULL, NULL);
}
}
@@ -251,6 +283,8 @@ gdk_window_impl_directfb_finalize (GObje
{
GdkWindowImplDirectFB *impl = GDK_WINDOW_IMPL_DIRECTFB (object);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p ) <- %dx%d\n", __FUNCTION__, impl, impl->drawable.width, impl->drawable.height );
+
if (GDK_WINDOW_IS_MAPPED (impl->drawable.wrapper))
gdk_window_hide (impl->drawable.wrapper);
@@ -280,12 +314,17 @@ gdk_window_impl_directfb_get_visible_reg
GdkRectangle rect = { 0, 0, 0, 0 };
DFBRectangle drect = { 0, 0, 0, 0 };
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, drawable );
+
if (priv->surface)
priv->surface->GetVisibleRectangle (priv->surface, &drect);
rect.x= drect.x;
rect.y= drect.y;
rect.width=drect.w;
rect.height=drect.h;
+
+ D_DEBUG_AT( GDKDFB_Window, " -> returning %4d,%4d-%4dx%4d\n", drect.x, drect.y, drect.w, drect.h );
+
return gdk_region_rectangle (&rect);
}
@@ -318,6 +357,8 @@ create_directfb_window (GdkWindowImplDir
DFBResult ret;
IDirectFBWindow *window;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %4dx%4d, caps 0x%08x )\n", __FUNCTION__, desc->width, desc->height, desc->caps );
+
ret = _gdk_display->layer->CreateWindow (_gdk_display->layer, desc, &window);
if (ret != DFB_OK)
@@ -427,6 +468,8 @@ gdk_directfb_window_new (GdkWindow
g_return_val_if_fail (attributes != NULL, NULL);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, parent );
+
if (!parent || attributes->window_type != GDK_WINDOW_CHILD)
parent = _gdk_parent_root;
@@ -609,6 +652,8 @@ gdk_window_new (GdkWindow *parent,
{
g_return_val_if_fail (attributes != NULL, NULL);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, parent );
+
return gdk_directfb_window_new (parent, attributes, attributes_mask,
DWCAPS_NONE, DWOP_NONE, DSCAPS_NONE);
}
@@ -633,6 +678,9 @@ _gdk_windowing_window_destroy (GdkWindow
g_return_if_fail (GDK_IS_WINDOW (window));
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %srecursing, %sforeign )\n", __FUNCTION__, window,
+ recursing ? "" : "not ", foreign_destroy ? "" : "no " );
+
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
@@ -674,6 +722,8 @@ gdk_window_destroy_notify (GdkWindow *wi
{
g_return_if_fail (GDK_IS_WINDOW (window));
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
if (!GDK_WINDOW_DESTROYED (window))
{
if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
@@ -721,6 +771,7 @@ gdk_directfb_change_focus (GdkWindow *ne
GdkWindow *new_win;
GdkWindow *event_win;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, new_focus_window );
/* No focus changes while the pointer is grabbed */
if (_gdk_directfb_pointer_grab_window)
@@ -796,6 +847,8 @@ gdk_directfb_window_raise (GdkWindow *wi
{
GdkWindowObject *parent;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
parent = GDK_WINDOW_OBJECT (window)->parent;
if (parent->children->data == window)
@@ -812,6 +865,8 @@ gdk_directfb_window_lower (GdkWindow *wi
{
GdkWindowObject *parent;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
parent = GDK_WINDOW_OBJECT (window)->parent;
parent->children = g_list_remove (parent->children, window);
@@ -841,6 +896,8 @@ send_map_events (GdkWindowObject *privat
if (!GDK_WINDOW_IS_MAPPED (private))
return;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, private );
+
event_win = gdk_directfb_other_event_window ((GdkWindow *) private, GDK_MAP);
if (event_win)
gdk_directfb_event_make (event_win, GDK_MAP);
@@ -882,6 +939,8 @@ gdk_directfb_window_send_crossing_events
GdkWindow *b;
GdkWindow *event_win;
+ D_DEBUG_AT( GDKDFB_Crossing, "%s( %p -> %p, %d )\n", __FUNCTION__, src, dest, mode );
+
/* Do a possible cursor change before checking if we need to
generate crossing events so cursor changes due to pointer
grabs work correctly. */
@@ -911,8 +970,10 @@ gdk_directfb_window_send_crossing_events
}
}
- if (dest == gdk_directfb_window_containing_pointer)
+ if (dest == gdk_directfb_window_containing_pointer) {
+ D_DEBUG_AT( GDKDFB_Crossing, " -> already containing the pointer\n" );
return;
+ }
if (gdk_directfb_window_containing_pointer == NULL)
gdk_directfb_window_containing_pointer = g_object_ref (_gdk_parent_root);
@@ -924,25 +985,35 @@ gdk_directfb_window_send_crossing_events
b = dest;
- if (a == b)
+ if (a == b) {
+ D_DEBUG_AT( GDKDFB_Crossing, " -> src == dest\n" );
return;
+ }
/* gdk_directfb_window_containing_pointer might have been destroyed.
* The refcount we hold on it should keep it, but it's parents
* might have died.
*/
- if (GDK_WINDOW_DESTROYED (a))
+ if (GDK_WINDOW_DESTROYED (a)) {
+ D_DEBUG_AT( GDKDFB_Crossing, " -> src is destroyed!\n" );
a = _gdk_parent_root;
+ }
gdk_directfb_mouse_get_info (&x, &y, &modifiers);
c = gdk_directfb_find_common_ancestor (a, b);
+ D_DEBUG_AT( GDKDFB_Crossing, " -> common ancestor %p\n", c );
+
non_linear = (c != a) && (c != b);
+ D_DEBUG_AT( GDKDFB_Crossing, " -> non_linear: %s\n", non_linear ? "YES" : "NO" );
+
event_win = gdk_directfb_pointer_event_window (a, GDK_LEAVE_NOTIFY);
if (event_win)
{
+ D_DEBUG_AT( GDKDFB_Crossing, " -> sending LEAVE to src\n" );
+
event = gdk_directfb_event_make (event_win, GDK_LEAVE_NOTIFY);
event->crossing.subwindow = NULL;
@@ -963,6 +1034,11 @@ gdk_directfb_window_send_crossing_events
event->crossing.focus = FALSE;
event->crossing.state = modifiers;
+
+ D_DEBUG_AT( GDKDFB_Crossing, " => LEAVE (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n",
+ event_win, a,
+ event->crossing.x, event->crossing.y, event->crossing.x_root, event->crossing.y_root,
+ event->crossing.mode, event->crossing.detail );
}
/* Traverse up from a to (excluding) c */
@@ -996,6 +1072,11 @@ gdk_directfb_window_send_crossing_events
event->crossing.focus = FALSE;
event->crossing.state = modifiers;
+
+ D_DEBUG_AT( GDKDFB_Crossing, " -> LEAVE (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n",
+ event_win, win,
+ event->crossing.x, event->crossing.y, event->crossing.x_root, event->crossing.y_root,
+ event->crossing.mode, event->crossing.detail );
}
last = win;
@@ -1049,6 +1130,11 @@ gdk_directfb_window_send_crossing_events
event->crossing.focus = FALSE;
event->crossing.state = modifiers;
+
+ D_DEBUG_AT( GDKDFB_Crossing, " -> ENTER (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n",
+ event_win, win,
+ event->crossing.x, event->crossing.y, event->crossing.x_root, event->crossing.y_root,
+ event->crossing.mode, event->crossing.detail );
}
}
@@ -1079,6 +1165,11 @@ gdk_directfb_window_send_crossing_events
event->crossing.focus = FALSE;
event->crossing.state = modifiers;
+
+ D_DEBUG_AT( GDKDFB_Crossing, " => ENTER (%p/%p) at %4f,%4f (%4f,%4f) mode %d, detail %d\n",
+ event_win, b,
+ event->crossing.x, event->crossing.y, event->crossing.x_root, event->crossing.y_root,
+ event->crossing.mode, event->crossing.detail );
}
if (mode != GDK_CROSSING_GRAB)
@@ -1101,6 +1192,8 @@ show_window_internal (GdkWindow *window,
GdkWindowImplDirectFB *impl;
GdkWindow *mousewin;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %sraise )\n", __FUNCTION__, window, raise ? "" : "no " );
+
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
@@ -1142,6 +1235,8 @@ gdk_window_show_unraised (GdkWindow *win
{
g_return_if_fail (GDK_IS_WINDOW (window));
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
show_window_internal (window, FALSE);
}
@@ -1150,6 +1245,8 @@ gdk_window_show (GdkWindow *window)
{
g_return_if_fail (GDK_IS_WINDOW (window));
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
show_window_internal (window, TRUE);
}
@@ -1163,6 +1260,8 @@ gdk_window_hide (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_DIRECTFB (private->impl);
@@ -1527,11 +1626,15 @@ _gdk_windowing_window_clear_area (GdkWin
gint dx = 0;
gint dy = 0;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %4d,%4d-%4dx%4d )\n", __FUNCTION__, window, x, y, width, height );
+
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_WINDOW_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window)) {
+ D_DEBUG_AT( GDKDFB_Window, " -> DESTROYED!\n" );
return;
-
+ }
+
private = GDK_WINDOW_OBJECT (window);
impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
@@ -1555,8 +1658,10 @@ _gdk_windowing_window_clear_area (GdkWin
dy += relative_to->y;
}
- if (bg_pixmap == GDK_NO_BG)
+ if (bg_pixmap == GDK_NO_BG) {
+ D_DEBUG_AT( GDKDFB_Window, " -> NO BG\n" );
return;
+ }
if (bg_pixmap && bg_pixmap != GDK_PARENT_RELATIVE_BG)
{
@@ -1567,6 +1672,8 @@ _gdk_windowing_window_clear_area (GdkWin
values.ts_x_origin = - dx;
values.ts_y_origin = - dy;
+ D_DEBUG_AT( GDKDFB_Window, " -> PIXMAP\n" );
+
gc = gdk_gc_new_with_values (GDK_DRAWABLE (impl), &values,
GDK_GC_FILL | GDK_GC_TILE |
GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
@@ -1580,6 +1687,8 @@ _gdk_windowing_window_clear_area (GdkWin
values.foreground = relative_to->bg_color;
+ D_DEBUG_AT( GDKDFB_Window, " -> COLOR\n" );
+
gc = gdk_gc_new_with_values (GDK_DRAWABLE (impl), &values,
GDK_GC_FOREGROUND);
}
@@ -1602,6 +1711,8 @@ _gdk_windowing_window_clear_area_e (GdkW
GdkWindowObject *private;
GdkWindowImplDirectFB *impl;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %4d,%4d-%4dx%4d )\n", __FUNCTION__, window, x, y, width, height );
+
g_return_if_fail (GDK_IS_WINDOW (window));
private = GDK_WINDOW_OBJECT (window);
@@ -1622,8 +1733,10 @@ _gdk_windowing_window_clear_area_e (GdkW
g_return_if_fail (GDK_IS_WINDOW (window));
- if (GDK_WINDOW_DESTROYED (window))
+ if (GDK_WINDOW_DESTROYED (window)) {
+ D_DEBUG_AT( GDKDFB_Window, " -> DESTROYED!\n" );
return;
+ }
_gdk_windowing_window_clear_area (window, x, y, width, height);
@@ -1635,6 +1748,8 @@ gdk_window_raise (GdkWindow *window)
{
GdkWindowImplDirectFB *impl;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@@ -1664,6 +1779,8 @@ gdk_window_lower (GdkWindow *window)
{
GdkWindowImplDirectFB *impl;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
+
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
@@ -1703,6 +1820,8 @@ gdk_window_set_hints (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %3d,%3d, min %4dx%4d, max %4dx%4d, flags 0x%08x )\n", __FUNCTION__,
+ window, x,y, min_width, min_height, max_width, max_height, flags );
/* N/A */
}
@@ -1728,7 +1847,9 @@ gdk_window_set_title (GdkWindow *windo
if (GDK_WINDOW_DESTROYED (window))
return;
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, '%s' )\n", __FUNCTION__, window, title );
/* N/A */
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, window );
}
void
@@ -1796,6 +1917,8 @@ gdk_window_set_background (GdkWindow *wi
g_return_if_fail (color != NULL);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %d,%d,%d )\n", __FUNCTION__, window, color->red, color->green, color->blue );
+
private = GDK_WINDOW_OBJECT (window);
private->bg_color = *color;
@@ -1818,6 +1941,9 @@ gdk_window_set_back_pixmap (GdkWindow *w
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (pixmap == NULL || !parent_relative);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p, %p, %srelative )\n", __FUNCTION__,
+ window, pixmap, parent_relative ? "" : "not " );
+
private = GDK_WINDOW_OBJECT (window);
old_pixmap = private->bg_pixmap;
@@ -1944,6 +2070,8 @@ _gdk_directfb_calc_abs (GdkWindow *windo
impl->abs_y += parent_impl->abs_y;
}
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p ) -> %4d,%4d\n", __FUNCTION__, window, impl->abs_x, impl->abs_y );
+
for (list = private->children; list; list = list->next)
{
_gdk_directfb_calc_abs (list->data);
@@ -2902,64 +3030,62 @@ static void
gdk_window_impl_directfb_process_updates (GdkPaintable *paintable,
gboolean update_children)
{
- GdkWindow *window;
- GdkWindowObject *private;
GdkWindowImplDirectFB *wimpl;
GdkDrawableImplDirectFB *impl;
+ GdkWindow *window;
+ GdkWindowObject *private;
+ GdkRegion *update_area;
wimpl = GDK_WINDOW_IMPL_DIRECTFB (paintable);
impl = (GdkDrawableImplDirectFB *)wimpl;
window = wimpl->gdkWindow;
private = (GdkWindowObject *)window;
- gboolean save_region = FALSE;
+
+ D_DEBUG_AT( GDKDFB_Paintable, "%s( %p, %schildren )\n", __FUNCTION__,
+ paintable, update_children ? "update " : "no " );
/* If an update got queued during update processing, we can get a
* window in the update queue that has an empty update_area.
* just ignore it.
*/
- if (private->update_area)
- {
- GdkRegion *update_area = private->update_area;
- private->update_area = NULL;
+ if (!private->update_area)
+ return;
+
+ update_area = private->update_area;
+ private->update_area = NULL;
- if (_gdk_event_func && gdk_window_is_viewable (window))
- {
- GdkRegion *expose_region;
- GdkRegion window_region;
- save_region = _gdk_windowing_window_queue_antiexpose (window, update_area);
+ D_DEBUG_AT( GDKDFB_Paintable, " -> update area %4d,%4d-%4dx%4d\n",
+ GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( &update_area->extents ) );
- if (save_region)
- expose_region = gdk_region_copy (update_area);
- else
- expose_region = update_area;
+ if (_gdk_event_func && gdk_window_is_viewable (window))
+ {
+ GdkRegion *expose_region = update_area;
+ GdkRegion window_region;
- temp_region_init_rectangle_vals( &window_region, 0, 0, impl->width, impl->height );
- gdk_region_intersect (expose_region,
- &window_region);
- temp_region_deinit (&window_region);
+ temp_region_init_rectangle_vals( &window_region, 0, 0, impl->width, impl->height );
+ gdk_region_intersect( expose_region, &window_region );
+ temp_region_deinit (&window_region);
- if (!gdk_region_empty (expose_region) &&
- (private->event_mask & GDK_EXPOSURE_MASK))
- {
- GdkEvent event;
+ if (!gdk_region_empty (expose_region) && (private->event_mask & GDK_EXPOSURE_MASK))
+ {
+ GdkEvent event;
- event.expose.type = GDK_EXPOSE;
- event.expose.window = g_object_ref (window);
- event.expose.send_event = FALSE;
- event.expose.count = 0;
- event.expose.region = expose_region;
- gdk_region_get_clipbox (expose_region, &event.expose.area);
- (*_gdk_event_func) (&event, _gdk_event_data);
+ event.expose.type = GDK_EXPOSE;
+ event.expose.window = g_object_ref (window);
+ event.expose.send_event = FALSE;
+ event.expose.count = 0;
+ event.expose.region = expose_region;
+ gdk_region_get_clipbox (expose_region, &event.expose.area);
+ (*_gdk_event_func) (&event, _gdk_event_data);
- g_object_unref (window);
- }
-
- if (expose_region != update_area)
- gdk_region_destroy (expose_region);
+ g_object_unref (window);
}
- if (!save_region)
- gdk_region_destroy (update_area);
+
+ if (expose_region != update_area)
+ gdk_region_destroy (expose_region);
}
+
+ gdk_region_destroy (update_area);
}
@@ -2968,7 +3094,7 @@ gdk_window_impl_directfb_begin_paint_reg
const GdkRegion *region)
{
GdkDrawableImplDirectFB *impl;
- GdkWindowImplDirectFB *wimpl;
+ GdkWindowImplDirectFB *wimpl;
gint i;
@@ -2979,36 +3105,59 @@ gdk_window_impl_directfb_begin_paint_reg
if (!region)
return;
- if (impl->buffered) {
- g_assert( impl->paint_depth > 0 );
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p ) <- %4d,%4d-%4d,%4d (%d boxes)\n", __FUNCTION__,
+ paintable, GDKDFB_RECTANGLE_VALS_FROM_SEGMENT(®ion->extents), region->numRects );
- gdk_region_union (&impl->paint_region, region);
- }
- else {
- g_assert( impl->paint_depth == 0 );
+ /* When it's buffered... */
+ if (impl->buffered)
+ {
+ /* ...we're already painting on it! */
+ g_assert( impl->paint_depth > 0 );
+
+ D_DEBUG_AT( GDKDFB_Window, " -> painted %4d,%4d-%4dx%4d (%d boxes)\n",
+ DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
+
+ /* Add the new region to the paint region... */
+ gdk_region_union (&impl->paint_region, region);
+ }
+ else
+ {
+ /* ...otherwise it's the first time! */
+ g_assert( impl->paint_depth == 0 );
- gdk_directfb_clip_region( GDK_DRAWABLE(paintable), NULL, NULL, &impl->clip_region );
+ /* Generate the clip region for painting around child windows. */
+ gdk_directfb_clip_region( GDK_DRAWABLE(paintable), NULL, NULL, &impl->clip_region );
- temp_region_init_copy( &impl->paint_region, region );
+ /* Initialize the paint region with the new one... */
+ temp_region_init_copy( &impl->paint_region, region );
- impl->buffered = TRUE;
- }
+ impl->buffered = TRUE;
+ }
+
+ D_DEBUG_AT( GDKDFB_Window, " -> painting %4d,%4d-%4dx%4d (%d boxes)\n",
+ DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
+ /* ...but clip the initial/compound result against the clip region. */
gdk_region_intersect (&impl->paint_region, &impl->clip_region);
+ D_DEBUG_AT( GDKDFB_Window, " -> clipped %4d,%4d-%4dx%4d (%d boxes)\n",
+ DFB_RECTANGLE_VALS_FROM_REGION( &impl->paint_region.extents ), impl->paint_region.numRects );
+
impl->paint_depth++;
+ D_DEBUG_AT( GDKDFB_Window, " -> depth is now %d\n", impl->paint_depth );
for (i = 0; i < region->numRects; i++)
{
GdkRegionBox *box = ®ion->rects[i];
+ D_DEBUG_AT( GDKDFB_Window, " -> [%2d] %4d,%4d-%4dx%4d\n", i, GDKDFB_RECTANGLE_VALS_FROM_SEGMENT( box ) );
+
_gdk_windowing_window_clear_area (GDK_WINDOW(wimpl->gdkWindow),
box->x1,
box->y1,
box->x2 - box->x1,
box->y2 - box->y1);
-
}
}
@@ -3019,6 +3168,8 @@ gdk_window_impl_directfb_end_paint (GdkP
impl = GDK_DRAWABLE_IMPL_DIRECTFB (paintable);
+ D_DEBUG_AT( GDKDFB_Window, "%s( %p )\n", __FUNCTION__, paintable );
+
g_return_if_fail (impl->paint_depth > 0);
g_assert( impl->buffered );
@@ -3034,8 +3185,11 @@ gdk_window_impl_directfb_end_paint (GdkP
{
DFBRegion reg = { impl->paint_region.extents.x1,
impl->paint_region.extents.y1,
- impl->paint_region.extents.x2 ,
- impl->paint_region.extents.y2 };
+ impl->paint_region.extents.x2-1,
+ impl->paint_region.extents.y2-1 };
+
+ D_DEBUG_AT( GDKDFB_Window, " -> flip %4d,%4d-%4dx%4d (%d boxes)\n",
+ DFB_RECTANGLE_VALS_FROM_REGION( ® ), impl->paint_region.numRects );
impl->surface->Flip( impl->surface, ®, 0 );
@@ -3043,37 +3197,43 @@ gdk_window_impl_directfb_end_paint (GdkP
}
}
#else
- if (impl->paint_depth == 0) {
- impl->buffered = FALSE;
-
- temp_region_deinit( &impl->clip_region );
-
- if (impl->paint_region.numRects) {
- GdkWindow *window = GDK_WINDOW( impl->wrapper );
-
- if (GDK_IS_WINDOW(window)) {
- GdkWindowObject *top = GDK_WINDOW_OBJECT( gdk_window_get_toplevel( window ) );
-
- if (top) {
- DFBRegion reg;
- GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (top->impl);
-
- reg.x1 = impl->abs_x - top->x + impl->paint_region.extents.x1;
- reg.y1 = impl->abs_y - top->y + impl->paint_region.extents.y1;
- reg.x2 = impl->abs_x - top->x + impl->paint_region.extents.x2 - 1;
- reg.y2 = impl->abs_y - top->y + impl->paint_region.extents.y2 - 1;
-
- //direct_log_printf( NULL, "Adding bounding box of paint: %d,%d - %dx%d (top %p, wimpl %p)\n",
- // DFB_RECTANGLE_VALS_FROM_REGION( ® ), top, wimpl );
-
- dfb_updates_add( &wimpl->flips, ® );
- }
+ if (impl->paint_depth == 0)
+ {
+ impl->buffered = FALSE;
+
+ temp_region_deinit( &impl->clip_region );
+
+ if (impl->paint_region.numRects)
+ {
+ GdkWindow *window = GDK_WINDOW( impl->wrapper );
+
+ if (GDK_IS_WINDOW(window))
+ {
+ GdkWindowObject *top = GDK_WINDOW_OBJECT( gdk_window_get_toplevel( window ) );
+
+ if (top)
+ {
+ DFBRegion reg;
+ GdkWindowImplDirectFB *wimpl = GDK_WINDOW_IMPL_DIRECTFB (top->impl);
+
+ reg.x1 = impl->abs_x - top->x + impl->paint_region.extents.x1;
+ reg.y1 = impl->abs_y - top->y + impl->paint_region.extents.y1;
+ reg.x2 = impl->abs_x - top->x + impl->paint_region.extents.x2 - 1;
+ reg.y2 = impl->abs_y - top->y + impl->paint_region.extents.y2 - 1;
+
+ D_DEBUG_AT( GDKDFB_Window, " -> queue flip %4d,%4d-%4dx%4d (%d boxes)\n",
+ DFB_RECTANGLE_VALS_FROM_REGION( ® ), impl->paint_region.numRects );
+
+ dfb_updates_add( &wimpl->flips, ® );
+ }
}
-
- temp_region_reset( &impl->paint_region );
- }
- }
+
+ temp_region_reset( &impl->paint_region );
+ }
+ }
#endif
+ else
+ D_DEBUG_AT( GDKDFB_Window, " -> depth is still %d\n", impl->paint_depth );
}
Only in gdk/directfb: gdkwindow-directfb.c.orig
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]