From 33105ca61fe6f83bbb18ab9dabea577124b2dfd1 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Thu, 25 Sep 2008 13:07:11 -0700 Subject: [PATCH] b=456467; revisit cairo xlib buggy repeat handling; r=roc --- gfx/cairo/buggy-repeat.patch | 39 +++++++++++++++--------- gfx/cairo/cairo/src/cairo-xlib-display.c | 21 +++++++++---- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/gfx/cairo/buggy-repeat.patch b/gfx/cairo/buggy-repeat.patch index ca53a3f60a5..3d27b8f9b7f 100644 --- a/gfx/cairo/buggy-repeat.patch +++ b/gfx/cairo/buggy-repeat.patch @@ -1,30 +1,39 @@ diff --git a/gfx/cairo/cairo/src/cairo-xlib-display.c b/gfx/cairo/cairo/src/cairo-xlib-display.c --- a/gfx/cairo/cairo/src/cairo-xlib-display.c +++ b/gfx/cairo/cairo/src/cairo-xlib-display.c -@@ -63,6 +63,8 @@ struct _cairo_xlib_job { - }; +@@ -216,6 +216,8 @@ _cairo_xlib_display_get (Display *dpy) + XExtCodes *codes; + int major_unused, minor_unused; - static cairo_xlib_display_t *_cairo_xlib_display_list; ++ static int buggy_repeat_force = -1; + -+static int buggy_repeat_force = -1; - - static void - _cairo_xlib_call_close_display_hooks (cairo_xlib_display_t *display) -@@ -302,6 +304,17 @@ _cairo_xlib_display_get (Display *dpy) + /* There is an apparent deadlock between this mutex and the + * mutex for the display, but it's actually safe. For the + * app to call XCloseDisplay() while any other thread is +@@ -308,6 +310,26 @@ _cairo_xlib_display_get (Display *dpy) + if (VendorRelease (dpy) <= 40500000) display->buggy_repeat = TRUE; } - ++ + /* XXX workaround; see https://bugzilla.mozilla.org/show_bug.cgi?id=413583 */ ++ /* If buggy_repeat_force == -1, then initialize. ++ * - set to -2, meaning "nothing was specified", and we trust the above detection. ++ * - if MOZ_CAIRO_BUGGY_REPEAT is '0' (exactly), then force buggy repeat off ++ * - if MOZ_CAIRO_BUGGY_REPEAT is '1' (exactly), then force buggy repeat on ++ */ + if (buggy_repeat_force == -1) { -+ if (getenv("MOZ_CAIRO_NO_BUGGY_REPEAT")) ++ const char *flag = getenv("MOZ_CAIRO_FORCE_BUGGY_REPEAT"); ++ ++ buggy_repeat_force = -2; ++ ++ if (flag && flag[0] == '0') + buggy_repeat_force = 0; -+ else ++ else if (flag && flag[0] == '1') + buggy_repeat_force = 1; + } + -+ if (buggy_repeat_force) -+ display->buggy_repeat = TRUE; -+ ++ if (buggy_repeat_force != -2) ++ display->buggy_repeat = (buggy_repeat_force == 1); + display->next = _cairo_xlib_display_list; _cairo_xlib_display_list = display; - diff --git a/gfx/cairo/cairo/src/cairo-xlib-display.c b/gfx/cairo/cairo/src/cairo-xlib-display.c index f50c1e12e17..be0dbcee54f 100644 --- a/gfx/cairo/cairo/src/cairo-xlib-display.c +++ b/gfx/cairo/cairo/src/cairo-xlib-display.c @@ -66,8 +66,6 @@ struct _cairo_xlib_job { static cairo_xlib_display_t *_cairo_xlib_display_list; -static int buggy_repeat_force = -1; - static void _cairo_xlib_remove_close_display_hook_internal (cairo_xlib_display_t *display, cairo_xlib_hook_t *hook); @@ -218,6 +216,8 @@ _cairo_xlib_display_get (Display *dpy) XExtCodes *codes; int major_unused, minor_unused; + static int buggy_repeat_force = -1; + /* There is an apparent deadlock between this mutex and the * mutex for the display, but it's actually safe. For the * app to call XCloseDisplay() while any other thread is @@ -312,15 +312,24 @@ _cairo_xlib_display_get (Display *dpy) } /* XXX workaround; see https://bugzilla.mozilla.org/show_bug.cgi?id=413583 */ + /* If buggy_repeat_force == -1, then initialize. + * - set to -2, meaning "nothing was specified", and we trust the above detection. + * - if MOZ_CAIRO_BUGGY_REPEAT is '0' (exactly), then force buggy repeat off + * - if MOZ_CAIRO_BUGGY_REPEAT is '1' (exactly), then force buggy repeat on + */ if (buggy_repeat_force == -1) { - if (getenv("MOZ_CAIRO_NO_BUGGY_REPEAT")) + const char *flag = getenv("MOZ_CAIRO_FORCE_BUGGY_REPEAT"); + + buggy_repeat_force = -2; + + if (flag && flag[0] == '0') buggy_repeat_force = 0; - else + else if (flag && flag[0] == '1') buggy_repeat_force = 1; } - if (buggy_repeat_force) - display->buggy_repeat = TRUE; + if (buggy_repeat_force != -2) + display->buggy_repeat = (buggy_repeat_force == 1); display->next = _cairo_xlib_display_list; _cairo_xlib_display_list = display;