On 9/26/06, Matt Lavin <[EMAIL PROTECTED]> wrote: > I've got a GTK application that draws on a GdkDrawable outside of an > expose event and it doesn't seem to work against GTK+/DFB 2.10.3. I > looked at the source a bit and I noticed that a recent change to > gdkdrawable-directfb.c (revision 1.5 in GTK+ CVS) removed calls to > gdk_directfb_update_region after the GdkDrawable primitive calls (like > drawing lines). gdk_directfb_update_region used to check if an expose > event was in progress and flip the surface if it wasn't, but now no > check occurs. I believe that the new code will not support drawing > graphics outside of a paint event. I know that it is generally not a > nice thing to do to paint outside of an expose event, but I'd love to > know the motivation behind the changes so I can appropriately adjust my > code. >
You can draw outside of a paint event you just need to place gdk_window_begin_paint_rect/end drawing calls around the code. Don't forget to call gdk_flush() after end its a no-op on directfb but required for X11 if you wan't to see anything under X. The above model maps nicely to directfb and better works on all platforms. gdk_window_begin_paint_rect ...draw stuff gdk_window_end_paint gdk_flush If you call the above outside the paint thread have fun with enter/leave you probably will find all my deadlock problems. You can also if you wish send exposes and call gdk_window_process_updates which is in my opinion cleaner. gdk_window_invalidate_rect gdk_window_process_updates gdk_flush Drawing outside the expose handler given you have gdk_window_invalidate_rect/process_updates does not make a lot of sense. Its quite fast and works all the time the only cost over begin/end is allocation of the expose event and insures you are not cleared by system expose events. What motivated the change is for directfb its the wrong drawing model. It was really a artifcact of the original GTK/X11 implementation that you could do this. There are a thousand reasons to not allow a ui toolkit to assume it is possible to draw to the screen without guard calls. X11 got it wrong the original port tried to emulate the X11 way leading to poor performance since you flipped on every draw op now Gtk has moved away from this model. Mike > _______________________________________________ > directfb-dev mailing list > [email protected] > http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev > _______________________________________________ directfb-dev mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
