Unverified Commit 8b15d574 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/fix_background' into 3.6.x

parents f24767b3 3563959c
......@@ -305,7 +305,6 @@ SetWindowToDefaults(register WindowPtr pWin)
#endif
}
#ifndef NXAGENT_SERVER
static void
MakeRootTile(WindowPtr pWin)
{
......@@ -348,7 +347,6 @@ MakeRootTile(WindowPtr pWin)
FreeScratchGC(pGC);
}
#endif /* NXAGENT_SERVER */
WindowPtr
AllocateWindow(ScreenPtr pScreen)
......
......@@ -1386,15 +1386,6 @@ FIXME: Use of nxagentParentWindow is strongly deprecated.
nxagentChangeOption(BorderWidth, 1);
}
nxagentLogoDepth = DefaultDepth(nxagentDisplay,
DefaultScreen(nxagentDisplay)
);
nxagentLogoBlack = 0x000000;
nxagentLogoRed = 0xff0000;
nxagentLogoWhite = 0xffffff;
nxagentLogoGray = 0x222222;
#ifdef WATCH
fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.1.\n");
......@@ -2860,13 +2851,6 @@ Bool nxagentReconnectDisplay(void *p0)
nxagentConfineWindow);
#endif
nxagentLogoDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay));
nxagentLogoBlack = 0x000000;
nxagentLogoRed = 0xff0000;
nxagentLogoWhite = 0xffffff;
nxagentLogoGray = 0x222222;
useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape);
/*
......
......@@ -124,7 +124,6 @@
extern Bool nxagentOnce;
extern WindowPtr nxagentRootTileWindow;
extern int nxagentSplashCount;
extern int nxagentLastClipboardClient;
......@@ -2453,20 +2452,6 @@ FIXME: This can be maybe optimized by consuming the
}
}
if (nxagentRootTileWindow != NULL)
{
if (nxagentWindowPriv(nxagentRootTileWindow) -> window == nxagentWindowPriv(pWin) -> window &&
nxagentSplashCount == 1 && X -> xexpose.count == 0)
{
#ifdef DEBUG
fprintf(stderr, "nxagentHandleExposeEvent: Clearing root tile window id [%u].\n",
nxagentWindowPriv(nxagentRootTileWindow) -> window);
#endif
XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window);
}
}
RegionUninit(&sum);
}
......
......@@ -240,7 +240,6 @@ DEFINES = \
-DNXAGENT_VISIBILITY \
-DNXAGENT_WAKEUP=1000 \
-DNXAGENT_ONSTART \
-DNXAGENT_SPLASH \
-DNXAGENT_ARTSD \
-DNXAGENT_RANDR_MODE_PREFIX \
-UNX_DEBUG_INPUT \
......
......@@ -413,6 +413,7 @@ FIXME: These variables, if not removed at all because have probably
* background.
*/
if (!whiteRoot)
blackRoot = TRUE;
nxagentInitKeystrokes(False);
......
......@@ -141,9 +141,6 @@ void nxagentWaitDisplay(void);
void nxagentListRemoteFonts(const char *, int);
unsigned int nxagentWMtimeout = 0;
Bool nxagentWMPassed = False;
/*
* Timeouts based on screen saver time.
*/
......@@ -243,8 +240,6 @@ Dispatch(void)
register HWEventQueuePtr* icheck = checkForInput;
long start_tick;
unsigned long currentDispatch = 0;
nextFreeClientID = 1;
InitSelections();
nClients = 0;
......@@ -265,12 +260,11 @@ Dispatch(void)
#ifdef NXAGENT_ONSTART
/*
* Set NX_WM property (used by NX client to identify
* the agent's window) three seconds since the first
* client connects.
* Set NX_WM property (used by NX client to identify the agent's
* window) three seconds since the first client connects.
*/
nxagentWMtimeout = GetTimeInMillis() + 3000;
unsigned int nxagentWMtimeout = GetTimeInMillis() + 3000;
#endif
......@@ -370,17 +364,14 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#ifdef NXAGENT_ONSTART
currentDispatch = GetTimeInMillis();
/*
* If the timeout is expired set the
* selection informing the NX client
* that the agent is ready.
* If the timeout is expired set the selection informing the
* NX client that the agent is ready.
*/
if (!nxagentWMPassed && (nxagentWMtimeout < currentDispatch))
if (nxagentWMtimeout < GetTimeInMillis())
{
nxagentRemoveSplashWindow(NULL);
nxagentRemoveSplashWindow();
}
nxagentClients = nClients;
......@@ -588,10 +579,7 @@ ProcReparentWindow(register ClientPtr client)
if (!pWin)
return(BadWindow);
if (!nxagentWMPassed)
{
nxagentRemoveSplashWindow(pWin);
}
nxagentRemoveSplashWindow();
pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
DixWriteAccess);
......
......@@ -114,10 +114,6 @@ Equipment Corporation.
#include "Drawable.h"
#include "Colormap.h"
/* prototypes (only MakeRootTile() required here) */
static void MakeRootTile(WindowPtr pWin);
#include "../../dix/window.c"
extern Bool nxagentWMIsRunning;
......@@ -132,69 +128,8 @@ extern Bool nxagentScreenTrap;
#undef TEST
#undef DEBUG
WindowPtr nxagentRootTileWindow;
extern void nxagentSetVersionProperty(WindowPtr pWin);
void nxagentClearSplash(WindowPtr pW)
{
ScreenPtr pScreen = pW->drawable.pScreen;
if (pW->backgroundState == BackgroundPixmap)
{
(*pScreen->DestroyPixmap)(pW->background.pixmap);
}
pW->backgroundState = BackgroundPixel;
pW->background.pixel = nxagentLogoBlack;
(*pScreen->ChangeWindowAttributes)(pW, CWBackPixmap|CWBackPixel);
}
static void
MakeRootTile(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
GCPtr pGC;
unsigned char back[128];
int len = BitmapBytePad(sizeof(long));
register unsigned char *from, *to;
register int i, j;
pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
pScreen->rootDepth, 0);
pWin->backgroundState = BackgroundPixmap;
pGC = GetScratchGC(pScreen->rootDepth, pScreen);
if (!pWin->background.pixmap || !pGC)
FatalError("could not create root tile");
{
CARD32 attributes[2];
attributes[0] = pScreen->whitePixel;
attributes[1] = pScreen->blackPixel;
(void)ChangeGC(pGC, GCForeground | GCBackground, attributes);
}
ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb;
to = back;
for (i = 4; i > 0; i--, from++)
for (j = len; j > 0; j--)
*to++ = *from;
(*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1,
0, 0, len, 4, 0, XYBitmap, (char *)back);
FreeScratchGC(pGC);
nxagentRootTileWindow = pWin;
}
void
InitRootWindow(WindowPtr pWin)
{
......@@ -249,28 +184,12 @@ InitRootWindow(WindowPtr pWin)
pWin->optional->cursor = rootCursor;
rootCursor->refcnt++;
#ifdef NXAGENT_SPLASH
if (blackRoot)
pWin->background.pixel = pScreen->blackPixel;
else
pWin->background.pixel = pScreen->whitePixel;
backFlag |= CWBackPixel;
MakeRootTile(pWin);
#else
if (!blackRoot && !whiteRoot) {
MakeRootTile(pWin);
backFlag |= CWBackPixmap;
}
else {
if (blackRoot)
pWin->background.pixel = pScreen->blackPixel;
else
pWin->background.pixel = pScreen->whitePixel;
backFlag |= CWBackPixel;
}
#endif
pWin->backingStore = defaultBackingStore;
pWin->forcedBS = (defaultBackingStore != NotUseful);
......
......@@ -681,7 +681,7 @@ Bool nxagentReconnectSession(void)
#endif
saveAgentState("RUNNING");
nxagentRemoveSplashWindow(NULL);
nxagentRemoveSplashWindow();
/*
* We let the proxy flush the link on our behalf
......
......@@ -146,9 +146,7 @@ Window nxagentInputWindows[MAXSCREENS];
Window nxagentScreenSaverWindows[MAXSCREENS];
#ifdef NXAGENT_ONSTART
Atom nxagentWMStart;
Window nxagentSplashWindow = None;
Pixmap nxagentPixmapLogo;
Atom nxagentReadyAtom;
#endif
ScreenPtr nxagentDefaultScreen = NULL;
......@@ -934,7 +932,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
nxagentQueryAtoms(pScreen);
#ifdef NXAGENT_ONSTART
nxagentWMStart = nxagentAtoms[3]; /* WM_NX_READY */
nxagentReadyAtom = nxagentAtoms[3]; /* WM_NX_READY */
#endif
/*
......@@ -3120,10 +3118,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
if (result == 1)
{
if (!nxagentWMPassed)
{
nxagentRemoveSplashWindow(NULL);
}
nxagentRemoveSplashWindow();
NXShadowExportChanges(&numRects, &ptBox);
pBox = (BoxRec *)ptBox;
......
......@@ -58,19 +58,24 @@
* Colors used to paint the splash screen.
*/
int nxagentLogoDepth;
int nxagentLogoWhite;
int nxagentLogoRed;
int nxagentLogoBlack;
int nxagentLogoGray;
#define nxagentLogoWhite 0xffffff
#define nxagentLogoBlack 0x000000
#define nxagentLogoDarkGray 0x222222
#define nxagentLogoLightGray 0xbbbbbb
void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height);
Pixmap nxagentPixmapLogo;
Window nxagentSplashWindow = None;
Bool nxagentWMPassed = False;
static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height);
/*
* From Screen.c.
*/
extern Atom nxagentWMStart;
#ifdef NXAGENT_ONSTART
extern Atom nxagentReadyAtom;
#endif
/*
* From Clipboard.c.
......@@ -78,27 +83,35 @@ extern Atom nxagentWMStart;
extern Atom serverCutProperty;
int nxagentShowSplashWindow(Window parentWindow)
void nxagentShowSplashWindow(Window parentWindow)
{
XWindowAttributes getAttributes;
XWindowChanges values;
XSetWindowAttributes attributes;
GC gc;
/*
* Show splash window only when running as X2Go Agent
*/
if(!nxagentX2go)
return;
#ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Got called.\n");
fprintf(stderr, "%s: Got called.\n", __func__);
#endif
#ifdef NXAGENT_TIMESTAMP
{
extern unsigned long startTime;
fprintf(stderr, "nxagentShowSplashWindow: Initializing splash start at [%d] milliseconds.\n",
fprintf(stderr, "%s: Initializing splash start at [%d] milliseconds.\n", __func__,
GetTimeInMillis() - startTime);
}
#endif
XSetSelectionOwner(nxagentDisplay, nxagentWMStart, None, CurrentTime);
#ifdef NXAGENT_ONSTART
XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, None, CurrentTime);
#endif
nxagentWMPassed = False;
......@@ -133,7 +146,7 @@ int nxagentShowSplashWindow(Window parentWindow)
getAttributes.height = nxagentOption(RootHeight);
#ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Going to create new splash window.\n");
fprintf(stderr, "%s: Going to create new splash window.\n", __func__);
#endif
nxagentSplashWindow =
......@@ -146,7 +159,7 @@ int nxagentShowSplashWindow(Window parentWindow)
BlackPixel (nxagentDisplay, 0));
#ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Created new splash window with id [%ld].\n",
fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__,
nxagentSplashWindow);
#endif
......@@ -162,45 +175,34 @@ int nxagentShowSplashWindow(Window parentWindow)
#ifdef NXAGENT_TIMESTAMP
{
extern unsigned long startTime;
fprintf(stderr, "nxagentShowSplashWindow: Splash ends [%d] milliseconds.\n",
fprintf(stderr, "%s: Splash ends [%d] milliseconds.\n", __func__,
GetTimeInMillis() - startTime);
}
#endif
return True;
}
void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
{
XPoint rect[4];
int w, h, c, w2, h2;
/*
* Show only X2GO Logo when running as X2Go Agent
*/
if(! nxagentX2go)
{
nxagentPixmapLogo = 0L;
return;
}
int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay));
#ifdef DEBUG
fprintf(stderr, "nxagentPaintLogo: Got called.\n");
fprintf(stderr, "%s: Got called.\n", __func__);
#endif
#ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "nxagentPaintLogo: begin\n");
fprintf(stderr, "nxagentPaintLogo: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n",width, height,
nxagentLogoDepth, nxagentLogoRed,
nxagentLogoWhite, nxagentLogoBlack);
fprintf(stderr, "%s: begin\n", __func__);
fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d w=%x b=%x g1=%x g2=%x \n", __func__,
width, height, depth,
nxagentLogoWhite, nxagentLogoBlack, nxagentLogoDarkGray, nxagentLogoLightGray);
#endif
w = width/scale;
h = height/scale;
int w = width/scale;
int h = height/scale;
w2 = w/2;
h2 = h/2;
int w2 = w/2;
int h2 = h/2;
int c;
if (height > width)
{
c = w/30;
......@@ -210,42 +212,52 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
c = w/48;
}
rect[0].x = 0; rect[0].y = 0;
rect[1].x = 0; rect[1].y = h;
rect[2].x = w; rect[2].y = h;
rect[3].x = w; rect[3].y = 0;
XSetFunction(nxagentDisplay, gc, GXcopy);
XSetFillStyle(nxagentDisplay, gc, FillSolid);
XSetForeground(nxagentDisplay, gc, nxagentLogoBlack);
XSetBackground(nxagentDisplay, gc, nxagentLogoRed);
nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, nxagentLogoDepth);
nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, depth);
if (!nxagentPixmapLogo)
{
return;
}
if (blackRoot)
{
XSetForeground(nxagentDisplay, gc, nxagentLogoBlack);
XSetBackground(nxagentDisplay, gc, nxagentLogoWhite);
}
else
{
XSetForeground(nxagentDisplay, gc, nxagentLogoWhite);
XSetBackground(nxagentDisplay, gc, nxagentLogoBlack);
}
XPoint rect[4];
rect[0].x = 0; rect[0].y = 0;
rect[1].x = 0; rect[1].y = h;
rect[2].x = w; rect[2].y = h;
rect[3].x = w; rect[3].y = 0;
/* paint background */
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
#ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "filled first poly\n");
fprintf(stderr, "%s: filled first poly\n", __func__);
#endif
XSetForeground(nxagentDisplay, gc, nxagentLogoRed);
XSetBackground(nxagentDisplay, gc, nxagentLogoWhite);
/*
* Draw X2GO Logo
*/
if (blackRoot)
XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray);
else
XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray);
/*
* Begin 'X'.
* Start 'X'.
*/
XSetForeground(nxagentDisplay, gc, nxagentLogoGray);
XSetBackground(nxagentDisplay, gc, nxagentLogoWhite);
rect[0].x = w2-7*c; rect[0].y = h2-5*c;
rect[1].x = w2-8*c; rect[1].y = h2-5*c;
rect[2].x = w2-4*c; rect[2].y = h2+3*c;
......@@ -379,22 +391,28 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo);
#ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "nxagentPaintLogo: end\n");
fprintf(stderr, "%s: end\n", __func__);
#endif
}
void nxagentRemoveSplashWindow(WindowPtr pWin)
void nxagentRemoveSplashWindow(void)
{
if (nxagentReconnectTrap) return;
if (nxagentWMPassed)
return;
if (nxagentReconnectTrap)
return;
#ifdef TEST
fprintf(stderr, "nxagentRemoveSplashWindow: Destroying the splash window.\n");
fprintf(stderr, "%s: Destroying the splash window.\n", __func__);
#endif
if (!nxagentWMPassed)
{
XSetSelectionOwner(nxagentDisplay, nxagentWMStart,
#ifdef NXAGENT_ONSTART
XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom,
nxagentDefaultWindows[0], CurrentTime);
#endif
nxagentWMPassed = True;
}
......@@ -407,7 +425,7 @@ void nxagentRemoveSplashWindow(WindowPtr pWin)
nxagentRefreshWindows(screenInfo.screens[0]->root);
#ifdef TEST
fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n",
fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__
"NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root));
#endif
......@@ -418,7 +436,6 @@ void nxagentRemoveSplashWindow(WindowPtr pWin)
if (nxagentPixmapLogo)
{
XFreePixmap(nxagentDisplay, nxagentPixmapLogo);
nxagentPixmapLogo = (Pixmap) 0;
}
}
......@@ -37,18 +37,9 @@ extern int XdmcpTimeOutRtx;
extern int XdmcpStartTime;
extern int nxagentXdmcpUp;
extern int nxagentLogoDepth;
extern int nxagentLogoWhite;
extern int nxagentLogoRed;
extern int nxagentLogoBlack;
extern int nxagentLogoGray;
extern Window nxagentSplashWindow;
extern int nxagentWMPassed;
extern int nxagentShowSplashWindow(Window);
extern void nxagentRemoveSplashWindow(WindowPtr pWin);
extern void nxagentShowSplashWindow(Window);
extern void nxagentRemoveSplashWindow();
#endif /* __Splash_H__ */
......@@ -118,12 +118,6 @@ extern WindowPtr nxagentRootTileWindow;
extern Bool nxagentReportPrivateWindowIds;
/*
* Also referenced in Events.c.
*/
int nxagentSplashCount = 0;
#define RECTLIMIT 25
#define BSPIXMAPLIMIT 128
......@@ -156,12 +150,6 @@ int GetWindowProperty(WindowPtr, Atom, long, long, Bool, Atom, Atom*, int*,
unsigned long*, unsigned long*, unsigned char**);
/*
* From NXwindow.c.
*/
void nxagentClearSplash(WindowPtr pWin);
/*
* Other local functions.
*/
......@@ -268,16 +256,6 @@ Bool nxagentCreateWindow(WindowPtr pWin)
return True;
}
nxagentSplashCount++;
if (nxagentSplashCount == 2)
{
nxagentClearSplash(nxagentRootTileWindow);
}
#ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "nxagentCreateWindow: nxagentSplashCount [%d]\n", nxagentSplashCount);
#endif
if (pWin->drawable.class == InputOnly)
{
mask = CWEventMask;
......@@ -487,14 +465,6 @@ Bool nxagentCreateWindow(WindowPtr pWin)
nxagentWindowPriv(pWin)->siblingAbove = None;
nxagentWindowPriv(pWin)->pPicture = NULL;
if (nxagentRootTileWindow)
{
if (nxagentWindowPriv(pWin)->window != nxagentWindowPriv(nxagentRootTileWindow)->window)
{
XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow)->window);
}
}
if (pWin->nextSib)
{
nxagentWindowPriv(pWin->nextSib)->siblingAbove = nxagentWindow(pWin);
......@@ -662,24 +632,6 @@ Bool nxagentDestroyWindow(WindowPtr pWin)
nxagentRootlessDelTopLevelWindow(pWin);
}
nxagentSplashCount--;
#ifdef DEBUG
fprintf(stderr, "nxagentDestroyWindow: The splash counter is now [%d].\n",
nxagentSplashCount);
#endif
if (nxagentSplashCount == 1)
{
XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window);
}
if (pWin == nxagentRootTileWindow)
{
nxagentWindowPriv(nxagentRootTileWindow)->window = None;
nxagentRootTileWindow = None;
}
pWindowPriv->window = None;
if (pWin -> optional)
......@@ -1486,7 +1438,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
#endif
}
#ifdef NXAGENT_SPLASH
/*
* This should bring again the splash window
* on top, so why the else clause? Is this
......@@ -1512,7 +1463,6 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask)
* }
* }
*/
#endif /* NXAGENT_SPLASH */
if (mask & CW_RootlessRestack)
{
......
......@@ -142,8 +142,10 @@ to authenticate access. See also the \fIxdm\fP(1) and
disables backing store support on all screens.
.TP 8
.B \-br
sets the default root window to solid black instead of the standard root weave
pattern.
sets the default root window to solid black (default).
.TP 8
.B \-wr
sets the default root window to solid white.
.TP 8
.B \-c
turns off key-click.
......
......@@ -634,6 +634,7 @@ void UseMsg(void)
ErrorF("v video blanking for screen-saver\n");
ErrorF("-v screen-saver without video blanking\n");
ErrorF("-wm WhenMapped default backing-store\n");
ErrorF("-wr create root window with white background\n");
ErrorF("-maxbigreqsize set maximal bigrequest size \n");
#ifdef PANORAMIX
ErrorF("+xinerama Enable XINERAMA (PanoramiX) extension\n");
......@@ -996,6 +997,8 @@ ProcessCommandLine(int argc, char *argv[])
defaultScreenSaverBlanking = DontPreferBlanking;
else if ( strcmp( argv[i], "-wm") == 0)
defaultBackingStore = WhenMapped;
else if ( strcmp( argv[i], "-wr") == 0)
whiteRoot = TRUE;
else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
if(++i < argc) {
long reqSizeArg = atol(argv[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment