Commit fae611c9 authored by Ulrich Sibiller's avatar Ulrich Sibiller

Client.c: save some lines

parent bbb23e58
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
#include "Utils.h" #include "Utils.h"
/* /*
* Need to include this after the stub * Need to include this after the stub definition of GC in Agent.h.
* definition of GC in Agent.h.
*/ */
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -70,22 +69,20 @@ ...@@ -70,22 +69,20 @@
#undef DEBUG #undef DEBUG
/* /*
* Returns the last signal delivered * Returns the last signal delivered to the process.
* to the process.
*/ */
extern int _X11TransSocketCheckSignal(void); extern int _X11TransSocketCheckSignal(void);
/* /*
* Time in milliseconds of first iteration * Time in milliseconds of first iteration through the dispatcher.
* through the dispatcher.
*/ */
unsigned long nxagentStartTime = -1; unsigned long nxagentStartTime = -1;
/* /*
* If defined, add a function checking if we * If defined, add a function checking if we need a null timeout after
* need a null timeout after a client wakeup. * a client wakeup.
*/ */
#undef CHECK_RESTARTED_CLIENTS #undef CHECK_RESTARTED_CLIENTS
...@@ -103,8 +100,8 @@ void nxagentCheckRestartedClients(struct timeval **timeout); ...@@ -103,8 +100,8 @@ void nxagentCheckRestartedClients(struct timeval **timeout);
int nxagentClientPrivateIndex; int nxagentClientPrivateIndex;
/* /*
* The master nxagent holds in nxagentShadowCounter * The master nxagent holds in nxagentShadowCounter the number of
* the number of shadow nxagents connected to itself. * shadow nxagents connected to itself.
*/ */
int nxagentShadowCounter = 0; int nxagentShadowCounter = 0;
...@@ -120,8 +117,8 @@ void nxagentInitClientPrivates(ClientPtr client) ...@@ -120,8 +117,8 @@ void nxagentInitClientPrivates(ClientPtr client)
} }
/* /*
* Guess the running application based on the * Guess the running application based on the properties attached to
* properties attached to its main window. * its main window.
*/ */
void nxagentGuessClientHint(ClientPtr client, Atom property, char *data) void nxagentGuessClientHint(ClientPtr client, Atom property, char *data)
...@@ -199,8 +196,8 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) ...@@ -199,8 +196,8 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
#endif #endif
/* /*
* From this moment on we ignore the visibility * From this moment on we ignore the visibility checks to keep
* checks to keep the windows updated. * the windows updated.
*/ */
nxagentChangeOption(IgnoreVisibility, 1); nxagentChangeOption(IgnoreVisibility, 1);
...@@ -210,7 +207,6 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property) ...@@ -210,7 +207,6 @@ void nxagentGuessShadowHint(ClientPtr client, Atom property)
void nxagentCheckIfShadowAgent(ClientPtr client) void nxagentCheckIfShadowAgent(ClientPtr client)
{ {
if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW) if (nxagentClientPriv(client) -> clientHint == NXAGENT_SHADOW)
{ {
#ifdef TEST #ifdef TEST
...@@ -234,14 +230,11 @@ void nxagentCheckIfShadowAgent(ClientPtr client) ...@@ -234,14 +230,11 @@ void nxagentCheckIfShadowAgent(ClientPtr client)
nxagentShadowCounter); nxagentShadowCounter);
#endif #endif
if (nxagentShadowCounter == 0) if (nxagentShadowCounter == 0)
{ {
/* /*
* The last shadow nxagent has been detached * The last shadow nxagent has been detached from master
* from master nxagent. * nxagent. The master nxagent could do some action here.
* The master nxagent could do some action
* here.
*/ */
#ifdef TEST #ifdef TEST
...@@ -255,13 +248,11 @@ void nxagentCheckIfShadowAgent(ClientPtr client) ...@@ -255,13 +248,11 @@ void nxagentCheckIfShadowAgent(ClientPtr client)
void nxagentWakeupByReconnect(void) void nxagentWakeupByReconnect(void)
{ {
int i;
#ifdef TEST #ifdef TEST
fprintf(stderr, "++++++nxagentWakeupByReconnect: Going to wakeup all clients.\n"); fprintf(stderr, "++++++nxagentWakeupByReconnect: Going to wakeup all clients.\n");
#endif #endif
for (i = 1; i < currentMaxClients; i++) for (int i = 1; i < currentMaxClients; i++)
{ {
if (clients[i] != NULL) if (clients[i] != NULL)
{ {
...@@ -343,8 +334,7 @@ void nxagentWaitWakeupBySplit(ClientPtr client) ...@@ -343,8 +334,7 @@ void nxagentWaitWakeupBySplit(ClientPtr client)
#endif #endif
/* /*
* Be sure we intercept an I/O error * Be sure we intercept an I/O error as well as an interrupt.
* as well as an interrupt.
*/ */
#ifdef USE_FINISH_SPLIT #ifdef USE_FINISH_SPLIT
...@@ -358,11 +348,9 @@ void nxagentWaitWakeupBySplit(ClientPtr client) ...@@ -358,11 +348,9 @@ void nxagentWaitWakeupBySplit(ClientPtr client)
for (;;) for (;;)
{ {
/* /*
* Can we handle all the possible events here * Can we handle all the possible events here or we need to select
* or we need to select only the split events? * only the split events? Handling all the possible events would
* Handling all the possible events would pre- * preempt the queue and make a better use of the link.
* empt the queue and make a better use of the
* link.
*/ */
#ifdef WAIT_ALL_EVENTS #ifdef WAIT_ALL_EVENTS
...@@ -407,9 +395,9 @@ void nxagentWaitWakeupBySplit(ClientPtr client) ...@@ -407,9 +395,9 @@ void nxagentWaitWakeupBySplit(ClientPtr client)
int nxagentSuspendBySplit(ClientPtr client) int nxagentSuspendBySplit(ClientPtr client)
{ {
/* /*
FIXME: Should record a serial number for the client, so that FIXME: Should record a serial number for the client, so that the
the client is not restarted because of an end of split client is not restarted because of an end of split of a
of a previous client with the same index. previous client with the same index.
*/ */
if (client -> index < MAX_CONNECTIONS) if (client -> index < MAX_CONNECTIONS)
{ {
...@@ -453,9 +441,9 @@ FIXME: Should record a serial number for the client, so that ...@@ -453,9 +441,9 @@ FIXME: Should record a serial number for the client, so that
int nxagentWakeupBySplit(ClientPtr client) int nxagentWakeupBySplit(ClientPtr client)
{ {
/* /*
FIXME: Should record a serial number for the client, so that FIXME: Should record a serial number for the client, so that the
the client is not restarted because of the end of the client is not restarted because of the end of the split for a
split for a previous client with the same index. previous client with the same index.
*/ */
if (client -> index < MAX_CONNECTIONS) if (client -> index < MAX_CONNECTIONS)
{ {
...@@ -498,16 +486,13 @@ void nxagentCheckRestartedClients(struct timeval **timeout) ...@@ -498,16 +486,13 @@ void nxagentCheckRestartedClients(struct timeval **timeout)
{ {
static struct timeval zero; static struct timeval zero;
int i;
/* /*
* If any of the restarted clients had requests * If any of the restarted clients had requests in input we'll need
* in input we'll need to enter the select with * to enter the select with a null timeout, or we will block until
* a null timeout, or we will block until any * any other client becomes available.
* other client becomes available.
*/ */
for (i = 1; i < currentMaxClients; i++) for (int i = 1; i < currentMaxClients; i++)
{ {
if (clients[i] != NULL && clients[i] -> osPrivate != NULL && if (clients[i] != NULL && clients[i] -> osPrivate != NULL &&
nxagentNeedWakeup(clients[i]) == 0) nxagentNeedWakeup(clients[i]) == 0)
......
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