Unverified Commit 3a3a3373 authored by Mike Gabriel's avatar Mike Gabriel

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

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