diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-01-23 13:00:03 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-01-23 13:00:03 (GMT) |
commit | d605889115f15c2c628a12bd185bf3fd92b156ee (patch) | |
tree | 09587ba7f01dd38c7806c9afdab115b4016a567e /abs/extra-testing/community/firefox/mozbug421977.patch | |
parent | 4702175bc8bf5f1af5c16d6ddd02140d017b8e02 (diff) | |
download | linhes_pkgbuild-d605889115f15c2c628a12bd185bf3fd92b156ee.zip linhes_pkgbuild-d605889115f15c2c628a12bd185bf3fd92b156ee.tar.gz linhes_pkgbuild-d605889115f15c2c628a12bd185bf3fd92b156ee.tar.bz2 |
Initial community packages for various users.
Diffstat (limited to 'abs/extra-testing/community/firefox/mozbug421977.patch')
-rw-r--r-- | abs/extra-testing/community/firefox/mozbug421977.patch | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/abs/extra-testing/community/firefox/mozbug421977.patch b/abs/extra-testing/community/firefox/mozbug421977.patch new file mode 100644 index 0000000..df8371a --- /dev/null +++ b/abs/extra-testing/community/firefox/mozbug421977.patch @@ -0,0 +1,158 @@ +Index: browser/components/shell/src/nsGNOMEShellService.cpp +=================================================================== +RCS file: /cvsroot/mozilla/browser/components/shell/src/nsGNOMEShellService.cpp,v +retrieving revision 1.21 +diff -d -u -p -U 8 -r1.21 nsGNOMEShellService.cpp +--- browser/components/shell/src/nsGNOMEShellService.cpp 1 Oct 2007 18:25:26 -0000 1.21 ++++ browser/components/shell/src/nsGNOMEShellService.cpp 15 Mar 2008 07:08:47 -0000 +@@ -58,16 +58,17 @@ + #include "nsIImage.h" + #include "prprf.h" + #ifdef MOZ_WIDGET_GTK2 + #include "nsIImageToPixbuf.h" + #endif + + #include <glib.h> + #include <glib-object.h> ++#include <gdk/gdk.h> + #include <gdk-pixbuf/gdk-pixbuf.h> + #include <limits.h> + #include <stdlib.h> + + struct ProtocolAssociation + { + const char *name; + PRBool essential; +@@ -442,117 +443,56 @@ nsGNOMEShellService::SetDesktopBackgroun + EmptyCString()); + + gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath); + gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), PR_TRUE); + + return rv; + } + +-// In: pointer to two characters CC +-// Out: parsed color number +-static PRUint8 +-HexToNum(char ch) +-{ +- if ('0' <= ch && '9' >= ch) +- return ch - '0'; +- +- if ('A' <= ch && 'F' >= ch) +- return ch - 'A'; +- +- if ('a' <= ch && 'f' >= ch) +- return ch - 'a'; +- +- return 0; +-} +- +- +-// In: 3 or 6-character RRGGBB hex string +-// Out: component colors +-static PRBool +-HexToRGB(const nsCString& aColorSpec, +- PRUint8 &aRed, +- PRUint8 &aGreen, +- PRUint8 &aBlue) +-{ +- const char *buf = aColorSpec.get(); +- +- if (aColorSpec.Length() == 6) { +- aRed = HexToNum(buf[0]) >> 4 | +- HexToNum(buf[1]); +- aGreen = HexToNum(buf[2]) >> 4 | +- HexToNum(buf[3]); +- aBlue = HexToNum(buf[4]) >> 4 | +- HexToNum(buf[5]); +- return PR_TRUE; +- } +- +- if (aColorSpec.Length() == 3) { +- aRed = HexToNum(buf[0]); +- aGreen = HexToNum(buf[1]); +- aBlue = HexToNum(buf[2]); +- +- aRed |= aRed >> 4; +- aGreen |= aGreen >> 4; +- aBlue |= aBlue >> 4; +- +- return PR_TRUE; +- } +- +- return PR_FALSE; +-} ++#define COLOR_16_TO_8_BIT(_c) ((_c) >> 8) ++#define COLOR_8_TO_16_BIT(_c) ((_c) << 8) + + NS_IMETHODIMP + nsGNOMEShellService::GetDesktopBackgroundColor(PRUint32 *aColor) + { + nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); + + nsCAutoString background; + gconf->GetString(NS_LITERAL_CSTRING(kDesktopColorKey), background); + + if (background.IsEmpty()) { + *aColor = 0; + return NS_OK; + } + +- // Chop off the leading '#' character +- background.Cut(0, 1); ++ GdkColor color; ++ gboolean success = gdk_color_parse(background.get(), &color); + +- PRUint8 red, green, blue; +- if (!HexToRGB(background, red, green, blue)) +- return NS_ERROR_FAILURE; ++ NS_ENSURE_TRUE(success, NS_ERROR_FAILURE); + +- // The result must be in RGB order with the high 8 bits zero. +- *aColor = (red << 16 | green << 8 | blue); ++ *aColor = COLOR_16_TO_8_BIT(color.red) << 16 | ++ COLOR_16_TO_8_BIT(color.green) << 8 | ++ COLOR_16_TO_8_BIT(color.blue); + return NS_OK; + } + +-static void +-ColorToHex(PRUint32 aColor, nsCString& aResult) +-{ +- char *buf = aResult.BeginWriting(7); +- if (!buf) +- return; +- +- PRUint8 red = (aColor >> 16); +- PRUint8 green = (aColor >> 8) & 0xff; +- PRUint8 blue = aColor & 0xff; +- +- PR_snprintf(buf, 8, "#%02x%02x%02x", red, green, blue); +-} +- + NS_IMETHODIMP + nsGNOMEShellService::SetDesktopBackgroundColor(PRUint32 aColor) + { + nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); + +- nsCString colorString; +- ColorToHex(aColor, colorString); ++ GdkColor color; ++ color.red = COLOR_8_TO_16_BIT(aColor >> 16); ++ color.green = COLOR_8_TO_16_BIT((aColor >> 8) & 0xff); ++ color.blue = COLOR_8_TO_16_BIT(aColor & 0xff); + +- gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), colorString); ++ gchar *colorString = gdk_color_to_string(&color); ++ gconf->SetString(NS_LITERAL_CSTRING(kDesktopColorKey), nsDependentCString(colorString)); ++ g_free (colorString); + + return NS_OK; + } + + NS_IMETHODIMP + nsGNOMEShellService::OpenApplication(PRInt32 aApplication) + { + nsCAutoString scheme; |