Bug 94569: Move xlib & xprint over to xxlibrgb* api. Patch by gisburn, I'm
just checking it in for him. a=asa, r=jag, r=Tomi.Leppikangas@oulu.fi, r=cls (Makefile changes), sr=kin
This commit is contained in:
Родитель
86f8875f09
Коммит
66340c96e8
|
@ -38,8 +38,8 @@ else
|
|||
DIRS = ps
|
||||
endif
|
||||
|
||||
# Build xlibrgb only for X toolkits
|
||||
ifneq (,$(filter motif xlib,$(MOZ_WIDGET_TOOLKIT))$(MOZ_ENABLE_XLIB))
|
||||
# Build xlibrgb only for X toolkits and/or Xprint
|
||||
ifneq (,$(filter motif xlib,$(MOZ_WIDGET_TOOLKIT))$(MOZ_ENABLE_XLIB)$(MOZ_ENABLE_XPRINT))
|
||||
DIRS += xlibrgb
|
||||
endif
|
||||
|
||||
|
|
|
@ -79,6 +79,9 @@ nsDeviceContextXlib::nsDeviceContextXlib()
|
|||
mHeightFloat = 0.0f;
|
||||
mWidth = -1;
|
||||
mHeight = -1;
|
||||
mXlibRgbHandle = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE);
|
||||
if (!mXlibRgbHandle)
|
||||
abort();
|
||||
}
|
||||
|
||||
nsDeviceContextXlib::~nsDeviceContextXlib()
|
||||
|
@ -94,10 +97,10 @@ NS_IMETHODIMP nsDeviceContextXlib::Init(nsNativeWidget aNativeWidget)
|
|||
|
||||
mWidget = aNativeWidget;
|
||||
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mScreen = xlib_rgb_get_screen();
|
||||
mVisual = xlib_rgb_get_visual();
|
||||
mDepth = xlib_rgb_get_depth();
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
mScreen = xxlib_rgb_get_screen(mXlibRgbHandle);
|
||||
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
mDepth = xxlib_rgb_get_depth(mXlibRgbHandle);
|
||||
|
||||
if (!mDefaultFont)
|
||||
mDefaultFont = XLoadQueryFont(mDisplay, XLIB_DEFAULT_FONT1);
|
||||
|
@ -183,10 +186,7 @@ NS_IMETHODIMP nsDeviceContextXlib::CreateRenderingContext(nsIRenderingContext *&
|
|||
surface = new nsDrawingSurfaceXlib();
|
||||
if (nsnull != surface) {
|
||||
xGC *gc = new xGC(mDisplay,(Drawable) mWidget, 0, NULL);
|
||||
rv = surface->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
rv = surface->Init(mXlibRgbHandle,
|
||||
(Drawable) mWidget,
|
||||
gc);
|
||||
|
||||
|
@ -380,9 +380,10 @@ NS_IMETHODIMP nsDeviceContextXlib::GetDrawingSurface(nsIRenderingContext &aConte
|
|||
NS_IMETHODIMP nsDeviceContextXlib::ConvertPixel(nscolor aColor, PRUint32 & aPixel)
|
||||
{
|
||||
PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::ConvertPixel()\n"));
|
||||
aPixel = xlib_rgb_xpixel_from_rgb(NS_RGB(NS_GET_B(aColor),
|
||||
NS_GET_G(aColor),
|
||||
NS_GET_R(aColor)));
|
||||
aPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle,
|
||||
NS_RGB(NS_GET_B(aColor),
|
||||
NS_GET_G(aColor),
|
||||
NS_GET_R(aColor)));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
|
||||
#include "nsDeviceContext.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include "xlibrgb.h"
|
||||
|
||||
class nsDeviceContextXlib : public DeviceContextImpl
|
||||
{
|
||||
|
@ -67,6 +66,7 @@ public:
|
|||
|
||||
NS_IMETHOD CreateFontCache();
|
||||
|
||||
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
|
||||
Display *GetDisplay() { return mDisplay; }
|
||||
Screen *GetScreen() { return mScreen; }
|
||||
Visual *GetVisual() { return mVisual; }
|
||||
|
@ -82,6 +82,7 @@ private:
|
|||
PRBool mWriteable;
|
||||
PRUint32 mNumCells;
|
||||
nsDrawingSurface mSurface;
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#include "prlog.h"
|
||||
#include "nsGCCache.h"
|
||||
|
||||
#include "xlibrgb.h" // for xlib_rgb_get_visual_info
|
||||
#include <X11/Xutil.h> // for XVisualInfo.
|
||||
#include "xlibrgb.h" // for xxlib_rgb_get_visual_info
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo *DrawingSurfaceXlibLM = PR_NewLogModule("DrawingSurfaceXlib");
|
||||
|
@ -39,6 +38,7 @@ nsDrawingSurfaceXlib::nsDrawingSurfaceXlib()
|
|||
mDrawable = 0;
|
||||
mDestroyDrawable = PR_FALSE;
|
||||
mImage = nsnull;
|
||||
mXlibRgbHandle = nsnull;
|
||||
mDisplay = nsnull;
|
||||
mScreen = nsnull;
|
||||
mVisual = nsnull;
|
||||
|
@ -55,29 +55,6 @@ nsDrawingSurfaceXlib::nsDrawingSurfaceXlib()
|
|||
mWidth = 0;
|
||||
mHeight = 0;
|
||||
mIsOffscreen = PR_FALSE;
|
||||
|
||||
// set up the masks for the pix formats
|
||||
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)
|
||||
{
|
||||
mPixFormat.mRedMask = x_visual_info->red_mask;
|
||||
mPixFormat.mGreenMask = x_visual_info->green_mask;;
|
||||
mPixFormat.mBlueMask = x_visual_info->blue_mask;;
|
||||
mPixFormat.mAlphaMask = 0;
|
||||
|
||||
mPixFormat.mRedCount = ConvertMaskToCount(x_visual_info->red_mask);
|
||||
mPixFormat.mGreenCount = ConvertMaskToCount(x_visual_info->green_mask);
|
||||
mPixFormat.mBlueCount = ConvertMaskToCount(x_visual_info->blue_mask);;
|
||||
mPixFormat.mAlphaCount = 0;
|
||||
|
||||
mPixFormat.mRedShift = GetShiftForMask(x_visual_info->red_mask);
|
||||
mPixFormat.mGreenShift = GetShiftForMask(x_visual_info->green_mask);
|
||||
mPixFormat.mBlueShift = GetShiftForMask(x_visual_info->blue_mask);
|
||||
mPixFormat.mAlphaShift = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsDrawingSurfaceXlib::~nsDrawingSurfaceXlib()
|
||||
|
@ -101,63 +78,85 @@ nsDrawingSurfaceXlib::~nsDrawingSurfaceXlib()
|
|||
NS_IMPL_ISUPPORTS1(nsDrawingSurfaceXlib, nsIDrawingSurface)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDrawingSurfaceXlib::Init(Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
nsDrawingSurfaceXlib::Init(XlibRgbHandle *aXlibRgbHandle,
|
||||
Drawable aDrawable,
|
||||
xGC *aGC)
|
||||
{
|
||||
PR_LOG(DrawingSurfaceXlibLM, PR_LOG_DEBUG, ("nsDrawingSurfaceXlib::Init()\n"));
|
||||
|
||||
mDisplay = aDisplay;
|
||||
mScreen = aScreen;
|
||||
mVisual = aVisual;
|
||||
mDepth = aDepth;
|
||||
mDrawable = aDrawable;
|
||||
mXlibRgbHandle = aXlibRgbHandle;
|
||||
mDrawable = aDrawable;
|
||||
|
||||
CommonInit();
|
||||
|
||||
if (mGC)
|
||||
mGC->Release();
|
||||
mGC = aGC;
|
||||
mGC->AddRef();
|
||||
|
||||
|
||||
mIsOffscreen = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDrawingSurfaceXlib::Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
nsDrawingSurfaceXlib::Init (XlibRgbHandle *aXlibRgbHandle,
|
||||
xGC * aGC,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRUint32 aFlags)
|
||||
{
|
||||
mDisplay = aDisplay;
|
||||
mScreen = aScreen;
|
||||
mVisual = aVisual;
|
||||
mDepth = aDepth;
|
||||
mXlibRgbHandle = aXlibRgbHandle;
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
mLockFlags = aFlags;
|
||||
|
||||
if(mGC)
|
||||
CommonInit();
|
||||
|
||||
if (mGC)
|
||||
mGC->Release();
|
||||
mGC = aGC;
|
||||
mGC->AddRef();
|
||||
|
||||
|
||||
mIsOffscreen = PR_TRUE;
|
||||
|
||||
mDrawable = XCreatePixmap(mDisplay,
|
||||
RootWindow(mDisplay, GetScreenNumber()),
|
||||
XRootWindow(mDisplay, GetScreenNumber()),
|
||||
mWidth,
|
||||
mHeight,
|
||||
mDepth);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDrawingSurfaceXlib::CommonInit()
|
||||
{
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
mScreen = xxlib_rgb_get_screen(mXlibRgbHandle);
|
||||
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
mDepth = xxlib_rgb_get_depth(mXlibRgbHandle);
|
||||
|
||||
XVisualInfo *x_visual_info = xxlib_rgb_get_visual_info(mXlibRgbHandle);
|
||||
NS_ASSERTION(nsnull != x_visual_info, "Visual info from xlibrgb is null.");
|
||||
|
||||
if (x_visual_info)
|
||||
{
|
||||
mPixFormat.mRedMask = x_visual_info->red_mask;
|
||||
mPixFormat.mGreenMask = x_visual_info->green_mask;;
|
||||
mPixFormat.mBlueMask = x_visual_info->blue_mask;;
|
||||
mPixFormat.mAlphaMask = 0;
|
||||
|
||||
mPixFormat.mRedCount = ConvertMaskToCount(x_visual_info->red_mask);
|
||||
mPixFormat.mGreenCount = ConvertMaskToCount(x_visual_info->green_mask);
|
||||
mPixFormat.mBlueCount = ConvertMaskToCount(x_visual_info->blue_mask);;
|
||||
mPixFormat.mAlphaCount = 0;
|
||||
|
||||
mPixFormat.mRedShift = GetShiftForMask(x_visual_info->red_mask);
|
||||
mPixFormat.mGreenShift = GetShiftForMask(x_visual_info->green_mask);
|
||||
mPixFormat.mBlueShift = GetShiftForMask(x_visual_info->blue_mask);
|
||||
mPixFormat.mAlphaShift = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDrawingSurfaceXlib::Lock(PRInt32 aX, PRInt32 aY,
|
||||
PRUint32 aWidth, PRUint32 aHeight,
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
|
||||
#include "nsIDrawingSurface.h"
|
||||
#include "nsGCCache.h"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "xlibrgb.h"
|
||||
|
||||
class nsDrawingSurfaceXlib : public nsIDrawingSurface
|
||||
{
|
||||
|
@ -46,23 +44,18 @@ public:
|
|||
NS_IMETHOD IsPixelAddressable(PRBool *aAddressable);
|
||||
NS_IMETHOD GetPixelFormat(nsPixelFormat *aFormat);
|
||||
|
||||
NS_IMETHOD Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
NS_IMETHOD Init (XlibRgbHandle *aHandle,
|
||||
Drawable aDrawable,
|
||||
xGC * aGC);
|
||||
|
||||
NS_IMETHOD Init (Display * aDisplay,
|
||||
Screen * aScreen,
|
||||
Visual * aVisual,
|
||||
int aDepth,
|
||||
NS_IMETHOD Init (XlibRgbHandle *aHandle,
|
||||
xGC * aGC,
|
||||
PRUint32 aWidth,
|
||||
PRUint32 aHeight,
|
||||
PRUint32 aFlags);
|
||||
|
||||
Drawable GetDrawable(void) { return (mDrawable); }
|
||||
Drawable GetDrawable() { return mDrawable; }
|
||||
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
|
||||
Display * GetDisplay() { return mDisplay; }
|
||||
Screen * GetScreen() { return mScreen; }
|
||||
Visual * GetVisual() { return mVisual; }
|
||||
|
@ -71,6 +64,9 @@ public:
|
|||
xGC * GetGC() { mGC->AddRef(); return mGC; }
|
||||
|
||||
private:
|
||||
void CommonInit();
|
||||
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
|
|
|
@ -167,6 +167,7 @@ static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);
|
|||
|
||||
static int gFontMetricsXlibCount = 0;
|
||||
static int gInitialized = 0;
|
||||
static XlibRgbHandle *gXlibRgbHandle = nsnull;
|
||||
static PRBool gAllowDoubleByteSpecialChars = PR_TRUE;
|
||||
|
||||
// XXX many of these statics need to be freed at shutdown time
|
||||
|
@ -732,7 +733,9 @@ nsFontMetricsXlib::FreeGlobals(void)
|
|||
for (charSetMap = gCharSetMap; charSetMap->mFontLangGroup; charSetMap++) {
|
||||
NS_IF_RELEASE(charSetMap->mFontLangGroup->mFontLangGroupAtom);
|
||||
charSetMap->mFontLangGroup->mFontLangGroupAtom = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
gXlibRgbHandle = nsnull;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1027,8 +1030,15 @@ nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
|||
nsString savedName = mFont->name;
|
||||
mFont->name = NS_LITERAL_STRING("serif");
|
||||
#endif /* XPRINT_FONT_HACK */
|
||||
|
||||
mDeviceContext = aContext;
|
||||
|
||||
#ifdef _IMPL_NS_XPRINT
|
||||
mDeviceContext = (nsDeviceContextXp *)aContext;
|
||||
#else
|
||||
mDeviceContext = (nsDeviceContextXlib *)aContext;
|
||||
#endif /* _IMPL_NS_XPRINT */
|
||||
|
||||
if (!gXlibRgbHandle)
|
||||
gXlibRgbHandle = mDeviceContext->GetXlibRgbHandle();
|
||||
|
||||
float app2dev;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
|
@ -1845,7 +1855,7 @@ nsFontXlib::LoadFont(void)
|
|||
|
||||
mAlreadyCalledLoadFont = PR_TRUE;
|
||||
|
||||
Display *aDisplay = xlib_rgb_get_display();
|
||||
Display *aDisplay = xxlib_rgb_get_display(gXlibRgbHandle);
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
if (nsFontMetricsXlib::mPrinterMode)
|
||||
|
@ -1937,7 +1947,7 @@ nsFontXlib::~nsFontXlib()
|
|||
{
|
||||
MOZ_COUNT_DTOR(nsFontXlib);
|
||||
if (mFont)
|
||||
XFreeFont(xlib_rgb_get_display(), mFont);
|
||||
XFreeFont(xxlib_rgb_get_display(gXlibRgbHandle), mFont);
|
||||
|
||||
if (mCharSetInfo == &ISO106461)
|
||||
PR_FREEIF(mMap);
|
||||
|
@ -3153,11 +3163,12 @@ static void
|
|||
GetFontNames(const char* aPattern, nsFontNodeArrayXlib* aNodes)
|
||||
{
|
||||
nsCAutoString previousNodeName;
|
||||
Display *dpy = xxlib_rgb_get_display(gXlibRgbHandle);
|
||||
|
||||
#ifdef USE_XPRINT
|
||||
if(nsFontMetricsXlib::mPrinterMode)
|
||||
{
|
||||
if (XpGetContext(xlib_rgb_get_display()) == None)
|
||||
if (XpGetContext(dpy) == None)
|
||||
{
|
||||
/* applications must not make any assumptions about fonts _before_ XpSetContext() !!! */
|
||||
NS_ERROR("Obtaining font information without valid print context (XListFonts()) _before_ XpSetContext()");
|
||||
|
@ -3166,7 +3177,7 @@ GetFontNames(const char* aPattern, nsFontNodeArrayXlib* aNodes)
|
|||
}
|
||||
#endif /* USE_XPRINT */
|
||||
int count;
|
||||
char** list = ::XListFonts(xlib_rgb_get_display(), aPattern, INT_MAX, &count);
|
||||
char** list = ::XListFonts(dpy, aPattern, INT_MAX, &count);
|
||||
if ((!list) || (count < 1)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@
|
|||
#include "nsRenderingContextXlib.h"
|
||||
#include "nsString.h"
|
||||
#include "nsUnitConversion.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
#include "xlibrgb.h"
|
||||
|
||||
// Remove this eventually after I remove all usage from implementation file. TonyT
|
||||
#define FONT_SWITCHING
|
||||
|
@ -211,7 +208,11 @@ public:
|
|||
protected:
|
||||
void RealizeFont();
|
||||
|
||||
nsIDeviceContext *mDeviceContext;
|
||||
#ifdef _IMPL_NS_XPRINT
|
||||
nsDeviceContextXp *mDeviceContext;
|
||||
#else
|
||||
nsDeviceContextXlib *mDeviceContext;
|
||||
#endif /* _IMPL_NS_XPRINT */
|
||||
nsFont *mFont;
|
||||
XFontStruct *mFontHandle;
|
||||
XFontStruct *mFontStruct;
|
||||
|
|
|
@ -48,6 +48,7 @@ static PRLogModuleInfo *ImageXlibLM = PR_NewLogModule("ImageXlib");
|
|||
static GC s1bitGC = 0;
|
||||
static GC sXbitGC = 0;
|
||||
|
||||
XlibRgbHandle *nsImageXlib::mXlibRgbHandle = nsnull;
|
||||
|
||||
nsImageXlib::nsImageXlib()
|
||||
{
|
||||
|
@ -73,7 +74,10 @@ nsImageXlib::nsImageXlib()
|
|||
mGC = nsnull;
|
||||
mNaturalWidth = 0;
|
||||
mNaturalHeight = 0;
|
||||
|
||||
if (!mXlibRgbHandle)
|
||||
mXlibRgbHandle = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE);
|
||||
if (!mXlibRgbHandle)
|
||||
abort();
|
||||
}
|
||||
|
||||
nsImageXlib::~nsImageXlib()
|
||||
|
@ -384,7 +388,9 @@ void nsImageXlib::ImageUpdated(nsIDeviceContext *aContext,
|
|||
gcv.function = GXcopy;
|
||||
sXbitGC = XCreateGC(mDisplay, mImagePixmap, GCFunction, &gcv);
|
||||
}
|
||||
xlib_draw_rgb_image_dithalign(mImagePixmap, sXbitGC,
|
||||
xxlib_draw_rgb_image_dithalign(
|
||||
mXlibRgbHandle,
|
||||
mImagePixmap, sXbitGC,
|
||||
aUpdateRect->x, aUpdateRect->y,
|
||||
aUpdateRect->width, aUpdateRect->height,
|
||||
XLIB_RGB_DITHER_MAX,
|
||||
|
@ -489,7 +495,7 @@ nsImageXlib::DrawScaled(nsIRenderingContext &aContext,
|
|||
XImage *ximage = 0;
|
||||
|
||||
if (pixmap) {
|
||||
ximage = XCreateImage(mDisplay, xlib_rgb_get_visual(),
|
||||
ximage = XCreateImage(mDisplay, xxlib_rgb_get_visual(mXlibRgbHandle),
|
||||
1, XYPixmap, 0, (char *)scaledAlpha,
|
||||
aDWidth, aDHeight,
|
||||
8, scaledRowBytes);
|
||||
|
@ -545,10 +551,10 @@ nsImageXlib::DrawScaled(nsIRenderingContext &aContext,
|
|||
0, 0, aDWidth-1, aDHeight-1,
|
||||
mImageBits, mRowBytes, scaledRGB, 3*aDWidth, 24);
|
||||
|
||||
xlib_draw_rgb_image(drawing->GetDrawable(), gc,
|
||||
aDX, aDY, aDWidth, aDHeight,
|
||||
XLIB_RGB_DITHER_MAX,
|
||||
scaledRGB, 3*aDWidth);
|
||||
xxlib_draw_rgb_image(mXlibRgbHandle, drawing->GetDrawable(), gc,
|
||||
aDX, aDY, aDWidth, aDHeight,
|
||||
XLIB_RGB_DITHER_MAX,
|
||||
scaledRGB, 3*aDWidth);
|
||||
nsMemory::Free(scaledRGB);
|
||||
}
|
||||
|
||||
|
@ -626,7 +632,6 @@ nsImageXlib::Draw(nsIRenderingContext &aContext, nsDrawingSurface aSurface,
|
|||
if (mDisplay == nsnull)
|
||||
mDisplay = drawing->GetDisplay();
|
||||
|
||||
|
||||
if (mAlphaDepth == 1)
|
||||
CreateAlphaBitmap(mWidth, mHeight);
|
||||
|
||||
|
@ -704,7 +709,7 @@ void nsImageXlib::DrawComposited32(PRBool isLSB, PRBool flipBytes,
|
|||
unsigned width, unsigned height,
|
||||
XImage *ximage, unsigned char *readData)
|
||||
{
|
||||
Visual *visual = xlib_rgb_get_visual();
|
||||
Visual *visual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
unsigned redIndex = findIndex32(visual->red_mask);
|
||||
unsigned greenIndex = findIndex32(visual->green_mask);
|
||||
unsigned blueIndex = findIndex32(visual->blue_mask);
|
||||
|
@ -743,7 +748,7 @@ nsImageXlib::DrawComposited24(PRBool isLSB, PRBool flipBytes,
|
|||
unsigned width, unsigned height,
|
||||
XImage *ximage, unsigned char *readData)
|
||||
{
|
||||
Visual *visual = xlib_rgb_get_visual();
|
||||
Visual *visual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
unsigned redIndex = findIndex24(visual->red_mask);
|
||||
unsigned greenIndex = findIndex24(visual->green_mask);
|
||||
unsigned blueIndex = findIndex24(visual->blue_mask);
|
||||
|
@ -791,18 +796,18 @@ nsImageXlib::DrawComposited16(PRBool isLSB, PRBool flipBytes,
|
|||
unsigned width, unsigned height,
|
||||
XImage *ximage, unsigned char *readData)
|
||||
{
|
||||
Visual *visual = xlib_rgb_get_visual();
|
||||
Visual *visual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
|
||||
unsigned *redScale = (xlib_get_prec_from_mask(visual->red_mask) == 5)
|
||||
unsigned *redScale = (xxlib_get_prec_from_mask(visual->red_mask) == 5)
|
||||
? scaled5 : scaled6;
|
||||
unsigned *greenScale = (xlib_get_prec_from_mask(visual->green_mask) == 5)
|
||||
unsigned *greenScale = (xxlib_get_prec_from_mask(visual->green_mask) == 5)
|
||||
? scaled5 : scaled6;
|
||||
unsigned *blueScale = (xlib_get_prec_from_mask(visual->blue_mask) == 5)
|
||||
unsigned *blueScale = (xxlib_get_prec_from_mask(visual->blue_mask) == 5)
|
||||
? scaled5 : scaled6;
|
||||
|
||||
unsigned long redShift = xlib_get_shift_from_mask(visual->red_mask);
|
||||
unsigned long greenShift = xlib_get_shift_from_mask(visual->green_mask);
|
||||
unsigned long blueShift = xlib_get_shift_from_mask(visual->blue_mask);
|
||||
unsigned long redShift = xxlib_get_shift_from_mask(visual->red_mask);
|
||||
unsigned long greenShift = xxlib_get_shift_from_mask(visual->green_mask);
|
||||
unsigned long blueShift = xxlib_get_shift_from_mask(visual->blue_mask);
|
||||
|
||||
for (unsigned y=0; y<height; y++) {
|
||||
unsigned char *baseRow = (unsigned char *)ximage->data
|
||||
|
@ -842,7 +847,7 @@ nsImageXlib::DrawCompositedGeneral(PRBool isLSB, PRBool flipBytes,
|
|||
unsigned width, unsigned height,
|
||||
XImage *ximage, unsigned char *readData)
|
||||
{
|
||||
Visual *visual = xlib_rgb_get_visual();
|
||||
Visual *visual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
|
||||
unsigned char *target = readData;
|
||||
|
||||
|
@ -889,17 +894,16 @@ nsImageXlib::DrawCompositedGeneral(PRBool isLSB, PRBool flipBytes,
|
|||
}
|
||||
}
|
||||
|
||||
unsigned redScale, greenScale, blueScale, redFill, greenFill, blueFill;
|
||||
redScale = 8-xlib_get_prec_from_mask(visual->red_mask);
|
||||
greenScale = 8-xlib_get_prec_from_mask(visual->green_mask);
|
||||
blueScale = 8-xlib_get_prec_from_mask(visual->blue_mask);
|
||||
redFill = 0xff>>xlib_get_prec_from_mask(visual->red_mask);
|
||||
greenFill = 0xff>>xlib_get_prec_from_mask(visual->green_mask);
|
||||
blueFill = 0xff>>xlib_get_prec_from_mask(visual->blue_mask);
|
||||
unsigned redScale = 8 - xxlib_get_prec_from_mask(visual->red_mask);
|
||||
unsigned greenScale = 8 - xxlib_get_prec_from_mask(visual->green_mask);
|
||||
unsigned blueScale = 8 - xxlib_get_prec_from_mask(visual->blue_mask);
|
||||
unsigned redFill = 0xff >> xxlib_get_prec_from_mask(visual->red_mask);
|
||||
unsigned greenFill = 0xff >> xxlib_get_prec_from_mask(visual->green_mask);
|
||||
unsigned blueFill = 0xff >> xxlib_get_prec_from_mask(visual->blue_mask);
|
||||
|
||||
unsigned long redShift = xlib_get_shift_from_mask(visual->red_mask);
|
||||
unsigned long greenShift = xlib_get_shift_from_mask(visual->green_mask);
|
||||
unsigned long blueShift = xlib_get_shift_from_mask(visual->blue_mask);
|
||||
unsigned long redShift = xxlib_get_shift_from_mask(visual->red_mask);
|
||||
unsigned long greenShift = xxlib_get_shift_from_mask(visual->green_mask);
|
||||
unsigned long blueShift = xxlib_get_shift_from_mask(visual->blue_mask);
|
||||
|
||||
for (int row=0; row<ximage->height; row++) {
|
||||
unsigned char *ptr =
|
||||
|
@ -972,10 +976,9 @@ nsImageXlib::DrawComposited(nsIRenderingContext &aContext,
|
|||
return;
|
||||
|
||||
nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib*)aSurface;
|
||||
Visual *visual = xlib_rgb_get_visual();
|
||||
|
||||
Display *dpy = drawing->GetDisplay();
|
||||
mDisplay = drawing->GetDisplay();
|
||||
Drawable drawable = drawing->GetDrawable();
|
||||
Visual *visual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
|
||||
// I hate clipping... too!
|
||||
PRUint32 surfaceWidth, surfaceHeight;
|
||||
|
@ -1016,7 +1019,7 @@ nsImageXlib::DrawComposited(nsIRenderingContext &aContext,
|
|||
// fprintf(stderr, "readX=%u readY=%u readWidth=%u readHeight=%u destX=%u destY=%u\n\n",
|
||||
// readX, readY, readWidth, readHeight, destX, destY);
|
||||
|
||||
XImage *ximage = XGetImage(dpy, drawable,
|
||||
XImage *ximage = XGetImage(mDisplay, drawable,
|
||||
readX, readY, readWidth, readHeight,
|
||||
AllPlanes, ZPixmap);
|
||||
|
||||
|
@ -1071,9 +1074,9 @@ nsImageXlib::DrawComposited(nsIRenderingContext &aContext,
|
|||
PRBool isLSB;
|
||||
unsigned int test = 1;
|
||||
isLSB = (((char *)&test)[0]) ? 1 : 0;
|
||||
int red_prec = xlib_get_prec_from_mask(visual->red_mask);
|
||||
int green_prec = xlib_get_prec_from_mask(visual->green_mask);
|
||||
int blue_prec = xlib_get_prec_from_mask(visual->blue_mask);
|
||||
int red_prec = xxlib_get_prec_from_mask(visual->red_mask);
|
||||
int green_prec = xxlib_get_prec_from_mask(visual->green_mask);
|
||||
int blue_prec = xxlib_get_prec_from_mask(visual->blue_mask);
|
||||
|
||||
|
||||
PRBool flipBytes =
|
||||
|
@ -1111,10 +1114,10 @@ nsImageXlib::DrawComposited(nsIRenderingContext &aContext,
|
|||
readWidth, readHeight, ximage, readData);
|
||||
|
||||
xGC *imageGC = ((nsRenderingContextXlib&)aContext).GetGC();
|
||||
xlib_draw_rgb_image(drawing->GetDrawable(), *imageGC,
|
||||
readX, readY, readWidth, readHeight,
|
||||
XLIB_RGB_DITHER_MAX,
|
||||
readData, 3*readWidth);
|
||||
xxlib_draw_rgb_image(mXlibRgbHandle, drawing->GetDrawable(), *imageGC,
|
||||
readX, readY, readWidth, readHeight,
|
||||
XLIB_RGB_DITHER_MAX,
|
||||
readData, 3*readWidth);
|
||||
XDestroyImage(ximage);
|
||||
imageGC->Release();
|
||||
nsMemory::Free(readData);
|
||||
|
@ -1131,7 +1134,7 @@ void nsImageXlib::CreateAlphaBitmap(PRInt32 aWidth, PRInt32 aHeight)
|
|||
XGCValues gcv;
|
||||
|
||||
if (mDisplay == nsnull)
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
|
||||
/* Create gc clip-mask on demand */
|
||||
if (mAlphaBits && IsFlagSet(nsImageUpdateFlags_kBitsChanged, mFlags)) {
|
||||
|
@ -1141,7 +1144,7 @@ void nsImageXlib::CreateAlphaBitmap(PRInt32 aWidth, PRInt32 aHeight)
|
|||
aWidth, aHeight, 1);
|
||||
|
||||
// Make an image out of the alpha-bits created by the image library
|
||||
x_image = XCreateImage(mDisplay, xlib_rgb_get_visual(),
|
||||
x_image = XCreateImage(mDisplay, xxlib_rgb_get_visual(mXlibRgbHandle),
|
||||
1, /* visual depth...1 for bitmaps */
|
||||
XYPixmap,
|
||||
0, /* x offset, XXX fix this */
|
||||
|
@ -1190,11 +1193,11 @@ void nsImageXlib::CreateOffscreenPixmap(PRInt32 aWidth, PRInt32 aHeight)
|
|||
{
|
||||
if (mImagePixmap == nsnull) {
|
||||
if (mDisplay == nsnull)
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
|
||||
mImagePixmap = XCreatePixmap(mDisplay, DefaultRootWindow(mDisplay),
|
||||
mImagePixmap = XCreatePixmap(mDisplay, XDefaultRootWindow(mDisplay),
|
||||
aWidth, aHeight,
|
||||
xlib_rgb_get_depth());
|
||||
xxlib_rgb_get_depth(mXlibRgbHandle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1242,10 +1245,9 @@ nsImageXlib::Draw(nsIRenderingContext &aContext,
|
|||
}
|
||||
|
||||
nsDrawingSurfaceXlib *drawing = (nsDrawingSurfaceXlib*)aSurface;
|
||||
|
||||
if (mDisplay == nsnull)
|
||||
mDisplay = drawing->GetDisplay();
|
||||
|
||||
|
||||
PRInt32
|
||||
validX = 0,
|
||||
validY = 0,
|
||||
|
@ -1624,7 +1626,7 @@ NS_IMETHODIMP nsImageXlib::DrawToImage(nsIImage* aDstImage,
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mDisplay)
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
|
||||
GC gc = XCreateGC(mDisplay, dest->mImagePixmap, 0, NULL);
|
||||
|
||||
|
|
|
@ -28,10 +28,8 @@
|
|||
#include "nsIImage.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsGCCache.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
#include "X11/Xlib.h"
|
||||
#include "X11/Xutil.h"
|
||||
#include "X11/Xos.h"
|
||||
// class nsDrawingSurfaceXlib;
|
||||
|
||||
class nsImageXlib : public nsIImage {
|
||||
|
@ -191,6 +189,7 @@ private:
|
|||
PRInt32 mDecodedX2;
|
||||
PRInt32 mDecodedY2;
|
||||
|
||||
static XlibRgbHandle *mXlibRgbHandle;
|
||||
Display *mDisplay;
|
||||
|
||||
// alpha layer members
|
||||
|
|
|
@ -163,6 +163,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext)
|
|||
}
|
||||
NS_ASSERTION(nsnull != mContext, "Device context is null.");
|
||||
|
||||
mXlibRgbHandle = mPrintContext->GetXlibRgbHandle();
|
||||
mDisplay = mPrintContext->GetDisplay();
|
||||
mScreen = mPrintContext->GetScreen();
|
||||
mVisual = mPrintContext->GetVisual();
|
||||
|
@ -191,6 +192,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
|||
mContext = do_QueryInterface(aContext);
|
||||
NS_ASSERTION(nsnull != mContext, "Device context is null.");
|
||||
|
||||
mXlibRgbHandle = mContext->GetXlibRgbHandle();
|
||||
mDisplay = mContext->GetDisplay();
|
||||
mScreen = mContext->GetScreen();
|
||||
mVisual = mContext->GetVisual();
|
||||
|
@ -202,10 +204,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsIWidget *aWindow)
|
|||
Drawable win = (Drawable)aWindow->GetNativeData(NS_NATIVE_WINDOW);
|
||||
xGC *gc = (xGC*)aWindow->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
|
||||
mRenderingSurface->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
mRenderingSurface->Init(mXlibRgbHandle,
|
||||
(PRUint32)win,
|
||||
gc);
|
||||
|
||||
|
@ -226,6 +225,7 @@ nsRenderingContextXlib::Init(nsIDeviceContext* aContext, nsDrawingSurface aSurfa
|
|||
mContext = do_QueryInterface(aContext);
|
||||
NS_ASSERTION(nsnull != mContext, "Device context is null.");
|
||||
|
||||
mXlibRgbHandle = mContext->GetXlibRgbHandle();
|
||||
mDisplay = mContext->GetDisplay();
|
||||
mScreen = mContext->GetScreen();
|
||||
mVisual = mContext->GetVisual();
|
||||
|
@ -480,9 +480,10 @@ void nsRenderingContextXlib::UpdateGC()
|
|||
memset(&values, 0, sizeof(XGCValues));
|
||||
|
||||
unsigned long color;
|
||||
color = xlib_rgb_xpixel_from_rgb (NS_RGB(NS_GET_B(mCurrentColor),
|
||||
NS_GET_G(mCurrentColor),
|
||||
NS_GET_R(mCurrentColor)));
|
||||
color = xxlib_rgb_xpixel_from_rgb (mXlibRgbHandle,
|
||||
NS_RGB(NS_GET_B(mCurrentColor),
|
||||
NS_GET_G(mCurrentColor),
|
||||
NS_GET_R(mCurrentColor)));
|
||||
values.foreground = color;
|
||||
valuesMask = GCForeground;
|
||||
|
||||
|
@ -762,10 +763,7 @@ nsRenderingContextXlib::CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlag
|
|||
NS_ADDREF(surf);
|
||||
if (!mGC)
|
||||
UpdateGC();
|
||||
surf->Init(mDisplay,
|
||||
mScreen,
|
||||
mVisual,
|
||||
mDepth,
|
||||
surf->Init(mXlibRgbHandle,
|
||||
mGC,
|
||||
aBounds->width,
|
||||
aBounds->height,
|
||||
|
|
|
@ -237,6 +237,7 @@ private:
|
|||
nsCOMPtr<nsIRegion> mClipRegion;
|
||||
float mP2T;
|
||||
nscolor mCurrentColor;
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Visual * mVisual;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "nsScreenXlib.h"
|
||||
#include "xlibrgb.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
nsScreenXlib :: nsScreenXlib ( )
|
||||
{
|
||||
|
@ -48,10 +49,14 @@ NS_IMPL_ISUPPORTS1(nsScreenXlib, nsIScreen)
|
|||
NS_IMETHODIMP
|
||||
nsScreenXlib :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
|
||||
{
|
||||
XlibRgbHandle *xrh;
|
||||
if (!(xrh = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE)))
|
||||
abort();
|
||||
|
||||
*outTop = 0;
|
||||
*outLeft = 0;
|
||||
*outWidth = DisplayWidth(xlib_rgb_get_display(), 0);
|
||||
*outHeight = DisplayHeight(xlib_rgb_get_display(), 0);
|
||||
*outWidth = XDisplayWidth(xxlib_rgb_get_display(xrh), 0);
|
||||
*outHeight = XDisplayHeight(xxlib_rgb_get_display(xrh), 0);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -61,10 +66,14 @@ nsScreenXlib :: GetRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PR
|
|||
NS_IMETHODIMP
|
||||
nsScreenXlib :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidth, PRInt32 *outHeight)
|
||||
{
|
||||
XlibRgbHandle *xrh;
|
||||
if (!(xrh = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE)))
|
||||
abort();
|
||||
|
||||
*outTop = 0;
|
||||
*outLeft = 0;
|
||||
*outWidth = DisplayWidth(xlib_rgb_get_display(), 0);
|
||||
*outHeight = DisplayHeight(xlib_rgb_get_display(), 0);
|
||||
*outWidth = XDisplayWidth(xxlib_rgb_get_display(xrh), 0);
|
||||
*outHeight = XDisplayHeight(xxlib_rgb_get_display(xrh), 0);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -74,7 +83,11 @@ nsScreenXlib :: GetAvailRect(PRInt32 *outLeft, PRInt32 *outTop, PRInt32 *outWidt
|
|||
NS_IMETHODIMP
|
||||
nsScreenXlib :: GetPixelDepth(PRInt32 *aPixelDepth)
|
||||
{
|
||||
*aPixelDepth = xlib_rgb_get_depth();
|
||||
XlibRgbHandle *xrh;
|
||||
if (!(xrh = xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE)))
|
||||
abort();
|
||||
|
||||
*aPixelDepth = xxlib_rgb_get_depth(xrh);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ typedef enum {
|
|||
MSB_FIRST
|
||||
} ByteOrder;
|
||||
|
||||
static void xxlib_deregister_handle_by_handle(XlibRgbHandle *handle);
|
||||
|
||||
typedef void (*XlibRgbConvFunc) (XlibRgbHandle *handle,
|
||||
XImage *image,
|
||||
|
@ -128,7 +129,7 @@ typedef void (*XlibRgbConvFunc) (XlibRgbHandle *handle,
|
|||
(i.e. some but not all windows have privately installed
|
||||
colormaps). */
|
||||
|
||||
typedef struct _XlibRgbHandle
|
||||
struct _XlibRgbHandle
|
||||
{
|
||||
Display *display;
|
||||
Screen *screen;
|
||||
|
@ -215,7 +216,7 @@ typedef struct _XlibRgbHandle
|
|||
|
||||
|
||||
unsigned long
|
||||
xxlib_get_prec_from_mask(XlibRgbHandle *handle, unsigned long val)
|
||||
xxlib_get_prec_from_mask(unsigned long val)
|
||||
{
|
||||
unsigned long retval = 0;
|
||||
unsigned int cur_bit = 0;
|
||||
|
@ -231,7 +232,7 @@ xxlib_get_prec_from_mask(XlibRgbHandle *handle, unsigned long val)
|
|||
}
|
||||
|
||||
unsigned long
|
||||
xxlib_get_shift_from_mask(XlibRgbHandle *handle, unsigned long val)
|
||||
xxlib_get_shift_from_mask(unsigned long val)
|
||||
{
|
||||
unsigned long cur_bit = 0;
|
||||
/* walk through the number, looking for the first 1 */
|
||||
|
@ -658,12 +659,12 @@ xxlib_rgb_choose_visual (XlibRgbHandle *handle)
|
|||
this only applies to cool visuals like true color and direct color. */
|
||||
if (handle->x_visual_info->class == TrueColor ||
|
||||
handle->x_visual_info->class == DirectColor) {
|
||||
handle->red_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->red_mask);
|
||||
handle->red_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->red_mask);
|
||||
handle->green_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->green_mask);
|
||||
handle->green_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->green_mask);
|
||||
handle->blue_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->blue_mask);
|
||||
handle->blue_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->blue_mask);
|
||||
handle->red_shift = xxlib_get_shift_from_mask(handle->x_visual_info->red_mask);
|
||||
handle->red_prec = xxlib_get_prec_from_mask(handle->x_visual_info->red_mask);
|
||||
handle->green_shift = xxlib_get_shift_from_mask(handle->x_visual_info->green_mask);
|
||||
handle->green_prec = xxlib_get_prec_from_mask(handle->x_visual_info->green_mask);
|
||||
handle->blue_shift = xxlib_get_shift_from_mask(handle->x_visual_info->blue_mask);
|
||||
handle->blue_prec = xxlib_get_prec_from_mask(handle->x_visual_info->blue_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -721,12 +722,12 @@ xxlib_rgb_choose_visual_for_xprint (XlibRgbHandle *handle, int aDepth)
|
|||
this only applies to cool visuals like true color and direct color. */
|
||||
if (handle->x_visual_info->class == TrueColor ||
|
||||
handle->x_visual_info->class == DirectColor) {
|
||||
handle->red_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->red_mask);
|
||||
handle->red_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->red_mask);
|
||||
handle->green_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->green_mask);
|
||||
handle->green_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->green_mask);
|
||||
handle->blue_shift = xxlib_get_shift_from_mask(handle, handle->x_visual_info->blue_mask);
|
||||
handle->blue_prec = xxlib_get_prec_from_mask(handle, handle->x_visual_info->blue_mask);
|
||||
handle->red_shift = xxlib_get_shift_from_mask(handle->x_visual_info->red_mask);
|
||||
handle->red_prec = xxlib_get_prec_from_mask(handle->x_visual_info->red_mask);
|
||||
handle->green_shift = xxlib_get_shift_from_mask(handle->x_visual_info->green_mask);
|
||||
handle->green_prec = xxlib_get_prec_from_mask(handle->x_visual_info->green_mask);
|
||||
handle->blue_shift = xxlib_get_shift_from_mask(handle->x_visual_info->blue_mask);
|
||||
handle->blue_prec = xxlib_get_prec_from_mask(handle->x_visual_info->blue_mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -803,20 +804,33 @@ xxlib_rgb_destroy_handle (XlibRgbHandle *handle)
|
|||
|
||||
if (handle->stage_buf)
|
||||
free(handle->stage_buf);
|
||||
|
||||
xxlib_deregister_handle_by_handle(handle);
|
||||
|
||||
#ifdef DEBUG
|
||||
/* force crash if someone tries to touch the handle... */
|
||||
memset(handle, 0, sizeof(XlibRgbHandle));
|
||||
#endif
|
||||
|
||||
/* done... */
|
||||
free(handle);
|
||||
}
|
||||
|
||||
/* create a XlibRgbHandle object, see |xxlib_rgb_create_handle_with_depth()| for details */
|
||||
XlibRgbHandle *
|
||||
xxlib_rgb_create_handle (Display *display, Screen *screen)
|
||||
xxlib_rgb_create_handle (const char *name, Display *display, Screen *screen)
|
||||
{
|
||||
int prefDepth = -1; /* let the function do the visual scoring */
|
||||
return xxlib_rgb_create_handle_with_depth(display, screen, prefDepth);
|
||||
return xxlib_rgb_create_handle_with_depth(name, display, screen, prefDepth);
|
||||
}
|
||||
|
||||
/* create a XlibRgbHandle object
|
||||
* It is possible to register the handle automagically with a |name|.
|
||||
* Handle names must be unique, but it is possible to register a handle
|
||||
* with more than one name via |xxlib_register_handle()|.
|
||||
*/
|
||||
XlibRgbHandle *
|
||||
xxlib_rgb_create_handle_with_depth (Display *display, Screen *screen, int prefDepth)
|
||||
xxlib_rgb_create_handle_with_depth (const char *name, Display *display, Screen *screen, int prefDepth)
|
||||
{
|
||||
XlibRgbHandle *handle = NULL;
|
||||
int i;
|
||||
|
@ -836,15 +850,21 @@ xxlib_rgb_create_handle_with_depth (Display *display, Screen *screen, int prefDe
|
|||
abort();
|
||||
}
|
||||
#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
|
||||
|
||||
|
||||
handle = malloc(sizeof(XlibRgbHandle));
|
||||
|
||||
if(!handle)
|
||||
return NULL;
|
||||
|
||||
|
||||
if (!(handle = malloc(sizeof(XlibRgbHandle))))
|
||||
return NULL;
|
||||
memset(handle, 0, sizeof(XlibRgbHandle));
|
||||
|
||||
/* should we register this handle ? */
|
||||
if (name)
|
||||
{
|
||||
if (!xxlib_register_handle(name, handle))
|
||||
{
|
||||
free(handle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
handle->display = display;
|
||||
handle->screen = screen;
|
||||
handle->screen_num = XScreenNumberOfScreen(screen);
|
||||
|
@ -1003,7 +1023,7 @@ xxlib_rgb_create_handle_with_depth (Display *display, Screen *screen, int prefDe
|
|||
handle->bpp = 4;
|
||||
break;
|
||||
}
|
||||
xxlib_rgb_select_conv (handle, handle->static_image[0], MSB_FIRST);
|
||||
xxlib_rgb_select_conv (handle, handle->static_image[0], MSB_FIRST);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
@ -3757,269 +3777,129 @@ xxlib_rgb_get_screen (XlibRgbHandle *handle)
|
|||
return (handle)?(handle->screen):(NULL);
|
||||
}
|
||||
|
||||
#ifdef XLIBRGB_ENABLE_OBSOLETE_API
|
||||
|
||||
static XlibRgbHandle *static_handle = NULL;
|
||||
|
||||
void
|
||||
xlib_rgb_init (Display *display, Screen *screen)
|
||||
typedef struct _RegisteredHandle
|
||||
{
|
||||
if(!static_handle)
|
||||
static_handle = xxlib_rgb_create_handle(display, screen);
|
||||
|
||||
if(!static_handle)
|
||||
abort();
|
||||
const char *name;
|
||||
XlibRgbHandle *handle;
|
||||
} RegisteredHandle;
|
||||
|
||||
static RegisteredHandle *registered_handles = NULL;
|
||||
static unsigned int registered_handles_size = 0;
|
||||
|
||||
/* find registered handle by name */
|
||||
static
|
||||
RegisteredHandle *xxlib_find_registered_handle(const char *name)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for( i=0 ; i < registered_handles_size ; i++ )
|
||||
{
|
||||
if (name && registered_handles[i].name &&
|
||||
!strcmp(name, registered_handles[i].name))
|
||||
return ®istered_handles[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth)
|
||||
/* register handle.
|
||||
* This API is public to register a handle more then once (=alias), or if the handle
|
||||
* has not been registered yet (e.g. |xxlib_rgb_create_handle()| called with
|
||||
* a NULL-|name| argument).
|
||||
*/
|
||||
Bool xxlib_register_handle(const char *name, XlibRgbHandle *handle)
|
||||
{
|
||||
if(!static_handle)
|
||||
static_handle = xxlib_rgb_create_handle_with_depth(display, screen, prefDepth);
|
||||
RegisteredHandle *entry = NULL;
|
||||
unsigned int i;
|
||||
|
||||
if (xxlib_find_handle(name) || (handle == NULL))
|
||||
return False;
|
||||
|
||||
/* search for a free slot... */
|
||||
for( i=0 ; i < registered_handles_size ; i++ )
|
||||
{
|
||||
if (!registered_handles[i].handle)
|
||||
{
|
||||
entry = ®istered_handles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* ... no unused entry found ? Then allocate a new one... */
|
||||
if (!entry)
|
||||
{
|
||||
registered_handles_size++;
|
||||
registered_handles = realloc(registered_handles, sizeof(RegisteredHandle)*registered_handles_size);
|
||||
|
||||
if (!registered_handles)
|
||||
abort();
|
||||
entry = ®istered_handles[registered_handles_size-1];
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("xxlib_register_handle: new entry '%s' %p\n", name, entry);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
printf("xxlib_register_handle: reusing entry '%s' %p\n", name, entry);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
if(!static_handle)
|
||||
abort();
|
||||
entry->name = strdup(name);
|
||||
entry->handle = handle;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_detach (void)
|
||||
/* unregister the given handle by name.
|
||||
* Return |True| if the |name| was found, |False| otherwise.
|
||||
* Note that |xxlib_rgb_destroy_handle()| unregisters the handle
|
||||
* automagically (including all aliases).
|
||||
*/
|
||||
Bool xxlib_deregister_handle(const char *name)
|
||||
{
|
||||
xxlib_rgb_destroy_handle(static_handle);
|
||||
static_handle = NULL;
|
||||
RegisteredHandle *entry;
|
||||
if (entry = xxlib_find_registered_handle(name))
|
||||
{
|
||||
free((void *)entry->name);
|
||||
entry->name = NULL;
|
||||
entry->handle = NULL;
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
void
|
||||
xlib_disallow_image_tiling (Bool disallow_it)
|
||||
/* used by |xxlib_rgb_destroy_handle()| to deregister handle and all
|
||||
* it's aliases... */
|
||||
static
|
||||
void xxlib_deregister_handle_by_handle(XlibRgbHandle *handle)
|
||||
{
|
||||
xxlib_disallow_image_tiling (static_handle, disallow_it);
|
||||
unsigned int i;
|
||||
|
||||
if (!handle)
|
||||
return;
|
||||
|
||||
for( i=0 ; i < registered_handles_size ; i++ )
|
||||
{
|
||||
if (registered_handles[i].handle == handle)
|
||||
{
|
||||
free((void *)registered_handles[i].name);
|
||||
registered_handles[i].name = NULL;
|
||||
registered_handles[i].handle = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long
|
||||
xlib_rgb_xpixel_from_rgb (uint32 rgb)
|
||||
/* find a registered handle by |name| */
|
||||
XlibRgbHandle *xxlib_find_handle(const char *name)
|
||||
{
|
||||
return xxlib_rgb_xpixel_from_rgb(static_handle, rgb);
|
||||
RegisteredHandle *entry = xxlib_find_registered_handle(name);
|
||||
#ifdef DEBUG
|
||||
printf("xxlib_find_handle: '%s' entry %p\n", name, entry);
|
||||
#endif /* DEBUG */
|
||||
return (entry)?(entry->handle):(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_foreground (GC gc, uint32 rgb)
|
||||
{
|
||||
xxlib_rgb_gc_set_foreground (static_handle, gc, rgb);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_background (GC gc, uint32 rgb)
|
||||
{
|
||||
xxlib_rgb_gc_set_background (static_handle, gc, rgb);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride)
|
||||
{
|
||||
xxlib_draw_rgb_image (static_handle,
|
||||
drawable,
|
||||
gc,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
dith,
|
||||
rgb_buf,
|
||||
rowstride);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image_dithalign (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride,
|
||||
int xdith,
|
||||
int ydith)
|
||||
{
|
||||
xxlib_draw_rgb_image_dithalign (static_handle,
|
||||
drawable,
|
||||
gc,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
dith,
|
||||
rgb_buf,
|
||||
rowstride,
|
||||
xdith,
|
||||
ydith);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_draw_rgb_32_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride)
|
||||
{
|
||||
xxlib_draw_rgb_32_image (static_handle,
|
||||
drawable,
|
||||
gc,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
dith,
|
||||
buf,
|
||||
rowstride);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_draw_gray_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride)
|
||||
{
|
||||
xxlib_draw_gray_image (static_handle,
|
||||
drawable,
|
||||
gc,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
dith,
|
||||
buf,
|
||||
rowstride);
|
||||
}
|
||||
|
||||
XlibRgbCmap *
|
||||
xlib_rgb_cmap_new (uint32 *colors, int n_colors)
|
||||
{
|
||||
return xxlib_rgb_cmap_new (static_handle, colors, n_colors);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_cmap_free (XlibRgbCmap *cmap)
|
||||
{
|
||||
xxlib_rgb_cmap_free (static_handle, cmap);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_draw_indexed_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride,
|
||||
XlibRgbCmap *cmap)
|
||||
{
|
||||
xxlib_draw_indexed_image (static_handle,
|
||||
drawable,
|
||||
gc,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
dith,
|
||||
buf,
|
||||
rowstride,
|
||||
cmap);
|
||||
}
|
||||
|
||||
/* Below are some functions which are primarily useful for debugging
|
||||
and experimentation. */
|
||||
Bool
|
||||
xlib_rgb_ditherable (void)
|
||||
{
|
||||
return xxlib_rgb_ditherable (static_handle);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_set_verbose (Bool verbose)
|
||||
{
|
||||
xxlib_rgb_set_verbose (static_handle, verbose);
|
||||
}
|
||||
|
||||
/* experimental colormap stuff */
|
||||
void
|
||||
xlib_rgb_set_install (Bool install)
|
||||
{
|
||||
xxlib_rgb_set_install (static_handle, install);
|
||||
}
|
||||
|
||||
void
|
||||
xlib_rgb_set_min_colors (int min_colors)
|
||||
{
|
||||
xxlib_rgb_set_min_colors (static_handle, min_colors);
|
||||
}
|
||||
|
||||
Colormap
|
||||
xlib_rgb_get_cmap (void)
|
||||
{
|
||||
return xxlib_rgb_get_cmap (static_handle);
|
||||
}
|
||||
|
||||
Visual *
|
||||
xlib_rgb_get_visual (void)
|
||||
{
|
||||
return xxlib_rgb_get_visual (static_handle);
|
||||
}
|
||||
|
||||
XVisualInfo *
|
||||
xlib_rgb_get_visual_info (void)
|
||||
{
|
||||
return xxlib_rgb_get_visual_info (static_handle);
|
||||
}
|
||||
|
||||
int
|
||||
xlib_rgb_get_depth (void)
|
||||
{
|
||||
return xxlib_rgb_get_depth (static_handle);
|
||||
}
|
||||
|
||||
Display *
|
||||
xlib_rgb_get_display (void)
|
||||
{
|
||||
return xxlib_rgb_get_display (static_handle);
|
||||
}
|
||||
|
||||
Screen *
|
||||
xlib_rgb_get_screen (void)
|
||||
{
|
||||
return xxlib_rgb_get_screen (static_handle);
|
||||
}
|
||||
|
||||
unsigned long
|
||||
xlib_get_prec_from_mask(unsigned long arg)
|
||||
{
|
||||
return xxlib_get_prec_from_mask (static_handle, arg);
|
||||
}
|
||||
|
||||
unsigned long
|
||||
xlib_get_shift_from_mask(unsigned long arg)
|
||||
{
|
||||
return xxlib_get_shift_from_mask (static_handle, arg);
|
||||
}
|
||||
|
||||
#endif /* XLIBRGB_ENABLE_OBSOLETE_API */
|
||||
|
||||
|
||||
|
|
|
@ -94,10 +94,10 @@ typedef enum
|
|||
} XlibRgbDither;
|
||||
|
||||
XlibRgbHandle *
|
||||
xxlib_rgb_create_handle (Display *display, Screen *screen);
|
||||
xxlib_rgb_create_handle (const char *name, Display *display, Screen *screen);
|
||||
|
||||
XlibRgbHandle *
|
||||
xxlib_rgb_create_handle_with_depth (Display *display, Screen *screen, int prefDepth);
|
||||
xxlib_rgb_create_handle_with_depth (const char *name, Display *display, Screen *screen, int prefDepth);
|
||||
|
||||
void
|
||||
xxlib_rgb_destroy_handle (XlibRgbHandle *handle);
|
||||
|
@ -205,6 +205,7 @@ xxlib_rgb_get_visual_info (XlibRgbHandle *handle);
|
|||
int
|
||||
xxlib_rgb_get_depth (XlibRgbHandle *handle);
|
||||
|
||||
/* hint: if you don't how to obtain a handle - use |xxlib_find_handle()| :-) */
|
||||
Display *
|
||||
xxlib_rgb_get_display (XlibRgbHandle *handle);
|
||||
|
||||
|
@ -212,139 +213,22 @@ Screen *
|
|||
xxlib_rgb_get_screen (XlibRgbHandle *handle);
|
||||
|
||||
unsigned long
|
||||
xxlib_get_prec_from_mask(XlibRgbHandle *handle, unsigned long);
|
||||
xxlib_get_prec_from_mask(unsigned long);
|
||||
|
||||
unsigned long
|
||||
xxlib_get_shift_from_mask(XlibRgbHandle *handle, unsigned long);
|
||||
xxlib_get_shift_from_mask(unsigned long);
|
||||
|
||||
#define XLIBRGB_ENABLE_OBSOLETE_API 1
|
||||
/* default name - for cases where there is only one XlibRgbHandle required */
|
||||
#define XXLIBRGB_DEFAULT_HANDLE ("xxlib-default")
|
||||
|
||||
#ifdef XLIBRGB_ENABLE_OBSOLETE_API
|
||||
void
|
||||
xlib_rgb_init (Display *display, Screen *screen);
|
||||
Bool
|
||||
xxlib_register_handle(const char *name, XlibRgbHandle *handle);
|
||||
|
||||
void
|
||||
xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
|
||||
Bool
|
||||
xxlib_deregister_handle(const char *name);
|
||||
|
||||
void
|
||||
xlib_rgb_detach (void);
|
||||
|
||||
void
|
||||
xlib_disallow_image_tiling (Bool disallow_it);
|
||||
|
||||
unsigned long
|
||||
xlib_rgb_xpixel_from_rgb (uint32 rgb);
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_foreground (GC gc, uint32 rgb);
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_background (GC gc, uint32 rgb);
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride);
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image_dithalign (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride,
|
||||
int xdith,
|
||||
int ydith);
|
||||
|
||||
void
|
||||
xlib_draw_rgb_32_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride);
|
||||
|
||||
void
|
||||
xlib_draw_gray_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride);
|
||||
|
||||
XlibRgbCmap *
|
||||
xlib_rgb_cmap_new (uint32 *colors, int n_colors);
|
||||
|
||||
void
|
||||
xlib_rgb_cmap_free (XlibRgbCmap *cmap);
|
||||
|
||||
void
|
||||
xlib_draw_indexed_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride,
|
||||
XlibRgbCmap *cmap);
|
||||
|
||||
/* Below are some functions which are primarily useful for debugging
|
||||
and experimentation. */
|
||||
Bool
|
||||
xlib_rgb_ditherable (void);
|
||||
|
||||
void
|
||||
xlib_rgb_set_verbose (Bool verbose);
|
||||
|
||||
/* experimental colormap stuff */
|
||||
void
|
||||
xlib_rgb_set_install (Bool install);
|
||||
|
||||
void
|
||||
xlib_rgb_set_min_colors (int min_colors);
|
||||
|
||||
Colormap
|
||||
xlib_rgb_get_cmap (void);
|
||||
|
||||
Visual *
|
||||
xlib_rgb_get_visual (void);
|
||||
|
||||
XVisualInfo *
|
||||
xlib_rgb_get_visual_info (void);
|
||||
|
||||
int
|
||||
xlib_rgb_get_depth (void);
|
||||
|
||||
Display *
|
||||
xlib_rgb_get_display (void);
|
||||
|
||||
Screen *
|
||||
xlib_rgb_get_screen (void);
|
||||
|
||||
unsigned long
|
||||
xlib_get_prec_from_mask(unsigned long);
|
||||
|
||||
unsigned long
|
||||
xlib_get_shift_from_mask(unsigned long);
|
||||
|
||||
#endif /* XLIBRGB_ENABLE_OBSOLETE_API */
|
||||
XlibRgbHandle *
|
||||
xxlib_find_handle(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
# Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
@ -34,10 +34,9 @@ IS_COMPONENT = 1
|
|||
MODULE_NAME = nsGfxXprintModule
|
||||
|
||||
EXTRA_DSO_LIBS = gkgfx
|
||||
REQUIRES = xpcom string widget view img util pref locale uconv unicharutil gfx2 imglib2 intl
|
||||
REQUIRES = xpcom string xlibrgb widget view img util pref locale uconv unicharutil gfx2 imglib2 intl
|
||||
|
||||
CSRCS = \
|
||||
../xlibrgb/xlibrgb.c \
|
||||
xprintutil.c \
|
||||
xprintutil_printtofile.c \
|
||||
$(NULL)
|
||||
|
@ -77,13 +76,8 @@ endif
|
|||
CFLAGS += $(TK_CFLAGS)
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
||||
# gisburn: linking against xlibrgb.so does not work due global variables
|
||||
# in that library which must not be shared between main toolkit and
|
||||
# Xprint module classes.
|
||||
# This will be fixed by bug 85527 ("Turn xlibrgb into a shared library" -
|
||||
# this RFE will introduce a new API for xlibrgb where these variables are
|
||||
# stored in a "handle" instead of using global variables...).
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
-lxlibrgb \
|
||||
-L$(DIST)/bin \
|
||||
-L$(DIST)/lib \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
static PRLogModuleInfo *nsDeviceContextXpLM = PR_NewLogModule("nsDeviceContextXp");
|
||||
#endif /* PR_LOGGING */
|
||||
|
||||
static NS_DEFINE_IID(kIDeviceContextSpecXPIID, NS_IDEVICE_CONTEXT_SPEC_XP_IID);
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsIDeviceContext.h
|
||||
*/
|
||||
|
@ -81,7 +79,7 @@ nsDeviceContextXp :: SetSpec(nsIDeviceContextSpec* aSpec)
|
|||
mPrintContext = new nsXPrintContext();
|
||||
xpSpec = do_QueryInterface(mSpec);
|
||||
if(xpSpec) {
|
||||
rv = mPrintContext->Init(this, xpSpec);
|
||||
rv = mPrintContext->Init(this, xpSpec);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -142,8 +140,8 @@ NS_IMETHODIMP nsDeviceContextXp :: CreateRenderingContext(nsIRenderingContext *&
|
|||
nsCOMPtr<nsRenderingContextXlib> xpContext;
|
||||
|
||||
xpContext = new nsRenderingContextXlib();
|
||||
if (xpContext){
|
||||
rv = xpContext->Init(this);
|
||||
if (xpContext) {
|
||||
rv = xpContext->Init(this);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -261,7 +259,7 @@ NS_IMETHODIMP nsDeviceContextXp::BeginDocument(PRUnichar * aTitle)
|
|||
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::BeginDocument()\n"));
|
||||
nsresult rv = NS_OK;
|
||||
if (mPrintContext != nsnull) {
|
||||
rv = mPrintContext->BeginDocument(aTitle);
|
||||
rv = mPrintContext->BeginDocument(aTitle);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -299,7 +297,7 @@ NS_IMETHODIMP nsDeviceContextXp::BeginPage(void)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mPrintContext != nsnull) {
|
||||
rv = mPrintContext->BeginPage();
|
||||
rv = mPrintContext->BeginPage();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -312,7 +310,7 @@ NS_IMETHODIMP nsDeviceContextXp::EndPage(void)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (mPrintContext != nsnull) {
|
||||
rv = mPrintContext->EndPage();
|
||||
rv = mPrintContext->EndPage();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -325,34 +323,36 @@ NS_IMETHODIMP nsDeviceContextXp :: ConvertPixel(nscolor aColor,
|
|||
PRUint32 & aPixel)
|
||||
{
|
||||
PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::ConvertPixel()\n"));
|
||||
aPixel = xlib_rgb_xpixel_from_rgb(NS_RGB(NS_GET_B(aColor),
|
||||
NS_GET_G(aColor),
|
||||
NS_GET_R(aColor)));
|
||||
aPixel = xxlib_rgb_xpixel_from_rgb(mPrintContext->GetXlibRgbHandle(),
|
||||
NS_RGB(NS_GET_B(aColor),
|
||||
NS_GET_G(aColor),
|
||||
NS_GET_R(aColor)));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Display *
|
||||
nsDeviceContextXp::GetDisplay()
|
||||
{
|
||||
if (mPrintContext != nsnull) {
|
||||
return mDisplay;
|
||||
} else {
|
||||
return (Display *)nsnull;
|
||||
}
|
||||
if (mPrintContext != nsnull) {
|
||||
return mDisplay;
|
||||
} else {
|
||||
return (Display *)nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDeviceContextXp::GetDepth(PRUint32& aDepth)
|
||||
{
|
||||
if (mPrintContext != nsnull) {
|
||||
aDepth = mPrintContext->GetDepth();
|
||||
} else {
|
||||
aDepth = 0;
|
||||
}
|
||||
return NS_OK;
|
||||
if (mPrintContext != nsnull) {
|
||||
aDepth = mPrintContext->GetDepth();
|
||||
} else {
|
||||
aDepth = 0;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeviceContextXp::GetPrintContext(nsXPrintContext*& aContext) {
|
||||
nsDeviceContextXp::GetPrintContext(nsXPrintContext*& aContext)
|
||||
{
|
||||
aContext = mPrintContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -32,10 +32,9 @@
|
|||
#include "nsIRenderingContext.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDeviceContextXPrint.h"
|
||||
#include "nsXPrintContext.h"
|
||||
#include "nsISupportsArray.h"
|
||||
|
||||
class nsXPrintContext;
|
||||
|
||||
class nsDeviceContextXp : public nsIDeviceContextXp
|
||||
{
|
||||
public:
|
||||
|
@ -78,6 +77,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetSpec(nsIDeviceContextSpec *aSpec);
|
||||
|
||||
XlibRgbHandle *GetXlibRgbHandle() { return mPrintContext->GetXlibRgbHandle(); }
|
||||
Display *GetDisplay();
|
||||
NS_IMETHOD GetPrintContext(nsXPrintContext*& aContext);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -38,7 +38,6 @@
|
|||
#include "prenv.h" /* for PR_GetEnv */
|
||||
|
||||
/* misc defines */
|
||||
//#define HACK_PRINTONSCREEN 1
|
||||
#define XPRINT_MAKE_24BIT_VISUAL_AVAILABLE_FOR_TESTING 1
|
||||
|
||||
#ifdef XPRINT_NOT_YET /* ToDo: make this dynamically */
|
||||
|
@ -71,7 +70,8 @@ int xerror_handler( Display *display, XErrorEvent *ev )
|
|||
nsXPrintContext::nsXPrintContext()
|
||||
{
|
||||
PR_LOG(nsXPrintContextLM, PR_LOG_DEBUG, ("nsXPrintContext::nsXPrintContext()\n"));
|
||||
|
||||
|
||||
mXlibRgbHandle = (XlibRgbHandle *)nsnull;
|
||||
mPDisplay = (Display *)nsnull;
|
||||
mPContext = (XPContext)None;
|
||||
mScreen = (Screen *)nsnull;
|
||||
|
@ -80,6 +80,10 @@ nsXPrintContext::nsXPrintContext()
|
|||
mDepth = 0;
|
||||
mIsGrayscale = PR_FALSE; /* default is color output */
|
||||
mIsAPrinter = PR_TRUE; /* default destination is printer */
|
||||
mPrintFile = nsnull;
|
||||
mXpuPrintToFileHandle = nsnull;
|
||||
mPrintResolution = 0L;
|
||||
mContext = nsnull;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
|
@ -95,7 +99,8 @@ nsXPrintContext::~nsXPrintContext()
|
|||
XPU_TRACE(XpDestroyContext(mPDisplay, mPContext));
|
||||
|
||||
// Cleanup things allocated along the way
|
||||
XPU_TRACE(xlib_rgb_detach());
|
||||
xxlib_rgb_destroy_handle(mXlibRgbHandle);
|
||||
mXlibRgbHandle = nsnull;
|
||||
|
||||
XPU_TRACE(XCloseDisplay(mPDisplay));
|
||||
|
||||
|
@ -115,8 +120,6 @@ nsXPrintContext::Init(nsDeviceContextXp *dc, nsIDeviceContextSpecXp *aSpec)
|
|||
* I wish current Xprt would have a 1bit/8bit StaticGray
|
||||
* visual for the PS DDX... ;-(
|
||||
*/
|
||||
char *buf;
|
||||
|
||||
/* I can't get any other visual than the 8bit peudocolor one working... BAD...
|
||||
* This env var allows others to test this without hacking their own binaries...
|
||||
*/
|
||||
|
@ -126,44 +129,24 @@ nsXPrintContext::Init(nsDeviceContextXp *dc, nsIDeviceContextSpecXp *aSpec)
|
|||
prefDepth = 24;
|
||||
}
|
||||
#endif /* XPRINT_MAKE_24BIT_VISUAL_AVAILABLE_FOR_TESTING */
|
||||
|
||||
unsigned short width, height;
|
||||
XRectangle rect;
|
||||
|
||||
/* print on screen(="normal" Xserver) is "DEBUG" for now...
|
||||
* maybe usefull for preview, too...
|
||||
*/
|
||||
#ifdef HACK_PRINTONSCREEN
|
||||
// debug: "print" on display server for quick debugging
|
||||
// see sleep() in nsXPrintContext::EndDocument()
|
||||
if( !strcmp("xprint_preview",(aSpec->GetCommand(&buf),buf)) )
|
||||
{
|
||||
mPDisplay = (Display *)XOpenDisplay(nsnull);
|
||||
mScreen = XDefaultScreenOfDisplay(mPDisplay);
|
||||
mScreenNumber = XScreenNumberOfScreen(mScreen);
|
||||
xlib_rgb_init_with_depth(mPDisplay, mScreen, prefDepth);
|
||||
xlib_disallow_image_tiling(TRUE);
|
||||
if( NS_FAILED( XPU_TRACE(SetupPrintContext(aSpec)) ) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mScreen = XpGetScreenOfContext(mPDisplay, mPContext);
|
||||
mScreenNumber = XScreenNumberOfScreen(mScreen);
|
||||
mXlibRgbHandle = xxlib_rgb_create_handle_with_depth("xprint", mPDisplay, mScreen, prefDepth);
|
||||
if (!mXlibRgbHandle)
|
||||
return NS_ERROR_FAILURE;
|
||||
xxlib_disallow_image_tiling(mXlibRgbHandle, TRUE);
|
||||
|
||||
SetupWindow(0, 0, 1200, 1200);
|
||||
mPrintResolution = 91 /* or 301 - intentionally forcing scaling */;
|
||||
XMapWindow(mPDisplay, mDrawable);
|
||||
}
|
||||
else
|
||||
#endif /* HACK_PRINTONSCREEN */
|
||||
{
|
||||
unsigned short width, height;
|
||||
XRectangle rect;
|
||||
XpGetPageDimensions(mPDisplay, mPContext, &width, &height, &rect);
|
||||
SetupWindow(rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
if( NS_FAILED( XPU_TRACE(SetupPrintContext(aSpec)) ) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
mScreen = XpGetScreenOfContext(mPDisplay, mPContext);
|
||||
mScreenNumber = XScreenNumberOfScreen(mScreen);
|
||||
xlib_rgb_init_with_depth(mPDisplay, mScreen, prefDepth);
|
||||
xlib_disallow_image_tiling(TRUE);
|
||||
|
||||
XpGetPageDimensions(mPDisplay, mPContext, &width, &height, &rect);
|
||||
SetupWindow(rect.x, rect.y, rect.width, rect.height);
|
||||
|
||||
XMapWindow(mPDisplay, mDrawable);
|
||||
}
|
||||
XMapWindow(mPDisplay, mDrawable);
|
||||
|
||||
mContext = dc;
|
||||
|
||||
|
@ -171,7 +154,12 @@ nsXPrintContext::Init(nsDeviceContextXp *dc, nsIDeviceContextSpecXp *aSpec)
|
|||
* ToDo: unset handler after all is done - what about handler "stacking" ?
|
||||
*/
|
||||
(void)XSetErrorHandler(xerror_handler);
|
||||
XSynchronize(mPDisplay, True);
|
||||
|
||||
/* only run unbuffered X11 connection on demand (for debugging/testing) */
|
||||
if( PR_GetEnv("MOZILLA_XPRINT_EXPERIMENTAL_SYNCHRONIZE") != nsnull )
|
||||
{
|
||||
XSynchronize(mPDisplay, True);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -193,9 +181,9 @@ nsXPrintContext::SetupWindow(int x, int y, int width, int height)
|
|||
mWidth = width;
|
||||
mHeight = height;
|
||||
|
||||
visual_info = xlib_rgb_get_visual_info();
|
||||
mVisual = xlib_rgb_get_visual();
|
||||
mDepth = xlib_rgb_get_depth();
|
||||
visual_info = xxlib_rgb_get_visual_info(mXlibRgbHandle);
|
||||
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
mDepth = xxlib_rgb_get_depth(mXlibRgbHandle);
|
||||
|
||||
background = XWhitePixel(mPDisplay, mScreenNumber);
|
||||
foreground = XBlackPixel(mPDisplay, mScreenNumber);
|
||||
|
@ -203,7 +191,7 @@ nsXPrintContext::SetupWindow(int x, int y, int width, int height)
|
|||
|
||||
xattributes.background_pixel = background;
|
||||
xattributes.border_pixel = foreground;
|
||||
xattributes.colormap = xlib_rgb_get_cmap();
|
||||
xattributes.colormap = xxlib_rgb_get_cmap(mXlibRgbHandle);
|
||||
xattributes_mask = CWBorderPixel | CWBackPixel;
|
||||
if( xattributes.colormap )
|
||||
xattributes_mask |= CWColormap;
|
||||
|
@ -264,6 +252,12 @@ nsXPrintContext::SetupPrintContext(nsIDeviceContextSpecXp *aSpec)
|
|||
if( (mPrintFile == nsnull) || (strlen(mPrintFile) == 0) )
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* workaround for crash in XCloseDisplay() on Solaris 2.7 Xserver - when
|
||||
* shared memory transport is used XCloseDisplay() tries to free() the
|
||||
* shared memory segment - causing heap corruption and/or SEGV.
|
||||
*/
|
||||
putenv("XSUNTRANSPORT=xxx");
|
||||
|
||||
/* get printer, either by "name" (foobar) or "name@display" (foobar@gaja:5)
|
||||
* ToDo: report error to user (dialog)
|
||||
|
@ -383,18 +377,6 @@ nsXPrintContext::EndPage()
|
|||
{
|
||||
XPU_TRACE(XpEndPage(mPDisplay));
|
||||
XPU_TRACE(XpuWaitForPrintNotify(mPDisplay, XPEndPageNotify));
|
||||
|
||||
#ifdef HACK_PRINTONSCREEN
|
||||
/* HACK: sleep 15secs if we're displaying to a "display" server
|
||||
* see nsXPrintContext::Init and XprintOnScreen macro above - this is only used if
|
||||
* we are printing to a normal Xserver and not to a Xprint server (e.g. in rare
|
||||
* rare cases...)
|
||||
*/
|
||||
if( XpuCheckExtension(mPDisplay) != 1 )
|
||||
{
|
||||
sleep(15);
|
||||
}
|
||||
#endif /* HACK_PRINTONSCREEN */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -416,18 +398,6 @@ nsXPrintContext::EndDocument()
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HACK_PRINTONSCREEN
|
||||
/* HACK: sleep 15secs if we're displaying to a "display" server
|
||||
* see nsXPrintContext::Init and XprintOnScreen macro above - this is only used if
|
||||
* we are printing to a normal Xserver and not to a Xprint server (e.g. in rare
|
||||
* rare cases...)
|
||||
*/
|
||||
if( XpuCheckExtension(mPDisplay) != 1 )
|
||||
{
|
||||
sleep(15);
|
||||
}
|
||||
#endif /* HACK_PRINTONSCREEN */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -697,11 +667,12 @@ nsXPrintContext::DrawImageBitsScaled(xGC *xgc, nsIImage *aImage,
|
|||
else
|
||||
{
|
||||
/* shortcut */
|
||||
xlib_draw_rgb_image(mDrawable,
|
||||
*xgc,
|
||||
aDX, aDY, aDWidth, aDHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
(unsigned char *)dstImg->data, dstImg->bytes_per_line);
|
||||
xxlib_draw_rgb_image(mXlibRgbHandle,
|
||||
mDrawable,
|
||||
*xgc,
|
||||
aDX, aDY, aDWidth, aDHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
(unsigned char *)dstImg->data, dstImg->bytes_per_line);
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
|
@ -865,19 +836,21 @@ nsXPrintContext::DrawImageBits(xGC *xgc,
|
|||
|
||||
if( mIsGrayscale )
|
||||
{
|
||||
xlib_draw_gray_image(mDrawable,
|
||||
image_gc,
|
||||
aX, aY, aWidth, aHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
image_bits, row_bytes);
|
||||
xxlib_draw_gray_image(mXlibRgbHandle,
|
||||
mDrawable,
|
||||
image_gc,
|
||||
aX, aY, aWidth, aHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
image_bits, row_bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
xlib_draw_rgb_image(mDrawable,
|
||||
image_gc,
|
||||
aX, aY, aWidth, aHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
image_bits, row_bytes);
|
||||
xxlib_draw_rgb_image(mXlibRgbHandle,
|
||||
mDrawable,
|
||||
image_gc,
|
||||
aX, aY, aWidth, aHeight,
|
||||
NS_XPRINT_RGB_DITHER,
|
||||
image_bits, row_bytes);
|
||||
}
|
||||
|
||||
if( alpha_pixmap != None )
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -34,10 +34,9 @@
|
|||
#include "nsCoord.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "nsGCCache.h"
|
||||
|
||||
#include "nsIDeviceContextSpecXPrint.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
class nsDeviceContextXp;
|
||||
|
||||
|
@ -56,10 +55,10 @@ public:
|
|||
Drawable GetDrawable() { return (mDrawable); }
|
||||
Screen * GetScreen() { return mScreen; }
|
||||
Visual * GetVisual() { return mVisual; }
|
||||
XlibRgbHandle *GetXlibRgbHandle() { return mXlibRgbHandle; }
|
||||
int GetDepth() { return mDepth; }
|
||||
int GetHeight() { return mHeight; }
|
||||
int GetWidth() { return mWidth; }
|
||||
int GetScreenNumber() { return XScreenNumberOfScreen(mScreen); }
|
||||
|
||||
Display * GetDisplay() { return mPDisplay; }
|
||||
NS_IMETHOD GetPrintResolution(int &aPrintResolution) const;
|
||||
|
@ -82,12 +81,12 @@ private:
|
|||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display *mPDisplay;
|
||||
Screen *mScreen;
|
||||
Visual *mVisual;
|
||||
GC mGC;
|
||||
Drawable mDrawable; /* window */
|
||||
XImage *mImage;
|
||||
int mDepth;
|
||||
int mScreenNumber;
|
||||
int mWidth;
|
||||
|
|
|
@ -86,10 +86,12 @@ PRBool nsAppShell::mAltDown = PR_FALSE;
|
|||
PRBool nsAppShell::mShiftDown = PR_FALSE;
|
||||
PRBool nsAppShell::mCtrlDown = PR_FALSE;
|
||||
PRBool nsAppShell::mMetaDown = PR_FALSE;
|
||||
XlibRgbHandle *nsAppShell::mXlib_rgb_handle = nsnull;
|
||||
|
||||
|
||||
// For debugging.
|
||||
static char *event_names[] = {
|
||||
static const char *event_names[] =
|
||||
{
|
||||
"",
|
||||
"",
|
||||
"KeyPress",
|
||||
|
@ -283,6 +285,14 @@ NS_METHOD nsAppShell::Create(int* bac, char ** bav)
|
|||
argv = bav;
|
||||
}
|
||||
|
||||
#ifdef NOT_NOW
|
||||
if (!XInitThreads()) {
|
||||
NS_WARNING("XInitThreads failed");
|
||||
/* fatal ! */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *displayName=nsnull;
|
||||
bool synchronize=false;
|
||||
|
||||
|
@ -312,31 +322,30 @@ NS_METHOD nsAppShell::Create(int* bac, char ** bav)
|
|||
|
||||
// Open the display
|
||||
if (mDisplay == nsnull) {
|
||||
mDisplay = XOpenDisplay(displayName);
|
||||
|
||||
if (synchronize)
|
||||
XSynchronize(mDisplay, True);
|
||||
// Requires XSynchronize(mDisplay, True); To stop X buffering. Use this
|
||||
// to make debugging easier. KenF
|
||||
|
||||
if (mDisplay == NULL) {
|
||||
fprintf(stderr, "%s: Cannot connect to X server %s\n",
|
||||
argv[0],
|
||||
XDisplayName(displayName));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
XtToolkitInitialize();
|
||||
app_context = XtCreateApplicationContext();
|
||||
XtDisplayInitialize(app_context, mDisplay, NULL, "Mozilla",
|
||||
NULL, 0, &mArgc, mArgv);
|
||||
|
||||
if (!(mDisplay = XtOpenDisplay (app_context, displayName,
|
||||
"Mozilla5", "Mozilla5", NULL, 0,
|
||||
&mArgc, mArgv)))
|
||||
{
|
||||
fprintf (stderr, "%s: unable to open display \"%s\"\n", mArgv[0], XDisplayName(displayName));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Requires XSynchronize(mDisplay, True); To stop X buffering. Use this
|
||||
// to make debugging easier. KenF
|
||||
if (synchronize)
|
||||
{
|
||||
NS_WARNING("running via unbuffered X connection.");
|
||||
XSynchronize(mDisplay, True);
|
||||
}
|
||||
|
||||
mScreen = XDefaultScreenOfDisplay(mDisplay);
|
||||
mXlib_rgb_handle = xxlib_rgb_create_handle(XXLIBRGB_DEFAULT_HANDLE, mDisplay, mScreen);
|
||||
if (!mXlib_rgb_handle)
|
||||
abort();
|
||||
}
|
||||
// _Xdebug = 1;
|
||||
|
||||
mScreen = XDefaultScreenOfDisplay(mDisplay);
|
||||
|
||||
xlib_rgb_init(mDisplay, mScreen);
|
||||
|
||||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("nsAppShell::Create(dpy=%p screen=%p)\n",
|
||||
mDisplay,
|
||||
|
@ -394,8 +403,9 @@ void CallProcessTimeoutsXtProc( XtPointer dummy1, XtIntervalId *dummy2 )
|
|||
|
||||
// reset timer
|
||||
XtAppContext *app_context = (XtAppContext *) dummy1;
|
||||
#define CALLPROCESSTIMEOUTSVAL (10)
|
||||
XtAppAddTimeOut(*app_context,
|
||||
100,
|
||||
CALLPROCESSTIMEOUTSVAL,
|
||||
CallProcessTimeoutsXtProc,
|
||||
app_context);
|
||||
}
|
||||
|
@ -433,7 +443,7 @@ nsresult nsAppShell::Run()
|
|||
|
||||
// set initial timer
|
||||
XtAppAddTimeOut(app_context,
|
||||
100,
|
||||
CALLPROCESSTIMEOUTSVAL,
|
||||
CallProcessTimeoutsXtProc,
|
||||
&app_context);
|
||||
|
||||
|
@ -1337,3 +1347,4 @@ void nsAppShell::ForwardEvent(XEvent *event, nsWidget *aWidget)
|
|||
|
||||
aWidget->DispatchWindowEvent(ev);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Roland.Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*/
|
||||
|
||||
#ifndef nsAppShell_h__
|
||||
|
@ -25,7 +26,9 @@
|
|||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsWidget.h"
|
||||
#include "prtime.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
class nsAppShell : public nsIAppShell
|
||||
{
|
||||
|
@ -50,8 +53,13 @@ class nsAppShell : public nsIAppShell
|
|||
NS_IMETHOD Exit();
|
||||
virtual void * GetNativeData(PRUint32 aDataType);
|
||||
static void DispatchXEvent(XEvent *event);
|
||||
/* |xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE)| would be the official
|
||||
* way - but |nsAppShell::GetXlibRgbHandle()| one is little bit faster... :-)
|
||||
*/
|
||||
static XlibRgbHandle *GetXlibRgbHandle() { return mXlib_rgb_handle; }
|
||||
static Display * mDisplay;
|
||||
private:
|
||||
static XlibRgbHandle *mXlib_rgb_handle;
|
||||
int xlib_fd;
|
||||
nsDispatchListener* mDispatchListener;
|
||||
static void HandleButtonEvent(XEvent *event, nsWidget *aWidget);
|
||||
|
|
|
@ -27,12 +27,9 @@
|
|||
* Currently this only supports the transfer of TEXT! FIXME
|
||||
*/
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsClipboard.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include "string.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -48,6 +45,9 @@
|
|||
#include "nsTextFormatter.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "xlibrgb.h"
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipboard);
|
|||
nsClipboard::nsClipboard() {
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
sDisplay = xlib_rgb_get_display();
|
||||
sDisplay = xxlib_rgb_get_display(nsAppShell::GetXlibRgbHandle());
|
||||
|
||||
Init();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Peter Hartshorn <peter@igelaus.com.au>
|
||||
*/
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsDragService.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIWidget.h"
|
||||
|
@ -69,12 +70,14 @@ NS_IMPL_QUERY_INTERFACE3(nsDragService, nsIDragService, nsIDragSession, nsIDragS
|
|||
|
||||
nsWidget *nsDragService::sWidget = nsnull;
|
||||
Window nsDragService::sWindow;
|
||||
XlibRgbHandle *nsDragService::sXlibRgbHandle;
|
||||
Display *nsDragService::sDisplay;
|
||||
PRBool nsDragService::mDragging = PR_FALSE;
|
||||
|
||||
nsDragService::nsDragService()
|
||||
{
|
||||
sDisplay = xlib_rgb_get_display();
|
||||
sXlibRgbHandle = nsAppShell::GetXlibRgbHandle();
|
||||
sDisplay = xxlib_rgb_get_display(sXlibRgbHandle);
|
||||
mCanDrop = PR_FALSE;
|
||||
sWindow = 0;
|
||||
}
|
||||
|
@ -252,10 +255,10 @@ void nsDragService::CreateDragCursor(PRUint32 aActionType)
|
|||
int depth;
|
||||
|
||||
wattr.override_redirect = true;
|
||||
depth = xlib_rgb_get_depth();
|
||||
depth = xxlib_rgb_get_depth(sXlibRgbHandle);
|
||||
|
||||
/* make a window off-screen at -64, -64 */
|
||||
sWindow = XCreateWindow(sDisplay, DefaultRootWindow(sDisplay),
|
||||
sWindow = XCreateWindow(sDisplay, XDefaultRootWindow(sDisplay),
|
||||
-64, -64, 32, 32, 0, depth,
|
||||
InputOutput, CopyFromParent,
|
||||
CWOverrideRedirect, &wattr);
|
||||
|
|
|
@ -71,6 +71,7 @@ protected:
|
|||
private:
|
||||
static nsWidget *sWidget;
|
||||
static Window sWindow;
|
||||
static XlibRgbHandle *sXlibRgbHandle;
|
||||
static Display *sDisplay;
|
||||
static PRBool mDragging;
|
||||
PRBool mCanDrop;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* tim copperfield <timecop@japan.co.jp>
|
||||
* Tim Copperfield <timecop@japan.co.jp>
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -47,8 +47,8 @@ nsScrollbar::nsScrollbar(PRBool aIsVertical) : nsWidget(), nsIScrollbar()
|
|||
mLineIncrement = 1;
|
||||
mIsVertical = aIsVertical;
|
||||
mBackground = NS_RGB(100,100,100);
|
||||
mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
mBorderPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
mBackgroundPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBackground);
|
||||
mBorderPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBackground);
|
||||
mBar = 0;
|
||||
mBarBounds.x = mBarBounds.y = mBarBounds.width = mBarBounds.height = 0;
|
||||
};
|
||||
|
@ -72,7 +72,7 @@ void nsScrollbar::CreateNative(Window aParent, nsRect aRect)
|
|||
attr.background_pixel = mBackgroundPixel;
|
||||
attr.border_pixel = mBorderPixel;
|
||||
// set the colormap
|
||||
attr.colormap = xlib_rgb_get_cmap();
|
||||
attr.colormap = xxlib_rgb_get_cmap(mXlibRgbHandle);
|
||||
// here's what's in the struct
|
||||
attr_mask = CWBitGravity | CWEventMask | CWBackPixel | CWBorderPixel;
|
||||
// check to see if there was actually a colormap.
|
||||
|
@ -82,8 +82,8 @@ void nsScrollbar::CreateNative(Window aParent, nsRect aRect)
|
|||
CreateNativeWindow(aParent, mBounds, attr, attr_mask);
|
||||
// set up the scrolling bar.
|
||||
attr.event_mask = Button1MotionMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | FocusChangeMask | VisibilityChangeMask;
|
||||
attr.background_pixel = xlib_rgb_xpixel_from_rgb(NS_RGB(192,192,192));
|
||||
attr.border_pixel = xlib_rgb_xpixel_from_rgb(NS_RGB(100,100,100));
|
||||
attr.background_pixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, NS_RGB(192,192,192));
|
||||
attr.border_pixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, NS_RGB(100,100,100));
|
||||
// set up the size
|
||||
CalcBarBounds();
|
||||
mBar = XCreateWindow(mDisplay,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "xlibrgb.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsGCCache.h"
|
||||
#include "nsAppShell.h" // needed for nsAppShell::GetXlibRgbHandle()
|
||||
|
||||
// Static Thread Local Storage index of the toolkit object associated with
|
||||
// a given thread...
|
||||
|
@ -33,8 +34,8 @@ static PRUintn gToolkitTLSIndex = 0;
|
|||
nsToolkit::nsToolkit()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mGC = NULL;
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mGC = nsnull;
|
||||
mDisplay = xxlib_rgb_get_display(nsAppShell::GetXlibRgbHandle());
|
||||
}
|
||||
|
||||
nsToolkit::~nsToolkit()
|
||||
|
@ -53,7 +54,7 @@ void nsToolkit::CreateSharedGC()
|
|||
if (mGC)
|
||||
return;
|
||||
|
||||
mGC = new xGC(mDisplay, DefaultRootWindow(mDisplay), 0, NULL);
|
||||
mGC = new xGC(mDisplay, XDefaultRootWindow(mDisplay), 0, nsnull);
|
||||
mGC->AddRef(); // this is for us
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult)
|
|||
// Create the TLS (Thread Local Storage) index the first time through
|
||||
if (gToolkitTLSIndex == 0)
|
||||
{
|
||||
status = PR_NewThreadPrivateIndex(&gToolkitTLSIndex, NULL);
|
||||
status = PR_NewThreadPrivateIndex(&gToolkitTLSIndex, nsnull);
|
||||
if (PR_FAILURE == status)
|
||||
{
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
|
|
@ -26,14 +26,13 @@
|
|||
* Tony Tsui <tony@igelaus.com.au>
|
||||
* L. David Baron <dbaron@fas.harvard.edu>
|
||||
* Tim Copperfield <timecop@network.email.ne.jp>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*/
|
||||
|
||||
#undef DEBUG_CURSORCACHE
|
||||
|
||||
#include "nsWidget.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsAppShell.h"
|
||||
|
||||
#include <X11/cursorfont.h>
|
||||
|
@ -123,9 +122,12 @@ nsWidget::nsWidget() // : nsBaseWidget()
|
|||
mBaseWindow = 0;
|
||||
mBackground = NS_RGB(192, 192, 192);
|
||||
mBorderRGB = NS_RGB(192, 192, 192);
|
||||
mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
/* |xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE)| would be the official
|
||||
* way - but |nsAppShell::GetXlibRgbHandle()| one is little bit faster...*/
|
||||
mXlibRgbHandle = nsAppShell::GetXlibRgbHandle();
|
||||
mBackgroundPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBackground);
|
||||
mBackground = NS_RGB(192, 192, 192);
|
||||
mBorderPixel = xlib_rgb_xpixel_from_rgb(mBorderRGB);
|
||||
mBorderPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBorderRGB);
|
||||
mParentWidget = nsnull;
|
||||
mName.AssignWithConversion("unnamed");
|
||||
mIsShown = PR_FALSE;
|
||||
|
@ -258,10 +260,10 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
NS_ASSERTION(!mBaseWindow, "already initialized");
|
||||
if (mBaseWindow) return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
mDisplay = xlib_rgb_get_display();
|
||||
mScreen = xlib_rgb_get_screen();
|
||||
mVisual = xlib_rgb_get_visual();
|
||||
mDepth = xlib_rgb_get_depth();
|
||||
mDisplay = xxlib_rgb_get_display(mXlibRgbHandle);
|
||||
mScreen = xxlib_rgb_get_screen(mXlibRgbHandle);
|
||||
mVisual = xxlib_rgb_get_visual(mXlibRgbHandle);
|
||||
mDepth = xxlib_rgb_get_depth(mXlibRgbHandle);
|
||||
|
||||
mParentWidget = aParent;
|
||||
|
||||
|
@ -283,7 +285,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
} else if (aParent) {
|
||||
parent = (Window)aParent->GetNativeData(NS_NATIVE_WINDOW);
|
||||
} else {
|
||||
parent = RootWindowOfScreen(mScreen);
|
||||
parent = XRootWindowOfScreen(mScreen);
|
||||
}
|
||||
|
||||
if (nsnull != aInitData) {
|
||||
|
@ -294,7 +296,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.event_mask = GetEventMask();
|
||||
attr.colormap = xlib_rgb_get_cmap();
|
||||
attr.colormap = xxlib_rgb_get_cmap(mXlibRgbHandle);
|
||||
|
||||
attr_mask = CWBitGravity | CWEventMask;
|
||||
|
||||
|
@ -304,7 +306,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
switch (mWindowType) {
|
||||
case eWindowType_dialog:
|
||||
mIsToplevel = PR_TRUE;
|
||||
parent = RootWindowOfScreen(mScreen);
|
||||
parent = XRootWindowOfScreen(mScreen);
|
||||
mBaseWindow = XCreateWindow(mDisplay, parent, mBounds.x, mBounds.y,
|
||||
mBounds.width, mBounds.height, 0,
|
||||
mDepth, InputOutput, mVisual,
|
||||
|
@ -318,7 +320,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
attr_mask |= CWOverrideRedirect | CWSaveUnder;
|
||||
attr.save_under = True;
|
||||
attr.override_redirect = True;
|
||||
parent = RootWindowOfScreen(mScreen);
|
||||
parent = XRootWindowOfScreen(mScreen);
|
||||
mBaseWindow = XCreateWindow(mDisplay, parent,
|
||||
mBounds.x, mBounds.y,
|
||||
mBounds.width, mBounds.height, 0,
|
||||
|
@ -330,7 +332,7 @@ nsWidget::StandardWidgetCreate(nsIWidget *aParent,
|
|||
|
||||
case eWindowType_toplevel:
|
||||
mIsToplevel = PR_TRUE;
|
||||
parent = RootWindowOfScreen(mScreen);
|
||||
parent = XRootWindowOfScreen(mScreen);
|
||||
mBaseWindow = XCreateWindow(mDisplay, parent, mBounds.x, mBounds.y,
|
||||
mBounds.width, mBounds.height, 0,
|
||||
mDepth, InputOutput, mVisual,
|
||||
|
@ -418,7 +420,7 @@ NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
|||
} else if (mParentWindow) {
|
||||
Window child;
|
||||
XTranslateCoordinates(mDisplay, mParentWindow,
|
||||
RootWindowOfScreen(mScreen),
|
||||
XRootWindowOfScreen(mScreen),
|
||||
aX, aY, &transRect.x, &transRect.y,
|
||||
&child);
|
||||
}
|
||||
|
@ -672,7 +674,7 @@ NS_IMETHODIMP nsWidget::SetBackgroundColor(const nscolor &aColor)
|
|||
PR_LOG(XlibWidgetsLM, PR_LOG_DEBUG, ("nsWidget::SetBackgroundColor()\n"));
|
||||
|
||||
nsBaseWidget::SetBackgroundColor(aColor);
|
||||
mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
mBackgroundPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBackground);
|
||||
// set the window attrib
|
||||
XSetWindowBackground(mDisplay, mBaseWindow, mBackgroundPixel);
|
||||
return NS_OK;
|
||||
|
@ -691,7 +693,7 @@ NS_IMETHODIMP nsWidget::WidgetToScreen(const nsRect& aOldRect,
|
|||
Window child;
|
||||
XTranslateCoordinates(mDisplay,
|
||||
mBaseWindow,
|
||||
RootWindowOfScreen(mScreen),
|
||||
XRootWindowOfScreen(mScreen),
|
||||
aOldRect.x, aOldRect.y,
|
||||
&aNewRect.x, &aNewRect.y,
|
||||
&child);
|
||||
|
@ -755,7 +757,7 @@ void nsWidget::CreateNative(Window aParent, nsRect aRect)
|
|||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.event_mask = GetEventMask();
|
||||
attr.colormap = xlib_rgb_get_cmap();
|
||||
attr.colormap = xxlib_rgb_get_cmap(mXlibRgbHandle);
|
||||
|
||||
attr_mask = CWBitGravity | CWEventMask;
|
||||
|
||||
|
@ -856,7 +858,7 @@ nsWidget::DeleteWindowCallback(Window aWindow)
|
|||
#endif
|
||||
for (int i = 0; i < eCursor_count_up_down; i++)
|
||||
if (gsXlibCursorCache[i])
|
||||
XFreeCursor(xlib_rgb_get_display(), gsXlibCursorCache[i]);
|
||||
XFreeCursor(nsAppShell::mDisplay, gsXlibCursorCache[i]);
|
||||
}
|
||||
|
||||
if (gsWindowDestroyCallback)
|
||||
|
@ -954,7 +956,7 @@ PRBool nsWidget::IsMouseInWindow(Window window, PRInt32 inMouseX, PRInt32 inMous
|
|||
int root_inMouse_y;
|
||||
Window returnedChild;
|
||||
Window rootWindow;
|
||||
rootWindow = RootWindow(mDisplay, DefaultScreen(mDisplay));
|
||||
rootWindow = XRootWindow(mDisplay, DefaultScreen(mDisplay));
|
||||
if (!XTranslateCoordinates(mDisplay, mBaseWindow, rootWindow,
|
||||
inMouseX, inMouseY,
|
||||
&root_inMouse_x, &root_inMouse_y, &returnedChild)){
|
||||
|
|
|
@ -21,15 +21,12 @@
|
|||
* Ken Faulkner <faulkner@igelaus.com.au>
|
||||
* Quy Tonthat <quy@igelaus.com.au>
|
||||
* B.J. Rossiter <bj@igelaus.com.au>
|
||||
* Roland.Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*/
|
||||
|
||||
#ifndef nsWidget_h__
|
||||
#define nsWidget_h__
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsHashtable.h"
|
||||
|
@ -37,6 +34,7 @@
|
|||
#include "nsIRegion.h"
|
||||
#include "nsIXlibWindowService.h"
|
||||
#include "nsIRollupListener.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
#ifdef DEBUG_blizzard
|
||||
#define XLIB_WIDGET_NOISY
|
||||
|
@ -210,6 +208,7 @@ protected:
|
|||
Window mParentWindow;
|
||||
|
||||
// All widgets have at least these items.
|
||||
XlibRgbHandle *mXlibRgbHandle;
|
||||
Display * mDisplay;
|
||||
Screen * mScreen;
|
||||
Window mBaseWindow;
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
* Ken Faulkner <faulkner@igelaus.com.au>
|
||||
* B.J. Rossiter <bj@igelaus.com.au>
|
||||
* Tony Tsui <tony@igelaus.com.au>
|
||||
* Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
|
||||
*/
|
||||
|
||||
#include "nsWindow.h"
|
||||
|
||||
#include "xlibrgb.h"
|
||||
|
||||
/* for window title unicode->locale conversion */
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "nsFileSpec.h" // for nsAutoCString
|
||||
|
||||
#define ABS(i) ( i<0 ? 0-i : i )
|
||||
#define ABS(i) ( (i)<0 ? 0-(i) : (i) )
|
||||
|
||||
// Variables for grabbing
|
||||
PRBool nsWindow::sIsGrabbing = PR_FALSE;
|
||||
|
@ -195,9 +195,9 @@ nsWindow::nsWindow() : nsWidget()
|
|||
NS_INIT_REFCNT();
|
||||
mName.AssignWithConversion("nsWindow");
|
||||
mBackground = NS_RGB(255, 255, 255);
|
||||
mBackgroundPixel = xlib_rgb_xpixel_from_rgb(mBackground);
|
||||
mBackgroundPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBackground);
|
||||
mBorderRGB = NS_RGB(255,255,255);
|
||||
mBorderPixel = xlib_rgb_xpixel_from_rgb(mBorderRGB);
|
||||
mBorderPixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, mBorderRGB);
|
||||
|
||||
// FIXME KenF
|
||||
mIsUpdating = PR_FALSE;
|
||||
|
|
|
@ -42,8 +42,10 @@ xtbin::~xtbin() {
|
|||
|
||||
void xtbin::xtbin_init() {
|
||||
initialized = 1;
|
||||
app_context = XtDisplayToApplicationContext(xlib_rgb_get_display());
|
||||
xtdisplay = xlib_rgb_get_display();
|
||||
xtdisplay = xxlib_rgb_get_display(xxlib_find_handle(XXLIBRGB_DEFAULT_HANDLE));
|
||||
if (!xtdisplay)
|
||||
abort();
|
||||
app_context = XtDisplayToApplicationContext(xtdisplay);
|
||||
}
|
||||
|
||||
void xtbin::xtbin_realize() {
|
||||
|
@ -70,15 +72,15 @@ void xtbin::xtbin_realize() {
|
|||
|
||||
mask = CWBitGravity | CWEventMask;
|
||||
|
||||
window = XCreateWindow(xlib_rgb_get_display(), parent_window,
|
||||
window = XCreateWindow(xtdisplay, parent_window,
|
||||
x, y, width, height, 0, CopyFromParent,
|
||||
CopyFromParent, CopyFromParent,
|
||||
mask, &attr);
|
||||
|
||||
XSelectInput(xlib_rgb_get_display(), window, ExposureMask);
|
||||
XSelectInput(xtdisplay, window, ExposureMask);
|
||||
|
||||
XMapWindow(xlib_rgb_get_display(), window);
|
||||
XFlush(xlib_rgb_get_display());
|
||||
XMapWindow(xtdisplay, window);
|
||||
XFlush(xtdisplay);
|
||||
|
||||
top_widget = XtAppCreateShell("drawingArea", "Wrapper",
|
||||
applicationShellWidgetClass, xtdisplay,
|
||||
|
|
Загрузка…
Ссылка в новой задаче