aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Options.h
blob: b5394ee0162b520b5f184188d01da0473529100d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
/**************************************************************************/
/*                                                                        */
/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)          */
/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de>  */
/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de>                */
/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de>                 */
/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)           */
/*                                                                        */
/* NXAGENT, NX protocol compression and NX extensions to this software    */
/* are copyright of the aforementioned persons and companies.             */
/*                                                                        */
/* Redistribution and use of the present software is allowed according    */
/* to terms specified in the file LICENSE which comes in the source       */
/* distribution.                                                          */
/*                                                                        */
/* All rights reserved.                                                   */
/*                                                                        */
/* NOTE: This software has received contributions from various other      */
/* contributors, only the core maintainers and supporters are listed as   */
/* copyright holders. Please contact us, if you feel you should be listed */
/* as copyright holder, as well.                                          */
/*                                                                        */
/**************************************************************************/

#ifndef __Options_H__
#define __Options_H__

#ifndef True
#define True   1
#endif

#ifndef False
#define False  0
#endif

#define UNDEFINED -1
#define COPY_UNLIMITED -1
#define DEFAULT_SLEEP_TIME 50

extern unsigned int nxagentPrintGeometryFlags;

typedef enum _BackingStoreMode
{
  BackingStoreUndefined = -1,
  BackingStoreNever,
  BackingStoreWhenRequested,
  BackingStoreForce

} BackingStoreMode;

typedef enum _ClipboardMode
{
  ClipboardBoth,
  ClipboardClient,
  ClipboardServer,
  ClipboardNone

} ClipboardMode;

typedef enum _ClientOsType
{
  ClientOsWinnt = 0,
  ClientOsLinux,
  ClientOsSolaris,
  ClientOsMac

} ClientOsType;

typedef enum _ToleranceChecksMode
{
  ToleranceChecksStrict = 0,
  ToleranceChecksSafe = 1,
  ToleranceChecksRisky = 2,
  ToleranceChecksBypass = 3
} ToleranceChecksMode;


#define DEFAULT_TOLERANCE ToleranceChecksStrict

typedef enum _KeycodeConversion
{
  KeycodeConversionOn = 0,
  KeycodeConversionOff = 1,
  KeycodeConversionAuto = 2
} KeycodeConversionMode;

#define DEFAULT_KEYCODE_CONVERSION KeycodeConversionAuto

/*
 * Set of options affecting agent operations.
 */

typedef struct _AgentOptions
{
  /*
   * Link type of the NX connection or none,
   * if this is a direct X11 connection.
   */

  int LinkType;

  /*
   * Is agent running in desktop mode? This
   * is presently the default.
   */

  int Desktop;

  /*
   * True if user activated rootless mode.
   */

  int Rootless;

  /*
   * True for shadow mode.
   */

  int Shadow;

  /*
   * True if user activated persistent mode.
   */

  int Persistent;

  /*
   * True if user activated fullscreen mode.
   */

  int Fullscreen;

  /*
   * True if the fullscreen NX session will
   * extend on all available screens.
   */

  int AllScreens;

  /*
   * Set to the auto-disconnect timeout, if
   * the user activated this feature.
   */

  int Timeout;

  /*
   * Geometry of the agent's window.
   */

  int X;
  int Y;
  int Width;
  int Height;
  int BorderWidth;

  /*
   * Geometry of the agent's window in window
   * mode. Used to restore window size when
   * switching back to window mode from full-
   * screen.
   */

  int WMBorderWidth;
  int WMTitleHeight;

  int SavedX;
  int SavedY;
  int SavedWidth;
  int SavedHeight;

  int SavedRootWidth;
  int SavedRootHeight;

  /*
   * Set if agent is running nested in another
   * agent X server.
   */

  int Nested;

  /*
   * Selected backing-store mode.
   */

  BackingStoreMode BackingStore;

  /*
   * Selected clipboard mode.
   */

  ClipboardMode Clipboard;

  /*
   * Enable agent to use the MITSHM extension in
   * path from remote proxy to the real X server.
   */

  int SharedMemory;

  /*
   * Enable agent to use shared Pixmaps
   */

  int SharedPixmaps;

  /*
   * Enable agent to propagate keyboard and pointer
   * device configuration to the remote X server.
   */

  int DeviceControl;

  /*
   * Explicitly asked config propagation.
   */

  int DeviceControlUserDefined;

  /*
   * Resuming keyboard device corrects keymap if session
   * migrates across platforms with different keycode
   * layout.
   */

  int ResetKeyboardAtResume;

  /*
   * Reset server when the last client disconnects.
   */

  int Reset;

  /* 
   * Geometry of the agent root window, relative to
   * the agent default window.
   */

  int RootX;
  int RootY;
  int RootWidth;
  int RootHeight;

  /*
   * Horizontal and vertical span of the
   * agent viewport.
   */

  int ViewportXSpan;
  int ViewportYSpan;

  /*
   * True if the user can resize the desktop
   * by dragging the window border.
   */

  int DesktopResize;

  /*
   * The scaling ratio of the shadow agent.
   */

  int Ratio;

  int XRatio;

  int YRatio;

  float FloatRatio;

  float FloatXRatio;

  float FloatYRatio;

  /*
   * The shadow agent uses the Damage extension.
   */

  int UseDamage;

  /*
   * Was the agent run with the -B option?
   */

  int Binder;

  char *BinderOptions;

  /*
   * Set if the agent has to connect to a
   * desktop manager to start the session.
   */

  int Xdmcp;

  /*
   * Latency of the link. It is simply set
   * to a reference value, calculated based
   * on the time required to complete the
   * query of the agent's atoms at session
   * startup.
   */

  int DisplayLatency;

  /*
   * Size of the Xlib display buffer. The
   * default is set according to the link
   * type.
   */

  int DisplayBuffer;

  /*
   * Buffer coalescence timeout.
   */

  int DisplayCoalescence;

  /*
   * Use the composite extension when
   * available on the remote display.
   */

  int Composite;

  /*
   * If set, don't skip internal operations
   * when the agent window is not fully visible.
   */

  int IgnoreVisibility;

  /*
   * If set, prevent the shadow session to
   * interact with master display.
   */

  int ViewOnly;

  /*
   * If true select a lossy or lossless comp-
   * ression method based on the characterist-
   * ics of the image.
   */

  int Adaptive;

  /*
   * Stream the images and update the display
   * when the image has been completely trans-
   * ferred.
   */

  int Streaming;

  /*
   * Use a lazy approach in updating the remote
   * display. This means delaying the bandwidth
   * consuming graphic operations and synchroniz-
   * ing the screen at idle time.
   */

  int DeferLevel;

  /*
   * Maximum elapsed time before a new full
   * synchronization.
   */

  unsigned long DeferTimeout;

  /*
   * Maximum size of the tile used when sending
   * an image to the remote display.
   */

  int TileWidth;
  int TileHeight;

  /*
   * Enabling/disabling the pulldown menu.
   */

  int Menu;

  /*
   * Enabling/disabling the magic pixel.
   */

  int MagicPixel;

  /*
   * Specify the Operative System of the client.
   */

  int ClientOs;

  /*
   * Inhibit some XKEYBOARD requests.
   */

  int InhibitXkb;

  /*
   * Maximum number of bytes that can be pasted from
   * an NX session into an external application.
   */

  int CopyBufferSize;

  /*
   * Max image data rate to the encoder input.
   */

  int ImageRateLimit;

 /*
  * True if agent should not exit if there are no
  * clients in rootless mode
  */

  int NoRootlessExit;

 /*
  * Store if the user wants Xinerama. There are variables called
  * noPanoramiXExtension and noRRXineramaExtensison in os/utils.c but
  * we cannot rely on them because RandR and PanoramiX change their
  * values when trying to initialize. So we use this variable to
  * save the user preference provided by the -/+(rr)xinerama parameter(s)
  * before initializing those extensions.
  */

  int Xinerama;

  /*
   * Sleep delay in microseconds.
   */

  unsigned int SleepTime;

  /*
   * Tolerance - tightens or loosens reconnect checks.
   */

  ToleranceChecksMode ReconnectTolerance;

  /*
   * Convert evdev keycodes to pc105.
   */
  KeycodeConversionMode KeycodeConversion;
} AgentOptionsRec;

typedef AgentOptionsRec *AgentOptionsPtr;

extern AgentOptionsPtr nxagentOptionsPtr;

/*
 * Macros and functions giving access to options.
 */

#define nxagentOption(option) \
    (nxagentOptionsPtr -> option)

#define nxagentChangeOption(option, value) \
    (nxagentOptionsPtr -> option = (value))

#define nxagentOptions() \
    (nxagentOptionsPtr)

/*
 * Initialize the options to the default values.
 */

extern void nxagentInitOptions(void);

/*
 * Initialize some options to the default values
 * at reconnection.
 */

extern void nxagentResetOptions(void);

/*
 * Save a copy of the current option repository.
 */

extern void nxagentSaveOptions(void);

/*
 * Restore the options reset by nxagentResetOptions
 * to their backup value.
 */

extern void nxagentRestoreOptions(void);

#endif /* __Options_H__ */