diff --git a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp index 35e3b71d084..5a60041e1e9 100644 --- a/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp +++ b/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp @@ -67,7 +67,6 @@ extern Display * gDisplay; extern Screen * gScreen; extern Visual * gVisual; extern int gDepth; -extern XVisualInfo *gVisualInfo; NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget) { diff --git a/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp b/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp index acf70bad006..c24354b05d5 100644 --- a/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp +++ b/mozilla/gfx/src/xlib/nsGfxFactoryXlib.cpp @@ -47,7 +47,6 @@ Display *gDisplay; Screen *gScreen; int gDepth; Visual *gVisual; -XVisualInfo *gVisualInfo; class nsGfxFactoryXlib : public nsIFactory { diff --git a/mozilla/widget/src/xlib/nsAppShell.cpp b/mozilla/widget/src/xlib/nsAppShell.cpp index dce3628fae2..2a20ba45188 100644 --- a/mozilla/widget/src/xlib/nsAppShell.cpp +++ b/mozilla/widget/src/xlib/nsAppShell.cpp @@ -26,9 +26,6 @@ #include "nsIServiceManager.h" #include "nsITimer.h" -static PRUint8 convertMaskToCount(unsigned long val); -static PRUint8 getShiftForMask(unsigned long val); - static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); @@ -40,6 +37,9 @@ extern "C" Visual * xlib_rgb_get_visual (void); +extern "C" XVisualInfo * +xlib_rgb_get_visual_info (void); + // this is so that we can get the timers in the base. most widget // toolkits do this through some set of globals. not here though. we // don't have that luxury @@ -122,8 +122,6 @@ nsresult nsAppShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) NS_METHOD nsAppShell::Create(int* argc, char ** argv) { - int num_visuals = 0; - XVisualInfo vis_template; // open the display if ((gDisplay = XOpenDisplay(NULL)) == NULL) { fprintf(stderr, "%s: Cannot connect to X server %s\n", @@ -132,24 +130,25 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv) } _Xdebug = 1; gScreen = DefaultScreenOfDisplay(gDisplay); + // init the rgb layer. this will provide // the visual information for us. xlib_rgb_init(gDisplay, gScreen); + gVisual = xlib_rgb_get_visual(); - // set the static vars for this class so we can find our - // way around... - vis_template.visualid = XVisualIDFromVisual(gVisual); - gVisualInfo = XGetVisualInfo(gDisplay, VisualIDMask, - &vis_template, &num_visuals); - if (gVisualInfo == NULL) { - printf("nsAppShell::Create(): Warning: Failed to get XVisualInfo\n"); + NS_ASSERTION(nsnull != gVisual,"Visual from xlibrgb is null."); + +#if 1 + XVisualInfo * x_visual_info = xlib_rgb_get_visual_info(); + + NS_ASSERTION(nsnull != x_visual_info,"Visual info from xlibrgb is null."); + + if (nsnull != x_visual_info) + { + gDepth = x_visual_info->depth; } - if (num_visuals != 1) { - printf("nsAppShell:Create(): Warning: %d XVisualInfo structs were returned.\n", num_visuals); - } - // get the depth for this display - gDepth = gVisualInfo->depth; +#endif return NS_OK; } diff --git a/mozilla/widget/src/xlib/nsWidget.h b/mozilla/widget/src/xlib/nsWidget.h index ba214ab0d11..288714d728a 100644 --- a/mozilla/widget/src/xlib/nsWidget.h +++ b/mozilla/widget/src/xlib/nsWidget.h @@ -143,7 +143,6 @@ extern Display *gDisplay; extern Screen *gScreen; extern int gDepth; extern Visual *gVisual; -extern XVisualInfo *gVisualInfo; // this is from the xlibrgb code.