diff options
author | Richard Hult <richard@imendio.com> | 2007-05-05 10:19:39 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2007-05-05 10:19:39 +0000 |
commit | d9dedc36ec04bc5053f5a88057bf41aab3bf587b (patch) | |
tree | f381e6a8e23ad6f6765ad966ba85b8cf21c28fbd | |
parent | e6993e9a3783f9c5f48a00c238382f02cb406258 (diff) | |
download | gtk+-d9dedc36ec04bc5053f5a88057bf41aab3bf587b.tar.gz |
Fix bugs #428733 and #433301. Turns out the lockFocus logic was flawed,
007-05-05 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c:
(gdk_quartz_drawable_get_context),
(gdk_quartz_drawable_release_context): Fix bugs #428733 and #433301.
Turns out the lockFocus logic was flawed, now we only lock/unlock
when called outside a real expose event and never flush manually.
svn path=/trunk/; revision=17798
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gdk/quartz/gdkdrawable-quartz.c | 32 |
2 files changed, 23 insertions, 17 deletions
@@ -1,3 +1,11 @@ +2007-05-05 Richard Hult <richard@imendio.com> + + * gdk/quartz/gdkdrawable-quartz.c: + (gdk_quartz_drawable_get_context), + (gdk_quartz_drawable_release_context): Fix bugs #428733 and #433301. + Turns out the lockFocus logic was flawed, now we only lock/unlock + when called outside a real expose event and never flush manually. + 2007-05-03 Behdad Esfahbod <behdad@gnome.org> * gtk/gtklabel.c (gtk_label_ensure_layout): diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c index 3b60a9ce09..113bee4d67 100644 --- a/gdk/quartz/gdkdrawable-quartz.c +++ b/gdk/quartz/gdkdrawable-quartz.c @@ -600,22 +600,23 @@ gdk_quartz_drawable_get_context (GdkDrawable *drawable, gboolean antialias) { GdkDrawableImplQuartz *drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable); + CGContextRef cg_context; if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable) && GDK_WINDOW_DESTROYED (drawable_impl->wrapper)) return NULL; - CGContextRef cg_context; - if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable)) { GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable); - - /* Lock focus when not called as part of begin/end paint cycle. - * This is needed to allow broken apps that draw outside of expose - * to still work (somewhat). + + /* Lock focus when not called as part of a drawRect call. This + * is needed when called from outside "real" expose events, for + * example for synthesized expose events when realizing windows + * and for widgets that send fake expose events like the arrow + * buttons in spinbuttons. */ - if (window_impl->begin_paint_count == 0) + if (window_impl->in_paint_rect_count == 0) { window_impl->pool = [[NSAutoreleasePool alloc] init]; if (![window_impl->view lockFocusIfCanDraw]) @@ -695,19 +696,16 @@ gdk_quartz_drawable_release_context (GdkDrawable *drawable, CGContextRestoreGState (cg_context); CGContextSetAllowsAntialiasing (cg_context, TRUE); - /* Only flush and unlock if called outside the expose, since it's - * already handled for otherwise. - */ - if (window_impl->in_paint_rect_count == 0 && window_impl->begin_paint_count == 0) + /* See comment in gdk_quartz_drawable_get_context(). */ + if (window_impl->in_paint_rect_count == 0) { - CGContextFlush (cg_context); [window_impl->view unlockFocus]; - } - if (window_impl->pool) - { - [window_impl->pool release]; - window_impl->pool = NULL; + if (window_impl->pool) + { + [window_impl->pool release]; + window_impl->pool = NULL; + } } } else if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable)) |