aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Imakefile2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Init.c14
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c43
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keystroke.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Millis.c13
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Millis.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdamage.c20
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c37
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXwindow.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Options.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/TestExt.c91
12 files changed, 63 insertions, 167 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
index ddbf08fab..c14b59a2c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile
+++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
@@ -42,7 +42,6 @@ SRCS = \
Keystroke.c \
Pointer.c \
Screen.c \
- TestExt.c \
Visual.c \
Drawable.c \
Window.c \
@@ -104,7 +103,6 @@ OBJS = \
Keystroke.o \
Pointer.o \
Screen.o \
- TestExt.o \
Visual.o \
Drawable.o \
Window.o \
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c
index d02af3f8d..80ca5fac1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Init.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c
@@ -183,13 +183,13 @@ int nxagentSaveUnder;
int nxagentDoFullGeneration = 1;
/*
- * 1 if agent running as X2goAgent
- * 0 if NX Agent
+ * True if agent is running as X2goAgent
+ * False if agent is running as NXAgent
*/
-int nxagentX2go;
+Bool nxagentX2go;
/*
- * Checking if agent is x2go agent
+ * Check if agent is x2go agent
*/
void checkX2goAgent(void)
@@ -200,13 +200,13 @@ void checkX2goAgent(void)
fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName);
#endif
- if( strcasecmp(nxagentProgName,"x2goagent") == 0)
+ if (strcasecmp(nxagentProgName,"x2goagent") == 0)
{
fprintf(stderr, "\nrunning as X2Go Agent\n");
- nxagentX2go=1;
+ nxagentX2go = True;
}
else
- nxagentX2go=0;
+ nxagentX2go = False;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 05adab494..96b33ea7d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -647,14 +647,15 @@ N/A
if (keymap64 == NULL)
{
XFreeModifiermap(modifier_keymap);
-
return -1;
}
len = (max_keycode - min_keycode + 1) * mapWidth;
keymap = (KeySym *)malloc(len * sizeof(KeySym));
for(i = 0; i < len; ++i)
+ {
keymap[i] = keymap64[i];
+ }
XFree(keymap64);
}
@@ -668,7 +669,6 @@ N/A
if (keymap == NULL)
{
XFreeModifiermap(modifier_keymap);
-
return -1;
}
@@ -682,18 +682,24 @@ N/A
memset(modmap, 0, sizeof(modmap));
for (j = 0; j < 8; j++)
- for(i = 0; i < modifier_keymap->max_keypermod; i++) {
+ {
+ for(i = 0; i < modifier_keymap->max_keypermod; i++)
+ {
CARD8 keycode;
if ((keycode =
modifier_keymap->
modifiermap[j * modifier_keymap->max_keypermod + i]))
+ {
modmap[keycode] |= 1<<j;
+ }
if (keycode > 0)
{
nxagentCheckModifierMasks(keycode, j);
}
}
+ }
+
XFreeModifiermap(modifier_keymap);
modifier_keymap = NULL;
@@ -747,13 +753,10 @@ XkbError:
#ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n");
- #endif
-
- #ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL");
#endif
- if (nxagentX2go == 1 && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0))
+ if (nxagentX2go && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0))
{
#ifdef TEST
fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__);
@@ -779,10 +782,9 @@ XkbError:
{
for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++);
- if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0)
+ if (nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0)
{
ErrorF("Warning: Wrong keyboard type: %s.\n", nxagentKeyboard);
-
goto XkbError;
}
@@ -842,7 +844,7 @@ XkbError:
{
#ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n",
- model, layout);
+ model?model:"(default)", layout?layout:"(default)");
#endif
}
@@ -872,8 +874,10 @@ XkbError:
* method for switching that off is the creation of a dir
* instead of a file.
*/
- if (nxagentX2go == 1)
+ if (nxagentX2go)
+ {
nxagentWriteKeyboardDir();
+ }
}
else
{
@@ -890,8 +894,10 @@ XkbError:
* know about that yet. Once x2go starts using clone
* we can drop this here.
*/
- if (nxagentX2go == 1)
+ if (nxagentX2go)
+ {
nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions);
+ }
}
}
#ifdef DEBUG
@@ -905,19 +911,20 @@ XkbError:
if (xkb && xkb->geom)
{
- XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb);
+ XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb);
}
#ifdef TEST
else
{
- fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n");
+ fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n");
}
#endif
#ifdef DEBUG
fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: "
"[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n",
- rules, model, layout, variant, options);
+ rules?rules:"(default)", model?model:"(default)", layout?layout:"(default)",
+ variant?variant:"(default)", options?options:"(default)");
#endif
XkbSetRulesDflts(rules, model, layout, variant, options);
@@ -931,7 +938,7 @@ XkbError:
if (xkb && xkb->geom)
{
- XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
+ XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls);
}
if (nxagentOption(Shadow) == 1 && pDev && pDev->key)
@@ -942,8 +949,8 @@ XkbError:
if (xkb)
{
- XkbFreeKeyboard(xkb, XkbAllComponentsMask, True);
- xkb = NULL;
+ XkbFreeKeyboard(xkb, XkbAllComponentsMask, True);
+ xkb = NULL;
}
free(model);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
index 6def29ae4..3e02d318d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
@@ -113,8 +113,6 @@ struct nxagentSpecialKeystrokeMap default_map[] = {
{KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, True, XK_f},
{KEYSTROKE_MINIMIZE, ControlMask, True, XK_m},
{KEYSTROKE_DEFER, ControlMask, True, XK_e},
- {KEYSTROKE_IGNORE, ControlMask, True, XK_BackSpace},
- {KEYSTROKE_IGNORE, 0, False, XK_Terminate_Server},
{KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, True, XK_j},
#ifdef DUMP
{KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, True, XK_a},
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Millis.c b/nx-X11/programs/Xserver/hw/nxagent/Millis.c
index ba801b62a..d3eb09a66 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Millis.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Millis.c
@@ -29,19 +29,6 @@
#include "Xos.h"
#include "Millis.h"
-#ifdef DDXTIME
-
-CARD32 GetTimeInMillis()
-{
- struct timeval ts;
-
- X_GETTIMEOFDAY(&ts);
-
- return(ts.tv_sec * 1000) + (ts.tv_usec / 1000);
-}
-
-#endif
-
const char *GetTimeAsString()
{
char *value;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Millis.h b/nx-X11/programs/Xserver/hw/nxagent/Millis.h
index 1e76ccbfb..3ba88ae63 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Millis.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Millis.h
@@ -28,8 +28,6 @@
#include "Xmd.h"
-CARD32 GetTimeInMillis(void);
-
const char *GetTimeInMillisAsString(void);
const char *GetTimeAsString(void);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c
index ad02e13a8..ef50edbee 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c
@@ -154,10 +154,10 @@ damagePolyText8(DrawablePtr pDrawable,
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (checkGCDamage (pDrawable, pGC))
- damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
+ x = damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
Linear8Bit, TT_POLY8);
-
- x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
+ else
+ x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
@@ -174,11 +174,11 @@ damagePolyText16(DrawablePtr pDrawable,
DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable);
if (checkGCDamage (pDrawable, pGC))
- damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
+ x = damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_POLY16);
-
- x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
+ else
+ x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
return x;
@@ -197,8 +197,8 @@ damageImageText8(DrawablePtr pDrawable,
if (checkGCDamage (pDrawable, pGC))
damageText (pDrawable, pGC, x, y, (unsigned long) count, chars,
Linear8Bit, TT_IMAGE8);
-
- (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
+ else
+ (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
@@ -217,8 +217,8 @@ damageImageText16(DrawablePtr pDrawable,
damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars,
FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit,
TT_IMAGE16);
-
- (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
+ else
+ (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars);
DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable);
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
index 22d5f191e..465e791da 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
@@ -278,9 +278,9 @@ Dispatch(void)
if (!clientReady)
return;
- #ifdef WATCH
+ #ifdef WATCH
- fprintf(stderr, "Dispatch: Watchpoint 12.\n");
+ fprintf(stderr, "Dispatch: Watchpoint 12.\n");
/*
Reply Total Cached Bits In Bits Out Bits/Reply Ratio
@@ -294,22 +294,22 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio
#98 1 256 bits (0 KB) -> 34 bits (0 KB) -> 256/1 -> 34/1 = 7.529:1
*/
- sleep(30);
+ sleep(30);
- #endif
+ #endif
- #ifdef TEST
- fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n",
- dispatchException);
+ #ifdef TEST
+ fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n",
+ dispatchException);
- fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n",
- dispatchExceptionAtReset);
- #endif
+ fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n",
+ dispatchExceptionAtReset);
+ #endif
- if (!(dispatchException & DE_TERMINATE))
- dispatchException = 0;
+ if (!(dispatchException & DE_TERMINATE))
+ dispatchException = 0;
- while (!dispatchException)
+ while (!dispatchException)
{
if (*icheck[0] != *icheck[1])
{
@@ -626,7 +626,7 @@ ProcReparentWindow(register ClientPtr client)
int
ProcQueryTree(register ClientPtr client)
{
- xQueryTreeReply reply;
+ xQueryTreeReply reply = {0};
int numChildren = 0;
register WindowPtr pChild, pWin, pHead;
Window *childIDs = (Window *)NULL;
@@ -637,7 +637,6 @@ ProcQueryTree(register ClientPtr client)
DixReadAccess);
if (!pWin)
return(BadWindow);
- memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply;
reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
@@ -720,8 +719,6 @@ ProcSetSelectionOwner(register ClientPtr client)
i++;
if (i < NumCurrentSelections)
{
- xEvent event = {0};
-
/* If the timestamp in client's request is in the past relative
to the time stamp indicating the last time the owner of the
selection was set, do not set the selection, just return
@@ -732,6 +729,7 @@ ProcSetSelectionOwner(register ClientPtr client)
if (CurrentSelections[i].client &&
(!pWin || (CurrentSelections[i].client != client)))
{
+ xEvent event = {0};
event.u.u.type = SelectionClear;
event.u.selectionClear.time = time.milliseconds;
event.u.selectionClear.window = CurrentSelections[i].window;
@@ -765,7 +763,7 @@ ProcSetSelectionOwner(register ClientPtr client)
CurrentSelections[i].client = (pWin ? client : NullClient);
if (SelectionCallback)
{
- SelectionInfoRec info;
+ SelectionInfoRec info = {0};
info.selection = &CurrentSelections[i];
info.kind= SelectionSetOwner;
@@ -1309,6 +1307,9 @@ CloseDownClient(register ClientPtr client)
CallCallbacks((&ClientStateCallback), (void *)&clientinfo);
}
FreeClientResources(client);
+ /* Disable client ID tracking. This must be done after
+ * ClientStateCallback. */
+ ReleaseClientIds(client);
if (client->index < nextFreeClientID)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
index 64bbf67c4..2fe37f79c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
@@ -1021,8 +1021,6 @@ SaveScreens(int on, int mode)
if (on == SCREEN_SAVER_FORCER)
{
- UpdateCurrentTimeIf();
- lastDeviceEventTime = currentTime;
if (mode == ScreenSaverReset)
what = SCREEN_SAVER_OFF;
else
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h
index 8e898bd77..b5394ee01 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Options.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h
@@ -365,7 +365,7 @@ typedef struct _AgentOptions
int DeferLevel;
/*
- * Maxuimum elapsed time before a new full
+ * Maximum elapsed time before a new full
* synchronization.
*/
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index a921df6ca..b78c01e30 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -134,7 +134,7 @@ static enum RECONNECTION_STEP failedStep;
/*
* Path of state File
*/
-char stateFile[PATH_MAX];
+char stateFile[PATH_MAX] = {0};
void setStatePath(char* path)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c b/nx-X11/programs/Xserver/hw/nxagent/TestExt.c
deleted file mode 100644
index 51a2ecb3d..000000000
--- a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
-/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
-/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
-/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
-/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
-/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
-/* */
-/* NXAGENT, NX protocol compression and NX extensions to this software */
-/* are copyright of the aforementioned persons and companies. */
-/* */
-/* Redistribution and use of the present software is allowed according */
-/* to terms specified in the file LICENSE which comes in the source */
-/* distribution. */
-/* */
-/* All rights reserved. */
-/* */
-/* NOTE: This software has received contributions from various other */
-/* contributors, only the core maintainers and supporters are listed as */
-/* copyright holders. Please contact us, if you feel you should be listed */
-/* as copyright holder, as well. */
-/* */
-/**************************************************************************/
-
-/*
-
-Copyright 1993 by Davor Matic
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. Davor Matic makes no representations about
-the suitability of this software for any purpose. It is provided "as
-is" without express or implied warranty.
-
-*/
-
-#include <nx-X11/X.h>
-#include <nx-X11/Xproto.h>
-#include <nx-X11/Xlib.h>
-#undef Bool
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "scrnintstr.h"
-#include "servermd.h"
-#include "mipointer.h"
-#define XTestSERVER_SIDE
-#include "xtestext1.h"
-
-extern CARD32 nxagentLastEventTime;
-
-void XTestGetPointerPos(short *fmousex, short *fmousey);
-
-void XTestJumpPointer(int jx, int jy, int dev_type);
-
-void XTestGenerateEvent(int dev_type, int keycode, int keystate,
- int mousex, int mousey);
-
-void XTestGetPointerPos(short *fmousex, short *fmousey)
-{
- int x,y;
-
- miPointerPosition(&x, &y);
- *fmousex = x;
- *fmousey = y;
-}
-
-void XTestJumpPointer(int jx, int jy, int dev_type)
-{
- miPointerAbsoluteCursor(jx, jy, GetTimeInMillis());
-}
-
-void XTestGenerateEvent(int dev_type, int keycode, int keystate,
- int mousex, int mousey)
-{
-/*
- xEvent tevent;
-
- tevent.u.u.type = (dev_type == XE_POINTER) ?
- (keystate == XTestKEY_UP) ? ButtonRelease : ButtonPress :
- (keystate == XTestKEY_UP) ? KeyRelease : KeyPress;
- tevent.u.u.detail = keycode;
- tevent.u.keyButtonPointer.rootX = mousex;
- tevent.u.keyButtonPointer.rootY = mousey;
- tevent.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
- mieqEnqueue(&tevent);
-*/
-}