aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-29 17:39:48 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-09-29 17:39:48 +0200
commit3a3a3373c36b5af6208ee5fdfe25e64b5766b75a (patch)
tree619edfb91b22fe9e604b115b6f88616e942709f9 /nx-X11/programs
parent796c8e421fd9df658fd5b324fcaa5182566e6905 (diff)
parent085f8a4f672ed3e167bdd7791835f7ab2bebb723 (diff)
downloadnx-libs-3a3a3373c36b5af6208ee5fdfe25e64b5766b75a.tar.gz
nx-libs-3a3a3373c36b5af6208ee5fdfe25e64b5766b75a.tar.bz2
nx-libs-3a3a3373c36b5af6208ee5fdfe25e64b5766b75a.zip
Merge branch 'uli42-pr/various2' into 3.6.x
Attributes GH PR #827: https://github.com/ArcticaProject/nx-libs/pull/827
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/code-versions.txt4
-rw-r--r--nx-X11/programs/Xserver/dix/dispatch.c3
-rw-r--r--nx-X11/programs/Xserver/dix/property.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.c148
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Atoms.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c20
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Colormap.c273
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Display.c10
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c305
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Font.c1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/GC.c324
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Holder.c2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Image.c30
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Imakefile67
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Init.c24
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c306
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c34
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c22
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXevents.c16
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXpicture.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXproperty.c109
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXrender.c8
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXshm.c3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXwindow.c7
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Options.c1
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Options.h10
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixels.c30
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Render.c794
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Render.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c515
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.h2
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Split.c4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Trap.h54
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Utils.h4
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Window.c2
-rw-r--r--nx-X11/programs/Xserver/os/utils.c11
-rw-r--r--nx-X11/programs/Xserver/randr/Imakefile2
-rw-r--r--nx-X11/programs/Xserver/render/Imakefile2
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbDflts.h2
39 files changed, 1066 insertions, 2093 deletions
diff --git a/nx-X11/programs/Xserver/code-versions.txt b/nx-X11/programs/Xserver/code-versions.txt
index 37a5f9d44..f5bb33621 100644
--- a/nx-X11/programs/Xserver/code-versions.txt
+++ b/nx-X11/programs/Xserver/code-versions.txt
@@ -4,7 +4,7 @@ backported, it rather describes what functionality level the modules
are at (roughly):
module xorg version
-composite 6.9/7.0
+composite 1.12 (~ 9838b70 2012-03-21 Introduce a consistent coding style [Keith Packard])
damageext 6.9/7.0
dbe 1.4.2
dix 1.3.0.0
@@ -12,7 +12,7 @@ fb 7.1/1.1
GL 6.9/7.0
mi 7.1/1.1
miext 7.1/1.1
-os 7.1/1.1
+os ? 7.1/1.1 + many backports, some of them from 2017
randr 1.18.0
record 1.4.2
render 6.9/7.0
diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c
index d656da748..f80cec0dd 100644
--- a/nx-X11/programs/Xserver/dix/dispatch.c
+++ b/nx-X11/programs/Xserver/dix/dispatch.c
@@ -407,6 +407,9 @@ Dispatch(void)
}
/* now, finally, deal with client requests */
+ /* Update currentTime so request time checks, such as for input
+ * device grabs, are calculated correctly */
+ UpdateCurrentTimeIf();
result = ReadRequestFromClient(client);
if (result <= 0)
{
diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c
index 66c38f56c..7f25a5c55 100644
--- a/nx-X11/programs/Xserver/dix/property.c
+++ b/nx-X11/programs/Xserver/dix/property.c
@@ -655,6 +655,7 @@ ProcListProperties(ClientPtr client)
return(client->noClientException);
}
+#ifndef NXAGENT_SERVER
int
ProcDeleteProperty(register ClientPtr client)
{
@@ -692,3 +693,4 @@ ProcDeleteProperty(register ClientPtr client)
else
return(result);
}
+#endif
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index 2ee67b9bb..1c48df61c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -161,6 +161,7 @@ static void finishWMDetection(Bool verbose)
void nxagentWMDetect()
{
+ /* FIXME: verbose is always false, there's no code to set it to true */
Bool verbose = False;
Bool windowManagerWasRunning = nxagentWMIsRunning;
@@ -176,10 +177,8 @@ void nxagentWMDetect()
finishWMDetection(verbose);
}
-int nxagentInitAtoms(WindowPtr pWin)
+void nxagentInitAtoms()
{
- Atom atom;
-
/*
* Value of nxagentAtoms[8] is "NX_AGENT_SIGNATURE".
*
@@ -188,43 +187,40 @@ int nxagentInitAtoms(WindowPtr pWin)
* run nested.
*/
- atom = MakeAtom(nxagentAtomNames[8], strlen(nxagentAtomNames[8]), 1);
+ Atom atom = MakeAtom(nxagentAtomNames[8], strlen(nxagentAtomNames[8]), 1);
if (atom == None)
{
#ifdef PANIC
- fprintf(stderr, "nxagentInitAtoms: PANIC! Could not create [%s] atom.\n",
+ fprintf(stderr, "%s: PANIC! Could not create [%s] atom.\n", __func__,
nxagentAtomNames[8]);
#endif
-
- return -1;
}
-
- return 1;
+ else
+ {
+ #ifdef TEST
+ fprintf(stderr, "nxagentInitAtoms: atom [%s] created with value [%d].\n",
+ nxagentAtomNames[8], atom);
+ #endif
+ }
}
int nxagentQueryAtoms(ScreenPtr pScreen)
{
- int i;
static unsigned long atomGeneration = 1;
int num_of_atoms = NXAGENT_NUMBER_OF_ATOMS;
char *names[NXAGENT_NUMBER_OF_ATOMS];
- unsigned long int startingTime = GetTimeInMillis();
-
#ifdef TEST
- fprintf(stderr, "nxagentQueryAtoms: Going to create the intern atoms on real display.\n");
-
- fprintf(stderr, "nxagentQueryAtoms: Starting time is [%ld].\n", startingTime);
+ fprintf(stderr, "%s: Going to create the intern atoms on real display.\n", __func__);
#endif
nxagentPrintAtomMapInfo("nxagentQueryAtoms: Entering");
- for (i = 0; i < num_of_atoms; i++)
+ for (int i = 0; i < num_of_atoms; i++)
{
names[i] = nxagentAtomNames[i];
-
nxagentAtoms[i] = None;
}
@@ -251,10 +247,10 @@ int nxagentQueryAtoms(ScreenPtr pScreen)
if (atomGeneration != serverGeneration)
{
#ifdef WARNING
- fprintf(stderr, "nxagentQueryAtoms: The nxagent has been reset with server %ld atom %ld.\n",
+ fprintf(stderr, "%s: The nxagent has been reset with server %ld atom %ld.\n", __func__,
serverGeneration, atomGeneration);
- fprintf(stderr, "nxagentQueryAtoms: Forcing a sync to detect the window manager.\n");
+ fprintf(stderr, "%s: Forcing a sync to detect the window manager.\n", __func__);
#endif
atomGeneration = serverGeneration;
@@ -312,19 +308,11 @@ int nxagentQueryAtoms(ScreenPtr pScreen)
#ifdef TEST
- for (i = 0; i < num_of_atoms; i++)
+ for (int i = 0; i < num_of_atoms; i++)
{
- fprintf(stderr, "nxagentQueryAtoms: Created intern atom [%s] with id [%ld].\n",
+ fprintf(stderr, "%s: Created intern atom [%s] with id [%ld].\n", __func__,
names[i], nxagentAtoms[i]);
}
-
- #endif
-
- nxagentChangeOption(DisplayLatency, GetTimeInMillis() - startingTime);
-
- #ifdef TEST
- fprintf(stderr, "nxagentQueryAtoms: Ending time is [%ld] reference latency is [%d] Ms.\n",
- GetTimeInMillis(), nxagentOption(DisplayLatency));
#endif
nxagentPrintAtomMapInfo("nxagentQueryAtoms: Exiting");
@@ -364,9 +352,8 @@ static void nxagentExpandCache(void)
}
/*
- * Check if there is space left on the map
- * and manage the possible consequent allocation,
- * then cache the atom-couple.
+ * Check if there is space left on the map and manage the possible
+ * consequent allocation, then cache the atom-couple.
*/
static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool duplicate)
@@ -374,10 +361,9 @@ static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool d
const char *s;
/*
- * We could remove this string duplication if
- * we know for sure that the server will not
- * reset, since only at reset the dix layer
- * free all the atom names.
+ * We could remove this string duplication if we knew for sure that
+ * the server will not reset, since only at reset the dix layer
+ * frees all the atom names.
*/
if (duplicate)
@@ -410,19 +396,16 @@ static void nxagentWriteAtom(Atom local, Atom remote, const char *string, Bool d
}
/*
- * FIXME: We should clean up the atom map
- * at nxagent reset, in order to cancel
- * all the local atoms but still maintaining
- * the Xserver values and the atom names.
+ * FIXME: We should clean up the atom map at nxagent reset, in order
+ * to cancel all the local atoms but still maintaining the Xserver
+ * values and the atom names.
*/
void nxagentResetAtomMap(void)
{
- unsigned i;
-
nxagentPrintAtomMapInfo("nxagentResetAtomMap: Entering");
- for (i = 0; i < privLastAtom; i++)
+ for (unsigned int i = 0; i < privLastAtom; i++)
{
privAtomMap[i].local = None;
}
@@ -437,16 +420,13 @@ void nxagentResetAtomMap(void)
static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
{
- XlibAtom *atom_list;
- char **name_list;
unsigned int i;
- int ret_value = 0;
int list_size = count + privLastAtom;
nxagentPrintAtomMapInfo("nxagentInitAtomMap: Entering");
- atom_list = malloc((list_size) * sizeof(*atom_list));
- name_list = malloc((list_size) * sizeof(char*));
+ XlibAtom *atom_list = malloc((list_size) * sizeof(*atom_list));
+ char **name_list = malloc((list_size) * sizeof(char*));
if ((atom_list == NULL) || (name_list == NULL))
{
@@ -470,7 +450,7 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
* ... if successful cache them too.
*/
- ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list);
+ int ret_value = XInternAtoms(nxagentDisplay, name_list, list_size, False, atom_list);
if (ret_value == 0)
{
@@ -528,22 +508,19 @@ static int nxagentInitAtomMap(char **atomNameList, int count, Atom *atomsRet)
}
/*
- * If the nxagent has been reset,
- * the local value of the atoms stored
- * in cache could have the value None,
- * do not call this function with None.
+ * If the nxagent has been reset, the local value of the atoms stored
+ * in cache could have the value None, do not call this function with
+ * None.
*/
static AtomMap* nxagentFindAtomByLocalValue(Atom local)
{
- unsigned i;
-
if (!ValidAtom(local))
{
return NULL;
}
- for (i = 0; i < privLastAtom; i++)
+ for (unsigned int i = 0; i < privLastAtom; i++)
{
if (local == privAtomMap[i].local)
{
@@ -556,14 +533,12 @@ static AtomMap* nxagentFindAtomByLocalValue(Atom local)
static AtomMap* nxagentFindAtomByRemoteValue(Atom remote)
{
- unsigned i;
-
if (remote == None || remote == BAD_RESOURCE)
{
return NULL;
}
- for (i = 0; i < privLastAtom; i++)
+ for (unsigned int i = 0; i < privLastAtom; i++)
{
if (remote == privAtomMap[i].remote)
{
@@ -576,9 +551,7 @@ static AtomMap* nxagentFindAtomByRemoteValue(Atom remote)
static AtomMap* nxagentFindAtomByName(char *string, unsigned int length)
{
- unsigned i;
-
- for (i = 0; i < privLastAtom; i++)
+ for (unsigned int i = 0; i < privLastAtom; i++)
{
if ((length == privAtomMap[i].length) &&
(strcmp(string, privAtomMap[i].string) == 0))
@@ -602,7 +575,6 @@ static AtomMap* nxagentFindAtomByName(char *string, unsigned int length)
Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
{
- Atom local;
AtomMap *current;
/*
@@ -610,7 +582,7 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
* our nxagentFindAtomByName.
*/
- local = MakeAtom(string, length, Makeit);
+ Atom local = MakeAtom(string, length, Makeit);
if (!ValidAtom(local))
{
@@ -634,7 +606,7 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
if ((current = nxagentFindAtomByName(string, length)))
{
/*
- * Found Cached by name.
+ * Found cached by name.
* It means that nxagent has been reset,
* but not the xserver so we still have cached its atoms.
*/
@@ -645,13 +617,11 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
}
/*
- * We really have to ask Xserver for it.
+ * We really have to ask the Xserver for it.
*/
{
- Atom remote;
-
- remote = XInternAtom(nxagentDisplay, string, !Makeit);
+ Atom remote = XInternAtom(nxagentDisplay, string, !Makeit);
if (remote == None)
{
@@ -670,10 +640,6 @@ Atom nxagentMakeAtom(char *string, unsigned int length, Bool Makeit)
Atom nxagentLocalToRemoteAtom(Atom local)
{
- AtomMap *current;
- const char *string;
- Atom remote;
-
#ifdef TEST
fprintf(stderr, "%s: entering\n", __func__);
#endif
@@ -681,7 +647,7 @@ Atom nxagentLocalToRemoteAtom(Atom local)
if (!ValidAtom(local))
{
#ifdef DEBUG
- fprintf(stderr, "%s: local [%d] is no valid - returning None\n", __func__, remote);
+ fprintf(stderr, "%s: local [%d] is no valid - returning None\n", __func__, local);
#endif
return None;
}
@@ -694,7 +660,9 @@ Atom nxagentLocalToRemoteAtom(Atom local)
return local;
}
- if ((current = nxagentFindAtomByLocalValue(local)))
+ AtomMap *current = nxagentFindAtomByLocalValue(local);
+
+ if (current)
{
#ifdef TEST
fprintf(stderr, "%s: local [%d] -> remote [%d]\n", __func__, local, current->remote);
@@ -702,9 +670,9 @@ Atom nxagentLocalToRemoteAtom(Atom local)
return current->remote;
}
- string = NameForAtom(local);
+ const char *string = NameForAtom(local);
- remote = XInternAtom(nxagentDisplay, string, False);
+ Atom remote = XInternAtom(nxagentDisplay, string, False);
if (remote == None)
{
@@ -726,10 +694,6 @@ Atom nxagentLocalToRemoteAtom(Atom local)
Atom nxagentRemoteToLocalAtom(Atom remote)
{
- AtomMap *current;
- char *string;
- Atom local;
-
if (remote == None || remote == BAD_RESOURCE)
{
#ifdef DEBUG
@@ -746,11 +710,13 @@ Atom nxagentRemoteToLocalAtom(Atom remote)
return remote;
}
- if ((current = nxagentFindAtomByRemoteValue(remote)))
+ AtomMap *current = nxagentFindAtomByRemoteValue(remote);
+
+ if (current)
{
if (!ValidAtom(current->local))
{
- local = MakeAtom(current->string, current->length, True);
+ Atom local = MakeAtom(current->string, current->length, True);
if (ValidAtom(local))
{
@@ -772,14 +738,16 @@ Atom nxagentRemoteToLocalAtom(Atom remote)
return current->local;
}
- if ((string = XGetAtomName(nxagentDisplay, remote)))
+ char *string = XGetAtomName(nxagentDisplay, remote);
+
+ if (string)
{
- local = MakeAtom(string, strlen(string), True);
+ Atom local = MakeAtom(string, strlen(string), True);
if (!ValidAtom(local))
{
#ifdef WARNING
- fprintf(stderr, "nxagentRemoteToLocalAtom: WARNING MakeAtom failed.\n");
+ fprintf(stderr, "%s: WARNING MakeAtom failed.\n", __func__);
#endif
local = None;
@@ -796,7 +764,7 @@ Atom nxagentRemoteToLocalAtom(Atom remote)
}
#ifdef WARNING
- fprintf(stderr, "nxagentRemoteToLocalAtom: WARNING failed to get name from remote atom.\n");
+ fprintf(stderr, "%s: WARNING failed to get name from remote atom.\n", __func__);
#endif
return None;
@@ -806,15 +774,13 @@ Atom nxagentRemoteToLocalAtom(Atom remote)
static void nxagentPrintAtomMapInfo(char *message)
{
- unsigned i;
-
fprintf(stderr, "--------------- Atom map in context [%s] ----------------------\n", message);
fprintf(stderr, "nxagentPrintAtomMapInfo: Map at [%p] size [%d] number of entry [%d] auto increment [%d].\n",
(void*) privAtomMap, privLastAtom, privAtomMapSize, NXAGENT_ATOM_MAP_SIZE_INCREMENT);
- for (i = 0; i < privLastAtom; i++)
+ for (unsigned int i = 0; i < privLastAtom; i++)
{
- fprintf(stderr, "[%5.1d] local: %6.1lu - remote: %6.1lu - [%p] %s\n", i,
+ fprintf(stderr, "[%5.1d] local: %6.1u - remote: %6.1u - [%p] %s\n", i,
privAtomMap[i].local,
privAtomMap[i].remote,
privAtomMap[i].string, validateString(privAtomMap[i].string));
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
index 391e06181..08eb1cfff 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h
@@ -41,7 +41,7 @@ extern Bool nxagentWMIsRunning;
* to the agent server.
*/
-int nxagentInitAtoms(WindowPtr pWin);
+void nxagentInitAtoms();
/*
* Query and create all the required atoms
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 024d685ba..fe5c7d2c9 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -74,9 +74,9 @@ Atom serverCutProperty;
Atom clientCutProperty;
static Window serverWindow;
-static const int nxagentPrimarySelection = 0;
-static const int nxagentClipboardSelection = 1;
-static const int nxagentMaxSelections = 2;
+const int nxagentPrimarySelection = 0;
+const int nxagentClipboardSelection = 1;
+const int nxagentMaxSelections = 2;
typedef struct _SelectionOwner
{
@@ -217,7 +217,7 @@ void nxagentPrintSelectionStat(int sel)
{
SelectionOwner lOwner = lastSelectionOwner[sel];
Selection curSel = CurrentSelections[sel];
- char *s =NULL;
+ char *s = NULL;
#ifdef CLIENTIDS
fprintf(stderr, " lastSelectionOwner[].client [%p] index [%d] PID [%d] Cmd [%s]\n",
@@ -304,8 +304,8 @@ void nxagentPrintClipboardStat(char *header)
fprintf(stderr, " lastClientProperty (Atom) [% 4d][%s]\n", lastClientProperty, NameForAtom(lastClientProperty));
fprintf(stderr, " lastClientSelection (Atom) [% 4d][%s]\n", lastClientSelection, NameForAtom(lastClientSelection));
fprintf(stderr, " lastClientTarget (Atom) [% 4d][%s]\n", lastClientTarget, NameForAtom(lastClientTarget));
- fprintf(stderr, " lastClientTime (Time) [%u]\n", lastServerTime);
- fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastServerReqTime);
+ fprintf(stderr, " lastClientTime (Time) [%u]\n", lastClientTime);
+ fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastClientReqTime);
fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize);
fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage));
@@ -617,7 +617,7 @@ FIXME: Do we need this?
}
else
{
- if (lastSelectionOwner[i].client != NULL &&
+ if (lastSelectionOwner[i].client != NULL &&
nxagentOption(Clipboard) != ClipboardClient)
{
xEvent x;
@@ -913,7 +913,7 @@ void nxagentCollectPropertyEvent(int resource)
SAFE_XFree(pszReturnData);
return;
}
-
+
if (resultFormat != 8 && resultFormat != 16 && resultFormat != 32)
{
#ifdef DEBUG
@@ -1571,10 +1571,10 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
x.u.selectionNotify.selection = selection;
x.u.selectionNotify.target = target;
x.u.selectionNotify.property = property;
-
+
(void) TryClientEvents(client, &x, 1, NoEventMask,
NoEventMask , NullGrab);
-
+
return 1;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
index 33b0738ec..b04977887 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c
@@ -69,11 +69,7 @@ Bool nxagentReconnectAllColormap(void *p0);
Bool nxagentCreateColormap(ColormapPtr pCmap)
{
- VisualPtr pVisual;
XColor *colors;
- int i, ncolors;
- Pixel red, green, blue;
- Pixel redInc, greenInc, blueInc;
Visual *visual;
int class;
@@ -83,8 +79,8 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
" visual [%lu].\n", pCmap->pVisual);
#endif
- pVisual = pCmap->pVisual;
- ncolors = pVisual->ColormapEntries;
+ VisualPtr pVisual = pCmap->pVisual;
+ int ncolors = pVisual->ColormapEntries;
pCmap->devPriv = (void *)malloc(sizeof(nxagentPrivColormap));
@@ -102,7 +98,6 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
class = pVisual->class;
}
-
nxagentColormapPriv(pCmap)->colormap =
XCreateColormap(nxagentDisplay,
nxagentDefaultWindows[pCmap->pScreen->myNum],
@@ -110,13 +105,15 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
(class & DynamicClass) ?
AllocAll : AllocNone);
- switch (class) {
+ switch (class)
+ {
case StaticGray: /* read only */
colors = (XColor *)malloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
+ for (int i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
+ for (int i = 0; i < ncolors; i++)
+ {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->red[i].co.local.green = colors[i].red;
pCmap->red[i].co.local.blue = colors[i].red;
@@ -126,10 +123,11 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
case StaticColor: /* read only */
colors = (XColor *)malloc(ncolors * sizeof(XColor));
- for (i = 0; i < ncolors; i++)
+ for (int i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
+ for (int i = 0; i < ncolors; i++)
+ {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->red[i].co.local.green = colors[i].green;
pCmap->red[i].co.local.blue = colors[i].blue;
@@ -139,21 +137,29 @@ Bool nxagentCreateColormap(ColormapPtr pCmap)
case TrueColor: /* read only */
colors = (XColor *)malloc(ncolors * sizeof(XColor));
- red = green = blue = 0L;
+ Pixel red = 0L, green = 0L, blue = 0L;
+ Pixel redInc, greenInc, blueInc;
redInc = lowbit(pVisual->redMask);
greenInc = lowbit(pVisual->greenMask);
blueInc = lowbit(pVisual->blueMask);
- for (i = 0; i < ncolors; i++) {
+ for (int i = 0; i < ncolors; i++)
+ {
colors[i].pixel = red | green | blue;
red += redInc;
- if (red > pVisual->redMask) red = 0L;
+ if (red > pVisual->redMask)
+ red = 0L;
+
green += greenInc;
- if (green > pVisual->greenMask) green = 0L;
+ if (green > pVisual->greenMask)
+ green = 0L;
+
blue += blueInc;
- if (blue > pVisual->blueMask) blue = 0L;
+ if (blue > pVisual->blueMask)
+ blue = 0L;
}
XQueryColors(nxagentDisplay, nxagentColormap(pCmap), colors, ncolors);
- for (i = 0; i < ncolors; i++) {
+ for (int i = 0; i < ncolors; i++)
+ {
pCmap->red[i].co.local.red = colors[i].red;
pCmap->green[i].co.local.green = colors[i].green;
pCmap->blue[i].co.local.blue = colors[i].blue;
@@ -187,13 +193,14 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr)
{
nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *) ptr;
- int i;
-
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
+ for (int i = 0; i < icws->numCmapIDs; i++)
+ {
+ if (SEARCH_PREDICATE)
+ {
icws->numWindows++;
return WT_DONTWALKCHILDREN;
}
+ }
return WT_WALKCHILDREN;
}
@@ -201,13 +208,15 @@ static int nxagentCountInstalledColormapWindows(WindowPtr pWin, void * ptr)
static int nxagentGetInstalledColormapWindows(WindowPtr pWin, void * ptr)
{
nxagentInstalledColormapWindows *icws = (nxagentInstalledColormapWindows *)ptr;
- int i;
- for (i = 0; i < icws->numCmapIDs; i++)
- if (SEARCH_PREDICATE) {
+ for (int i = 0; i < icws->numCmapIDs; i++)
+ {
+ if (SEARCH_PREDICATE)
+ {
icws->windows[icws->index++] = nxagentWindow(pWin);
return WT_DONTWALKCHILDREN;
}
+ }
return WT_WALKCHILDREN;
}
@@ -243,7 +252,8 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
icws.numCmapIDs = nxagentListInstalledColormaps(pScreen, icws.cmapIDs);
icws.numWindows = 0;
WalkTree(pScreen, nxagentCountInstalledColormapWindows, (void *)&icws);
- if (icws.numWindows) {
+ if (icws.numWindows)
+ {
icws.windows = (Window *)malloc((icws.numWindows + 1) * sizeof(Window));
icws.index = 0;
WalkTree(pScreen, nxagentGetInstalledColormapWindows, (void *)&icws);
@@ -257,15 +267,15 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
SAFE_free(icws.cmapIDs);
- if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) {
+ if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows))
+ {
SAFE_free(nxagentOldInstalledColormapWindows);
#ifdef _XSERVER64
{
- int i;
Window64 *windows = (Window64 *)malloc(numWindows * sizeof(Window64));
- for(i = 0; i < numWindows; ++i)
+ for(int i = 0; i < numWindows; ++i)
windows[i] = icws.windows[i];
XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
windows, numWindows);
@@ -285,36 +295,36 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen)
This will only work with default local visual colormaps.
*/
if (icws.numWindows)
+ {
+ WindowPtr pWin;
+ Visual *visual;
+ ColormapPtr pCmap;
+
+ pWin = nxagentWindowPtr(icws.windows[0]);
+ visual = nxagentVisualFromID(pScreen, wVisual(pWin));
+
+ if (visual == nxagentDefaultVisual(pScreen))
+ pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
+ RT_COLORMAP);
+ else
+ pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
+ RT_COLORMAP);
+
+ if (pCmap != NULL)
{
- WindowPtr pWin;
- Visual *visual;
- ColormapPtr pCmap;
-
- pWin = nxagentWindowPtr(icws.windows[0]);
- visual = nxagentVisualFromID(pScreen, wVisual(pWin));
-
- if (visual == nxagentDefaultVisual(pScreen))
- pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
- RT_COLORMAP);
- else
- pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
- RT_COLORMAP);
-
- if (pCmap != NULL)
- {
- XSetWindowColormap(nxagentDisplay,
- nxagentDefaultWindows[pScreen->myNum],
- nxagentColormap(pCmap));
- }
- #ifdef WARNING
- else
- {
- fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! "
- "Window at [%p] has no colormap with class [%d].\n",
- (void *)pWin, pWin -> drawable.class);
- }
- #endif
+ XSetWindowColormap(nxagentDisplay,
+ nxagentDefaultWindows[pScreen->myNum],
+ nxagentColormap(pCmap));
}
+ #ifdef WARNING
+ else
+ {
+ fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! "
+ "Window at [%p] has no colormap with class [%d].\n",
+ (void *)pWin, pWin -> drawable.class);
+ }
+ #endif
+ }
#endif /* DUMB_WINDOW_MANAGERS */
}
else
@@ -347,17 +357,15 @@ void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen)
void nxagentDirectInstallColormaps(ScreenPtr pScreen)
{
- int i, n;
Colormap pCmapIDs[MAXCMAPS];
- if (!nxagentDoDirectColormaps) return;
-
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+ if (!nxagentDoDirectColormaps)
+ return;
- for (i = 0; i < n; i++) {
- ColormapPtr pCmap;
+ int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
- pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
+ for (int i = 0; i < n; i++) {
+ ColormapPtr pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
if (pCmap)
XInstallColormap(nxagentDisplay, nxagentColormap(pCmap));
}
@@ -365,14 +373,13 @@ void nxagentDirectInstallColormaps(ScreenPtr pScreen)
void nxagentDirectUninstallColormaps(ScreenPtr pScreen)
{
- int i, n;
Colormap pCmapIDs[MAXCMAPS];
if (!nxagentDoDirectColormaps) return;
- n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
+ int n = (*pScreen->ListInstalledColormaps)(pScreen, pCmapIDs);
- for (i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
ColormapPtr pCmap;
pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
@@ -383,45 +390,39 @@ void nxagentDirectUninstallColormaps(ScreenPtr pScreen)
void nxagentInstallColormap(ColormapPtr pCmap)
{
- int index;
- ColormapPtr pOldCmap;
-
- index = pCmap->pScreen->myNum;
- pOldCmap = InstalledMaps[index];
+ int index = pCmap->pScreen->myNum;
+ ColormapPtr pOldCmap = InstalledMaps[index];
if(pCmap != pOldCmap)
- {
- nxagentDirectUninstallColormaps(pCmap->pScreen);
+ {
+ nxagentDirectUninstallColormaps(pCmap->pScreen);
- /* Uninstall pInstalledMap. Notify all interested parties. */
- if(pOldCmap != (ColormapPtr)None)
- WalkTree(pCmap->pScreen, TellLostMap, (void *)&pOldCmap->mid);
+ /* Uninstall pInstalledMap. Notify all interested parties. */
+ if(pOldCmap != (ColormapPtr)None)
+ WalkTree(pCmap->pScreen, TellLostMap, (void *)&pOldCmap->mid);
- InstalledMaps[index] = pCmap;
- WalkTree(pCmap->pScreen, TellGainedMap, (void *)&pCmap->mid);
+ InstalledMaps[index] = pCmap;
+ WalkTree(pCmap->pScreen, TellGainedMap, (void *)&pCmap->mid);
- nxagentSetInstalledColormapWindows(pCmap->pScreen);
- nxagentDirectInstallColormaps(pCmap->pScreen);
- }
+ nxagentSetInstalledColormapWindows(pCmap->pScreen);
+ nxagentDirectInstallColormaps(pCmap->pScreen);
+ }
}
void nxagentUninstallColormap(ColormapPtr pCmap)
{
- int index;
- ColormapPtr pCurCmap;
-
- index = pCmap->pScreen->myNum;
- pCurCmap = InstalledMaps[index];
+ int index = pCmap->pScreen->myNum;
+ ColormapPtr pCurCmap = InstalledMaps[index];
if(pCmap == pCurCmap)
+ {
+ if ((unsigned int)pCmap->mid != pCmap->pScreen->defColormap)
{
- if ((unsigned int)pCmap->mid != pCmap->pScreen->defColormap)
- {
- pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
- RT_COLORMAP);
- (*pCmap->pScreen->InstallColormap)(pCurCmap);
- }
+ pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
+ RT_COLORMAP);
+ (*pCmap->pScreen->InstallColormap)(pCurCmap);
}
+ }
}
int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
@@ -429,7 +430,6 @@ int nxagentListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
if (nxagentInstalledDefaultColormap)
{
*pCmapIds = InstalledMaps[pScreen->myNum]->mid;
-
return 1;
}
else
@@ -443,10 +443,9 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
if (pCmap->pVisual->class & DynamicClass)
#ifdef _XSERVER64
{
- int i;
XColor *pColors64 = (XColor *)malloc(nColors * sizeof(XColor) );
- for(i = 0; i < nColors; ++i)
+ for(int i = 0; i < nColors; ++i)
{
pColors64[i].pixel = pColors[i].pixel;
pColors64[i].red = pColors[i].red;
@@ -466,50 +465,43 @@ void nxagentStoreColors(ColormapPtr pCmap, int nColors, xColorItem *pColors)
void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen,
unsigned short *pBlue, VisualPtr pVisual)
{
- int shift;
- unsigned int lim;
-
- shift = 16 - pVisual->bitsPerRGBValue;
- lim = (1 << pVisual->bitsPerRGBValue) - 1;
+ int shift = 16 - pVisual->bitsPerRGBValue;
+ unsigned int lim = (1 << pVisual->bitsPerRGBValue) - 1;
if ((pVisual->class == PseudoColor) || (pVisual->class == DirectColor))
- {
- /* rescale to rgb bits */
- *pRed = ((*pRed >> shift) * 65535) / lim;
- *pGreen = ((*pGreen >> shift) * 65535) / lim;
- *pBlue = ((*pBlue >> shift) * 65535) / lim;
- }
+ {
+ /* rescale to rgb bits */
+ *pRed = ((*pRed >> shift) * 65535) / lim;
+ *pGreen = ((*pGreen >> shift) * 65535) / lim;
+ *pBlue = ((*pBlue >> shift) * 65535) / lim;
+ }
else if (pVisual->class == GrayScale)
- {
- /* rescale to gray then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
- }
+ {
+ /* rescale to gray then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
else if (pVisual->class == StaticGray)
- {
- unsigned int limg;
-
- limg = pVisual->ColormapEntries - 1;
- /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
- *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
- *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
- *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
- }
+ {
+ unsigned int limg = pVisual->ColormapEntries - 1;
+ /* rescale to gray then [0..limg] then [0..65535] then rgb bits */
+ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100;
+ *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg;
+ *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim;
+ }
else
- {
- unsigned limr, limg, limb;
-
- limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- /* rescale to [0..limN] then [0..65535] then rgb bits */
- *pRed = ((((((*pRed * (limr + 1)) >> 16) *
- 65535) / limr) >> shift) * 65535) / lim;
- *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
- 65535) / limg) >> shift) * 65535) / lim;
- *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
- 65535) / limb) >> shift) * 65535) / lim;
- }
+ {
+ unsigned limr = pVisual->redMask >> pVisual->offsetRed;
+ unsigned limg = pVisual->greenMask >> pVisual->offsetGreen;
+ unsigned limb = pVisual->blueMask >> pVisual->offsetBlue;
+ /* rescale to [0..limN] then [0..65535] then rgb bits */
+ *pRed = ((((((*pRed * (limr + 1)) >> 16) *
+ 65535) / limr) >> shift) * 65535) / lim;
+ *pGreen = ((((((*pGreen * (limg + 1)) >> 16) *
+ 65535) / limg) >> shift) * 65535) / lim;
+ *pBlue = ((((((*pBlue * (limb + 1)) >> 16) *
+ 65535) / limb) >> shift) * 65535) / lim;
+ }
}
Bool nxagentCreateDefaultColormap(ScreenPtr pScreen)
@@ -517,7 +509,6 @@ Bool nxagentCreateDefaultColormap(ScreenPtr pScreen)
VisualPtr pVisual;
ColormapPtr pCmap;
unsigned short zero = 0, ones = 0xFFFF;
- Pixel wp, bp;
#if defined(DEBUG) || defined(DEBUG_COLORMAP)
fprintf(stderr, "Debug: Searching for the root visual [%lu].\n",
@@ -533,8 +524,8 @@ Bool nxagentCreateDefaultColormap(ScreenPtr pScreen)
!= Success)
return False;
- wp = pScreen->whitePixel;
- bp = pScreen->blackPixel;
+ Pixel wp = pScreen->whitePixel;
+ Pixel bp = pScreen->blackPixel;
if ((AllocColor(pCmap, &ones, &ones, &ones, &wp, 0) !=
Success) ||
(AllocColor(pCmap, &zero, &zero, &zero, &bp, 0) !=
@@ -553,7 +544,6 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2)
{
ColormapPtr pCmap = (ColormapPtr)p0;
Bool* pBool = (Bool*)p2;
- VisualPtr pVisual;
#ifdef NXAGENT_RECONNECT_COLORMAP_DEBUG
fprintf(stderr, "nxagentReconnectColormap: %p\n", pCmap);
@@ -562,7 +552,7 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2)
if (!*pBool || !pCmap)
return;
- pVisual = pCmap -> pVisual;
+ VisualPtr pVisual = pCmap -> pVisual;
nxagentColormapPriv(pCmap)->colormap =
XCreateColormap(nxagentDisplay,
@@ -579,14 +569,13 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2)
Bool nxagentReconnectAllColormap(void *p0)
{
- int cid;
Bool success = True;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_COLORMAP_DEBUG)
fprintf(stderr, "nxagentReconnectAllColormap\n");
#endif
- for (cid = 0; (cid < MAXCLIENTS) && success; cid++)
+ for (int cid = 0; (cid < MAXCLIENTS) && success; cid++)
{
if (clients[cid] && success)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index c25afc597..c6412f38a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -2803,11 +2803,11 @@ Bool nxagentReconnectDisplay(void *p0)
#endif
nxagentConfineWindow = XCreateWindow(nxagentDisplay,
- DefaultRootWindow(nxagentDisplay),
- 0, 0, 1, 1, 0, 0,
- InputOnly,
- CopyFromParent,
- 0L, NULL);
+ DefaultRootWindow(nxagentDisplay),
+ 0, 0, 1, 1, 0, 0,
+ InputOnly,
+ CopyFromParent,
+ 0L, NULL);
if (nxagentReportWindowIds) {
fprintf(stderr, "NXAGENT_WINDOW_ID: CONFINEMENT_WINDOW,WID:[0x%x]\n",
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index 4a6a05482..e9de1450d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -345,7 +345,7 @@ void nxagentRemoteWindowID(Window window, Bool newline)
XTextProperty tp;
#endif
- fprintf(stderr, "0x%lx", window);
+ fprintf(stderr, "0x%x", window);
if (!window)
{
@@ -372,23 +372,21 @@ void nxagentRemoteWindowID(Window window, Bool newline)
#else
- if (XGetWMName(nxagentDisplay, window, &tp) != 0)
+ if (XGetWMName(nxagentDisplay, window, &tp) == 0)
{
fprintf(stderr, " (has no name) ");
}
else if (tp.nitems > 0)
{
- int count = 0;
- int i, ret;
- char **list = NULL;
-
fprintf(stderr, " \"");
- ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count);
+ int count = 0;
+ char **list = NULL;
+ int ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count);
if ((ret == Success || ret > 0) && list != NULL)
{
- for (i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
{
fprintf(stderr, "%s", list[i]);
}
@@ -426,20 +424,14 @@ void nxagentRemoteWindowID(Window window, Bool newline)
void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
{
XWindowAttributes attributes;
- int i;
if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0)
{
return;
}
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
-
- fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
- "override_redirect=%s\n", attributes.x, attributes.y,
+ fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s "
+ "override_redirect=%s\n", indent, "", attributes.x, attributes.y,
attributes.width, attributes.height,
(attributes.class == 0) ? "CopyFromParent" :
((attributes.class == 1) ? "InputOutput" : "InputOnly"),
@@ -456,14 +448,25 @@ void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
}
-#ifdef DEBUG_TREE
/*
* Walk remote windows tree.
+ *
+ * FIXME:
+ * ========== nxagentRemoteWindowsTree ============
+ *
+ * Root Window ID: 0x169 (the root window) (has no name)
+ * Parent window ID: 0x2a00063 "NX Agent"
+ * 0 children.
+ *
+ * ========== nxagentInternalWindowsTree ==========
+ * Window ID=[0x9d] Remote ID=[0x2a0007e] Name: ( has no name )
+ * x=0 y=0 width=1440 height=810 class=InputOutput map_state=IsViewable override_redirect=No
+ *
+ * -> Internal root window's remote id is not listed in RemoteWindowsTree.
*/
void nxagentRemoteWindowsTree(Window window, int level)
{
- int i, j;
unsigned long rootWin, parentWin;
unsigned int numChildren;
unsigned long *childList = NULL;
@@ -488,25 +491,15 @@ void nxagentRemoteWindowsTree(Window window, int level)
if (level == 0 || numChildren > 0)
{
- fprintf(stderr, " ");
-
- for (j = 0; j < level; j++)
- {
- fprintf(stderr, " ");
- }
+ fprintf(stderr, "%*s", (level * 4) + 5, ""); /* 4 spaces per level */
fprintf(stderr, "%d child%s%s\n", numChildren, (numChildren == 1) ? "" :
"ren", (numChildren == 1) ? ":" : ".");
}
- for (i = (int) numChildren - 1; i >= 0; i--)
+ for (int i = (int) numChildren - 1; i >= 0; i--)
{
- fprintf(stderr, " ");
-
- for (j = 0; j < level; j++)
- {
- fprintf(stderr, " ");
- }
+ fprintf(stderr, "%*s", (level * 5) + 6, ""); /* 5 spaces per level */
nxagentRemoteWindowID(childList[i], TRUE);
@@ -515,9 +508,8 @@ void nxagentRemoteWindowsTree(Window window, int level)
nxagentRemoteWindowsTree(childList[i], level + 1);
}
- SAFE_XFree((char *) childList);
+ SAFE_XFree(childList);
}
-#endif
/*
* Print info about internal window.
@@ -525,7 +517,6 @@ void nxagentRemoteWindowsTree(Window window, int level)
void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
{
- int i;
int result;
unsigned long ulReturnItems;
unsigned long ulReturnBytesLeft;
@@ -533,8 +524,8 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
int iReturnFormat;
unsigned char *pszReturnData = NULL;
- fprintf(stderr, "Window ID=[0x%lx] Remote ID=[0x%lx] ", pWin -> drawable.id,
- nxagentWindow(pWin));
+ fprintf(stderr, "Window ID=[0x%x] %s Remote ID=[0x%x] ", pWin -> drawable.id,
+ pWin->parent ? "" : "(the root window)", nxagentWindow(pWin));
result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0,
sizeof(CARD32), False, AnyPropertyType,
@@ -546,22 +537,15 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
if (result == Success && pszReturnData != NULL)
{
- pszReturnData[ulReturnItems] = '\0';
-
- fprintf(stderr, "\"%s\"\n", (char *) pszReturnData);
+ fprintf(stderr, "\"%*.*s\"\n", (int)ulReturnItems, (int)ulReturnItems, (char *) pszReturnData);
}
else
{
fprintf(stderr, "%s\n", "( has no name )");
}
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
-
- fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
- "override_redirect=%s", pWin -> drawable.x, pWin -> drawable.y,
+ fprintf(stderr, "%*sx=%d y=%d width=%d height=%d class=%s map_state=%s "
+ "override_redirect=%s", indent, "", pWin -> drawable.x, pWin -> drawable.y,
pWin -> drawable.width, pWin -> drawable.height,
(pWin -> drawable.class == 0) ? "CopyFromParent" :
((pWin -> drawable.class == 1) ? "InputOutput" :
@@ -584,17 +568,11 @@ void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
void nxagentInternalWindowsTree(WindowPtr pWin, int indent)
{
- WindowPtr pChild;
- int i;
-
while (pWin)
{
- pChild = pWin -> firstChild;
+ WindowPtr pChild = pWin -> firstChild;
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
+ fprintf(stderr, "%*s", indent, "");
nxagentInternalWindowInfo(pWin, indent, TRUE);
@@ -1025,7 +1003,7 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
case doDebugTree:
{
- fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n");
+ fprintf(stderr, "\n========== nxagentRemoteWindowsTree ============\n");
nxagentRemoteWindowsTree(nxagentWindow(screenInfo.screens[0]->root), 0);
fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n");
@@ -1228,9 +1206,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentXkbNumTrap = 0;
}
- /* Calculate the time elapsed between this and the last event we
- received. Add this delta to time we recorded for the last
- KeyPress event we passed on to our clients. */
+ /* Calculate the time elapsed between this and the last event we
+ received. Add this delta to time we recorded for the last
+ KeyPress event we passed on to our clients. */
memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease;
x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
@@ -1571,18 +1549,18 @@ FIXME: Don't enqueue the KeyRelease event if the key was
{
WindowPtr pWin;
- #ifdef DEBUG
- fprintf(stderr, "%s: Going to handle new FocusIn event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode));
- {
- XlibWindow w;
+ #ifdef DEBUG
+ fprintf(stderr, "%s: Going to handle new FocusIn event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode));
+ {
+ XlibWindow w;
int revert_to;
XGetInputFocus(nxagentDisplay, &w, &revert_to);
- fprintf(stderr, "%s: (FocusIn): Event win [0x%x] Focus owner [0x%x] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]);
- }
+ fprintf(stderr, "%s: (FocusIn): Event win [0x%x] Focus owner [0x%x] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]);
+ }
#else
- #ifdef TEST
- fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__);
- #endif
+ #ifdef TEST
+ fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__);
+ #endif
#endif
/*
@@ -1614,27 +1592,27 @@ FIXME: Don't enqueue the KeyRelease event if the key was
{
#if defined(DEBUG) || defined(DEBUG_AUTOGRAB)
fprintf(stderr, "%s: (FocusIn): grabbing\n", __func__);
- #endif
+ #endif
nxagentGrabPointerAndKeyboard(NULL);
}
- /* else
+ /* else
{
#if defined(DEBUG) || defined(DEBUG_AUTOGRAB)
fprintf(stderr, "%s: (FocusIn): ungrabbing\n", __func__);
- #endif
+ #endif
nxagentUngrabPointerAndKeyboard(NULL);
}
- */
+ */
}
break;
}
case FocusOut:
{
- #ifdef DEBUG
- fprintf(stderr, "%s: Going to handle new FocusOut event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode));
- #else
- #ifdef TEST
- fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__);
+ #ifdef DEBUG
+ fprintf(stderr, "%s: Going to handle new FocusOut event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode));
+ #else
+ #ifdef TEST
+ fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__);
#endif
#endif
@@ -1655,22 +1633,14 @@ FIXME: Don't enqueue the KeyRelease event if the key was
* Force the keys all up when focus is lost.
*/
- int i, k;
- int mask = 1;
- CARD8 val;
-
- XEvent xM;
- memset(&xM, 0, sizeof(XEvent));
-
- for (i = 0; i < DOWN_LENGTH; i++) /* input.h */
+ for (int i = 0; i < DOWN_LENGTH; i++) /* input.h */
{
- val = inputInfo.keyboard->key->down[i];
+ CARD8 val = inputInfo.keyboard->key->down[i];
if (val != 0)
{
- for (k = 0; k < 8; k++)
+ for (int k = 0; k < 8; k++)
{
- if (val & (mask << k))
{
#ifdef NXAGENT_FIXKEYS_DEBUG
fprintf(stderr, "sending KeyRelease event for keycode: %x\n",
@@ -1687,6 +1657,9 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
{
+ XEvent xM;
+
+ memset(&xM, 0, sizeof(XEvent));
xM.type = KeyRelease;
xM.xkey.display = nxagentDisplay;
xM.xkey.type = KeyRelease;
@@ -2241,7 +2214,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
/*
* Handle the agent window's changes.
*/
-
+
if (closeSession)
{
if (nxagentOption(Persistent))
@@ -3230,12 +3203,10 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X)
#ifdef TEST
{
- WindowPtr pSib;
-
fprintf(stderr, "nxagentCheckWindowConfiguration: Before restacking top level window [%p]\n",
(void *) nxagentWindowPtr(X -> window));
- for (pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib)
+ for (WindowPtr pSib = screenInfo.screens[0]->root -> firstChild; pSib; pSib = pSib -> nextSib)
{
fprintf(stderr, "nxagentCheckWindowConfiguration: Top level window: [%p].\n",
(void *) pSib);
@@ -3594,16 +3565,13 @@ int nxagentHandleReparentNotify(XEvent* X)
if (nxagentOption(Rootless))
{
- WindowPtr pWin;
-
XlibWindow w;
XlibWindow root_return = 0;
XlibWindow parent_return = 0;
XlibWindow *children_return = NULL;
unsigned int nchildren_return = 0;
Status result;
-
- pWin = nxagentWindowPtr(X -> xreparent.window);
+ WindowPtr pWin = nxagentWindowPtr(X -> xreparent.window);
#ifdef TEST
@@ -3697,13 +3665,11 @@ int nxagentHandleReparentNotify(XEvent* X)
XlibWindow junk;
XlibWindow *childrenReturn = NULL;
unsigned int nchildrenReturn = 0;
- Status result;
XWindowAttributes attributes;
int x, y;
- int xParent, yParent;
/*
- * Calculate the absolute upper-left X e Y
+ * Calculate the absolute upper-left X e Y
*/
if ((XGetWindowAttributes(nxagentDisplay, X -> xreparent.window,
@@ -3732,10 +3698,12 @@ int nxagentHandleReparentNotify(XEvent* X)
if (w != DefaultRootWindow(nxagentDisplay))
{
+ int xParent, yParent;
+
do
{
- result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn,
- &childrenReturn, &nchildrenReturn);
+ Status result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn,
+ &childrenReturn, &nchildrenReturn);
SAFE_XFree(childrenReturn);
@@ -3767,7 +3735,7 @@ int nxagentHandleReparentNotify(XEvent* X)
/*
* Difference between Absolute X and Parent X gives thickness of side frame.
- * Difference between Absolute Y and Parent Y gives thickness of title bar.
+ * Difference between Absolute Y and Parent Y gives thickness of title bar.
*/
nxagentChangeOption(WMBorderWidth, (x - xParent));
@@ -3778,19 +3746,29 @@ int nxagentHandleReparentNotify(XEvent* X)
return 1;
}
-void nxagentEnableKeyboardEvents(void)
+/*
+ * Helper for nxagent(Enable|Disable)(Keyboard|Pointer)Events
+ */
+static void nxagentSwitchEventsAllScreens(Mask mask, Bool enable)
{
- int i;
- Mask mask = nxagentGetDefaultEventMask();
+ Mask newmask = nxagentGetDefaultEventMask();
- mask |= NXAGENT_KEYBOARD_EVENT_MASK;
+ if (enable)
+ newmask |= mask;
+ else
+ newmask &= ~mask;
- nxagentSetDefaultEventMask(mask);
+ nxagentSetDefaultEventMask(newmask);
- for (i = 0; i < nxagentNumScreens; i++)
+ for (int i = 0; i < nxagentNumScreens; i++)
{
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
+ XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], newmask);
}
+}
+
+void nxagentEnableKeyboardEvents(void)
+{
+ nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, True);
XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd,
NXAGENT_KEYBOARD_EXTENSION_EVENT_MASK,
@@ -3799,49 +3777,19 @@ void nxagentEnableKeyboardEvents(void)
void nxagentDisableKeyboardEvents(void)
{
- int i;
- Mask mask = nxagentGetDefaultEventMask();
-
- mask &= ~NXAGENT_KEYBOARD_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_KEYBOARD_EVENT_MASK, False);
XkbSelectEvents(nxagentDisplay, XkbUseCoreKbd, 0x0, 0x0);
}
void nxagentEnablePointerEvents(void)
{
- int i;
- Mask mask = nxagentGetDefaultEventMask();
-
- mask |= NXAGENT_POINTER_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, True);
}
void nxagentDisablePointerEvents(void)
{
- int i;
- Mask mask = nxagentGetDefaultEventMask();
-
- mask &= ~NXAGENT_POINTER_EVENT_MASK;
-
- nxagentSetDefaultEventMask(mask);
-
- for (i = 0; i < nxagentNumScreens; i++)
- {
- XSelectInput(nxagentDisplay, nxagentDefaultWindows[i], mask);
- }
+ nxagentSwitchEventsAllScreens(NXAGENT_POINTER_EVENT_MASK, False);
}
void nxagentSendFakeKey(int key)
@@ -4104,9 +4052,7 @@ void nxagentHandleCollectPropertyEvent(XEvent *X)
unsigned long ulReturnBytesLeft;
unsigned char *pszReturnData = NULL;
int result;
- int resource;
-
- resource = X -> xclient.data.l[1];
+ int resource = X -> xclient.data.l[1];
if (X -> xclient.data.l[2] == False)
{
@@ -4232,17 +4178,14 @@ void nxagentSynchronizeExpose(void)
int nxagentLookupByWindow(WindowPtr pWin)
{
- int i;
- int j;
-
- for (j = 0; j < nxagentExposeQueue.length; j++)
+ for (int j = 0; j < nxagentExposeQueue.length; j++)
{
- i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
+ int i = (nxagentExposeQueue.start + j) % EXPOSED_SIZE;
if (nxagentExposeQueue.exposures[i].pWindow == pWin &&
!nxagentExposeQueue.exposures[i].remoteRegionIsCompleted)
{
- return i;
+ return i;
}
}
@@ -4251,28 +4194,18 @@ int nxagentLookupByWindow(WindowPtr pWin)
void nxagentRemoveDuplicatedKeys(XEvent *X)
{
- _XQEvent *prev;
- _XQEvent *qelt;
-
- _XQEvent *qeltKeyRelease;
- _XQEvent *prevKeyRelease;
+ _XQEvent *qelt = nxagentDisplay -> head;
KeyCode lastKeycode = X -> xkey.keycode;
- qelt = nxagentDisplay -> head;
-
if (qelt == NULL)
{
#ifdef TEST
- int more;
-
fprintf(stderr, "nxagentRemoveDuplicatedKeys: Trying to read more events "
"from the X server.\n");
- more = nxagentReadEvents(nxagentDisplay);
-
- if (more > 0)
+ if (nxagentReadEvents(nxagentDisplay) > 0)
{
fprintf(stderr, "nxagentRemoveDuplicatedKeys: Successfully read more events "
"from the X server.\n");
@@ -4289,6 +4222,10 @@ void nxagentRemoveDuplicatedKeys(XEvent *X)
if (qelt != NULL)
{
+ _XQEvent *prev;
+ _XQEvent *qeltKeyRelease;
+ _XQEvent *prevKeyRelease;
+
prev = qeltKeyRelease = prevKeyRelease = NULL;
LockDisplay(nxagentDisplay);
@@ -4391,23 +4328,18 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr rect)
int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr)
{
- RegionPtr exposeRgn;
- RegionPtr remoteExposeRgn;
+ RegionPtr remoteExposeRgn = (RegionRec *) ptr;
#ifdef DEBUG
- BoxRec box;
-
fprintf(stderr, "nxagentClipAndSendExpose: Called.\n");
#endif
- remoteExposeRgn = (RegionRec *) ptr;
-
if (pWin -> drawable.class != InputOnly)
{
- exposeRgn = RegionCreate(NULL, 1);
+ RegionPtr exposeRgn = RegionCreate(NULL, 1);
#ifdef DEBUG
- box = *RegionExtents(remoteExposeRgn);
+ BoxRec box = *RegionExtents(remoteExposeRgn);
fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n",
box.x1, box.y1, box.x2, box.y2);
@@ -4526,14 +4458,12 @@ int nxagentUserInput(void *p)
int nxagentHandleRRScreenChangeNotify(XEvent *X)
{
- XRRScreenChangeNotifyEvent *Xr;
+ XRRScreenChangeNotifyEvent *Xr = (XRRScreenChangeNotifyEvent *) X;
#ifdef DEBUG
fprintf(stderr, "nxagentHandleRRScreenChangeNotify called.\n");
#endif
- Xr = (XRRScreenChangeNotifyEvent *) X;
-
nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height,
Xr -> mwidth, Xr -> mheight);
@@ -4576,12 +4506,9 @@ int nxagentPendingEvents(Display *dpy)
}
else
{
- int result;
int readable;
- result = NXTransReadable(dpy -> fd, &readable);
-
- if (result == 0)
+ if (NXTransReadable(dpy -> fd, &readable) == 0)
{
if (readable > 0)
{
@@ -4669,11 +4596,6 @@ int nxagentWaitEvents(Display *dpy, useconds_t msec)
#ifdef NX_DEBUG_INPUT
-void nxagentDumpInputInfo(void)
-{
- fprintf(stderr, "Dumping input info ON.\n");
-}
-
void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data)
{
if (strcmp(validateString(NameForAtom(property)), "NX_DEBUG_INPUT") == 0)
@@ -4731,9 +4653,6 @@ static const char *nxagentGrabStateToString(int state)
void nxagentDumpInputDevicesState(void)
{
- int i, k;
- int mask = 1;
- CARD8 val;
DeviceIntPtr dev;
GrabPtr grab;
WindowPtr pWin = NULL;
@@ -4743,15 +4662,15 @@ void nxagentDumpInputDevicesState(void)
dev = inputInfo.keyboard;
- for (i = 0; i < DOWN_LENGTH; i++)
+ for (int i = 0; i < DOWN_LENGTH; i++)
{
- val = dev -> key -> down[i];
+ CARD8 val = dev -> key -> down[i];
if (val != 0)
{
- for (k = 0; k < 8; k++)
+ for (int k = 0; k < 8; k++)
{
- if (val & (mask << k))
+ if (val & (1 << k))
{
fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k,
XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0)));
@@ -4804,15 +4723,15 @@ void nxagentDumpInputDevicesState(void)
dev = inputInfo.pointer;
- for (i = 0; i < DOWN_LENGTH; i++)
+ for (int i = 0; i < DOWN_LENGTH; i++)
{
- val = dev -> button -> down[i];
+ CARD8 val = dev -> button -> down[i];
if (val != 0)
{
- for (k = 0; k < 8; k++)
+ for (int k = 0; k < 8; k++)
{
- if (val & (mask << k))
+ if (val & (1 << k))
{
fprintf(stderr, "\n\t[%d]", i * 8 + k);
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c
index 7370bc56d..09ad471c8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Font.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c
@@ -1692,6 +1692,7 @@ char *nxagentMakeScalableFontName(const char *fontName, int scalableResolution)
const char *s;
int field;
+ /* FIXME: use str(n)dup()? */
if ((scalableFontName = malloc(strlen(fontName) + 1)) == NULL)
{
#ifdef PANIC
diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c
index df9c4ad0a..b53428f96 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/GC.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c
@@ -297,85 +297,27 @@ void nxagentValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
pGC->stipple = lastStipple;
}
+#define CHECKGCVAL(cmask, member, val) do {if (mask & cmask) { values.member = (val); changeFlag += nxagentTestGC(values.member, member); } } while (0)
+
void nxagentChangeGC(GCPtr pGC, unsigned long mask)
{
#ifdef TEST
static int nDiscarded;
#endif
- XGCValues values;
-
+ XGCValues values = {0};
int changeFlag = 0;
- if (mask & GCFunction)
- {
- values.function = pGC->alu;
-
- changeFlag |= nxagentTestGC(values.function, function);
- }
-
- if (mask & GCPlaneMask)
- {
- values.plane_mask = pGC->planemask;
-
- changeFlag += nxagentTestGC(values.plane_mask, plane_mask);
- }
-
- if (mask & GCForeground)
- {
- values.foreground = nxagentPixel(pGC->fgPixel);
-
- changeFlag += nxagentTestGC(values.foreground, foreground);
- }
-
- if (mask & GCBackground)
- {
- values.background = nxagentPixel(pGC->bgPixel);
-
- changeFlag += nxagentTestGC(values.background, background);
- }
-
- if (mask & GCLineWidth)
- {
- values.line_width = pGC->lineWidth;
-
- changeFlag += nxagentTestGC(values.line_width, line_width);
- }
-
- if (mask & GCLineStyle)
- {
- values.line_style = pGC->lineStyle;
-
- changeFlag += nxagentTestGC(values.line_style, line_style);
- }
-
- if (mask & GCCapStyle)
- {
- values.cap_style = pGC->capStyle;
-
- changeFlag += nxagentTestGC(values.cap_style, cap_style);
- }
-
- if (mask & GCJoinStyle)
- {
- values.join_style = pGC->joinStyle;
-
- changeFlag += nxagentTestGC(values.join_style, join_style);
- }
-
- if (mask & GCFillStyle)
- {
- values.fill_style = pGC->fillStyle;
-
- changeFlag += nxagentTestGC(values.fill_style, fill_style);
- }
-
- if (mask & GCFillRule)
- {
- values.fill_rule = pGC->fillRule;
-
- changeFlag += nxagentTestGC(values.fill_rule, fill_rule);
- }
+ CHECKGCVAL(GCFunction, function, pGC->alu);
+ CHECKGCVAL(GCPlaneMask, plane_mask, pGC->planemask);
+ CHECKGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel));
+ CHECKGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel));
+ CHECKGCVAL(GCLineWidth, line_width, pGC->lineWidth);
+ CHECKGCVAL(GCLineStyle, line_style, pGC->lineStyle);
+ CHECKGCVAL(GCCapStyle, cap_style, pGC->capStyle);
+ CHECKGCVAL(GCJoinStyle, join_style, pGC->joinStyle);
+ CHECKGCVAL(GCFillStyle, fill_style, pGC->fillStyle);
+ CHECKGCVAL(GCFillRule, fill_rule, pGC->fillRule);
if (mask & GCTile)
{
@@ -460,19 +402,8 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask)
changeFlag += nxagentTestGC(values.stipple, stipple);
}
- if (mask & GCTileStipXOrigin)
- {
- values.ts_x_origin = pGC->patOrg.x;
-
- changeFlag += nxagentTestGC(values.ts_x_origin, ts_x_origin);
- }
-
- if (mask & GCTileStipYOrigin)
- {
- values.ts_y_origin = pGC->patOrg.y;
-
- changeFlag += nxagentTestGC(values.ts_y_origin, ts_y_origin);
- }
+ CHECKGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x);
+ CHECKGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y);
if (mask & GCFont)
{
@@ -483,38 +414,14 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask)
else
{
values.font = nxagentFont(pGC->font);
-
changeFlag += nxagentTestGC(values.font, font);
}
}
- if (mask & GCSubwindowMode)
- {
- values.subwindow_mode = pGC->subWindowMode;
-
- changeFlag += nxagentTestGC(values.subwindow_mode, subwindow_mode);
- }
-
- if (mask & GCGraphicsExposures)
- {
- values.graphics_exposures = pGC->graphicsExposures;
-
- changeFlag += nxagentTestGC(values.graphics_exposures, graphics_exposures);
- }
-
- if (mask & GCClipXOrigin)
- {
- values.clip_x_origin = pGC->clipOrg.x;
-
- changeFlag += nxagentTestGC(values.clip_x_origin, clip_x_origin);
- }
-
- if (mask & GCClipYOrigin)
- {
- values.clip_y_origin = pGC->clipOrg.y;
-
- changeFlag += nxagentTestGC(values.clip_y_origin, clip_y_origin);
- }
+ CHECKGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode);
+ CHECKGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures);
+ CHECKGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x);
+ CHECKGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y);
if (mask & GCClipMask)
{
@@ -525,12 +432,7 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask)
mask &= ~GCClipMask;
}
- if (mask & GCDashOffset)
- {
- values.dash_offset = pGC->dashOffset;
-
- changeFlag += nxagentTestGC(values.dash_offset, dash_offset);
- }
+ CHECKGCVAL(GCDashOffset, dash_offset, pGC->dashOffset);
if (mask & GCDashList)
{
@@ -543,12 +445,7 @@ void nxagentChangeGC(GCPtr pGC, unsigned long mask)
}
}
- if (mask & GCArcMode)
- {
- values.arc_mode = pGC->arcMode;
-
- changeFlag += nxagentTestGC(values.arc_mode, arc_mode);
- }
+ CHECKGCVAL(GCArcMode, arc_mode, pGC->arcMode);
if (nxagentGCTrap == 1)
{
@@ -1008,10 +905,10 @@ int nxagentDestroyNewGCResourceType(void * p, XID id)
return 1;
}
+#define SETGCVAL(mask, member, val) valuemask |= mask; values.member = (val)
+
static void nxagentReconnectGC(void *param0, XID param1, void * param2)
{
- XGCValues values;
- unsigned long valuemask;
GCPtr pGC = (GCPtr) param0;
Bool *pBool = (Bool*)param2;
@@ -1035,42 +932,29 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2)
fprintf(stderr, "nxagentReconnectGC: GC at [%p].\n", (void *) pGC);
#endif
- valuemask = 0;
- memset(&values,0,sizeof(XGCValues));
- values.function = pGC->alu;
- valuemask |= GCFunction;
- values.plane_mask = pGC->planemask;
- valuemask |= GCPlaneMask;
- values.foreground = nxagentPixel(pGC->fgPixel);
- valuemask |= GCForeground;
- values.background = nxagentPixel(pGC->bgPixel);
- valuemask |= GCBackground;
-
- values.line_width = pGC->lineWidth;
- valuemask |= GCLineWidth;
- values.line_style = pGC->lineStyle;
- valuemask |= GCLineStyle;
- values.cap_style = pGC->capStyle;
- valuemask |= GCCapStyle;
- values.join_style = pGC->joinStyle;
- valuemask |= GCJoinStyle;
- values.fill_style = pGC->fillStyle;
- valuemask |= GCFillStyle;
- values.fill_rule = pGC->fillRule;
- valuemask |= GCFillRule;
-
- if (!pGC -> tileIsPixel && (pGC -> tile.pixmap != NULL))
+ XGCValues values = {0};
+ unsigned long valuemask = 0;
+ SETGCVAL(GCFunction, function, pGC->alu);
+ SETGCVAL(GCPlaneMask, plane_mask, pGC->planemask);
+ SETGCVAL(GCForeground, foreground, nxagentPixel(pGC->fgPixel));
+ SETGCVAL(GCBackground, background, nxagentPixel(pGC->bgPixel));
+ SETGCVAL(GCLineWidth, line_width, pGC->lineWidth);
+ SETGCVAL(GCLineStyle, line_style, pGC->lineStyle);
+ SETGCVAL(GCCapStyle, cap_style, pGC->capStyle);
+ SETGCVAL(GCJoinStyle, join_style, pGC->joinStyle);
+ SETGCVAL(GCFillStyle, fill_style, pGC->fillStyle);
+ SETGCVAL(GCFillRule, fill_rule, pGC->fillRule);
+
+ if (!pGC -> tileIsPixel && (pGC -> tile.pixmap != NULL))
{
if (nxagentPixmapIsVirtual(pGC -> tile.pixmap))
{
- values.tile = nxagentPixmap(nxagentRealPixmap(pGC -> tile.pixmap));
+ SETGCVAL(GCTile, tile, nxagentPixmap(nxagentRealPixmap(pGC -> tile.pixmap)));
}
else
{
- values.tile = nxagentPixmap(pGC -> tile.pixmap);
+ SETGCVAL(GCTile, tile, nxagentPixmap(pGC -> tile.pixmap));
}
-
- valuemask |= GCTile;
}
if (pGC->stipple != NULL)
@@ -1087,7 +971,7 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2)
nxagentReconnectPixmap(nxagentRealPixmap(pGC -> stipple), 0, pBool);
}
- values.stipple = nxagentPixmap(nxagentRealPixmap(pGC -> stipple));
+ SETGCVAL(GCStipple, stipple, nxagentPixmap(nxagentRealPixmap(pGC -> stipple)));
}
else
{
@@ -1101,42 +985,31 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2)
nxagentReconnectPixmap(pGC -> stipple, 0, pBool);
}
- values.stipple = nxagentPixmap(pGC->stipple);
+ SETGCVAL(GCStipple, stipple, nxagentPixmap(pGC->stipple));
}
- valuemask |= GCStipple;
}
- values.ts_x_origin = pGC->patOrg.x;
- valuemask |= GCTileStipXOrigin;
- values.ts_y_origin = pGC->patOrg.y;
- valuemask |= GCTileStipYOrigin;
+ SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC->patOrg.x);
+ SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC->patOrg.y);
if (pGC->font != NULL)
{
- values.font = nxagentFont(pGC->font);
- valuemask |= GCFont;
+ SETGCVAL(GCFont, font, nxagentFont(pGC->font));
}
- values.subwindow_mode = pGC->subWindowMode;
- valuemask |= GCSubwindowMode;
- values.graphics_exposures = pGC->graphicsExposures;
- valuemask |= GCGraphicsExposures;
- values.clip_x_origin = pGC->clipOrg.x;
- valuemask |= GCClipXOrigin;
- values.clip_y_origin = pGC->clipOrg.y;
- valuemask |= GCClipYOrigin;
- valuemask |= GCClipMask;
- values.dash_offset = pGC->dashOffset;
- valuemask |= GCDashOffset;
+ SETGCVAL(GCSubwindowMode, subwindow_mode, pGC->subWindowMode);
+ SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC->graphicsExposures);
+ SETGCVAL(GCClipXOrigin, clip_x_origin, pGC->clipOrg.x);
+ SETGCVAL(GCClipYOrigin, clip_y_origin, pGC->clipOrg.y);
+ valuemask |= GCClipMask; /* FIXME: where's the ClipMask pixmap?? */
+ SETGCVAL(GCDashOffset, dash_offset, pGC->dashOffset);
if (pGC->dash != NULL)
{
- values.dashes = *pGC->dash;
- valuemask |= GCDashList;
+ SETGCVAL(GCDashList, dashes, *pGC->dash);
}
- values.arc_mode = pGC->arcMode;
- valuemask |= GCArcMode;
+ SETGCVAL(GCArcMode, arc_mode, pGC->arcMode);
if ((nxagentGC(pGC) = XCreateGC(nxagentDisplay,
nxagentDefaultDrawables[pGC->depth],
@@ -1440,22 +1313,17 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2)
*/
GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen)
{
- GCPtr pGC;
- XGCValues values;
- unsigned long mask;
- int nxagentSaveGCTrap;
-
/*
* The GC trap is temporarily disabled in
* order to allow the remote clipmask reset
* requested by GetScratchGC().
*/
- nxagentSaveGCTrap = nxagentGCTrap;
+ int nxagentSaveGCTrap = nxagentGCTrap;
nxagentGCTrap = 0;
- pGC = GetScratchGC(depth, pScreen);
+ GCPtr pGC = GetScratchGC(depth, pScreen);
nxagentGCTrap = nxagentSaveGCTrap;
@@ -1468,65 +1336,31 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen)
return NULL;
}
- mask = 0;
-
- values.function = pGC -> alu;
- mask |= GCFunction;
-
- values.plane_mask = pGC -> planemask;
- mask |= GCPlaneMask;
-
- values.foreground = nxagentPixel(pGC -> fgPixel);
- mask |= GCForeground;
-
- values.background = nxagentPixel(pGC -> bgPixel);
- mask |= GCBackground;
-
- values.line_width = pGC -> lineWidth;
- mask |= GCLineWidth;
-
- values.line_style = pGC -> lineStyle;
- mask |= GCLineStyle;
-
- values.cap_style = pGC -> capStyle;
- mask |= GCCapStyle;
-
- values.join_style = pGC -> joinStyle;
- mask |= GCJoinStyle;
-
- values.fill_style = pGC -> fillStyle;
- mask |= GCFillStyle;
-
- values.fill_rule = pGC -> fillRule;
- mask |= GCFillRule;
-
- values.arc_mode = pGC -> arcMode;
- mask |= GCArcMode;
-
- values.ts_x_origin = pGC -> patOrg.x;
- mask |= GCTileStipXOrigin;
-
- values.ts_y_origin = pGC -> patOrg.y;
- mask |= GCTileStipYOrigin;
-
- values.subwindow_mode = pGC -> subWindowMode;
- mask |= GCSubwindowMode;
-
- values.graphics_exposures = pGC -> graphicsExposures;
- mask |= GCGraphicsExposures;
-
- /*
- * The GCClipMask is set to none inside
- * the GetScratchGC() function.
- */
-
- values.clip_x_origin = pGC -> clipOrg.x;
- mask |= GCClipXOrigin;
-
- values.clip_y_origin = pGC -> clipOrg.y;
- mask |= GCClipYOrigin;
-
- XChangeGC(nxagentDisplay, nxagentGC(pGC), mask, &values);
+ unsigned long valuemask = 0;
+ XGCValues values = {0};
+ SETGCVAL(GCFunction, function, pGC -> alu);
+ SETGCVAL(GCPlaneMask, plane_mask, pGC -> planemask);
+ SETGCVAL(GCForeground, foreground, nxagentPixel(pGC -> fgPixel));
+ SETGCVAL(GCBackground, background, nxagentPixel(pGC -> bgPixel));
+ SETGCVAL(GCLineWidth, line_width, pGC -> lineWidth);
+ SETGCVAL(GCLineStyle, line_style, pGC -> lineStyle);
+ SETGCVAL(GCCapStyle, cap_style, pGC -> capStyle);
+ SETGCVAL(GCJoinStyle, join_style, pGC -> joinStyle);
+ SETGCVAL(GCFillStyle, fill_style, pGC -> fillStyle);
+ SETGCVAL(GCFillRule, fill_rule, pGC -> fillRule);
+ SETGCVAL(GCArcMode, arc_mode, pGC -> arcMode);
+ SETGCVAL(GCTileStipXOrigin, ts_x_origin, pGC -> patOrg.x);
+ SETGCVAL(GCTileStipYOrigin, ts_y_origin, pGC -> patOrg.y);
+ SETGCVAL(GCSubwindowMode, subwindow_mode, pGC -> subWindowMode);
+ SETGCVAL(GCGraphicsExposures, graphics_exposures, pGC -> graphicsExposures);
+ SETGCVAL(GCClipXOrigin, clip_x_origin, pGC -> clipOrg.x);
+ SETGCVAL(GCClipYOrigin, clip_y_origin, pGC -> clipOrg.y);
+
+ /* The GCClipMask is set to none inside the GetScratchGC() function. */
+
+ /* FIXME: What about GCDashOffset? */
+
+ XChangeGC(nxagentDisplay, nxagentGC(pGC), valuemask, &values);
memset(&(nxagentGCPriv(pGC) -> lastServerValues), 0, sizeof(XGCValues));
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Holder.c b/nx-X11/programs/Xserver/hw/nxagent/Holder.c
index aae48471b..c27f67818 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Holder.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Holder.c
@@ -185,8 +185,6 @@ void nxagentApplyPlaceholder(Drawable drawable, int x, int y,
}
XFreeGC(nxagentDisplay, gc);
-
- return;
}
#ifdef DUMP
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c
index a7bacaf85..e55ed2dd2 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Image.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c
@@ -644,23 +644,23 @@ FIXME: Should use these.
pDrawable -> depth != 1 &&
nxagentOption(DeferLevel) >= 1)
{
- /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/
- if (dstHeight > 16)
- {
- /* -------------------------------------------------------------------------------- */
- #ifdef TEST
- fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] "
- "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1,
- pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2,
- (void *) pDrawable);
- #endif
+ /* -- changed by dimbor (small "bed-sheets" never need be prevented - always put) --*/
+ if (dstHeight > 16)
+ {
+ /* -------------------------------------------------------------------------------- */
+ #ifdef TEST
+ fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on region [%d,%d,%d,%d] "
+ "for drawable at [%p] with drawable pixmap.\n", pRegion -> extents.x1,
+ pRegion -> extents.y1, pRegion -> extents.x2, pRegion -> extents.y2,
+ (void *) pDrawable);
+ #endif
- nxagentMarkCorruptedRegion(pDrawable, pRegion);
+ nxagentMarkCorruptedRegion(pDrawable, pRegion);
- goto nxagentPutImageEnd;
- /* --- changed by dimbor ---*/
- }
- /* ------------------------- */
+ goto nxagentPutImageEnd;
+ /* --- changed by dimbor ---*/
+ }
+ /* ------------------------- */
}
if (pDrawable -> type == DRAWABLE_WINDOW &&
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
index b3450440e..ff9538f3e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile
+++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile
@@ -203,18 +203,43 @@ INCLUDES = \
### NXAGENT Defines:
#
-# NXAGENT_FONTCACHE_SIZE Number of cache slots
-# NXAGENT_SHAPE Old shape code
-# NXAGENT_GLYPHCACHE
-# NXAGENT_GLYPHCACHE_SIZE Slots for glyph cache
-# NXAGENT_SHAPE2 New shape code
-# NXAGENT_FIXKEYS Force the release of pressed key when losing focus
-# NXAGENT_EXPOSURES Manage expose events
+# NXAGENT_SHAPE Old shape code
+# NXAGENT_SHAPE2 New shape code
+# NXAGENT_FIXKEYS Force the release of pressed key when losing focus
# NXAGENT_CLIPBOARD Enables clipboard cut and paste function between X servers.
-# NXAGENT_FONTEXCLUDE Exclude some specific font names (only "-ult1mo" at this moment).
-# NXAGENT FULLSCREEN Fullscreen mode
-# NXAGENT_RANDR_MODE_PREFIX Use prefixed (i.e., nx_<x>x<y>) RandR modes
+# NXAGENT_RANDR_MODE_PREFIX Prefix for RandR modes (i.e., nx_<x>x<y>) (default: nx_)
# NXAGENT_RANDR_XINERAMA_CLIPPING cut off invisible window parts in xinerama mode (you probably do not want this)
+# NXAGENT_TIMESTAMP print duration for some routines
+#
+### macros not investigated yet:
+#
+# NXAGENT_PICTURE_ALWAYS_POINTS_TO_VIRTUAL
+# NXAGENT_RENDER_CLEANUP
+# NXAGENT_WAKEUP=<milliseconds>
+# NXAGENT_ONSTART
+# NXAGENT_SPLASH
+# NXAGENT_ARTSD
+#
+### Debug macros:
+#
+# DEBUG_COLORMAP
+# DEBUG_TREE
+# NXAGENT_DEBUG
+# NXAGENT_FIXKEYS_DEBUG
+# NXAGENT_FONTCACHE_DEBUG
+# NXAGENT_FONTMATCH_DEBUG
+# NXAGENT_LOGO_DEBUG
+# NXAGENT_RECONNECT_COLORMAP_DEBUG
+# NXAGENT_RECONNECT_CURSOR_DEBUG
+# NXAGENT_RECONNECT_DEBUG
+# NXAGENT_RECONNECT_DISPLAY_DEBUG
+# NXAGENT_RECONNECT_FONT_DEBUG
+# NXAGENT_RECONNECT_PICTFORMAT_DEBUG
+# NXAGENT_RECONNECT_PICTURE_DEBUG
+# NXAGENT_RECONNECT_SCREEN_DEBUG
+# NXAGENT_RECONNECT_WINDOW_DEBUG
+# NXAGENT_XKBD_DEBUG
+# NX_DEBUG_INPUT
#if nxVersion
NX_DEFINES = \
@@ -224,34 +249,26 @@ NX_DEFINES = \
#endif
DEFINES = \
- -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \
+ -g $(OS_DEFINES) $(EXT_DEFINES) $(NX_DEFINES) \
-UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI \
-DNXAGENT_SERVER \
- -DNXAGENT_CONSTRAINCURSOR \
- -DNXAGENT_FONTCACHE_SIZE=50 \
- -DNXAGENT_GLYPHCACHE -DNXAGENT_GLYPHCACHE_SIZE=50 \
-DNXAGENT_RENDER_CLEANUP \
-DNXAGENT_SHAPE2 \
-DNXAGENT_FIXKEYS \
-DNXAGENT_CLIPBOARD \
- -DNXAGENT_EXPOSURES \
- -DNXAGENT_FONTEXCLUDE \
- -DNXAGENT_PACKEDIMAGES \
- -DNXAGENT_VISIBILITY \
-DNXAGENT_WAKEUP=1000 \
-DNXAGENT_ONSTART \
-DNXAGENT_ARTSD \
- -DNXAGENT_RANDR_MODE_PREFIX \
-UNX_DEBUG_INPUT \
- -DRANDR_10_INTERFACE=1 \
- -DRANDR_12_INTERFACE=1 \
- -DRANDR_13_INTERFACE=1 \
- -DRANDR_14_INTERFACE=1 \
- -DRANDR_15_INTERFACE=1 \
+ -DRANDR_10_INTERFACE=1 \
+ -DRANDR_12_INTERFACE=1 \
+ -DRANDR_13_INTERFACE=1 \
+ -DRANDR_14_INTERFACE=1 \
+ -DRANDR_15_INTERFACE=1 \
-DPANORAMIX \
-UDEBUG_TREE \
-DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \
- $(NULL)
+ $(NULL)
all:: $(OBJS)
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c
index 2a0bceaf5..0b4ffd601 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Init.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c
@@ -71,6 +71,7 @@ is" without express or implied warranty.
#include "Millis.h"
#include "Error.h"
#include "Keystroke.h"
+#include "Atoms.h"
#include <nx/NX.h>
#include "compext/Compext.h"
@@ -148,6 +149,8 @@ extern void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data,
void *args);
#endif
+extern const char *nxagentProgName;
+
void ddxInitGlobals(void)
{
/*
@@ -199,8 +202,6 @@ Bool nxagentX2go;
void checkX2goAgent(void)
{
- extern const char *nxagentProgName;
-
#ifdef TEST
fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName);
#endif
@@ -221,15 +222,6 @@ void checkX2goAgent(void)
void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
{
- char *authority;
- int i;
-
- #ifdef __sun
-
- char *environment;
-
- #endif
-
/*
* Print our pid and version information.
*/
@@ -295,11 +287,13 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
}
#endif
- if ((authority = getenv("NX_XAUTHORITY")))
+ char *authority = getenv("NX_XAUTHORITY");
+
+ if (authority)
{
#ifdef __sun
- environment = malloc(15 + strlen(authority));
+ char *environment = malloc(15 + strlen(authority));
sprintf(environment, "XAUTHORITY=%s", authority);
@@ -391,7 +385,7 @@ FIXME: These variables, if not removed at all because have probably
nxagentNumScreens = 1;
}
- for (i = 0; i < nxagentNumScreens; i++)
+ for (int i = 0; i < nxagentNumScreens; i++)
{
AddScreen(nxagentOpenScreen, argc, argv);
}
@@ -421,6 +415,8 @@ FIXME: These variables, if not removed at all because have probably
#ifdef NXAGENT_CLIPBOARD
AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL);
#endif
+
+ nxagentInitAtoms();
}
void
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index b7ed38ca3..0ebaf677b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -188,261 +188,57 @@ static void nxagentCheckRemoteKeycodes(void);
static CARD8 nxagentConvertedKeycodes[] =
{
/* evdev pc105*/
- /* 0 */ 0,
- /* 1 */ 1,
- /* 2 */ 2,
- /* 3 */ 3,
- /* 4 */ 4,
- /* 5 */ 5,
- /* 6 */ 6,
- /* 7 */ 7,
- /* 8 */ 8,
- /* 9 */ 9,
- /* 10 */ 10,
- /* 11 */ 11,
- /* 12 */ 12,
- /* 13 */ 13,
- /* 14 */ 14,
- /* 15 */ 15,
- /* 16 */ 16,
- /* 17 */ 17,
- /* 18 */ 18,
- /* 19 */ 19,
- /* 20 */ 20,
- /* 21 */ 21,
- /* 22 */ 22,
- /* 23 */ 23,
- /* 24 */ 24,
- /* 25 */ 25,
- /* 26 */ 26,
- /* 27 */ 27,
- /* 28 */ 28,
- /* 29 */ 29,
- /* 30 */ 30,
- /* 31 */ 31,
- /* 32 */ 32,
- /* 33 */ 33,
- /* 34 */ 34,
- /* 35 */ 35,
- /* 36 */ 36,
- /* 37 */ 37,
- /* 38 */ 38,
- /* 39 */ 39,
- /* 40 */ 40,
- /* 41 */ 41,
- /* 42 */ 42,
- /* 43 */ 43,
- /* 44 */ 44,
- /* 45 */ 45,
- /* 46 */ 46,
- /* 47 */ 47,
- /* 48 */ 48,
- /* 49 */ 49,
- /* 50 */ 50,
- /* 51 */ 51,
- /* 52 */ 52,
- /* 53 */ 53,
- /* 54 */ 54,
- /* 55 */ 55,
- /* 56 */ 56,
- /* 57 */ 57,
- /* 58 */ 58,
- /* 59 */ 59,
- /* 60 */ 60,
- /* 61 */ 61,
- /* 62 */ 62,
- /* 63 */ 63,
- /* 64 */ 64,
- /* 65 */ 65,
- /* 66 */ 66,
- /* 67 */ 67,
- /* 68 */ 68,
- /* 69 */ 69,
- /* 70 */ 70,
- /* 71 */ 71,
- /* 72 */ 72,
- /* 73 */ 73,
- /* 74 */ 74,
- /* 75 */ 75,
- /* 76 */ 76,
- /* 77 */ 77,
- /* 78 */ 78,
- /* 79 */ 79,
- /* 80 */ 80,
- /* 81 */ 81,
- /* 82 */ 82,
- /* 83 */ 83,
- /* 84 */ 84,
- /* 85 */ 85,
- /* 86 */ 86,
- /* 87 */ 87,
- /* 88 */ 88,
- /* 89 */ 89,
- /* 90 */ 90,
- /* 91 */ 91,
- /* 92 */ 124,
- /* 93 */ 93,
- /* 94 */ 94,
- /* 95 */ 95,
- /* 96 */ 96,
- /* 97 */ 211,
- /* 98 */ 98,
- /* 99 */ 99,
- /* 100 */ 100,
- /* 101 */ 208,
- /* 102 */ 102,
- /* 103 */ 103,
- /* 104 */ 108,
- /* 105 */ 109,
- /* 106 */ 112,
- /* 107 */ 111,
- /* 108 */ 113,
- /* 109 */ 109,
- /* 110 */ 97,
- /* 111 */ 98,
- /* 112 */ 99,
- /* 113 */ 100,
- /* 114 */ 102,
- /* 115 */ 103,
- /* 116 */ 104,
- /* 117 */ 105,
- /* 118 */ 106,
- /* 119 */ 107,
- /* 120 */ 120,
- /* 121 */ 121,
- /* 122 */ 122,
- /* 123 */ 123,
- /* 124 */ 124,
- /* 125 */ 126,
- /* 126 */ 126,
- /* 127 */ 110,
- /* 128 */ 128,
- /* 129 */ 129,
- /* 130 */ 130,
- /* 131 */ 131,
- /* 132 */ 133,
- /* 133 */ 115,
- /* 134 */ 116,
- /* 135 */ 117,
- /* 136 */ 136,
- /* 137 */ 137,
- /* 138 */ 138,
- /* 139 */ 139,
- /* 140 */ 140,
- /* 141 */ 141,
- /* 142 */ 142,
- /* 143 */ 143,
- /* 144 */ 144,
- /* 145 */ 145,
- /* 146 */ 146,
- /* 147 */ 147,
- /* 148 */ 148,
- /* 149 */ 149,
- /* 150 */ 150,
- /* 151 */ 151,
- /* 152 */ 152,
- /* 153 */ 153,
- /* 154 */ 154,
- /* 155 */ 155,
- /* 156 */ 156,
- /* 157 */ 157,
- /* 158 */ 158,
- /* 159 */ 159,
- /* 160 */ 160,
- /* 161 */ 161,
- /* 162 */ 162,
- /* 163 */ 163,
- /* 164 */ 164,
- /* 165 */ 165,
- /* 166 */ 166,
- /* 167 */ 167,
- /* 168 */ 168,
- /* 169 */ 169,
- /* 170 */ 170,
- /* 171 */ 171,
- /* 172 */ 172,
- /* 173 */ 173,
- /* 174 */ 174,
- /* 175 */ 175,
- /* 176 */ 176,
- /* 177 */ 177,
- /* 178 */ 178,
- /* 179 */ 179,
- /* 180 */ 180,
- /* 181 */ 181,
- /* 182 */ 182,
- /* 183 */ 183,
- /* 184 */ 184,
- /* 185 */ 185,
- /* 186 */ 186,
- /* 187 */ 187,
- /* 188 */ 188,
- /* 189 */ 189,
- /* 190 */ 190,
- /* 191 */ 118,
- /* 192 */ 119,
- /* 193 */ 120,
- /* 194 */ 121,
- /* 195 */ 122,
- /* 196 */ 196,
- /* 197 */ 197,
- /* 198 */ 198,
- /* 199 */ 199,
- /* 200 */ 200,
- /* 201 */ 201,
- /* 202 */ 202,
- /* 203 */ 93,
- /* 204 */ 125,
- /* 205 */ 156,
- /* 206 */ 127,
- /* 207 */ 128,
- /* 208 */ 208,
- /* 209 */ 209,
- /* 210 */ 210,
- /* 211 */ 211,
- /* 212 */ 212,
- /* 213 */ 213,
- /* 214 */ 214,
- /* 215 */ 215,
- /* 216 */ 216,
- /* 217 */ 217,
- /* 218 */ 218,
- /* 219 */ 219,
- /* 220 */ 220,
- /* 221 */ 221,
- /* 222 */ 222,
- /* 223 */ 223,
- /* 224 */ 224,
- /* 225 */ 225,
- /* 226 */ 226,
- /* 227 */ 227,
- /* 228 */ 228,
- /* 229 */ 229,
- /* 230 */ 230,
- /* 231 */ 231,
- /* 232 */ 232,
- /* 233 */ 233,
- /* 234 */ 234,
- /* 235 */ 235,
- /* 236 */ 236,
- /* 237 */ 237,
- /* 238 */ 238,
- /* 239 */ 239,
- /* 240 */ 240,
- /* 241 */ 241,
- /* 242 */ 242,
- /* 243 */ 243,
- /* 244 */ 244,
- /* 245 */ 245,
- /* 246 */ 246,
- /* 247 */ 247,
- /* 248 */ 248,
- /* 249 */ 249,
- /* 250 */ 250,
- /* 251 */ 251,
- /* 252 */ 252,
- /* 253 */ 253,
- /* 254 */ 254,
+ /* 0 */ 0, /* 1 */ 1, /* 2 */ 2, /* 3 */ 3, /* 4 */ 4,
+ /* 5 */ 5, /* 6 */ 6, /* 7 */ 7, /* 8 */ 8, /* 9 */ 9,
+ /* 10 */ 10, /* 11 */ 11, /* 12 */ 12, /* 13 */ 13, /* 14 */ 14,
+ /* 15 */ 15, /* 16 */ 16, /* 17 */ 17, /* 18 */ 18, /* 19 */ 19,
+ /* 20 */ 20, /* 21 */ 21, /* 22 */ 22, /* 23 */ 23, /* 24 */ 24,
+ /* 25 */ 25, /* 26 */ 26, /* 27 */ 27, /* 28 */ 28, /* 29 */ 29,
+ /* 30 */ 30, /* 31 */ 31, /* 32 */ 32, /* 33 */ 33, /* 34 */ 34,
+ /* 35 */ 35, /* 36 */ 36, /* 37 */ 37, /* 38 */ 38, /* 39 */ 39,
+ /* 40 */ 40, /* 41 */ 41, /* 42 */ 42, /* 43 */ 43, /* 44 */ 44,
+ /* 45 */ 45, /* 46 */ 46, /* 47 */ 47, /* 48 */ 48, /* 49 */ 49,
+ /* 50 */ 50, /* 51 */ 51, /* 52 */ 52, /* 53 */ 53, /* 54 */ 54,
+ /* 55 */ 55, /* 56 */ 56, /* 57 */ 57, /* 58 */ 58, /* 59 */ 59,
+ /* 60 */ 60, /* 61 */ 61, /* 62 */ 62, /* 63 */ 63, /* 64 */ 64,
+ /* 65 */ 65, /* 66 */ 66, /* 67 */ 67, /* 68 */ 68, /* 69 */ 69,
+ /* 70 */ 70, /* 71 */ 71, /* 72 */ 72, /* 73 */ 73, /* 74 */ 74,
+ /* 75 */ 75, /* 76 */ 76, /* 77 */ 77, /* 78 */ 78, /* 79 */ 79,
+ /* 80 */ 80, /* 81 */ 81, /* 82 */ 82, /* 83 */ 83, /* 84 */ 84,
+ /* 85 */ 85, /* 86 */ 86, /* 87 */ 87, /* 88 */ 88, /* 89 */ 89,
+ /* 90 */ 90, /* 91 */ 91, /* 92 */ 124, /* 93 */ 93, /* 94 */ 94,
+ /* 95 */ 95, /* 96 */ 96, /* 97 */ 211, /* 98 */ 98, /* 99 */ 99,
+ /* 100 */ 100, /* 101 */ 208, /* 102 */ 102, /* 103 */ 103, /* 104 */ 108,
+ /* 105 */ 109, /* 106 */ 112, /* 107 */ 111, /* 108 */ 113, /* 109 */ 109,
+ /* 110 */ 97, /* 111 */ 98, /* 112 */ 99, /* 113 */ 100, /* 114 */ 102,
+ /* 115 */ 103, /* 116 */ 104, /* 117 */ 105, /* 118 */ 106, /* 119 */ 107,
+ /* 120 */ 120, /* 121 */ 121, /* 122 */ 122, /* 123 */ 123, /* 124 */ 124,
+ /* 125 */ 126, /* 126 */ 126, /* 127 */ 110, /* 128 */ 128, /* 129 */ 129,
+ /* 130 */ 130, /* 131 */ 131, /* 132 */ 133, /* 133 */ 115, /* 134 */ 116,
+ /* 135 */ 117, /* 136 */ 136, /* 137 */ 137, /* 138 */ 138, /* 139 */ 139,
+ /* 140 */ 140, /* 141 */ 141, /* 142 */ 142, /* 143 */ 143, /* 144 */ 144,
+ /* 145 */ 145, /* 146 */ 146, /* 147 */ 147, /* 148 */ 148, /* 149 */ 149,
+ /* 150 */ 150, /* 151 */ 151, /* 152 */ 152, /* 153 */ 153, /* 154 */ 154,
+ /* 155 */ 155, /* 156 */ 156, /* 157 */ 157, /* 158 */ 158, /* 159 */ 159,
+ /* 160 */ 160, /* 161 */ 161, /* 162 */ 162, /* 163 */ 163, /* 164 */ 164,
+ /* 165 */ 165, /* 166 */ 166, /* 167 */ 167, /* 168 */ 168, /* 169 */ 169,
+ /* 170 */ 170, /* 171 */ 171, /* 172 */ 172, /* 173 */ 173, /* 174 */ 174,
+ /* 175 */ 175, /* 176 */ 176, /* 177 */ 177, /* 178 */ 178, /* 179 */ 179,
+ /* 180 */ 180, /* 181 */ 181, /* 182 */ 182, /* 183 */ 183, /* 184 */ 184,
+ /* 185 */ 185, /* 186 */ 186, /* 187 */ 187, /* 188 */ 188, /* 189 */ 189,
+ /* 190 */ 190, /* 191 */ 118, /* 192 */ 119, /* 193 */ 120, /* 194 */ 121,
+ /* 195 */ 122, /* 196 */ 196, /* 197 */ 197, /* 198 */ 198, /* 199 */ 199,
+ /* 200 */ 200, /* 201 */ 201, /* 202 */ 202, /* 203 */ 93, /* 204 */ 125,
+ /* 205 */ 156, /* 206 */ 127, /* 207 */ 128, /* 208 */ 208, /* 209 */ 209,
+ /* 210 */ 210, /* 211 */ 211, /* 212 */ 212, /* 213 */ 213, /* 214 */ 214,
+ /* 215 */ 215, /* 216 */ 216, /* 217 */ 217, /* 218 */ 218, /* 219 */ 219,
+ /* 220 */ 220, /* 221 */ 221, /* 222 */ 222, /* 223 */ 223, /* 224 */ 224,
+ /* 225 */ 225, /* 226 */ 226, /* 227 */ 227, /* 228 */ 228, /* 229 */ 229,
+ /* 230 */ 230, /* 231 */ 231, /* 232 */ 232, /* 233 */ 233, /* 234 */ 234,
+ /* 235 */ 235, /* 236 */ 236, /* 237 */ 237, /* 238 */ 238, /* 239 */ 239,
+ /* 240 */ 240, /* 241 */ 241, /* 242 */ 242, /* 243 */ 243, /* 244 */ 244,
+ /* 245 */ 245, /* 246 */ 246, /* 247 */ 247, /* 248 */ 248, /* 249 */ 249,
+ /* 250 */ 250, /* 251 */ 251, /* 252 */ 252, /* 253 */ 253, /* 254 */ 254,
/* 255 */ 255
};
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
index 10616834e..b7a054913 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c
@@ -194,6 +194,13 @@ extern int nxagentMaxAllowedResets;
extern int nxagentFindClientResource(int, RESTYPE, void *);
+#ifdef NXAGENT_CLIPBOARD
+extern int nxagentPrimarySelection;
+extern int nxagentClipboardSelection;
+extern int nxagentMaxSelections;
+#endif
+
+extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*);
void
InitSelections()
@@ -206,23 +213,23 @@ InitSelections()
#ifdef NXAGENT_CLIPBOARD
{
Selection *newsels;
- newsels = (Selection *)malloc(2 * sizeof(Selection));
+ newsels = (Selection *)malloc(nxagentMaxSelections * sizeof(Selection));
if (!newsels)
return;
- NumCurrentSelections += 2;
+ NumCurrentSelections += nxagentMaxSelections;
CurrentSelections = newsels;
- CurrentSelections[0].selection = XA_PRIMARY;
- CurrentSelections[0].lastTimeChanged = ClientTimeToServerTime(0);
- CurrentSelections[0].window = screenInfo.screens[0]->root->drawable.id;
- CurrentSelections[0].pWin = NULL;
- CurrentSelections[0].client = NullClient;
-
- CurrentSelections[1].selection = MakeAtom("CLIPBOARD", 9, 1);
- CurrentSelections[1].lastTimeChanged = ClientTimeToServerTime(0);
- CurrentSelections[1].window = screenInfo.screens[0]->root->drawable.id;
- CurrentSelections[1].pWin = NULL;
- CurrentSelections[1].client = NullClient;
+ CurrentSelections[nxagentPrimarySelection].selection = XA_PRIMARY;
+ CurrentSelections[nxagentPrimarySelection].lastTimeChanged = ClientTimeToServerTime(0);
+ CurrentSelections[nxagentPrimarySelection].window = screenInfo.screens[0]->root->drawable.id;
+ CurrentSelections[nxagentPrimarySelection].pWin = NULL;
+ CurrentSelections[nxagentPrimarySelection].client = NullClient;
+
+ CurrentSelections[nxagentClipboardSelection].selection = MakeAtom("CLIPBOARD", 9, 1);
+ CurrentSelections[nxagentClipboardSelection].lastTimeChanged = ClientTimeToServerTime(0);
+ CurrentSelections[nxagentClipboardSelection].window = screenInfo.screens[0]->root->drawable.id;
+ CurrentSelections[nxagentClipboardSelection].pWin = NULL;
+ CurrentSelections[nxagentClipboardSelection].client = NullClient;
}
#endif
@@ -769,7 +776,6 @@ ProcOpenFont(register ClientPtr client)
fontReq[stuff->nbytes]=0;
if (strchr(fontReq,'*') || strchr(fontReq,'?'))
{
- extern int nxOpenFont(ClientPtr, XID, Mask, unsigned, char*);
#ifdef NXAGENT_FONTMATCH_DEBUG
fprintf(stderr, "Dispatch: ProcOpenFont try to find a common font with font pattern=%s\n",fontReq);
#endif
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index bfb208593..992a6674f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
@@ -88,13 +88,7 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c);
#include "Agent.h"
#include "Font.h"
-#ifndef NX_TRANS_SOCKET
-
-#define NX_TRANS_SOCKET
-
-#endif
-
-#ifdef NX_TRANS_SOCKET
+#ifdef NXAGENT_SERVER
#define NXFONTPATHLENGTH 1024
char _NXFontPath[NXFONTPATHLENGTH];
@@ -107,8 +101,6 @@ char _NXFontPath[NXFONTPATHLENGTH];
static const char *_NXGetFontPath(const char *path)
{
- const char *fontEnv;
-
/*
* Check the environment only once.
*/
@@ -118,13 +110,13 @@ static const char *_NXGetFontPath(const char *path)
return _NXFontPath;
}
- fontEnv = getenv("NX_FONT");
+ const char *fontEnv = getenv("NX_FONT");
if (fontEnv != NULL && *fontEnv != '\0')
{
if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH)
{
-#ifdef NX_TRANS_TEST
+#ifdef TEST
fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
#endif
goto _NXGetFontPathError;
@@ -132,7 +124,7 @@ static const char *_NXGetFontPath(const char *path)
snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv);
-#ifdef NX_TRANS_TEST
+#ifdef TEST
fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
#endif
@@ -143,7 +135,7 @@ _NXGetFontPathError:
snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path);
-#ifdef NX_TRANS_TEST
+#ifdef TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
#endif
@@ -1003,9 +995,9 @@ SetDefaultFontPath(char *path)
size = 0,
bad;
-#ifdef NX_TRANS_SOCKET
+#ifdef NXAGENT_SERVER
path = (char *) _NXGetFontPath(path);
-#endif /* NX_TRANS_SOCKET */
+#endif /* NXAGENT_SERVER */
start = path;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
index 78d74a0d5..031e62431 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c
@@ -147,6 +147,16 @@ extern Display *nxagentDisplay;
extern WindowPtr nxagentLastEnteredWindow;
+#ifdef VIEWPORT_FRAME
+extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr);
+#endif
+extern int nxagentShadowInit(ScreenPtr, WindowPtr);
+
+#ifdef NXAGENT_CLIPBOARD
+extern int nxagentSendNotify(xEvent*);
+#endif
+
+
void
ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab,
TimeStamp time, Bool autoGrab)
@@ -466,11 +476,6 @@ void
DefineInitialRootWindow(register WindowPtr win)
{
register ScreenPtr pScreen = win->drawable.pScreen;
- #ifdef VIEWPORT_FRAME
- extern void nxagentInitViewportFrame(ScreenPtr, WindowPtr);
- #endif
- extern int nxagentShadowInit(ScreenPtr, WindowPtr);
-
sprite.hotPhys.pScreen = pScreen;
sprite.hotPhys.x = pScreen->width / 2;
sprite.hotPhys.y = pScreen->height / 2;
@@ -537,7 +542,6 @@ ProcSendEvent(ClientPtr client)
if (stuff -> event.u.u.type == SelectionNotify)
{
- extern int nxagentSendNotify(xEvent*);
if (nxagentSendNotify(&stuff->event) == 1)
return Success;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
index 491af5b30..7ccc04bc8 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
@@ -81,6 +81,8 @@ void *nxagentMatchingFormats(PictFormatPtr pForm);
void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats);
+extern int nxagentPicturePrivateIndex;
+
PictFormatPtr
PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
{
@@ -303,8 +305,6 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
static PicturePtr createSourcePicture(void)
{
- extern int nxagentPicturePrivateIndex;
-
/*
* Compute size of entire PictureRect, plus privates.
*/
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
index 9d8a46c4f..9799d80d5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
@@ -93,6 +93,14 @@ nxagentWMStateRec;
#undef TEST
#undef DEBUG
+#ifdef NXAGENT_CLIPBOARD
+extern WindowPtr nxagentGetClipboardWindow(Atom, WindowPtr);
+#endif
+
+#ifdef NXAGENT_ARTSD
+extern Atom mcop_local_atom;
+#endif
+
int
ProcChangeProperty(ClientPtr client)
{
@@ -127,11 +135,7 @@ ProcChangeProperty(ClientPtr client)
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
#ifdef NXAGENT_CLIPBOARD
- {
- extern WindowPtr nxagentGetClipboardWindow(Atom, WindowPtr);
-
- pWin = nxagentGetClipboardWindow(stuff->property, NULL);
- }
+ pWin = nxagentGetClipboardWindow(stuff->property, NULL);
if (pWin == NULL)
#endif
@@ -168,7 +172,6 @@ ProcChangeProperty(ClientPtr client)
they are already set reflecting the server side settings.
Just return success.
*/
- extern Atom mcop_local_atom;
if (stuff->property == mcop_local_atom)
return client->noClientException;
}
@@ -549,14 +552,17 @@ ProcGetProperty(ClientPtr client)
#ifdef NXAGENT_CLIPBOARD
/* GetWindowProperty clipboard use only */
+/* FIXME: that's wrong, it is also called in Window.c and Events. */
+/* FIXME: should be moved to a different file, is not derived from
+ dix */
int
GetWindowProperty(pWin, property, longOffset, longLength, delete,
type, actualType, format, nItems, bytesAfter, propData )
WindowPtr pWin;
Atom property;
- long longOffset;
- long longLength;
- Bool delete;
+ long longOffset;
+ long longLength;
+ Bool delete;
Atom type;
Atom *actualType;
int *format;
@@ -569,24 +575,24 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if (!pWin)
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "%s: invalid window\n", __func__);
-#endif
+ #endif
return BadWindow;
}
if (!ValidAtom(property))
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "%s: invalid atom [%d]\n", __func__, property);
-#endif
+ #endif
return(BadAtom);
}
if ((type != AnyPropertyType) && !ValidAtom(type))
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "%s: invalid type [%d]\n", __func__, type);
-#endif
+ #endif
return(BadAtom);
}
@@ -604,14 +610,14 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if (!pProp)
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "%s: property not found [%d]\n", __func__, property);
-#endif
+ #endif
return (BadAtom);
}
/* If the request type and actual type don't match. Return the
- property information, but not the data. */
+ property information, but not the data. */
if (((type != pProp->type) &&
(type != AnyPropertyType))
@@ -624,20 +630,20 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
return(Success);
}
-/*
- * Return type, format, value to client
- */
+ /*
+ * Return type, format, value to client
+ */
n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
ind = longOffset << 2;
- /* If longOffset is invalid such that it causes "len" to
- be negative, it's a value error. */
+ /* If longOffset is invalid such that it causes "len" to
+ be negative, it's a value error. */
if (n < ind)
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "%s: negative property len\n", __func__);
-#endif
+ #endif
return BadValue;
}
@@ -650,9 +656,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if (delete && (*bytesAfter == 0))
{ /* send the event */
- xEvent event;
-
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {0};
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -663,7 +667,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
if (len)
{
- *propData = (unsigned char *)(pProp->data) + ind;
+ *propData = (unsigned char *)(pProp->data) + ind;
}
if (delete && (*bytesAfter == 0))
@@ -681,3 +685,50 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
return(Success);
}
#endif
+
+int
+ProcDeleteProperty(register ClientPtr client)
+{
+ WindowPtr pWin;
+ REQUEST(xDeletePropertyReq);
+ int result;
+
+ REQUEST_SIZE_MATCH(xDeletePropertyReq);
+ UpdateCurrentTime();
+ pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
+ DixWriteAccess);
+ if (!pWin)
+ return(BadWindow);
+ if (!ValidAtom(stuff->property))
+ {
+ client->errorValue = stuff->property;
+ return (BadAtom);
+ }
+
+#ifdef XCSECURITY
+ switch(SecurityCheckPropertyAccess(client, pWin, stuff->property,
+ DixDestroyAccess))
+ {
+ case SecurityErrorOperation:
+ client->errorValue = stuff->property;
+ return BadAtom;;
+ case SecurityIgnoreOperation:
+ return Success;
+ }
+#endif
+
+#ifdef NXAGENT_SERVER
+ /* prevent clients from deleting the NX_AGENT_VERSION property */
+ {
+ Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True);
+ if (stuff->property == prop)
+ return client->noClientException;
+ }
+#endif
+
+ result = DeleteProperty(pWin, stuff->property);
+ if (client->noClientException != Success)
+ return(client->noClientException);
+ else
+ return(result);
+}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
index 7456bd3a5..105d7048b 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
@@ -90,7 +90,7 @@ void miTrapezoidBounds (int ntrap, xTrapezoid *traps, BoxPtr box);
extern int nxagentCursorSaveRenderInfo(ScreenPtr, CursorPtr);
extern void nxagentCursorPostSaveRenderInfo(CursorPtr, ScreenPtr, PicturePtr, int, int);
-extern int nxagentRenderRealizeCursor(ScreenPtr, CursorPtr);
+extern void nxagentRenderRealizeCursor(ScreenPtr, CursorPtr);
extern int nxagentCreatePicture(PicturePtr, Mask);
extern void nxagentChangePicture(PicturePtr, Mask);
extern int nxagentChangePictureClip(PicturePtr, int, int, xRectangle *, int, int);
@@ -124,6 +124,8 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
xFixed *stops,
xRenderColor *colors);
+extern int nxagentAlphaEnabled;
+
/*
* The void pointer is actually a XGlyphElt8.
*/
@@ -184,7 +186,6 @@ ProcRenderQueryPictFormats (ClientPtr client)
int numScreens;
int numSubpixel;
- extern int nxagentAlphaEnabled;
/* REQUEST(xRenderQueryPictFormatsReq); */
REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq);
@@ -715,6 +716,9 @@ ProcRenderTrapezoids (ClientPtr client)
{
if (pFormat != NULL)
{
+ if (nxagentTrapezoidExtents && nxagentTrapezoidExtents != NullBox)
+ free(nxagentTrapezoidExtents);
+
nxagentTrapezoidExtents = (BoxPtr) malloc(sizeof(BoxRec));
miTrapezoidBounds (ntraps, (xTrapezoid *) &stuff[1], nxagentTrapezoidExtents);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
index 9a314391c..e1b55f561 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
@@ -81,6 +81,8 @@ extern void fbPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *pImage);
+extern int nxagentImageLength(int, int, int, int, int);
+
void
ShmExtensionInit(void)
{
@@ -228,7 +230,6 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
#ifdef NXAGENT_SERVER
int length;
char *newdata;
- extern int nxagentImageLength(int, int, int, int, int);
#ifdef TEST
fprintf(stderr, "fbShmPutImage: Called with drawable at [%p] GC at [%p] data at [%p].\n",
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
index 3dcb552e5..88e68e463 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c
@@ -106,7 +106,6 @@ Equipment Corporation.
#include "Screen.h"
#include "Options.h"
-#include "Atoms.h"
#include "Clipboard.h"
#include "Splash.h"
#include "Rootless.h"
@@ -204,8 +203,6 @@ InitRootWindow(WindowPtr pWin)
fprintf(stderr, "InitRootWindow: Mapping default windows.\n");
#endif
- nxagentInitAtoms(pWin);
-
nxagentInitClipboard(pWin);
nxagentMapDefaultWindows();
@@ -215,9 +212,7 @@ InitRootWindow(WindowPtr pWin)
#ifdef NXAGENT_ARTSD
{
char artsd_port[10];
- short int nPort;
- extern void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
- nPort = atoi(display) + 7000;
+ short int nPort = atoi(display) + 7000;
sprintf(artsd_port,"%d", nPort);
nxagentPropagateArtsdProperties(pScreen, artsd_port);
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.c b/nx-X11/programs/Xserver/hw/nxagent/Options.c
index 10e006a23..5c3a44c23 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Options.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Options.c
@@ -133,7 +133,6 @@ void nxagentInitOptions(void)
nxagentOptions.Xdmcp = 0;
- nxagentOptions.DisplayLatency = 0;
nxagentOptions.DisplayBuffer = UNDEFINED;
nxagentOptions.DisplayCoalescence = 0;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Options.h b/nx-X11/programs/Xserver/hw/nxagent/Options.h
index 88bb60e8f..02e1890b3 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Options.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Options.h
@@ -295,16 +295,6 @@ typedef struct _AgentOptions
int Xdmcp;
/*
- * Latency of the link. It is simply set
- * to a reference value, calculated based
- * on the time required to complete the
- * query of the agent's atoms at session
- * startup.
- */
-
- int DisplayLatency;
-
- /*
* Size of the Xlib display buffer. The
* default is set according to the link
* type.
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c
index e59ef97ab..93038eab6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixels.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixels.c
@@ -63,10 +63,6 @@ int nxagentUniquePixels(XImage *image)
int elements = PIXEL_ELEMENTS;
int unique = 0;
- int total;
- int ratio;
- int step;
-
int last = -1;
const char *next = image -> data;
@@ -80,9 +76,9 @@ int nxagentUniquePixels(XImage *image)
* Take at most 256 pixels from the image.
*/
- total = image -> width * image -> height;
+ int total = image -> width * image -> height;
- step = total / elements;
+ int step = total / elements;
if (step < PIXEL_STEP)
{
@@ -231,7 +227,7 @@ int nxagentUniquePixels(XImage *image)
#endif
}
- ratio = unique * 100 / elements;
+ int ratio = unique * 100 / elements;
#ifdef TEST
fprintf(stderr, "nxagentUniquePixels: Found [%d] unique pixels out of [%d] with ratio [%d%%].\n",
@@ -267,13 +263,11 @@ unsigned int Get16(const char *buffer, int order)
unsigned int Get24(const char *buffer, int order)
{
- int i;
-
const char *next = (order == MSBFirst ? buffer : buffer + 2);
unsigned int result = 0;
- for (i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++)
{
result <<= 8;
@@ -294,13 +288,11 @@ unsigned int Get24(const char *buffer, int order)
unsigned int Get32(const char *buffer, int order)
{
- int i;
-
const char *next = (order == MSBFirst ? buffer : buffer + 3);
unsigned int result = 0;
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
result <<= 8;
@@ -341,13 +333,11 @@ void Put16(unsigned int value, char *buffer, int order)
void Put24(unsigned int value, char *buffer, int order)
{
- int i;
-
if (order == MSBFirst)
{
buffer += 2;
- for (i = 3; i > 0; i--)
+ for (int i = 3; i > 0; i--)
{
*buffer-- = (unsigned char) (value & 0xff);
@@ -356,7 +346,7 @@ void Put24(unsigned int value, char *buffer, int order)
}
else
{
- for (i = 3; i > 0; i--)
+ for (int i = 3; i > 0; i--)
{
*buffer++ = (unsigned char) (value & 0xff);
@@ -367,13 +357,11 @@ void Put24(unsigned int value, char *buffer, int order)
void Put32(unsigned int value, char *buffer, int order)
{
- int i;
-
if (order == MSBFirst)
{
buffer += 3;
- for (i = 4; i > 0; i--)
+ for (int i = 4; i > 0; i--)
{
*buffer-- = (unsigned char) (value & 0xff);
@@ -382,7 +370,7 @@ void Put32(unsigned int value, char *buffer, int order)
}
else
{
- for (i = 4; i > 0; i--)
+ for (int i = 4; i > 0; i--)
{
*buffer++ = (unsigned char) (value & 0xff);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c
index ebc1fe287..6113a419a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Render.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c
@@ -114,12 +114,8 @@ XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pForm);
BoxPtr nxagentGlyphsExtents;
BoxPtr nxagentTrapezoidExtents;
-#ifdef DEBUG
-
static void nxagentPrintFormat(XRenderPictFormat *pFormat);
-#endif
-
/*
* From NXglyph.c.
*/
@@ -150,10 +146,6 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask);
int nxagentChangePictureClip(PicturePtr pPicture, int clipType, int nRects,
xRectangle *rects, int xOrigin, int yOrigin);
-void nxagentDestroyPictureClip(PicturePtr pPicture);
-
-void nxagentValidatePicture(PicturePtr pPicture, Mask mask);
-
void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height);
@@ -169,23 +161,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps);
-void nxagentRasterizeTrapezoid(PicturePtr pMask, xTrapezoid *trap,
- int x_off, int y_off);
-
-void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris);
-
-void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int npoint, xPointFixed *points);
-
void nxagentChangePicture(PicturePtr pPicture, Mask mask);
-void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int npoint, xPointFixed *points);
-
void nxagentReferenceGlyphSet(GlyphSetPtr glyphSet);
void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph);
@@ -222,8 +199,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
int bitsToClean;
int widthInBytes;
int height = gi -> height;
- register int i;
- int j;
#ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n",
@@ -248,14 +223,14 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
if (ImageByteOrder(dpy) == LSBFirst)
{
- for (i = 3; i < bytesToClean; i += 4)
+ for (int i = 3; i < bytesToClean; i += 4)
{
images[i] = 0x00;
}
}
else
{
- for (i = 0; i < bytesToClean; i += 4)
+ for (int i = 0; i < bytesToClean; i += 4)
{
images[i] = 0x00;
}
@@ -263,7 +238,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#ifdef DUMP
fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
- for (i = 0; i < bytesPerLine; i++)
+ for (int i = 0; i < bytesPerLine; i++)
{
fprintf(stderr, "[%d]", images[i]);
}
@@ -299,8 +274,9 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
ImageByteOrder(dpy), BitmapBitOrder(dpy));
#endif
- for (i = 1; i <= height; i++)
+ for (int i = 1; i <= height; i++)
{
+ int j;
if (ImageByteOrder(dpy) == BitmapBitOrder(dpy))
{
for (j = 1; j <= bytesToClean; j++)
@@ -350,7 +326,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
#ifdef DUMP
fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
- for (i = 0; i < bytesPerLine; i++)
+ for (int i = 0; i < bytesPerLine; i++)
{
fprintf(stderr, "[%d]", images[i]);
}
@@ -386,22 +362,22 @@ nxagentCleanGlyphs(xGlyphInfo *gi,
{
while (height > 0)
{
- i = bytesToClean;
+ int count = bytesToClean;
- while (i > 0)
+ while (count > 0)
{
- *(images + (bytesPerLine - i)) = 0;
+ *(images + (bytesPerLine - count)) = 0;
#ifdef DEBUG
fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n");
#endif
- i--;
+ count--;
}
#ifdef DUMP
fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean);
- for (i = 0; i < bytesPerLine; i++)
+ for (int i = 0; i < bytesPerLine; i++)
{
fprintf(stderr, "[%d]", images[i]);
}
@@ -458,12 +434,11 @@ void nxagentRenderExtensionInit(void)
XRenderQueryVersion(nxagentDisplay, &major_version, &minor_version);
/*
- * As the RENDER requests are passed directly to
- * the remote X server this can cause problems if
- * our RENDER version is different from the version
- * supported by the remote. For this reasos let's
- * advertise to our clients the lowest between the
- + two versions.
+ * As the RENDER requests are passed directly to the remote X
+ * server this can cause problems if our RENDER version is
+ * different from the version supported by the remote. For this
+ * reasons let's advertise to our clients the lowest between the
+ * two versions.
*/
if (major_version > SERVER_RENDER_MAJOR_VERSION ||
@@ -539,57 +514,41 @@ void nxagentCursorPostSaveRenderInfo(CursorPtr pCursor, ScreenPtr pScreen,
nxagentCursorYOffset(pCursor, pScreen) = y;
}
-int nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
{
- int cid;
- int x, y;
-
- PicturePtr pPicture;
-
- pPicture = nxagentCursorPicture(pCursor, pScreen);
+ PicturePtr pPicture = nxagentCursorPicture(pCursor, pScreen);
pPicture -> refcnt++;
- x = nxagentCursorXOffset(pCursor, pScreen);
- y = nxagentCursorYOffset(pCursor, pScreen);
-
- /*
- * Set the lossless trap so that the image functions
- * will not try to encode the image using a lossy
- * compression. Drawables should have a quality flag,
- * telling if they were originally encoded with a
- * lossy algorithm. This would allow us to skip the
- * synchronization if the cursor was already encoded
- * with the best quality.
- */
+ int x = nxagentCursorXOffset(pCursor, pScreen);
+ int y = nxagentCursorYOffset(pCursor, pScreen);
#ifdef TEST
- fprintf(stderr, "nxagentRenderRealizeCursor: Forcing the synchronization "
- "of the cursor.\n");
+ fprintf(stderr, "%s: Forcing the synchronization of the cursor.\n", __func__);
#endif
nxagentMarkCorruptedRegion(pPicture -> pDrawable, NULL);
+ /*
+ * Set the lossless trap so that the image functions will not try to
+ * encode the image using a lossy compression. Drawables should have
+ * a quality flag, telling if they were originally encoded with a
+ * lossy algorithm. This would allow us to skip the synchronization
+ * if the cursor was already encoded with the best quality.
+ */
+
nxagentLosslessTrap = 1;
nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
nxagentLosslessTrap = 0;
-
- cid = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y);
-
- nxagentCursor(pCursor, pScreen) = cid;
-
- return 1;
+ nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y);
}
int nxagentCreatePicture(PicturePtr pPicture, Mask mask)
{
XRenderPictureAttributes attributes;
unsigned long valuemask=0;
- XRenderPictFormat *pForm;
-
- Picture id;
#ifdef DEBUG
fprintf(stderr, "nxagentCreatePicture: Function called with picture at [%p] and mask [%ld].\n",
@@ -630,145 +589,113 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask)
if (mask & CPRepeat)
{
attributes.repeat = (Bool)pPicture -> repeat;
-
valuemask |= CPRepeat;
-
nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat);
}
if (mask & CPAlphaMap)
{
attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture;
-
valuemask |= CPAlphaMap;
-
nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map);
}
if (mask & CPAlphaXOrigin)
{
attributes.alpha_x_origin = pPicture -> alphaOrigin.x;
-
valuemask |= CPAlphaXOrigin;
-
nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin);
}
if (mask & CPAlphaYOrigin)
{
attributes.alpha_y_origin = pPicture -> alphaOrigin.y;
-
valuemask |= CPAlphaYOrigin;
-
nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin);
}
if (mask & CPClipXOrigin)
{
attributes.clip_x_origin = pPicture -> clipOrigin.x;
-
valuemask |= CPClipXOrigin;
-
nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin);
}
if (mask & CPClipYOrigin)
{
attributes.clip_y_origin = pPicture -> clipOrigin.y;
-
valuemask |= CPClipYOrigin;
-
nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin);
}
if (mask & CPGraphicsExposure)
{
attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures;
-
valuemask |= CPGraphicsExposure;
-
nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures);
}
if (mask & CPSubwindowMode)
{
attributes.subwindow_mode = pPicture -> subWindowMode;
-
valuemask |= CPSubwindowMode;
-
nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode);
}
if (mask & CPClipMask)
{
attributes.clip_mask = None;
-
valuemask |= CPClipMask;
-
nxagentSetPictureRemoteValue(pPicture, clip_mask, attributes.clip_mask);
}
if (mask & CPPolyEdge)
{
attributes.poly_edge = pPicture -> polyEdge;
-
valuemask |= CPPolyEdge;
-
nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge);
}
if (mask & CPPolyMode)
{
attributes.poly_mode = pPicture -> polyMode;
-
valuemask |= CPPolyMode;
-
nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode);
}
if (mask & CPDither)
{
attributes.dither = pPicture -> dither;
-
valuemask |= CPDither;
-
nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither);
}
if (mask & CPComponentAlpha)
{
attributes.component_alpha = pPicture -> componentAlpha;
-
valuemask |= CPComponentAlpha;
-
nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha);
}
- pForm = NULL;
+ XRenderPictFormat *pForm = NULL;
if (pPicture -> pFormat != NULL)
{
pForm = nxagentMatchingFormats(pPicture -> pFormat);
-
- #ifdef DEBUG
-
nxagentPrintFormat(pForm);
-
- #endif
}
if (pForm == NULL)
{
fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n");
-
return 0;
}
- id = XRenderCreatePicture(nxagentDisplay,
- nxagentDrawable(pPicture -> pDrawable),
- pForm,
- valuemask,
- &attributes);
+ Picture id = XRenderCreatePicture(nxagentDisplay,
+ nxagentDrawable(pPicture -> pDrawable),
+ pForm,
+ valuemask,
+ &attributes);
#ifdef TEST
fprintf(stderr, "nxagentCreatePicture: Created picture at [%p] with drawable at [%p].\n",
@@ -776,9 +703,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask)
#endif
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
nxagentPicturePriv(pPicture) -> picture = id;
@@ -801,9 +726,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask)
XRenderPictFormat *nxagentMatchingFormats(PictFormatPtr pFormat)
{
- int i;
-
- for (i = 0; i < nxagentNumFormats; i++)
+ for (int i = 0; i < nxagentNumFormats; i++)
{
if (pFormat -> type == nxagentArrayFormats[i].type &&
pFormat -> depth == nxagentArrayFormats[i].depth &&
@@ -843,9 +766,7 @@ void nxagentDestroyPicture(PicturePtr pPicture)
nxagentPicturePriv(pPicture) -> picture);
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
@@ -887,7 +808,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Apparently useless with QT.
*/
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
-
XRenderSetPictureClipRectangles(nxagentDisplay,
nxagentPicturePriv(pPicture) -> picture,
xOrigin,
@@ -898,13 +818,10 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_mask, 1);
-
#endif
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
break;
@@ -920,7 +837,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Apparently useless with QT.
*/
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
-
XRenderSetPictureClipRectangles(nxagentDisplay,
nxagentPicturePriv(pPicture) -> picture,
xOrigin,
@@ -931,13 +847,10 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_mask, 1);
-
#endif
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
break;
@@ -969,7 +882,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Apparently useless with QT.
*/
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
-
XRenderSetPictureClipRegion(nxagentDisplay,
nxagentPicturePriv(pPicture) -> picture,
reg);
@@ -977,13 +889,10 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentSetPictureRemoteValue(pPicture, clip_x_origin, xOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_y_origin, yOrigin);
nxagentSetPictureRemoteValue(pPicture, clip_mask, 1);
-
#endif
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
XDestroyRegion(reg);
@@ -1003,13 +912,6 @@ FIXME: Is this useful or just a waste of bandwidth?
return 1;
}
-void nxagentDestroyPictureClip(PicturePtr pPicture)
-{
- #ifdef DEBUG
- fprintf(stderr, "nxagentDestroyPictureClip: Nothing to do.\n");
- #endif
-}
-
void nxagentChangePicture(PicturePtr pPicture, Mask mask)
{
XRenderPictureAttributes attributes;
@@ -1028,11 +930,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPRepeat)
{
attributes.repeat = (Bool)pPicture -> repeat;
-
if (nxagentCheckPictureRemoteValue(pPicture, repeat, attributes.repeat) == 0)
{
valuemask |= CPRepeat;
-
nxagentSetPictureRemoteValue(pPicture, repeat, attributes.repeat);
}
}
@@ -1040,11 +940,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPAlphaMap)
{
attributes.alpha_map = nxagentPicturePriv(pPicture -> alphaMap) -> picture;
-
if (nxagentCheckPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map) == 0)
{
valuemask |= CPAlphaMap;
-
nxagentSetPictureRemoteValue(pPicture, alpha_map, attributes.alpha_map);
}
}
@@ -1052,11 +950,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPAlphaXOrigin)
{
attributes.alpha_x_origin = pPicture -> alphaOrigin.x;
-
if (nxagentCheckPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin) == 0)
{
valuemask |= CPAlphaXOrigin;
-
nxagentSetPictureRemoteValue(pPicture, alpha_x_origin, attributes.alpha_x_origin);
}
}
@@ -1064,11 +960,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPAlphaYOrigin)
{
attributes.alpha_y_origin = pPicture -> alphaOrigin.y;
-
if (nxagentCheckPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin) == 0)
{
valuemask |= CPAlphaYOrigin;
-
nxagentSetPictureRemoteValue(pPicture, alpha_y_origin, attributes.alpha_y_origin);
}
}
@@ -1076,11 +970,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPClipXOrigin)
{
attributes.clip_x_origin = pPicture -> clipOrigin.x;
-
if (nxagentCheckPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin) == 0)
{
valuemask |= CPClipXOrigin;
-
nxagentSetPictureRemoteValue(pPicture, clip_x_origin, attributes.clip_x_origin);
}
}
@@ -1088,11 +980,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPClipYOrigin)
{
attributes.clip_y_origin = pPicture -> clipOrigin.y;
-
if (nxagentCheckPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin) == 0)
{
valuemask |= CPClipYOrigin;
-
nxagentSetPictureRemoteValue(pPicture, clip_y_origin, attributes.clip_y_origin);
}
}
@@ -1100,11 +990,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPGraphicsExposure)
{
attributes.graphics_exposures = (Bool)pPicture -> graphicsExposures;
-
if (nxagentCheckPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures) == 0)
{
valuemask |= CPGraphicsExposure;
-
nxagentSetPictureRemoteValue(pPicture, graphics_exposures, attributes.graphics_exposures);
}
}
@@ -1112,31 +1000,25 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPSubwindowMode)
{
attributes.subwindow_mode = pPicture -> subWindowMode;
-
if (nxagentCheckPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode) == 0)
{
valuemask |= CPSubwindowMode;
-
nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode);
}
}
if (mask & CPClipMask)
{
- attributes.clip_mask = None;
-
/*
- * The nxagent doesn't know the remote id of
- * the picture's clip mask, so the clip_mask
- * value is used as a boolean: it is set to 0
- * when the clip_mask is None, otherwise it is
- * 1.
+ * The nxagent doesn't know the remote id of the picture's clip
+ * mask, so the clip_mask value is used as a boolean: it is set to
+ * 0 when the clip_mask is None, otherwise it is 1.
*/
+ attributes.clip_mask = None;
if (nxagentPicturePriv(pPicture) -> lastServerValues.clip_mask != 0)
{
valuemask |= CPClipMask;
-
nxagentSetPictureRemoteValue(pPicture, clip_mask, 0);
}
}
@@ -1144,11 +1026,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPPolyEdge)
{
attributes.poly_edge = pPicture -> polyEdge;
-
if (nxagentCheckPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge) == 0)
{
valuemask |= CPPolyEdge;
-
nxagentSetPictureRemoteValue(pPicture, poly_edge, attributes.poly_edge);
}
}
@@ -1156,11 +1036,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPPolyMode)
{
attributes.poly_mode = pPicture -> polyMode;
-
if (nxagentCheckPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode) == 0)
{
valuemask |= CPPolyMode;
-
nxagentSetPictureRemoteValue(pPicture, poly_mode, attributes.poly_mode);
}
}
@@ -1168,11 +1046,9 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPDither)
{
attributes.dither = pPicture -> dither;
-
if (nxagentCheckPictureRemoteValue(pPicture, dither, attributes.dither) == 0)
{
valuemask |= CPDither;
-
nxagentSetPictureRemoteValue(pPicture, dither, attributes.dither);
}
}
@@ -1180,17 +1056,14 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
if (mask & CPComponentAlpha)
{
attributes.component_alpha = pPicture -> componentAlpha;
-
if (nxagentCheckPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha) == 0)
{
valuemask |= CPComponentAlpha;
-
nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha);
}
}
#ifdef TEST
-
if (pPicture && pPicture->pDrawable && pPicture -> pDrawable -> type == DRAWABLE_PIXMAP)
{
fprintf(stderr, "nxagentChangePicture: %sPixmap [%p] Picture [%p][%p].\n",
@@ -1198,7 +1071,6 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask)
(void *) pPicture -> pDrawable, (void *) nxagentPicturePriv(pPicture) -> picture,
(void *) pPicture);
}
-
#endif
/*
FIXME: Is this useful or just a waste of bandwidth?
@@ -1208,7 +1080,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Without this the text is not rendered on GTK/Cairo.
*/
#ifndef SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS
-
if (valuemask != 0)
{
XRenderChangePicture(nxagentDisplay,
@@ -1223,20 +1094,10 @@ FIXME: Is this useful or just a waste of bandwidth?
(void *) pPicture);
}
#endif
-
- #endif
+ #endif /* SKIP_REALLY_ALL_LOUSY_RENDER_OPERATIONS */
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
- #endif
-}
-
-void nxagentValidatePicture(PicturePtr pPicture, Mask mask)
-{
- #ifdef DEBUG
- fprintf(stderr, "nxagentValidatePicture: Nothing to do.\n");
#endif
}
@@ -1244,15 +1105,12 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height)
{
- RegionPtr pDstRegion;
-
if (pSrc == NULL || pDst == NULL)
{
return;
}
#ifdef DEBUG
-
if (pSrc && pSrc -> pDrawable != NULL)
{
fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n",
@@ -1281,12 +1139,11 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
pMask -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window",
(void *) pMask -> pDrawable);
}
-
#endif
if (NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst))
{
- pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height);
+ RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height);
#ifdef TEST
if ((pDstRegion) && (pDst && pDst->pDrawable)) {
@@ -1306,11 +1163,10 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
}
/*
- * Synchronize the content of the shared memory pixmap
- * but pay attention at not doing this more than once.
- * We need to wait until the image data has been recom-
- * posed at the X server side or the operation will use
- * the wrong data.
+ * Synchronize the content of the shared memory pixmap but pay
+ * attention at not doing this more than once. We need to wait
+ * until the image data has been recom- posed at the X server side
+ * or the operation will use the wrong data.
*/
if (pSrc -> pDrawable != NULL)
@@ -1361,14 +1217,12 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
}
/*
- * The glyphs flag have to be propagated between
- * drawables, in order to avoid to encode the
- * text with lossy algorithms (like JPEG). Unlu-
- * ckily we have verified that if the render com-
- * posite propagates the flag, the deferring of
- * render trapezoids doesn't work well. Moreover,
- * by commenting out this code we have not noticed
- * any visual problems.
+ * The glyphs flag have to be propagated between drawables, in order
+ * to avoid to encode the text with lossy algorithms (like
+ * JPEG). Unlu- ckily we have verified that if the render com-
+ * posite propagates the flag, the deferring of render trapezoids
+ * doesn't work well. Moreover, by commenting out this code we have
+ * not noticed any visual problems.
*
* if (nxagentDrawableContainGlyphs(pSrc -> pDrawable) == 1)
* {
@@ -1391,9 +1245,7 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD
height);
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
@@ -1401,23 +1253,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists,
XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase)
{
- XRenderPictFormat *pForm;
-
BoxRec glyphBox;
XGlyphElt8 *elements;
- #ifdef SPLIT_GLYPH_LISTS
-
- GlyphPtr glyph;
-
- int x;
- int y;
- int i;
- int j;
-
- #endif /* #ifdef SPLIT_GLYPH_LISTS */
-
if (pSrc == NULL || pDst == NULL)
{
return;
@@ -1432,18 +1271,13 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
}
#endif
- pForm = NULL;
+ XRenderPictFormat *pForm = NULL;
if (maskFormat != NULL)
{
pForm = nxagentMatchingFormats(maskFormat);
-
- #ifdef DEBUG
-
nxagentPrintFormat(pForm);
- #endif
-
if (pForm == NULL)
{
return;
@@ -1458,10 +1292,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
glyphBox.y2 = nxagentGlyphsExtents -> y2;
/*
- * By extending the glyph extents the
- * visual aspect looks nicer because
- * the synchronized region is not glued
- * to the fonts.
+ * By extending the glyph extents the visual aspect looks nicer
+ * because the synchronized region is not glued to the fonts.
*/
if (glyphBox.x2 != glyphBox.x1)
@@ -1478,16 +1310,14 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
}
/*
- * If the destination window is hidden, the
- * operation can be prevented.
+ * If the destination window is hidden, the operation can be
+ * prevented.
*/
if (pDst -> pDrawable -> type == DRAWABLE_WINDOW)
{
- RegionPtr pRegion;
-
- pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1,
- glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1);
+ RegionPtr pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1,
+ glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1);
if (RegionNil(pRegion) == 1)
{
@@ -1505,9 +1335,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
}
/*
- * Need to synchronize the pixmaps involved in
- * the operation before rendering the glyphs
- * on the real X server.
+ * Need to synchronize the pixmaps involved in the operation before
+ * rendering the glyphs on the real X server.
*/
if (pSrc -> pDrawable != NULL &&
@@ -1522,11 +1351,9 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
#endif
/*
- * If the source drawable is going to be
- * repeated over the destination drawable
- * during the composite operation, we need
- * to synchronize the whole drawable to
- * avoid graphical problems.
+ * If the source drawable is going to be repeated over the
+ * destination drawable during the composite operation, we need to
+ * synchronize the whole drawable to avoid graphical problems.
*/
if (pSrc -> repeat == 1 || nxagentGlyphsExtents == NullBox)
@@ -1625,14 +1452,13 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
#endif
#ifdef SPLIT_GLYPH_LISTS
+ GlyphPtr glyph;
/*
- * We split glyphs lists here and recalculate
- * the offsets of each list to make them ab-
- * solute and not relatives to the prior list.
- * This way each time we call XRenderComposi-
- * teText it has to deal only with a list of
- * glyphs. This is done to further improve
+ * We split glyphs lists here and recalculate the offsets of each
+ * list to make them ab- solute and not relatives to the prior list.
+ * This way each time we call XRenderComposi- teText it has to deal
+ * only with a list of glyphs. This is done to further improve
* caching.
*/
@@ -1640,7 +1466,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
if (nlists > 1)
{
- for (j = 1; j < nlists; j++)
+ int x;
+ int y;
+
+ for (int j = 1; j < nlists; j++)
{
x = elements -> xOff;
y = elements -> yOff;
@@ -1650,7 +1479,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
j, nlists, elements -> xOff, elements -> yOff);
#endif
- for (i = 0; i < elements -> nchars; i++)
+ for (int i = 0; i < elements -> nchars; i++)
{
glyph = *glyphsBase++;
@@ -1682,7 +1511,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
{
case 1:
{
- for (j = 0; j < nlists; j++)
+ for (int j = 0; j < nlists; j++)
{
XRenderCompositeText8(nxagentDisplay,
op,
@@ -1698,12 +1527,11 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements++;
}
-
break;
}
case 2:
{
- for (j = 0; j < nlists; j++)
+ for (int j = 0; j < nlists; j++)
{
XRenderCompositeText16(nxagentDisplay,
op,
@@ -1719,12 +1547,11 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements++;
}
-
break;
}
case 4:
{
- for (j = 0; j < nlists; j++)
+ for (int j = 0; j < nlists; j++)
{
XRenderCompositeText32(nxagentDisplay,
op,
@@ -1740,7 +1567,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements++;
}
-
break;
}
default:
@@ -1749,7 +1575,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n",
sizeID);
#endif
-
break;
}
}
@@ -1773,7 +1598,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements -> yOff,
(XGlyphElt8*) elements,
nlists);
-
break;
}
case 2:
@@ -1789,7 +1613,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements -> yOff,
(XGlyphElt16*) elements,
nlists);
-
break;
}
case 4:
@@ -1805,7 +1628,6 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
elements -> yOff,
(XGlyphElt32*) elements,
nlists);
-
break;
}
default:
@@ -1814,19 +1636,15 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n",
sizeID);
#endif
-
break;
}
}
-
#endif /* #ifdef SPLIT_GLYPH_LISTS */
}
void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color,
int nRect, xRectangle *rects)
{
- RegionPtr rectRegion;
-
if (pDst == NULL)
{
return;
@@ -1851,7 +1669,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color,
(op == PictOpSrc ||
(op == PictOpOver && color -> alpha == 0xffff)))
{
- rectRegion = RegionFromRects(nRect, rects, CT_REGION);
+ RegionPtr rectRegion = RegionFromRects(nRect, rects, CT_REGION);
if (pDst -> clientClipType != CT_NONE)
{
@@ -1889,9 +1707,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color,
nRect);
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
@@ -1899,12 +1715,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps)
{
- XRenderPictFormat *pForm;
-
XTrapezoid *current = (XTrapezoid *) traps;
- RegionPtr pDstRegion;
-
int remaining = ntrap;
#ifdef TEST
@@ -1918,18 +1730,13 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
return;
}
- pForm = NULL;
+ XRenderPictFormat *pForm = NULL;
if (maskFormat != NULL)
{
pForm = nxagentMatchingFormats(maskFormat);
-
- #ifdef DEBUG
-
nxagentPrintFormat(pForm);
- #endif
-
if (pForm == NULL)
{
return;
@@ -1943,7 +1750,6 @@ FIXME: Is this useful or just a waste of bandwidth?
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
#ifdef TEST
-
if (pSrc->pDrawable) {
fprintf(stderr, "nxagentTrapezoids: Source is a [%s] of geometry [%d,%d].\n",
(pSrc -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"),
@@ -1955,7 +1761,6 @@ FIXME: Is this useful or just a waste of bandwidth?
(pDst -> pDrawable -> type == DRAWABLE_PIXMAP ? "pixmap" : "window"),
pDst -> pDrawable -> width, pDst -> pDrawable -> height);
}
-
#endif
/*
@@ -1994,11 +1799,11 @@ FIXME: Is this useful or just a waste of bandwidth?
if (NXAGENT_SHOULD_DEFER_TRAPEZOIDS(pDst -> pDrawable))
{
- pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL,
- nxagentTrapezoidExtents -> x1,
- nxagentTrapezoidExtents -> y1,
- nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1,
- nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1);
+ RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL,
+ nxagentTrapezoidExtents -> x1,
+ nxagentTrapezoidExtents -> y1,
+ nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1,
+ nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1);
#ifdef TEST
if (pDst && pDst->pDrawable) {
@@ -2043,298 +1848,46 @@ FIXME: Is this useful or just a waste of bandwidth?
nxagentSynchronizeBox(pDst -> pDrawable, nxagentTrapezoidExtents, NEVER_BREAK);
}
- XRenderCompositeTrapezoids(nxagentDisplay,
- op,
- nxagentPicturePriv(pSrc) -> picture,
- nxagentPicturePriv(pDst) -> picture,
- pForm,
- xSrc,
- ySrc,
- (XTrapezoid *) current,remaining);
-
-
- #endif
-
- #ifdef DEBUG
-
- XSync(nxagentDisplay, 0);
-
- #endif
-}
-
-void nxagentRasterizeTrapezoid(PicturePtr pMask, xTrapezoid *trap,
- int x_off, int y_off)
-{
- #ifdef DEBUG
- fprintf(stderr, "nxagentRasterizeTrapezoids: Nothing to do.\n");
- #endif
-}
-
-void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris)
-{
- XRenderPictFormat *pForm;
-
- #ifdef DEBUG
- fprintf(stderr, "nxagentTriangles: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n",
- (void *) pSrc, (void *) pDst, xSrc, ySrc, ntri);
- #endif
-
- if (pSrc == NULL || pDst == NULL)
- {
- return;
- }
-
- pForm = NULL;
-
- if (maskFormat != NULL)
- {
- pForm = nxagentMatchingFormats(maskFormat);
-
- #ifdef DEBUG
-
- nxagentPrintFormat(pForm);
-
- #endif
-
- if (pForm == NULL)
- {
- return;
- }
- }
-
- /*
- * If the X_RenderCompositeTriangles requests
- * increment the traffic, we can defer the
- * operation like nxagentTrapezoids() does.
- */
-
- if (pSrc -> pDrawable != NULL &&
- nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriangles: Going to synchronize the source drawable at [%p].\n",
- (void *) pSrc -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriangles: Going to synchronize the destination drawable at [%p].\n",
- (void *) pDst -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- XRenderCompositeTriangles(nxagentDisplay,
- op,
- nxagentPicturePriv(pSrc) -> picture,
- nxagentPicturePriv(pDst) -> picture,
- pForm,
- xSrc,
- ySrc,
- (XTriangle*)tris,
- ntri);
-
- #ifdef DEBUG
-
- XSync(nxagentDisplay, 0);
-
- #endif
-}
-
-void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int npoint, xPointFixed *points)
-{
- XRenderPictFormat *pForm;
-
- #ifdef DEBUG
- fprintf(stderr, "nxagentTriStrip: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n",
- (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint);
- #endif
-
- if (pSrc == NULL || pDst == NULL)
- {
- return;
- }
-
- pForm = NULL;
-
- if (maskFormat != NULL)
- {
- pForm = nxagentMatchingFormats(maskFormat);
-
- #ifdef DEBUG
-
- nxagentPrintFormat(pForm);
-
- #endif
-
- if (pForm == NULL)
- {
- return;
- }
- }
-
- /*
- * If the X_RenderCompositeTriStrip requests
- * increment the traffic, we can defer the
- * operation like nxagentTrapezoids() does.
- */
-
- if (pSrc -> pDrawable != NULL &&
- nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriStrip: Going to synchronize the source drawable at [%p].\n",
- (void *) pSrc -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriStrip: Going to synchronize the destination drawable at [%p].\n",
- (void *) pDst -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- XRenderCompositeTriStrip(nxagentDisplay,
- op,
- nxagentPicturePriv(pSrc) -> picture,
- nxagentPicturePriv(pDst) -> picture,
- pForm,
- xSrc,
- ySrc,
- (XPointFixed*)points,
- npoint);
-
- #ifdef DEBUG
-
- XSync(nxagentDisplay, 0);
-
- #endif
-}
+ XRenderCompositeTrapezoids(nxagentDisplay,
+ op,
+ nxagentPicturePriv(pSrc) -> picture,
+ nxagentPicturePriv(pDst) -> picture,
+ pForm,
+ xSrc,
+ ySrc,
+ (XTrapezoid *) current,remaining);
-void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
- int npoint, xPointFixed *points)
-{
- XRenderPictFormat *pForm;
- #ifdef DEBUG
- fprintf(stderr, "nxagentTriFan: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n",
- (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint);
#endif
- if (pSrc == NULL || pDst == NULL)
- {
- return;
- }
-
- pForm = NULL;
-
- if (maskFormat != NULL)
- {
- pForm = nxagentMatchingFormats(maskFormat);
-
- #ifdef DEBUG
-
- nxagentPrintFormat(pForm);
-
- #endif
-
- if (pForm == NULL)
- {
- return;
- }
- }
-
- /*
- * If the X_RenderCompositeTriFan requests
- * increment the traffic, we can defer the
- * operation like nxagentTrapezoids() does.
- */
-
- if (pSrc -> pDrawable != NULL &&
- nxagentDrawableStatus(pSrc -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriFan: Going to synchronize the source drawable at [%p].\n",
- (void *) pSrc -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pSrc -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized)
- {
- #ifdef TEST
- fprintf(stderr, "nxagentTriFan: Going to synchronize the destination drawable at [%p].\n",
- (void *) pDst -> pDrawable);
- #endif
-
- nxagentSynchronizeDrawable(pDst -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
- }
-
- XRenderCompositeTriFan(nxagentDisplay,
- op,
- nxagentPicturePriv(pSrc) -> picture,
- nxagentPicturePriv(pDst) -> picture,
- pForm,
- xSrc,
- ySrc,
- (XPointFixed*)points,
- npoint);
-
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
void nxagentQueryFormats(void)
{
- XRenderInfo *xri;
- XExtDisplayInfo *info = NULL;
- XRenderPictFormat *pformat=NULL;
-
- int i;
-
#ifdef DEBUG
fprintf(stderr, "nxagentQueryFormats.\n");
#endif
if (XRenderQueryFormats(nxagentDisplay))
{
- #ifdef DEBUG
+ int i;
+ #ifdef DEBUG
XSync(nxagentDisplay, 0);
-
#endif
- info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay);
+ XExtDisplayInfo *info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay);
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
- xri = (XRenderInfo *) info -> data;
+ XRenderInfo *xri = (XRenderInfo *) info -> data;
- pformat = xri -> format;
+ XRenderPictFormat *pformat = xri -> format;
for (i = 0; i < xri -> nformat; i++)
{
@@ -2354,7 +1907,6 @@ void nxagentQueryFormats(void)
}
#ifdef DEBUG
-
if (nxagentNumFormats == 0)
{
fprintf(stderr, "nxagentQueryFormats: Number of formats is [%d].\n",
@@ -2365,7 +1917,6 @@ void nxagentQueryFormats(void)
fprintf(stderr, "nxagentQueryFormats: Old number of formats is [%d]. New number of formats is [%d].\n",
nxagentNumFormats, i);
}
-
#endif
nxagentNumFormats = i;
@@ -2374,24 +1925,17 @@ void nxagentQueryFormats(void)
void nxagentCreateGlyphSet(GlyphSetPtr pGly)
{
- XRenderPictFormat *pForm;
-
#ifdef DEBUG
fprintf(stderr, "nxagentCreateGlyphSet: Glyphset at [%p].\n", (void *) pGly);
#endif
- pForm = NULL;
+ XRenderPictFormat *pForm = NULL;
if (pGly -> format != NULL)
{
pForm = nxagentMatchingFormats(pGly -> format);
-
- #ifdef DEBUG
-
nxagentPrintFormat(pForm);
- #endif
-
if (pForm == NULL)
{
return;
@@ -2401,9 +1945,7 @@ void nxagentCreateGlyphSet(GlyphSetPtr pGly)
pGly -> remoteID = XRenderCreateGlyphSet(nxagentDisplay, pForm);
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
@@ -2440,13 +1982,6 @@ void nxagentFreeGlyphSet(GlyphSetPtr glyphSet)
void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
int nglyphs, CARD8 *images, int sizeImages)
{
- GlyphRefPtr gr;
- Glyph *tempGids;
-
- int i;
-
- CARD8 *normalizedImages;
-
#ifdef DEBUG
fprintf(stderr, "nxagentAddGlyphs: Glyphset at [%p]. Number of glyphs [%d].\n",
(void *) glyphSet, nglyphs);
@@ -2468,12 +2003,12 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
* as synchronized.
*/
- tempGids = gids;
-
- for (i = 0; i < nglyphs; i++)
+ for (int i = 0; i < nglyphs; i++)
{
- if ((gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0)) &&
- gr -> glyph != DeletedGlyph)
+ Glyph *tempGids = gids;
+ GlyphRefPtr gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0);
+
+ if (gr && gr -> glyph != DeletedGlyph)
{
#ifdef DEBUG
fprintf(stderr, "nxagentAddGlyphs: Added Glyph [%p][%ld] to glyphset [%p].\n",
@@ -2486,7 +2021,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
tempGids++;
}
- normalizedImages = NULL;
+ CARD8 *normalizedImages = NULL;
if (sizeImages > 0)
{
@@ -2533,20 +2068,15 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
}
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
}
void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph)
{
GlyphRefPtr gr;
- CARD32 *tempGids;
Glyph gid;
- int i;
-
if (glyphSet -> remoteID == 0)
{
#ifdef TEST
@@ -2564,9 +2094,9 @@ void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph)
* they can be freed.
*/
- tempGids = gids;
+ CARD32 *tempGids = gids;
- for (i = 0; i < nglyph; i++)
+ for (int i = 0; i < nglyph; i++)
{
gid = (Glyph)*tempGids;
@@ -2594,7 +2124,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Apparently useless with QT.
*/
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
-
XRenderSetPictureTransform(nxagentDisplay,
nxagentPicturePriv(pPicture) -> picture,
(XTransform *) transform);
@@ -2629,7 +2158,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Apparently useless with QT.
*/
#ifndef SKIP_LOUSY_RENDER_OPERATIONS
-
XRenderSetPictureFilter(nxagentDisplay,
nxagentPicturePriv(pPicture) -> picture,
szFilter,
@@ -2644,7 +2172,6 @@ FIXME: Is this useful or just a waste of bandwidth?
Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
#ifdef RENDER
-
#ifdef DEBUG
fprintf(stderr, "nxagentPictureInit: Screen [%p].\n", (void *) pScreen);
#endif
@@ -2659,20 +2186,17 @@ Bool nxagentPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
nxagentPicturePrivateIndex = AllocatePicturePrivateIndex();
AllocatePicturePrivate(pScreen, nxagentPicturePrivateIndex, sizeof(nxagentPrivPictureRec));
-
#endif
return TRUE;
}
-#ifdef DEBUG
-
static void nxagentPrintFormat(XRenderPictFormat *pFormat)
{
+#ifdef DEBUG
if (pFormat == NULL)
{
fprintf(stderr, "nxagentPrintFormat: WARNING! null pointer passed to function.\n");
-
return;
}
@@ -2698,16 +2222,11 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat)
pFormat -> direct.blueMask,
pFormat -> direct.alpha,
pFormat -> direct.alphaMask);
-}
-
#endif
+}
Bool nxagentFillGlyphSet(GlyphSetPtr pGly)
{
- GlyphPtr glyph;
-
- int i;
-
#ifdef DEBUG
fprintf(stderr, "nxagentFillGlyphSet: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] "
"Format [%p] FDepth [%d] RemoteID [%ld].\n", (void *) pGly, pGly -> refcnt,
@@ -2721,9 +2240,9 @@ Bool nxagentFillGlyphSet(GlyphSetPtr pGly)
* corrupted the glyphs for each glyphset.
*/
- for (i = 0; i < pGly -> hash.hashSet -> size; i++)
+ for (int i = 0; i < pGly -> hash.hashSet -> size; i++)
{
- glyph = pGly -> hash.table[i].glyph;
+ GlyphPtr glyph = pGly -> hash.table[i].glyph;
if (glyph && (glyph != DeletedGlyph))
{
@@ -2738,12 +2257,11 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2)
{
GlyphSetPtr pGly = (GlyphSetPtr) p0;
- XRenderPictFormat *pForm = NULL;
-
- int i;
-
if (nxagentReconnectTrap == 0)
{
+ int i;
+ XRenderPictFormat *pForm = NULL;
+
#ifdef DEBUG
fprintf(stderr, "nxagentReconnectGlyphSet: GlyphSet at [%p].\n", (void *) pGly);
#endif
@@ -2770,9 +2288,7 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2)
}
#ifdef DEBUG
-
XSync(nxagentDisplay, 0);
-
#endif
nxagentFillGlyphSet(pGly);
@@ -2786,7 +2302,6 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2)
Bool nxagentReconnectAllGlyphSet(void *p)
{
Bool success = True;
- int i;
nxagentQueryFormats();
@@ -2794,7 +2309,7 @@ Bool nxagentReconnectAllGlyphSet(void *p)
fprintf(stderr, "nxagentReconnectAllGlyphSet\n");
#endif
- for (i = 0; (i < MAXCLIENTS) && (success); i++)
+ for (int i = 0; (i < MAXCLIENTS) && (success); i++)
{
if (clients[i])
{
@@ -2812,7 +2327,6 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2)
unsigned long mask = 0;
XRenderPictureAttributes attributes;
- XRenderPictFormat *pForm;
#ifdef TEST
fprintf(stderr, "nxagentReconnectPicture: Called with bool [%d] and picture at [%p].\n",
@@ -2835,9 +2349,8 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2)
if (pPicture -> repeat)
{
- mask |= CPRepeat;
-
attributes.repeat = (Bool) pPicture -> repeat;
+ mask |= CPRepeat;
}
if (pPicture -> alphaMap)
@@ -2855,48 +2368,36 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2)
attributes.alpha_map = nxagentPicture(pPicture -> alphaMap);
attributes.alpha_x_origin = pPicture -> alphaOrigin.x;
attributes.alpha_y_origin = pPicture -> alphaOrigin.y;
-
mask |= (CPAlphaMap | CPAlphaXOrigin | CPAlphaYOrigin);
}
if (pPicture -> graphicsExposures)
{
attributes.graphics_exposures = pPicture -> graphicsExposures;
-
mask |= CPGraphicsExposure;
}
attributes.subwindow_mode = pPicture -> subWindowMode;
-
mask |= CPSubwindowMode;
attributes.poly_edge = pPicture -> polyEdge;
-
mask |= CPPolyEdge;
attributes.poly_mode = pPicture -> polyMode;
-
mask |= CPPolyMode;
attributes.dither = pPicture -> dither;
-
mask |= CPDither;
attributes.component_alpha = pPicture -> componentAlpha;
-
mask |= CPComponentAlpha;
- pForm = NULL;
+ XRenderPictFormat *pForm = NULL;
if (pPicture -> pFormat)
{
pForm = nxagentMatchingFormats(pPicture -> pFormat);
-
- #ifdef DEBUG
-
nxagentPrintFormat(pForm);
-
- #endif
}
if (!pForm && pPicture->pSourcePict)
@@ -2927,9 +2428,7 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2)
&attributes);
#ifdef TEST
-
XSync(nxagentDisplay, 0);
-
#endif
#ifdef TEST
@@ -2953,27 +2452,24 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2)
Bool nxagentReconnectAllPicture(void *p)
{
- int i;
- Bool r;
+ Bool r = True;
#ifdef TEST
fprintf(stderr, "nxagentReconnectAllPicture: Going to recreate all pictures.\n");
#endif
- for (i = 0, r = True; i < MAXCLIENTS; i++)
+ for (int i = 0; i < MAXCLIENTS; i++)
{
if (clients[i])
{
FindClientResourcesByType(clients[i], PictureType, nxagentReconnectPicture, &r);
#ifdef WARNING
-
if (!r)
{
fprintf(stderr, "nxagentReconnectAllPicture: WARNING! Failed to recreate "
"picture for client [%d].\n", i);
}
-
#endif
}
}
@@ -3009,27 +2505,24 @@ void nxagentDisconnectPicture(void * p0, XID x1, void* p2)
Bool nxagentDisconnectAllPicture(void)
{
- int i;
- Bool r;
+ Bool r = True;
#ifdef DEBUG
fprintf(stderr, "nxagentDisconnectAllPicture.\n");
#endif
- for (i = 0, r = True; i < MAXCLIENTS; i++)
+ for (int i = 0; i < MAXCLIENTS; i++)
{
if (clients[i])
{
FindClientResourcesByType(clients[i], PictureType, nxagentDisconnectPicture, &r);
#ifdef WARNING
-
if (!r)
{
fprintf(stderr, "nxagentDisconnectAllPicture: WARNING! Failed to disconnect "
"picture for client [%d].\n", i);
}
-
#endif
}
}
@@ -3039,15 +2532,12 @@ Bool nxagentDisconnectAllPicture(void)
void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color)
{
- Picture id;
-
if (nxagentRenderEnable == False)
{
return;
}
#ifdef DEBUG
-
fprintf(stderr, "nxagentRenderCreateSolidFill: Got called.\n");
if (pPicture == NULL)
@@ -3059,13 +2549,12 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color)
{
fprintf(stderr, "nxagentRenderCreateSolidFill: WARNING! color pointer is NULL.\n");
}
-
#endif /* #ifdef DEBUG */
memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
sizeof(XRenderPictureAttributes_));
- id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color);
+ Picture id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color);
#ifdef DEBUG
XSync(nxagentDisplay, 0);
@@ -3083,17 +2572,12 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
xFixed *stops,
xRenderColor *colors)
{
- Picture id;
-
- XLinearGradient linearGradient;
-
if (nxagentRenderEnable == False)
{
return;
}
#ifdef DEBUG
-
fprintf(stderr, "nxagentRenderCreateLinearGradient: Got called.\n");
if (pPicture == NULL)
@@ -3120,20 +2604,21 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1,
{
fprintf(stderr, "nxagentRenderCreateLinearGradient: WARNING! colors pointer is NULL.\n");
}
-
#endif /* #ifdef DEBUG */
memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
sizeof(XRenderPictureAttributes_));
+ XLinearGradient linearGradient;
+
linearGradient.p1.x = (XFixed) p1 -> x;
linearGradient.p1.y = (XFixed) p1 -> y;
linearGradient.p2.x = (XFixed) p2 -> x;
linearGradient.p2.y = (XFixed) p2 -> y;
- id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient,
- (XFixed *) stops,
- (XRenderColor *) colors, nStops);
+ Picture id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient,
+ (XFixed *) stops,
+ (XRenderColor *) colors, nStops);
#ifdef DEBUG
XSync(nxagentDisplay, 0);
@@ -3154,17 +2639,12 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
xFixed *stops,
xRenderColor *colors)
{
- Picture id;
-
- XRadialGradient radialGradient;
-
if (nxagentRenderEnable == False)
{
return;
}
#ifdef DEBUG
-
fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n");
if (pPicture == NULL)
@@ -3191,12 +2671,13 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
{
fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n");
}
-
#endif /* #ifdef DEBUG */
memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
sizeof(XRenderPictureAttributes_));
+ XRadialGradient radialGradient;
+
radialGradient.inner.x = (XFixed) inner -> x;
radialGradient.inner.y = (XFixed) inner -> y;
radialGradient.inner.radius = (XFixed) innerRadius;
@@ -3204,7 +2685,7 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner,
radialGradient.outer.y = (XFixed) outer -> y;
radialGradient.outer.radius = (XFixed) outerRadius;
- id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient,
+ Picture id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient,
(XFixed *) stops,
(XRenderColor *) colors, nStops);
@@ -3225,17 +2706,12 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
xFixed *stops,
xRenderColor *colors)
{
- Picture id;
-
- XConicalGradient conicalGradient;
-
if (nxagentRenderEnable == False)
{
return;
}
#ifdef DEBUG
-
fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n");
if (pPicture == NULL)
@@ -3257,19 +2733,20 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
{
fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n");
}
-
#endif /* #ifdef DEBUG */
memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0,
sizeof(XRenderPictureAttributes_));
+ XConicalGradient conicalGradient;
+
conicalGradient.center.x = (XFixed) center -> x;
conicalGradient.center.y = (XFixed) center -> y;
conicalGradient.angle = (XFixed) angle;
- id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient,
- (XFixed *) stops,
- (XRenderColor *) colors, nStops);
+ Picture id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient,
+ (XFixed *) stops,
+ (XRenderColor *) colors, nStops);
#ifdef DEBUG
XSync(nxagentDisplay, 0);
@@ -3281,4 +2758,3 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture,
nxagentPicturePriv(pPicture) -> picture = id;
}
-
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.h b/nx-X11/programs/Xserver/hw/nxagent/Render.h
index 1c56ec16b..70fefe42d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Render.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Render.h
@@ -104,7 +104,7 @@ while (0)
void nxagentRenderExtensionInit(void);
Bool nxagentPictureInit(ScreenPtr, PictFormatPtr, int);
-int nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
+void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi,
int nglyphs, CARD8 *images, int sizeImages);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 8285d464d..c8449675a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -141,6 +141,10 @@ extern Bool useXpmIcon;
extern Bool nxagentReportWindowIds;
+#ifdef NXAGENT_TIMESTAMP
+extern unsigned long startTime;
+#endif
+
Window nxagentDefaultWindows[MAXSCREENS];
Window nxagentInputWindows[MAXSCREENS];
Window nxagentScreenSaverWindows[MAXSCREENS];
@@ -210,8 +214,14 @@ RegionRec nxagentShadowUpdateRegion;
#define NXAGENT_DEFAULT_DPI 96
#define NXAGENT_AUTO_DPI -1
+#ifndef NXAGENT_RANDR_MODE_PREFIX
+#define NXAGENT_RANDR_MODE_PREFIX nx_
+#endif
+
extern Bool nxagentAutoDPI;
+extern char *nxagentKeyboard;
+
/*
* From randr/randr.c. This was originally static
* but we need it here.
@@ -268,8 +278,6 @@ void nxagentSetScreenInfo(ScreenInfo *screenInfo)
void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
{
- int i;
-
/*
* Formats are created with no care of which are supported
* on the real display. Creating only formats supported
@@ -279,7 +287,7 @@ void nxagentSetPixmapFormats(ScreenInfo *screenInfo)
screenInfo -> numPixmapFormats = nxagentNumPixmapFormats;
- for (i = 0; i < nxagentNumPixmapFormats; i++)
+ for (int i = 0; i < nxagentNumPixmapFormats; i++)
{
screenInfo -> formats[i].depth = nxagentPixmapFormats[i].depth;
screenInfo -> formats[i].bitsPerPixel = nxagentPixmapFormats[i].bits_per_pixel;
@@ -399,7 +407,7 @@ FIXME: We'll check for ReparentNotify and LeaveNotify events after
if (!XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e))
break;
#ifdef TEST
- fprintf(stderr, "%d: swallowing LeaveNotify event\m", __func__);
+ fprintf(stderr, "%s: swallowing LeaveNotify event\n", __func__);
#endif
}
@@ -651,14 +659,12 @@ FIXME: Do we need to check the key grab if the
Bool nxagentCreateScreenResources(ScreenPtr pScreen)
{
- Bool ret;
-
CreatePixmapProcPtr savedCreatePixmap = pScreen->CreatePixmap;
ModifyPixmapHeaderProcPtr savedModifyPixmapHeader = pScreen->ModifyPixmapHeader;
pScreen->CreatePixmap = fbCreatePixmap;
pScreen->ModifyPixmapHeader = miModifyPixmapHeader;
- ret = miCreateScreenResources(pScreen);
+ Bool ret = miCreateScreenResources(pScreen);
pScreen->CreatePixmap = savedCreatePixmap;
pScreen->ModifyPixmapHeader = savedModifyPixmapHeader;
@@ -688,7 +694,6 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
{
int error = Success;
VisualID visual = 0;
- int i;
XID xid;
if (nxagentOption(Rootless))
@@ -696,7 +701,7 @@ void nxagentInitViewportFrame(ScreenPtr pScreen, WindowPtr pRootWin)
return;
}
- for (i = 0; i < pScreen -> numDepths; i++)
+ for (int i = 0; i < pScreen -> numDepths; i++)
{
if (pScreen -> allowedDepths[i].depth == pRootWin -> drawable.depth)
{
@@ -896,7 +901,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
VisualPtr visuals;
DepthPtr depths;
int numVisuals, numDepths;
- int i, j, depthIndex;
+ int depthIndex;
unsigned long valuemask;
XSetWindowAttributes attributes;
XWindowAttributes gattributes;
@@ -1198,14 +1203,8 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
}
#ifdef NXAGENT_TIMESTAMP
-
- {
- extern unsigned long startTime;
-
- fprintf(stderr, "Screen: going to open screen, time is [%d] milliseconds.\n",
- GetTimeInMillis() - startTime);
- }
-
+ fprintf(stderr, "Screen: going to open screen, time is [%d] milliseconds.\n",
+ GetTimeInMillis() - startTime);
#endif
/*
@@ -1226,7 +1225,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec));
- for (i = 0; i < nxagentNumDepths; i++)
+ for (int i = 0; i < nxagentNumDepths; i++)
{
depths[i].depth = nxagentDepths[i];
depths[i].numVids = 0;
@@ -1247,7 +1246,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec));
- for (i = 0; i < nxagentNumVisuals; i++)
+ for (int i = 0; i < nxagentNumVisuals; i++)
{
visuals[numVisuals].vid = FakeClientID(0);
visuals[numVisuals].class = nxagentVisuals[i].class;
@@ -1276,20 +1275,19 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
}
else
{
+ int j;
for (j = 0; j < numVisuals; j++)
{
- if (visuals[numVisuals].class == visuals[j].class &&
- visuals[numVisuals].bitsPerRGBValue ==
- visuals[j].bitsPerRGBValue &&
- visuals[numVisuals].ColormapEntries ==
- visuals[j].ColormapEntries &&
- visuals[numVisuals].nplanes == visuals[j].nplanes &&
- visuals[numVisuals].redMask == visuals[j].redMask &&
- visuals[numVisuals].greenMask == visuals[j].greenMask &&
- visuals[numVisuals].blueMask == visuals[j].blueMask &&
- visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
- visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
- visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
+ if (visuals[numVisuals].class == visuals[j].class &&
+ visuals[numVisuals].bitsPerRGBValue == visuals[j].bitsPerRGBValue &&
+ visuals[numVisuals].ColormapEntries == visuals[j].ColormapEntries &&
+ visuals[numVisuals].nplanes == visuals[j].nplanes &&
+ visuals[numVisuals].redMask == visuals[j].redMask &&
+ visuals[numVisuals].greenMask == visuals[j].greenMask &&
+ visuals[numVisuals].blueMask == visuals[j].blueMask &&
+ visuals[numVisuals].offsetRed == visuals[j].offsetRed &&
+ visuals[numVisuals].offsetGreen == visuals[j].offsetGreen &&
+ visuals[numVisuals].offsetBlue == visuals[j].offsetBlue)
break;
}
@@ -1305,7 +1303,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
(long unsigned int)visuals[numVisuals].vid);
#endif
- for (j = 0; j < numDepths; j++)
+ for (int j = 0; j < numDepths; j++)
{
if (depths[j].depth == nxagentVisuals[i].depth)
{
@@ -1466,7 +1464,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
* pixmap for each depth.
*/
- for (i = 0; i < numDepths; i++)
+ for (int i = 0; i < numDepths; i++)
{
nxagentMarkPlaceholderNotLoaded(i);
}
@@ -2133,13 +2131,8 @@ N/A
XSelectInput(nxagentDisplay, DefaultRootWindow(nxagentDisplay), StructureNotifyMask);
#ifdef NXAGENT_TIMESTAMP
-
- {
- extern unsigned long startTime;
-
- fprintf(stderr, "Screen: open screen finished, time is [%d] milliseconds.\n",
- GetTimeInMillis() - startTime);
- }
+ fprintf(stderr, "Screen: open screen finished, time is [%d] milliseconds.\n",
+ GetTimeInMillis() - startTime);
#endif
@@ -2586,9 +2579,7 @@ void nxagentShadowSetWindowOptions(void)
int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
{
- int i;
char *layout = NULL;
- extern char *nxagentKeyboard;
XlibGC gc;
XGCValues value;
@@ -2609,6 +2600,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
if (nxagentKeyboard != NULL)
{
+ int i;
for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++);
if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0)
@@ -2645,7 +2637,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
if (NXShadowCreate(nxagentDisplay, layout, nxagentShadowDisplayName,
(void *) &nxagentShadowDisplay) != 1)
{
- #ifdef PANIIC
+ #ifdef PANIC
fprintf(stderr, "nxagentShadowInit: PANIC! Failed to initialize shadow "
"display [%s].\n", nxagentShadowDisplayName);
#endif
@@ -2714,37 +2706,31 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
case StaticGray:
{
className = "StaticGray";
-
break;
}
case StaticColor:
{
className = "StaticColor";
-
break;
}
case PseudoColor:
{
className = "PseudoColor";
-
break;
}
case DirectColor:
{
className = "DirectColor";
-
break;
}
case GrayScale:
{
className = "GrayScale";
-
break;
}
default:
{
className = "";
-
break;
}
}
@@ -3222,29 +3208,14 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr
void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
unsigned int lineMaster, char **buffer)
{
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- unsigned short color16 = 0;
- unsigned char * icBuffer;
- unsigned char * cBuffer = NULL;
unsigned char * tBuffer = (unsigned char *) *buffer;
- unsigned int lineShadow;
- unsigned int length;
- unsigned int c;
- unsigned int pad;
- unsigned int color32 = 0;
- unsigned long redMask;
- unsigned long greenMask;
- unsigned long blueMask;
- Visual *pVisual;
- length = nxagentImageLength(width, height, ZPixmap, 0, nxagentShadowDepth);
+ unsigned int length = nxagentImageLength(width, height, ZPixmap, 0, nxagentShadowDepth);
- cBuffer = malloc(length);
- icBuffer = cBuffer;
+ unsigned char *cBuffer = malloc(length);
+ unsigned char *icBuffer = cBuffer;
- pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth);
+ Visual *pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth);
if (pVisual == NULL)
{
@@ -3260,9 +3231,9 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask);
#endif
- redMask = nxagentShadowDisplay -> screens[0].root_visual[0].red_mask;
- greenMask = nxagentShadowDisplay -> screens[0].root_visual[0].green_mask;
- blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask;
+ unsigned long redMask = nxagentShadowDisplay -> screens[0].root_visual[0].red_mask;
+ unsigned long greenMask = nxagentShadowDisplay -> screens[0].root_visual[0].green_mask;
+ unsigned long blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask;
#ifdef TEST
fprintf(stderr, "nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].\n",
@@ -3276,7 +3247,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
*/
case 16:
{
- pad = lineMaster - nxagentBppMaster * width;
+ unsigned int pad = lineMaster - nxagentBppMaster * width;
#ifdef TEST
fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineMaster, width, pad);
@@ -3284,8 +3255,13 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
while (height > 0)
{
- for (c = 0; c < width ; c++)
+ for (unsigned int c = 0; c < width ; c++)
{
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ unsigned short color16;
+
if (imageByteOrder == LSBFirst)
{
color16 = *tBuffer++;
@@ -3353,9 +3329,8 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
*/
case 24:
{
- lineShadow = PixmapBytePad(width, nxagentShadowDepth);
-
- pad = lineShadow - nxagentBppShadow * width;
+ unsigned int lineShadow = PixmapBytePad(width, nxagentShadowDepth);
+ unsigned int pad = lineShadow - nxagentBppShadow * width;
#ifdef TEST
fprintf(stderr, "nxagentCorrectDepthShadow: line [%d] width[%d] pad[%d].\n", lineShadow, width, pad);
@@ -3363,8 +3338,11 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
while (height > 0)
{
- for (c = 0; c < width; c++)
+ for (unsigned int c = 0; c < width; c++)
{
+ unsigned short color16;
+ unsigned int color32;
+
if (imageByteOrder == LSBFirst)
{
color32 = *tBuffer++;
@@ -3446,7 +3424,6 @@ void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port)
unsigned char *pszReturnData = NULL;
int iReturn;
- int i,in;
char tchar[] = " ";
/*
FIXME: The port information is not used at the moment and produces a
@@ -3479,8 +3456,6 @@ FIXME: The port information is not used at the moment and produces a
if (iReturn == Success && atomReturnType != None &&
ulReturnItems > 0 && pszReturnData != NULL)
{
- char *local_buf;
-
#ifdef TEST
fprintf(stderr, "nxagentPropagateArtsdProperties: Got [%ld] elements of format [%d] with [%ld] bytes left.\n",
ulReturnItems, iReturnFormat, ulReturnBytesLeft);
@@ -3495,12 +3470,13 @@ FIXME: The port information is not used at the moment and produces a
#endif
- local_buf = (char *) malloc(strlen((char*)pszReturnData) + 100);
+ char *local_buf = (char *) malloc(strlen((char*)pszReturnData) + 100);
if (local_buf)
{
memset(local_buf, 0, strlen((char *) pszReturnData));
+ int i, in;
for (i = 0, in = 0; pszReturnData[i] != '\0'; i++)
{
local_buf[in]=pszReturnData[i];
@@ -3611,9 +3587,7 @@ FIXME: The port information is not used at the moment and produces a
Bool nxagentReconnectScreen(void *p0)
{
- CARD16 w, h;
PixmapPtr pPixmap = (PixmapPtr)nxagentDefaultScreen->devPrivate;
- Mask mask;
#if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG)
fprintf(stderr, "nxagentReconnectScreen\n");
@@ -3634,8 +3608,8 @@ Bool nxagentReconnectScreen(void *p0)
pPixmap,
nxagentPixmap( pPixmap ));
#endif
- w = 16;
- h = 16;
+ CARD16 w = 16;
+ CARD16 h = 16;
(*nxagentDefaultScreen->QueryBestSize)(StippleShape, &w, &h, nxagentDefaultScreen);
if (!(nxagentPixmap(nxagentDefaultScreen->PixmapPerDepth[0]) =
XCreatePixmap(nxagentDisplay,
@@ -3644,7 +3618,7 @@ Bool nxagentReconnectScreen(void *p0)
h,
1)));
- mask = nxagentGetDefaultEventMask();
+ Mask mask = nxagentGetDefaultEventMask();
mask |= NXAGENT_KEYBOARD_EVENT_MASK | NXAGENT_POINTER_EVENT_MASK;
nxagentSetDefaultEventMask(mask);
XSelectInput(nxagentDisplay, nxagentDefaultWindows[0], mask);
@@ -3663,8 +3637,8 @@ Bool nxagentReconnectScreen(void *p0)
/* intersect two rectangles */
Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
- int bx1, int by1, unsigned int bw, unsigned int bh,
- int *x, int *y, unsigned int *w, unsigned int *h)
+ int bx1, int by1, unsigned int bw, unsigned int bh,
+ int *x, int *y, unsigned int *w, unsigned int *h)
{
int tx1, ty1, tx2, ty2, ix, iy;
unsigned int iw, ih;
@@ -3721,9 +3695,9 @@ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah,
/* intersect two rectangles, return aw/ah for w/h if resulting
rectangle is (partly) outside of bounding box */
Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
- int bx1, int by1, unsigned int bw, unsigned int bh,
- int bbx1, int bby1, int bbx2, int bby2,
- int *x, int *y, unsigned int *w, unsigned int *h)
+ int bx1, int by1, unsigned int bw, unsigned int bh,
+ int bbx1, int bby1, int bbx2, int bby2,
+ int *x, int *y, unsigned int *w, unsigned int *h)
{
#ifdef DEBUG
@@ -3877,9 +3851,6 @@ void nxagentAdjustCustomMode(ScreenPtr pScreen)
int nxagentChangeScreenConfig(int screen, int width, int height)
{
- ScreenPtr pScreen;
- int r;
-
#ifdef DEBUG
fprintf(stderr, "nxagentChangeScreenConfig: called for screen [%d], width [%d] height [%d]\n", screen, width, height);
#endif
@@ -3923,13 +3894,13 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
return 0;
}
- pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen;
+ ScreenPtr pScreen = screenInfo.screens[screen] -> root -> drawable.pScreen;
#ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %d x %d\n", width, height);
#endif
- r = nxagentResizeScreen(pScreen, width, height, 0, 0);
+ int r = nxagentResizeScreen(pScreen, width, height, 0, 0);
if (r != 0)
{
@@ -3958,21 +3929,25 @@ int nxagentChangeScreenConfig(int screen, int width, int height)
/*
Destroy an output after removing it from any crtc that might reference it
*/
-void nxagentDropOutput(RROutputPtr o) {
+void nxagentDropOutput(RROutputPtr o)
+{
RRCrtcPtr c = o->crtc;
- if (c) {
- for (int i = 0; i < c->numOutputs; i++) {
- if (c->outputs[i] == o) {
-#ifdef DEBUG
- fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c);
-#endif
- RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL);
+ if (c)
+ {
+ for (int i = 0; i < c->numOutputs; i++)
+ {
+ if (c->outputs[i] == o)
+ {
+ #ifdef DEBUG
+ fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c);
+ #endif
+ RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL);
}
}
}
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "nxagentDropOutput: destroying output [%s]\n", o->name);
-#endif
+ #endif
RROutputDestroy(o);
}
@@ -3993,23 +3968,22 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
int i;
int number = 0;
- XineramaScreenInfo *screeninfo = NULL;
+ XineramaScreenInfo *screeninfo = XineramaQueryScreens(nxagentDisplay, &number);
- screeninfo = XineramaQueryScreens(nxagentDisplay, &number);
if (number)
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() returned [%d] screens:\n", number);
for (int i=0; i < number; i++) {
- fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height);
+ fprintf(stderr, "nxagentAdjustRandRXinerama: screen_number [%d] x_org [%d] y_org [%d] width [%d] height [%d]\n", screeninfo[i].screen_number, screeninfo[i].x_org, screeninfo[i].y_org, screeninfo[i].width, screeninfo[i].height);
}
-#endif
+ #endif
}
else
{
-#ifdef DEBUG
+ #ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: XineramaQueryScreens() failed - continuing without Xinerama\n");
-#endif
+ #endif
}
/*
@@ -4020,7 +3994,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
* behaved. The single PanoramiX/Xinerama extension however
* disables xinerama if only one screen exists.
*/
- if (number == 0) {
+ if (number == 0)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: faking xinerama\n");
#endif
@@ -4028,8 +4003,9 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free(screeninfo);
- if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) {
- return FALSE;
+ if (!(screeninfo = malloc(sizeof(XineramaScreenInfo))))
+ {
+ return FALSE;
}
/* fake a xinerama screeninfo that covers the whole screen */
@@ -4066,7 +4042,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
bbx2 = bby2 = 0;
bbx1 = bby1 = INT_MAX;
- for (i = 0; i < number; i++) {
+ for (i = 0; i < number; i++)
+ {
bbx2 = max(bbx2, screeninfo[i].x_org + screeninfo[i].width);
bby2 = max(bby2, screeninfo[i].y_org + screeninfo[i].height);
bbx1 = min(bbx1, screeninfo[i].x_org);
@@ -4083,8 +4060,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* adjust the number of CRTCs to match the number of reported
xinerama screens on the real server */
- while (number != pScrPriv->numCrtcs) {
- if (number < pScrPriv->numCrtcs) {
+ while (number != pScrPriv->numCrtcs)
+ {
+ if (number < pScrPriv->numCrtcs)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying crtc\n");
#endif
@@ -4108,12 +4087,14 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* set gamma. Currently the only reason for doing this is
preventing the xrandr command from complaining about missing
gamma. */
- for (i = 0; i < pScrPriv->numCrtcs; i++) {
- if (pScrPriv->crtcs[i]->gammaSize == 0) {
- CARD16 gamma = 0;
- RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1);
- RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma);
- RRCrtcGammaNotify(pScrPriv->crtcs[i]);
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ {
+ if (pScrPriv->crtcs[i]->gammaSize == 0)
+ {
+ CARD16 gamma = 0;
+ RRCrtcGammaSetSize(pScrPriv->crtcs[i], 1);
+ RRCrtcGammaSet(pScrPriv->crtcs[i], &gamma, &gamma, &gamma);
+ RRCrtcGammaNotify(pScrPriv->crtcs[i]);
}
}
@@ -4127,13 +4108,15 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
nxagentDropOutput(pScrPriv->outputs[i]);
/* add and init outputs */
- for (i = 0; i < number; i++) {
- if (i >= pScrPriv->numOutputs) {
+ for (i = 0; i < number; i++)
+ {
+ if (i >= pScrPriv->numOutputs)
+ {
sprintf(name, "NX%d", i+1);
output = RROutputCreate(pScreen, name, strlen(name), NULL);
- /* will be done later
- RROutputSetConnection(output, RR_Disconnected);
- */
+ /* will be done later
+ RROutputSetConnection(output, RR_Disconnected);
+ */
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: created new output [%s]\n", name);
#endif
@@ -4154,7 +4137,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
RROutputSetPhysicalSize(output, 0, 0);
}
- for (i = 0; i < pScrPriv->numOutputs; i++) {
+ for (i = 0; i < pScrPriv->numOutputs; i++)
+ {
Bool disable_output = FALSE;
RRModePtr mymode = NULL, prevmode = NULL;
int new_x = 0;
@@ -4174,23 +4158,27 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
width, height,
screeninfo[i].x_org, screeninfo[i].y_org,
screeninfo[i].width, screeninfo[i].height,
- bbx1, bby1, bbx2, bby2,
+ bbx1, bby1, bbx2, bby2,
&new_x, &new_y, &new_w, &new_h);
#endif
/* save previous mode */
prevmode = pScrPriv->crtcs[i]->mode;
#ifdef DEBUG
- if (prevmode) {
+ if (prevmode)
+ {
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: prevmode [%s] ([%p]) refcnt [%d]\n", i, pScrPriv->outputs[i]->name, prevmode->name, (void *)prevmode, prevmode->refcnt);
- } else {
+ }
+ else
+ {
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no prevmode\n", i, pScrPriv->outputs[i]->name);
}
#endif
RROutputSetCrtcs(pScrPriv->outputs[i], &(pScrPriv->crtcs[i]), 1);
- if (disable_output) {
+ if (disable_output)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: no (valid) intersection - disconnecting\n", i, pScrPriv->outputs[i]->name);
#endif
@@ -4205,7 +4193,8 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
* mode of the output's crtc. This also leads to xinerama not
* showing the disconnected head anymore.
*/
- if (prevmode) {
+ if (prevmode)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: removing mode from output [%d] name [%s]\n", i, pScrPriv->outputs[i]->name);
#endif
@@ -4227,15 +4216,11 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
memset(&modeInfo, '\0', sizeof(modeInfo));
-#ifdef NXAGENT_RANDR_MODE_PREFIX
/* avoid collisions with pre-existing default modes by using a
separate namespace. If we'd simply use XxY we could not
distinguish between pre-existing modes which should stay
and our own modes that should be removed after use. */
- sprintf(name, "nx_%dx%d", new_w, new_h);
-#else
- sprintf(name, "%dx%d", new_w, new_h);
-#endif
+ sprintf(name, "%s%dx%d", QUOTE(NXAGENT_RANDR_MODE_PREFIX), new_w, new_h);
modeInfo.width = new_w;
modeInfo.height = new_h;
@@ -4247,27 +4232,29 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
mymode = RRModeGet(&modeInfo, name);
#ifdef DEBUG
- if (mymode) {
+ if (mymode)
+ {
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] ([%p]) created/received, refcnt [%d]\n", i, pScrPriv->outputs[i]->name, name, (void *) mymode, mymode->refcnt);
}
else
{
- /* FIXME: what is the correct behaviour in this case? */
+ /* FIXME: what is the correct behaviour in this case? */
fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]: mode [%s] creation failed!\n", i, pScrPriv->outputs[i]->name, name);
}
#endif
- if (prevmode && mymode == prevmode) {
+ if (prevmode && mymode == prevmode)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: mymode [%s] ([%p]) == prevmode [%s] ([%p])\n", mymode->name, (void *) mymode, prevmode->name, (void *)prevmode);
#endif
/* if they are the same RRModeGet() has increased the
- refcnt by 1. We decrease it again by calling only
- RRModeDestroy() and forget about prevmode */
- RRModeDestroy(mymode);
+ refcnt by 1. We decrease it again by calling only
+ RRModeDestroy() and forget about prevmode */
+ RRModeDestroy(mymode);
}
else
- {
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: setting mode [%s] ([%p]) refcnt [%d] for output %d [%s]\n", mymode->name, (void *) mymode, mymode->refcnt, i, pScrPriv->outputs[i]->name);
#endif
@@ -4283,11 +4270,12 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
/* throw away the mode if otherwise unused. We do not need it
anymore. We call FreeResource() to ensure the system will not
try to free it again on shutdown */
- if (prevmode && prevmode->refcnt == 1) {
+ if (prevmode && prevmode->refcnt == 1)
+ {
#ifdef DEBUG
fprintf(stderr, "nxagentAdjustRandRXinerama: destroying prevmode [%s]\n", prevmode->name);
#endif
- FreeResource(prevmode->mode.id, 0);
+ FreeResource(prevmode->mode.id, 0);
}
RROutputChanged(pScrPriv->outputs[i], TRUE);
@@ -4298,19 +4286,20 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
SAFE_free(screeninfo);
#ifdef DEBUG
- for (i = 0; i < pScrPriv->numCrtcs; i++) {
+ for (i = 0; i < pScrPriv->numCrtcs; i++)
+ {
RRModePtr mode = pScrPriv->crtcs[i]->mode;
if (mode) {
- fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->mode->name, (void *)pScrPriv->crtcs[i]->mode, pScrPriv->crtcs[i]->mode->refcnt, pScrPriv->crtcs[i]->numOutputs);
+ fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has mode [%s] ([%p]), refcnt [%d] and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->mode->name, (void *)pScrPriv->crtcs[i]->mode, pScrPriv->crtcs[i]->mode->refcnt, pScrPriv->crtcs[i]->numOutputs);
}
else
{
- fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has no mode and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->numOutputs);
+ fprintf(stderr, "nxagentAdjustRandRXinerama: crtc [%d] ([%p]) has no mode and [%d] outputs:\n", i, (void *) pScrPriv->crtcs[i], pScrPriv->crtcs[i]->numOutputs);
}
if (pScrPriv->crtcs[i]->numOutputs > 0)
for (int j=0; j < pScrPriv->crtcs[i]->numOutputs; j++)
- fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc);
+ fprintf(stderr, "nxagentAdjustRandRXinerama: output [%d] name [%s]->crtc=[%p]\n", j, pScrPriv->crtcs[i]->outputs[j]->name, (void *)pScrPriv->crtcs[i]->outputs[j]->crtc);
}
#endif
@@ -4338,24 +4327,13 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin)
{
- PixmapPtr pVirtualPixmap;
- nxagentPrivPixmapPtr pPrivPixmap;
- XlibGC gc;
- XGCValues values;
- int i;
- int xSrc, ySrc, xDst, yDst, w, h;
- int nRects;
- int size;
- BoxPtr pBox;
- XRectangle *pRects;
- BoxRec extents;
- RegionRec cleanRegion;
+ XGCValues values = {0};
miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage;
- pVirtualPixmap = nxagentVirtualPixmap(pPixmap);
+ PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap);
- pPrivPixmap = nxagentPixmapPriv(pPixmap);
+ nxagentPrivPixmapPtr pPrivPixmap = nxagentPixmapPriv(pPixmap);
pPrivPixmap -> isBackingPixmap = 1;
@@ -4364,13 +4342,14 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
values.subwindow_mode = IncludeInferiors;
- gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
+ XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
/*
* Initialize to the corrupted region.
* Coordinates are relative to the window.
*/
+ RegionRec cleanRegion;
RegionInit(&cleanRegion, NullBox, 1);
RegionCopy(&cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin));
@@ -4395,12 +4374,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
RegionSubtract(&cleanRegion, prgnSave, &cleanRegion);
- nRects = RegionNumRects(&cleanRegion);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
- pBox = RegionRects(&cleanRegion);
+ int nRects = RegionNumRects(&cleanRegion);
+ int size = nRects * sizeof(XRectangle);
+ XRectangle *pRects = (XRectangle *) malloc(size);
+ BoxPtr pBox = RegionRects(&cleanRegion);
- for (i = nRects; i-- > 0;)
+ for (int i = nRects; i-- > 0;)
{
pRects[i].x = pBox[i].x1;
pRects[i].y = pBox[i].y1;
@@ -4412,12 +4391,12 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
SAFE_free(pRects);
- extents = *RegionExtents(&cleanRegion);
+ BoxRec extents = *RegionExtents(&cleanRegion);
RegionUninit(&cleanRegion);
- xDst = extents.x1;
- yDst = extents.y1;
+ int xDst = extents.x1;
+ int yDst = extents.y1;
/*
* Left here the wrong solution. The window could be not
@@ -4430,11 +4409,11 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
* ySrc = yDst + yorg - pWin -> drawable.y;
*/
- xSrc = xDst + pBackingStore -> x;
- ySrc = yDst + pBackingStore -> y;
+ int xSrc = xDst + pBackingStore -> x;
+ int ySrc = yDst + pBackingStore -> y;
- w = extents.x2 - extents.x1;
- h = extents.y2 - extents.y1;
+ int w = extents.x2 - extents.x1;
+ int h = extents.y2 - extents.y1;
XCopyArea(nxagentDisplay, nxagentWindow(pWin), nxagentPixmap(pPixmap), gc,
xSrc, ySrc, w, h, xDst, yDst);
@@ -4455,18 +4434,7 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
int yorg, WindowPtr pWin)
{
- PixmapPtr pVirtualPixmap;
- RegionPtr clipRegion;
- XlibGC gc;
- XGCValues values;
- int i;
- int xSrc, ySrc, xDst, yDst, w, h;
- int nRects;
- int size;
- BoxPtr pBox;
- XRectangle *pRects;
- BoxRec extents;
- miBSWindowPtr pBackingStore;
+ XGCValues values = {0};
/*
* Limit the area to restore to the
@@ -4476,16 +4444,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
RegionIntersect(prgnRestore, prgnRestore,
&pWin -> drawable.pScreen -> root -> winSize);
- pBackingStore = (miBSWindowPtr) pWin -> backStorage;
+ miBSWindowPtr pBackingStore = (miBSWindowPtr) pWin -> backStorage;
- pVirtualPixmap = nxagentVirtualPixmap(pPixmap);
+ PixmapPtr pVirtualPixmap = nxagentVirtualPixmap(pPixmap);
fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore),
RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0);
values.subwindow_mode = ClipByChildren;
- gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
+ XlibGC gc = XCreateGC(nxagentDisplay, nxagentWindow(screenInfo.screens[0]->root), GCSubwindowMode, &values);
/*
* Translate the reference point to the origin of the window.
@@ -4495,7 +4463,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
-pWin -> drawable.x - pWin -> borderWidth,
-pWin -> drawable.y - pWin -> borderWidth);
- clipRegion = prgnRestore;
+ RegionPtr clipRegion = prgnRestore;
if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized)
{
@@ -4541,12 +4509,12 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
RegionSubtract(clipRegion, prgnRestore, clipRegion);
}
- nRects = RegionNumRects(clipRegion);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
- pBox = RegionRects(clipRegion);
+ int nRects = RegionNumRects(clipRegion);
+ int size = nRects * sizeof(XRectangle);
+ XRectangle *pRects = (XRectangle *) malloc(size);
+ BoxPtr pBox = RegionRects(clipRegion);
- for (i = nRects; i-- > 0;)
+ for (int i = nRects; i-- > 0;)
{
pRects[i].x = pBox[i].x1;
pRects[i].y = pBox[i].y1;
@@ -4558,16 +4526,16 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
SAFE_free(pRects);
- extents = *RegionExtents(clipRegion);
+ BoxRec extents = *RegionExtents(clipRegion);
- xDst = extents.x1;
- yDst = extents.y1;
+ int xDst = extents.x1;
+ int yDst = extents.y1;
- xSrc = xDst - xorg + pWin -> drawable.x;
- ySrc = yDst - yorg + pWin -> drawable.y;
+ int xSrc = xDst - xorg + pWin -> drawable.x;
+ int ySrc = yDst - yorg + pWin -> drawable.y;
- w = extents.x2 - extents.x1;
- h = extents.y2 - extents.y1;
+ int w = extents.x2 - extents.x1;
+ int h = extents.y2 - extents.y1;
nxagentFlushConfigureWindow();
@@ -4661,11 +4629,7 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr pScreen, int maxwidth, int maxheig
void nxagentShadowAdaptToRatio(void)
{
- ScreenPtr pScreen;
- RegionRec region;
- BoxRec box;
-
- pScreen = screenInfo.screens[0];
+ ScreenPtr pScreen = screenInfo.screens[0];
nxagentShadowSetRatio(nxagentOption(Width) * 1.0 / nxagentShadowWidth,
nxagentOption(Height) * 1.0 / nxagentShadowHeight);
@@ -4676,10 +4640,14 @@ void nxagentShadowAdaptToRatio(void)
WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = nxagentShadowPixmapPtr -> drawable.width;
- box.y2 = nxagentShadowPixmapPtr -> drawable.height;
+ BoxRec box = {
+ .x1 = 0,
+ .y1 = 0,
+ .x2 = nxagentShadowPixmapPtr -> drawable.width,
+ .y2 = nxagentShadowPixmapPtr -> drawable.height
+ };
+
+ RegionRec region;
RegionInit(&region, &box, 1);
@@ -4690,11 +4658,9 @@ void nxagentShadowAdaptToRatio(void)
void nxagentPrintGeometry(void)
{
- int i;
-
- for (i = 0; i < screenInfo.numScreens; i++)
+ for (int i = 0; i < screenInfo.numScreens; i++)
{
- if (nxagentPrintGeometryFlags && (1 << i))
+ if (nxagentPrintGeometryFlags & (1 << i))
{
fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d] "
"fullscreen [%d].\n", i, screenInfo.screens[i] -> width,
@@ -4711,21 +4677,15 @@ void nxagentPrintGeometry(void)
void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
{
static int init = 1;
- static Display *shadow;
- static Window win;
-
- XlibGC gc;
- XGCValues value;
- XImage *image;
- WindowPtr pWin = screenInfo.screens[0]->root;
- unsigned int format;
- int depth, pixmapWidth, pixmapHeight, length;
- char *data;
+ static Display *shadow = NULL;
+ static Window win = 0;
- depth = pPixmap -> drawable.depth;
- pixmapWidth = pPixmap -> drawable.width;
- pixmapHeight = pPixmap -> drawable.height;
- format = (depth == 1) ? XYPixmap : ZPixmap;
+ int depth = pPixmap -> drawable.depth;
+ /*
+ int pixmapWidth = pPixmap -> drawable.width;
+ int pixmapHeight = pPixmap -> drawable.height;
+ */
+ unsigned int format = (depth == 1) ? XYPixmap : ZPixmap;
if (init)
{
@@ -4770,9 +4730,9 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
XRaiseWindow(nxagentDisplay, win);
}
- length = nxagentImageLength(width, height, format, 0, depth);
-
- if ((data = malloc(length)) == NULL)
+ int length = nxagentImageLength(width, height, format, 0, depth);
+ char *data = malloc(length);
+ if (data == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentShowPixmap: malloc failed.\n");
@@ -4783,12 +4743,12 @@ void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
/*
FIXME
- image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y,
- width, height, AllPlanes, format);
+ XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), x, y,
+ width, height, AllPlanes, format);
*/
- image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0,
- width, height, AllPlanes, format);
+ XImage *image = XGetImage(nxagentDisplay, RootWindow(nxagentDisplay, 0), 0, 0,
+ width, height, AllPlanes, format);
if (image == NULL)
{
@@ -4806,13 +4766,15 @@ FIXME
memcpy(image -> data, data, length);
- value.foreground = 0xffffff;
- value.background = 0x000000;
- value.plane_mask = 0xffffff;
- value.fill_style = FillSolid;
+ XGCValues value = {
+ .foreground = 0xffffff,
+ .background = 0x000000,
+ .plane_mask = 0xffffff,
+ .fill_style = FillSolid
+ };
- gc = XCreateGC(shadow, win, GCBackground |
- GCForeground | GCFillStyle | GCPlaneMask, &value);
+ XlibGC gc = XCreateGC(shadow, win, GCBackground |
+ GCForeground | GCFillStyle | GCPlaneMask, &value);
XSync(shadow, 0);
@@ -4843,26 +4805,19 @@ FIXME
void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc, int width,
int height, int xDst, int yDst)
{
- Display *shadow;
-
- XlibGC gc;
- XGCValues value;
- XImage *image;
- unsigned int format;
- int depth, pixmapWidth, pixmapHeight, length;
- char *data = NULL;
- Visual *pVisual;
+ Display *shadow = nxagentDisplay;
- depth = pPixmap -> drawable.depth;
- pixmapWidth = pPixmap -> drawable.width;
- pixmapHeight = pPixmap -> drawable.height;
- format = (depth == 1) ? XYPixmap : ZPixmap;
-
- shadow = nxagentDisplay;
+ int depth = pPixmap -> drawable.depth;
+ /*
+ int pixmapWidth = pPixmap -> drawable.width;
+ int pixmapHeight = pPixmap -> drawable.height;
+ */
+ unsigned int format = (depth == 1) ? XYPixmap : ZPixmap;
- length = nxagentImageLength(width, height, format, 0, depth);
+ int length = nxagentImageLength(width, height, format, 0, depth);
+ char *data = malloc(length);
- if ((data = malloc(length)) == NULL)
+ if (data == NULL)
{
#ifdef WARNING
fprintf(stderr, "nxagentFbRestoreArea: malloc failed.\n");
@@ -4870,11 +4825,13 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
return;
}
+
+ XImage *image = NULL;
/*
- image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc,
- width, height, AllPlanes, format);
+ XImage *image = XGetImage(nxagentDisplay, nxagentPixmap(pPixmap), xSrc, ySrc,
+ width, height, AllPlanes, format);
*/
-
+
if (image == NULL)
{
#ifdef WARNING
@@ -4892,7 +4849,7 @@ void nxagentFbRestoreArea(PixmapPtr pPixmap, WindowPtr pWin, int xSrc, int ySrc,
/*
FIXME
*/
- pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth);
+ Visual *pVisual = nxagentImageVisual((DrawablePtr) pPixmap, depth);
if (pVisual == NULL)
{
@@ -4914,14 +4871,16 @@ FIXME
fprintf(stderr, "nxagentFbRestoreArea: Cleaning %d bytes of image.\n", length);
- value.foreground = 0xffffff;
- value.background = 0x000000;
- value.plane_mask = 0xffffff;
- value.fill_style = FillSolid;
- value.function = GXcopy;
+ XGCValues value = {
+ .foreground = 0xffffff,
+ .background = 0x000000,
+ .plane_mask = 0xffffff,
+ .fill_style = FillSolid,
+ .function = GXcopy
+ };
- gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground |
- GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value);
+ XlibGC gc = XCreateGC(shadow, nxagentWindow(screenInfo.screens[0]->root), GCBackground |
+ GCForeground | GCFillStyle | GCPlaneMask | GCFunction, &value);
NXCleanImage(image);
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
index 2f93105ef..bf5d8894e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h
@@ -136,6 +136,8 @@ void nxagentSetWMNormalHintsMaxsize(ScreenPtr, int, int);
void nxagentShadowSetRatio(float, float);
+void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port);
+
/*
* Change window settings to adapt to a ratio.
*/
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c
index d58d70bfd..33005e86d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Split.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c
@@ -792,11 +792,11 @@ void nxagentWaitDrawable(DrawablePtr pDrawable)
else
{
fprintf(stderr, "nxagentWaitDrawable: Drawable at [%p] can now be restarted.\n",
- (void *) pDrawable);
+ (void *) pDrawable);
}
#endif
-
+
return;
}
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Trap.h b/nx-X11/programs/Xserver/hw/nxagent/Trap.h
index 3d4bd11f9..cd1e79ff7 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Trap.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Trap.h
@@ -27,91 +27,68 @@
#define __Traps_H__
/*
- * Set if we are dispatching a render
- * extension request. Used to avoid
+ * Set if we are dispatching a render extension request. Used to avoid
* reentrancy in GC operations.
*/
-
extern int nxagentGCTrap;
/*
- * Set if we are enqueing an internal
- * operation, CreateWindow and Reparent-
- * Window. Used to remove any screen operation.
+ * Set if we are enqueing an internal operation, CreateWindow and
+ * Reparent- Window. Used to remove any screen operation.
*/
-
extern int nxagentScreenTrap;
/*
- * Set if we are executing a GC operation
- * only on the X side. Used to avoid
- * reentrancy in FB layer.
+ * Set if we are executing a GC operation only on the X side. Used to
+ * avoid reentrancy in FB layer.
*/
-
extern int nxagentFBTrap;
/*
- * Set if we are dispatching a shared
- * memory extension request.
+ * Set if we are dispatching a shared memory extension request.
*/
-
extern int nxagentShmTrap;
/*
- * Set if a shared pixmap operation is
- * requested by the client.
+ * Set if a shared pixmap operation is requested by the client.
*/
-
extern int nxagentShmPixmapTrap;
/*
- * Set if we are dispatching a XVideo
- * extension request.
+ * Set if we are dispatching a XVideo extension request.
*/
-
extern int nxagentXvTrap;
/*
- * Set if we are dispatching a GLX
- * extension request.
+ * Set if we are dispatching a GLX extension request.
*/
-
extern int nxagentGlxTrap;
/*
* Set while we are resuming the session.
*/
-
extern int nxagentReconnectTrap;
/*
- * Set if we need to realize a drawable
- * by using a lossless encoding.
+ * Set if we need to realize a drawable by using a lossless encoding.
*/
-
extern int nxagentLosslessTrap;
/*
- * Set to force the synchronization of
- * a drawable.
+ * Set to force the synchronization of a drawable.
*/
-
extern int nxagentSplitTrap;
/*
- * Set to avoid CapsLock synchronization
- * problems when CapsLock is the first
- * key to be pressed in the session.
+ * Set to avoid CapsLock synchronization problems when CapsLock is the
+ * first key to be pressed in the session.
*/
-
extern int nxagentXkbCapsTrap;
/*
- * Set to avoid NumLock synchronization
- * problems when NumLock is the first
- * key to be pressed in the session.
+ * Set to avoid NumLock synchronization problems when NumLock is the
+ * first key to be pressed in the session.
*/
-
extern int nxagentXkbNumTrap;
/*
@@ -119,7 +96,6 @@ extern int nxagentXkbNumTrap;
* the real X server. This is used to avoid endless loops if callbacks
* would trigger another event by the real X server
*/
-
extern int nxagentExternalClipboardEventTrap;
#endif /* __Trap_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Utils.h b/nx-X11/programs/Xserver/hw/nxagent/Utils.h
index 0aebda839..e61a79144 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Utils.h
+++ b/nx-X11/programs/Xserver/hw/nxagent/Utils.h
@@ -47,4 +47,8 @@ static inline const char * validateString(const char *str) {
#define SAFE_XFree(what) do {if (what) {XFree(what); what = NULL;}} while (0)
#define SAFE_free(what) do {free(what); what = NULL;} while (0)
+/* some helper macros to produce a quoted string from other macros */
+#define QUOTEEXP(str) #str
+#define QUOTE(str) QUOTEEXP(str)
+
#endif /* __Utils_H__ */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c
index 80e9bef3b..fadf6ffb1 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Window.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c
@@ -2671,7 +2671,7 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2)
nxagentCursorPriv(pCursor, pScreen) &&
nxagentCursor(pCursor, pScreen))
{
- #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG_disabled
+ #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG
char msg[] = "nxagentDisconnectWindow:";
nxagentPrintCursorInfo(pCursor, msg);
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index 4d81ff927..f9b06de2d 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -271,6 +271,14 @@ long Memory_fail = 0;
char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
#endif
+#ifdef NXAGENT_SERVER
+extern const char *nxagentProgName;
+#endif
+
+#ifdef NX_TRANS_SOCKET
+extern char **environ;
+#endif
+
extern char dispatchExceptionAtReset;
/* Extension enable/disable in miinitext.c */
@@ -554,7 +562,6 @@ AdjustWaitForDelay (void * waitTime, unsigned long newdelay)
void UseMsg(void)
{
#ifdef NXAGENT_SERVER
- extern const char *nxagentProgName;
ErrorF("Usage: %s [<options>] [:<display>]\n\n", nxagentProgName);
#else
ErrorF("use: X [:<display>] [option]\n");
@@ -1731,8 +1738,6 @@ Popen(char *command, char *type)
#else
- extern char **environ;
-
char **ep = environ;
ep = environ;
diff --git a/nx-X11/programs/Xserver/randr/Imakefile b/nx-X11/programs/Xserver/randr/Imakefile
index 6c5c89450..2e21efe4c 100644
--- a/nx-X11/programs/Xserver/randr/Imakefile
+++ b/nx-X11/programs/Xserver/randr/Imakefile
@@ -62,7 +62,7 @@
$(NULL)
INCLUDES = -I../include -I../mi \
- -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
+ -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I../render \
`pkg-config --cflags-only-I pixman-1`
diff --git a/nx-X11/programs/Xserver/render/Imakefile b/nx-X11/programs/Xserver/render/Imakefile
index 235acf1ed..2246a35d9 100644
--- a/nx-X11/programs/Xserver/render/Imakefile
+++ b/nx-X11/programs/Xserver/render/Imakefile
@@ -44,7 +44,7 @@ NXAGENT_SKIP_OBJS = \
$(NULL)
INCLUDES = -I. -I../include -I../mi \
- -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \
+ -I../fb -I$(EXTINCSRC) -I$(XINCLUDESRC) \
-I../Xext \
`pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
diff --git a/nx-X11/programs/Xserver/xkb/xkbDflts.h b/nx-X11/programs/Xserver/xkb/xkbDflts.h
index 575814baa..8fe12bdaf 100644
--- a/nx-X11/programs/Xserver/xkb/xkbDflts.h
+++ b/nx-X11/programs/Xserver/xkb/xkbDflts.h
@@ -411,7 +411,7 @@ static XkbSymInterpretRec dfltSI[69]= {
255,
{ XkbSA_LockControls, { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } } },
-#ifndef NX_TRANS_SOCKET
+#ifndef NXAGENT_SERVER
/*
* Make sure that the server can't be killed