aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2017-03-10 20:19:19 +0100
committerMihai Moldovan <ionic@ionic.de>2017-03-10 20:19:19 +0100
commit320cece2e97035665d4df5e382ea45e5a7f07efa (patch)
treee69e6342ece32a992ae29376697b4ecc691266de /nx-X11/programs/Xserver/hw/nxagent
parentdc8477f76372e685eb999a71afb4e5ec7e3176f1 (diff)
parentee2a933c3d4ad65849443cc917c59ad479083ca8 (diff)
downloadnx-libs-320cece2e97035665d4df5e382ea45e5a7f07efa.tar.gz
nx-libs-320cece2e97035665d4df5e382ea45e5a7f07efa.tar.bz2
nx-libs-320cece2e97035665d4df5e382ea45e5a7f07efa.zip
Merge branch 'uli42-pr/misc_cherries' into 3.6.x
Attributes GH PR #378: https://github.com/ArcticaProject/nx-libs/pull/378
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Display.c39
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c6
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Rootless.c49
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c10
5 files changed, 53 insertions, 53 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index a6c21503a..2bc12a3b4 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1235,9 +1235,11 @@ static void nxagentParseOptions(char *name, char *value)
return;
#else
if (PANORAMIX_DISABLED_COND && RRXINERAMA_DISABLED_COND)
+ {
nxagentChangeOption(Xinerama, 0);
fprintf(stderr, "Warning: XINERAMA extension has been disabled on %s startup.\n", __progname);
return;
+ }
if (!strcmp(value, "1"))
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index 85683503b..599b335f6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -169,7 +169,6 @@ Pixmap nxagentIconPixmap;
Pixmap nxagentIconShape;
Bool useXpmIcon = False;
-unsigned int nxagentLogoColor(unsigned int value);
Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask);
@@ -185,13 +184,6 @@ static int nxagentInitAndCheckVisuals(int flexibility);
static int nxagentCheckForColormapsCompatibility(int flexibility);
/*
- * FIXME: These must definitely become local.
- */
-
-XVisualInfo pV;
-unsigned int r, b, g, or, ob, og, off;
-
-/*
* Save Internal implementation Also called in Reconnect.c.
*/
@@ -217,23 +209,6 @@ int nxagentServerOrder()
return MSBFirst;
}
-unsigned int nxagentLogoColor(unsigned int value)
-{
- /*
- * Takes a color value in RGB24 (0xff0000, 0x00ff00,
- * 0x0000ff) and converts it into an equivalent for
- * the current visual.
- */
-
- int cr=0, cg=0, cb=0;
-
- cr = (value >> or) &r;
- cg = (value >> (og - 8)) &g;
- cb = (value >> (ob - 16)) &b;
-
- return (cr | cg | cb);
-}
-
/*
* FIXME: This error handler is not printing anything
* in the session log. This is OK once the session is
@@ -407,7 +382,7 @@ static void nxagentSigchldHandler(int signal)
* Leave the other children unaffected.
*/
- if (pid == 0 && nxagentRootlessDialogPid)
+ if (nxagentRootlessDialogPid)
{
pid = waitpid(nxagentRootlessDialogPid, &status, options);
@@ -1412,12 +1387,6 @@ FIXME: Use of nxagentParentWindow is strongly deprecated.
DefaultScreen(nxagentDisplay)
);
- pV = nxagentVisuals[nxagentDefaultVisualIndex];
-
- r = pV.red_mask;
- g = pV.green_mask;
- b = pV.blue_mask;
-
nxagentLogoBlack = 0x000000;
nxagentLogoRed = 0xff0000;
nxagentLogoWhite = 0xffffff;
@@ -2880,12 +2849,6 @@ Bool nxagentReconnectDisplay(void *p0)
nxagentLogoDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay));
- pV = nxagentVisuals[nxagentDefaultVisualIndex];
-
- r = pV.red_mask;
- g = pV.green_mask;
- b = pV.blue_mask;
-
nxagentLogoBlack = 0x000000;
nxagentLogoRed = 0xff0000;
nxagentLogoWhite = 0xffffff;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 88af5d400..208ae0653 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -997,8 +997,7 @@ XkbError:
XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap,
nxagentBell, nxagentChangeKeyboardControl);
- if (!nxagentKeyboard ||
- (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") == 0)))
+ if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0)
{
goto XkbError;
}
@@ -1083,8 +1082,7 @@ XkbError:
free(nxagentXkbConfigFilePath);
- if (!nxagentKeyboard ||
- (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") == 0)))
+ if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0)
{
goto XkbError;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index 68c6890d8..f42f9d99d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -315,6 +315,13 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
Mask mask;
toplevel = malloc(sizeof(WindowPtr) * nchildren);
+
+ if (!toplevel)
+ {
+ /* FIXME: Is this too much and we and simply return here? */
+ FatalError("nxagentRootlessRestack: malloc() failed.");
+ }
+
ntoplevel = 0;
for(i = 0; i < nchildren; i++)
@@ -334,6 +341,7 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
if (!ntoplevel)
{
+ free(toplevel);
return;
}
@@ -343,14 +351,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
for (i = 0; i < ntoplevel; i++)
{
- fprintf(stderr, "[%p]\n", toplevel[i]);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", toplevel[i]);
}
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows before restack:");
for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{
- fprintf(stderr, "[%p]\n", pWin);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", pWin);
}
#endif
@@ -386,14 +394,14 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
for (i = 0; i < ntoplevel; i++)
{
- fprintf(stderr, "[%p]\n", toplevel[i]);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", toplevel[i]);
}
fprintf(stderr, "nxagentRootlessRestack: Internal top level windows after restack:");
for (pWin = screenInfo.screens[0]->root -> firstChild; pWin != NULL; pWin = pWin -> nextSib)
{
- fprintf(stderr, "[%p]\n", pWin);
+ fprintf(stderr, "nxagentRootlessRestack: [%p]\n", pWin);
}
#endif
@@ -496,6 +504,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
#ifdef _XSERVER64
else if (strcmp(typeS, "CARDINAL") == 0 || strcmp(typeS, "WM_SIZE_HINTS") == 0)
{
+ /* FIXME: is it okay here to ignore malloc fails? */
unsigned long *buffer = malloc(nUnits * sizeof(*buffer));
int *input = value;
int i;
@@ -639,6 +648,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
int i;
int j = 0;
+ if (!atoms)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s'- bailing out.\n", typeS);
+ #endif
+ return False;
+ }
+
freeMem = True;
export = True;
output = (char *) atoms;
@@ -689,6 +706,14 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value)
WindowPtr pWindow;
int i;
+ if (!wind)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ #endif
+ return False;
+ }
+
freeMem = True;
export = True;
output = (char*) wind;
@@ -965,7 +990,7 @@ void nxagentImportProperty(Window window,
}
}
- if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window =! None))
+ if ((wmHints.flags & IconWindowHint) && (wmHints.icon_window != None))
{
WindowPtr icon = nxagentWindowPtr(wmHints.icon_window);
@@ -986,7 +1011,7 @@ void nxagentImportProperty(Window window,
}
}
- if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask =! None))
+ if ((wmHints.flags & IconMaskHint) && (wmHints.icon_mask != None))
{
PixmapPtr icon = nxagentPixmapPtr(wmHints.icon_mask);
@@ -1036,7 +1061,7 @@ void nxagentImportProperty(Window window,
if (atoms == NULL)
{
#ifdef WARNING
- fprintf(stderr, "nxagentImportProperty: WARNING! Malloc failed bailing out.\n");
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
#endif
return;
@@ -1066,6 +1091,14 @@ void nxagentImportProperty(Window window,
WindowPtr pWindow;
int i;
+ if (!wind)
+ {
+ #ifdef WARNING
+ fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS);
+ #endif
+
+ return;
+ }
freeMem = True;
import = True;
output = (char*) wind;
@@ -1184,7 +1217,7 @@ void nxagentAddPropertyToList(Atom property, WindowPtr pWin)
if ((tmp = malloc(sizeof(struct nxagentPropertyRec))) == NULL)
{
- FatalError("nxagentAddPropertyToList: malloc failed.");
+ FatalError("nxagentAddPropertyToList: malloc() failed.");
}
#ifdef TEST
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index 982c88314..23e1d5452 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -3122,10 +3122,14 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat
WindowPtr pWin = (WindowPtr)param0;
Bool *pBool = (Bool*)data_buffer;
CursorPtr pCursor;
- ScreenPtr pScreen = pWin -> drawable.pScreen;
+ ScreenPtr pScreen;
- if (!pWin || !*pBool || !(pCursor = wCursor(pWin)) ||
- !(nxagentCursorPriv(pCursor, pScreen)))
+ if (!pWin || !*pBool || !(pCursor = wCursor(pWin)))
+ return;
+
+ pScreen = pWin -> drawable.pScreen;
+
+ if (!(nxagentCursorPriv(pCursor, pScreen)))
{
return;
}