@@ -68,9 +68,7 @@ extern Selection *CurrentSelections;
68
68
int nxagentLastClipboardClient = -1 ;
69
69
70
70
static int agentClipboardInitialized = False ;
71
- #ifdef DEBUG
72
71
static int clientAccum ;
73
- #endif
74
72
75
73
XlibAtom serverTransToAgentProperty ;
76
74
Atom clientCutProperty ;
@@ -156,19 +154,16 @@ static char szAgentCLIPBOARD[] = "CLIPBOARD";
156
154
/* number of milliseconds to wait for a conversion from the real X server. */
157
155
#define CONVERSION_TIMEOUT 5000
158
156
159
- #ifdef DEBUG
160
157
/*
161
158
* Time window (milliseconds) within to detect multiple conversion
162
159
* calls of the same client.
163
160
*/
164
161
#define ACCUM_TIME 5000
165
- #endif
166
162
167
163
/*
168
164
* some helpers for debugging output
169
165
*/
170
166
171
- #ifdef DEBUG
172
167
static const char * getClientSelectionStageString (int stage )
173
168
{
174
169
switch (stage )
@@ -181,15 +176,18 @@ static const char * getClientSelectionStageString(int stage)
181
176
default : return ("UNKNOWN!" ); break ;;
182
177
}
183
178
}
179
+
180
+ #ifdef DEBUG
184
181
#define setClientSelectionStage (stage ) do {fprintf(stderr, "%s: Changing selection stage from [%s] to [%s]\n", __func__, getClientSelectionStageString(lastClientStage), getClientSelectionStageString(SelectionStage##stage)); lastClientStage = SelectionStage##stage;} while (0)
185
182
#define printClientSelectionStage () do {fprintf(stderr, "%s: Current selection stage [%s]\n", __func__, getClientSelectionStageString(lastClientStage));} while (0)
186
- #define WINDOWID (ptr ) (ptr) ? (ptr->drawable.id) : 0
187
- #define CLINDEX (clientptr ) (clientptr) ? (clientptr->index) : -1
188
183
#else
189
184
#define setClientSelectionStage (stage ) do {lastClientStage = SelectionStage##stage;} while (0)
190
185
#define printClientSelectionStage ()
191
186
#endif
192
187
188
+ #define WINDOWID (ptr ) (ptr) ? (ptr->drawable.id) : 0
189
+ #define CLINDEX (clientptr ) (clientptr) ? (clientptr->index) : -1
190
+
193
191
#ifdef DEBUG
194
192
/*
195
193
* see also nx-X11/lib/src/ErrDes.c
@@ -267,7 +265,6 @@ void nxagentPrintClipboardStat(char *);
267
265
extern unsigned long startTime ;
268
266
#endif
269
267
270
- #ifdef DEBUG
271
268
static void printSelectionStat (int sel )
272
269
{
273
270
SelectionOwner lOwner = lastSelectionOwner [sel ];
@@ -313,14 +310,12 @@ static void printSelectionStat(int sel)
313
310
fprintf (stderr , " CurrentSelections[].window [0x%x]\n" , curSel .window );
314
311
return ;
315
312
}
316
- #endif
317
313
318
- void nxagentPrintClipboardStat ( char * header )
314
+ void nxagentDumpClipboardStat ( void )
319
315
{
320
- #ifdef DEBUG
321
316
char * s = NULL ;
322
317
323
- fprintf (stderr , "/----- Clipboard internal status - %s ----- \n" , header );
318
+ fprintf (stderr , "/----- Clipboard internal status -----\n" );
324
319
325
320
fprintf (stderr , " current time (Time) [%u]\n" , GetTimeInMillis ());
326
321
fprintf (stderr , " agentClipboardInitialized (Bool) [%s]\n" , agentClipboardInitialized ? "True" : "False" );
@@ -399,7 +394,6 @@ void nxagentPrintClipboardStat(char *header)
399
394
fprintf (stderr , "\\------------------------------------------------------------------------------\n" );
400
395
401
396
SAFE_XFree (s );
402
- #endif
403
397
}
404
398
405
399
/*
@@ -581,8 +575,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
581
575
(void * ) pClient , CLINDEX (pClient ), (void * ) pWindow , WINDOWID (pWindow ));
582
576
#endif
583
577
584
- nxagentPrintClipboardStat ("before nxagentClearClipboard" );
585
-
586
578
/*
587
579
* Only for PRIMARY and CLIPBOARD selections.
588
580
*/
@@ -610,8 +602,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
610
602
lastClientWindowPtr = NULL ;
611
603
setClientSelectionStage (None );
612
604
}
613
-
614
- nxagentPrintClipboardStat ("after nxagentClearClipboard" );
615
605
}
616
606
617
607
/*
@@ -655,8 +645,6 @@ void nxagentHandleSelectionClearFromXServer(XEvent *X)
655
645
fprintf (stderr , "%s: SelectionClear event for selection [%lu].\n" , __func__ , X -> xselectionclear .selection );
656
646
#endif
657
647
658
- nxagentPrintClipboardStat ("before nxagentHandleSelectionClearFromXServer" );
659
-
660
648
if (!agentClipboardInitialized )
661
649
{
662
650
#ifdef DEBUG
@@ -701,7 +689,6 @@ void nxagentHandleSelectionClearFromXServer(XEvent *X)
701
689
702
690
lastClientWindowPtr = NULL ;
703
691
setClientSelectionStage (None );
704
- nxagentPrintClipboardStat ("after nxagentHandleSelectionClearFromXServer" );
705
692
}
706
693
707
694
/*
@@ -760,8 +747,6 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X)
760
747
}
761
748
#endif
762
749
763
- nxagentPrintClipboardStat ("before nxagentHandleSelectionRequestFromXServer" );
764
-
765
750
if (!agentClipboardInitialized )
766
751
{
767
752
#ifdef DEBUG
@@ -984,7 +969,6 @@ void nxagentHandleSelectionRequestFromXServer(XEvent *X)
984
969
}
985
970
}
986
971
}
987
- nxagentPrintClipboardStat ("after nxagentHandleSelectionRequestFromXServer" );
988
972
}
989
973
990
974
/*
@@ -1887,7 +1871,6 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
1887
1871
}
1888
1872
}
1889
1873
1890
- #ifdef DEBUG
1891
1874
if (lastClientClientPtr == client && (GetTimeInMillis () - lastClientReqTime < ACCUM_TIME ))
1892
1875
{
1893
1876
/*
@@ -1897,9 +1880,11 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
1897
1880
* client requesting PRIMARY and CLIPBOARD would match here, too
1898
1881
*/
1899
1882
1883
+ #ifdef DEBUG
1900
1884
fprintf (stderr , "%s: Consecutives request from client [%p] selection [%u] "
1901
1885
"elapsed time [%u] clientAccum [%d]\n" , __func__ , (void * ) client , selection ,
1902
1886
GetTimeInMillis () - lastClientReqTime , clientAccum );
1887
+ #endif
1903
1888
1904
1889
clientAccum ++ ;
1905
1890
}
@@ -1911,7 +1896,6 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
1911
1896
clientAccum = 0 ;
1912
1897
}
1913
1898
}
1914
- #endif
1915
1899
1916
1900
if (target == clientTEXT ||
1917
1901
target == XA_STRING ||
0 commit comments