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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
|
/*
* $XFree86: xc/lib/Xrandr/Xrandr.c,v 1.13tsi Exp $
*
* Copyright © 2000 Compaq Computer Corporation, Inc.
* Copyright © 2002 Hewlett Packard Company, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Compaq or HP not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. HP makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Jim Gettys, HP Labs, HP.
*/
#include <stdio.h>
#include <X11/Xlib.h>
/* we need to be able to manipulate the Display structure on events */
#include <X11/Xlibint.h>
#include <X11/extensions/render.h>
#include <X11/extensions/Xrender.h>
#include "Xrandrint.h"
XExtensionInfo XRRExtensionInfo;
char XRRExtensionName[] = RANDR_NAME;
static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire);
static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy, Window window);
static int
XRRCloseDisplay (Display *dpy, XExtCodes *codes);
static /* const */ XExtensionHooks rr_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
NULL, /* flush_gc */
NULL, /* free_gc */
NULL, /* create_font */
NULL, /* free_font */
XRRCloseDisplay, /* close_display */
XRRWireToEvent, /* wire_to_event */
XRREventToWire, /* event_to_wire */
NULL, /* error */
NULL, /* error_string */
};
static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
{
XExtDisplayInfo *info = XRRFindDisplay(dpy);
XRRScreenChangeNotifyEvent *aevent;
xRRScreenChangeNotifyEvent *awire;
RRCheckExtension(dpy, info, False);
switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
{
case RRScreenChangeNotify:
awire = (xRRScreenChangeNotifyEvent *) wire;
aevent = (XRRScreenChangeNotifyEvent *) event;
aevent->type = awire->type & 0x7F;
aevent->serial = _XSetLastRequestRead(dpy,
(xGenericReply *) wire);
aevent->send_event = (awire->type & 0x80) != 0;
aevent->display = dpy;
aevent->window = awire->window;
aevent->root = awire->root;
aevent->timestamp = awire->timestamp;
aevent->config_timestamp = awire->configTimestamp;
aevent->size_index = awire->sizeID;
aevent->subpixel_order = awire->subpixelOrder;
aevent->rotation = awire->rotation;
aevent->width = awire->widthInPixels;
aevent->height = awire->heightInPixels;
aevent->mwidth = awire->widthInMillimeters;
aevent->mheight = awire->heightInMillimeters;
return True;
}
return False;
}
static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire)
{
XExtDisplayInfo *info = XRRFindDisplay(dpy);
XRRScreenChangeNotifyEvent *aevent;
xRRScreenChangeNotifyEvent *awire;
RRCheckExtension(dpy, info, False);
switch ((event->type & 0x7F) - info->codes->first_event)
{
case RRScreenChangeNotify:
awire = (xRRScreenChangeNotifyEvent *) wire;
aevent = (XRRScreenChangeNotifyEvent *) event;
awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
awire->rotation = (CARD8) aevent->rotation;
awire->sequenceNumber = aevent->serial & 0xFFFF;
awire->timestamp = aevent->timestamp;
awire->configTimestamp = aevent->config_timestamp;
awire->root = aevent->root;
awire->window = aevent->window;
awire->sizeID = aevent->size_index;
awire->subpixelOrder = aevent->subpixel_order;
awire->widthInPixels = aevent->width;
awire->heightInPixels = aevent->height;
awire->widthInMillimeters = aevent->mwidth;
awire->heightInMillimeters = aevent->mheight;
return True;
}
return False;
}
XExtDisplayInfo *
XRRFindDisplay (Display *dpy)
{
XExtDisplayInfo *dpyinfo;
XRandRInfo *xrri;
int i, numscreens;
dpyinfo = XextFindDisplay (&XRRExtensionInfo, dpy);
if (!dpyinfo) {
dpyinfo = XextAddDisplay (&XRRExtensionInfo, dpy,
XRRExtensionName,
&rr_extension_hooks,
RRNumberEvents, 0);
numscreens = ScreenCount(dpy);
xrri = Xmalloc (sizeof(XRandRInfo) +
sizeof(char *) * numscreens);
xrri->config = (XRRScreenConfiguration **)(xrri + 1);
for(i = 0; i < numscreens; i++)
xrri->config[i] = NULL;
xrri->major_version = -1;
dpyinfo->data = (char *) xrri;
}
return dpyinfo;
}
static int
XRRCloseDisplay (Display *dpy, XExtCodes *codes)
{
int i;
XRRScreenConfiguration **configs;
XExtDisplayInfo *info = XRRFindDisplay (dpy);
XRandRInfo *xrri;
LockDisplay(dpy);
/*
* free cached data
*/
if (XextHasExtension(info)) {
xrri = (XRandRInfo *) info->data;
if (xrri) {
configs = xrri->config;
for (i = 0; i < ScreenCount(dpy); i++) {
if (configs[i] != NULL) XFree (configs[i]);
}
XFree (xrri);
}
}
UnlockDisplay(dpy);
return XextRemoveDisplay (&XRRExtensionInfo, dpy);
}
Rotation XRRConfigRotations(XRRScreenConfiguration *config, Rotation *current_rotation)
{
*current_rotation = config->current_rotation;
return config->rotations;
}
XRRScreenSize *XRRConfigSizes(XRRScreenConfiguration *config, int *nsizes)
{
*nsizes = config->nsizes;
return config->sizes;
}
short *XRRConfigRates (XRRScreenConfiguration *config, int sizeID, int *nrates)
{
short *r = config->rates;
int nents = config->nrates;
/* Skip over the intervening rate lists */
while (sizeID > 0 && nents > 0)
{
int i = (*r + 1);
r += i;
nents -= i;
sizeID--;
}
if (!nents)
{
*nrates = 0;
return 0;
}
*nrates = (int) *r;
return r + 1;
}
Time XRRConfigTimes (XRRScreenConfiguration *config, Time *config_timestamp)
{
*config_timestamp = config->config_timestamp;
return config->timestamp;
}
SizeID XRRConfigCurrentConfiguration (XRRScreenConfiguration *config,
Rotation *rotation)
{
*rotation = (Rotation) config->current_rotation;
return (SizeID) config->current_size;
}
short XRRConfigCurrentRate (XRRScreenConfiguration *config)
{
return config->current_rate;
}
/*
* Go get the screen configuration data and salt it away for future use;
* returns NULL if extension not supported
*/
static XRRScreenConfiguration *_XRRValidateCache (Display *dpy, int screen)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
XRRScreenConfiguration **configs;
XRandRInfo *xrri;
if (XextHasExtension(info)) {
xrri = (XRandRInfo *) info->data;
configs = xrri->config;
if (configs[screen] == NULL)
configs[screen] = _XRRGetScreenInfo (dpy, RootWindow(dpy, screen));
return configs[screen];
} else {
return NULL;
}
}
/* given a screen, return the information from the (possibly) cached data */
Rotation XRRRotations(Display *dpy, int screen, Rotation *current_rotation)
{
XRRScreenConfiguration *config;
Rotation cr;
LockDisplay(dpy);
if ((config = _XRRValidateCache(dpy, screen))) {
*current_rotation = config->current_rotation;
cr = config->rotations;
UnlockDisplay(dpy);
return cr;
}
else {
UnlockDisplay(dpy);
*current_rotation = RR_Rotate_0;
return 0; /* no rotations supported */
}
}
/* given a screen, return the information from the (possibly) cached data */
XRRScreenSize *XRRSizes(Display *dpy, int screen, int *nsizes)
{
XRRScreenConfiguration *config;
XRRScreenSize *sizes;
LockDisplay(dpy);
if ((config = _XRRValidateCache(dpy, screen))) {
*nsizes = config->nsizes;
sizes = config->sizes;
UnlockDisplay(dpy);
return sizes;
}
else {
UnlockDisplay(dpy);
*nsizes = 0;
return NULL;
}
}
short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates)
{
XRRScreenConfiguration *config;
short *rates;
LockDisplay(dpy);
if ((config = _XRRValidateCache(dpy, screen))) {
rates = XRRConfigRates (config, sizeID, nrates);
UnlockDisplay(dpy);
return rates;
}
else {
UnlockDisplay(dpy);
*nrates = 0;
return NULL;
}
}
/* given a screen, return the information from the (possibly) cached data */
Time XRRTimes (Display *dpy, int screen, Time *config_timestamp)
{
XRRScreenConfiguration *config;
Time ts;
LockDisplay(dpy);
if ((config = _XRRValidateCache(dpy, screen))) {
*config_timestamp = config->config_timestamp;
ts = config->timestamp;
UnlockDisplay(dpy);
return ts;
} else {
UnlockDisplay(dpy);
return CurrentTime;
}
}
int XRRRootToScreen(Display *dpy, Window root)
{
int snum;
for (snum = 0; snum < ScreenCount(dpy); snum++) {
if (RootWindow(dpy, snum) == root) return snum;
}
return -1;
}
Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
if (XextHasExtension(info)) {
*event_basep = info->codes->first_event;
*error_basep = info->codes->first_error;
return True;
} else {
return False;
}
}
static Bool
_XRRHasRates (int major, int minor)
{
return major > 1 || (major == 1 && minor >= 1);
}
Status XRRQueryVersion (Display *dpy,
int *major_versionp,
int *minor_versionp)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
xRRQueryVersionReply rep;
xRRQueryVersionReq *req;
XRandRInfo *xrri;
RRCheckExtension (dpy, info, 0);
xrri = (XRandRInfo *) info->data;
/*
* only get the version information from the server if we don't have it already
*/
if (xrri->major_version == -1) {
LockDisplay (dpy);
GetReq (RRQueryVersion, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRQueryVersion;
req->majorVersion = RANDR_MAJOR;
req->minorVersion = RANDR_MINOR;
if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
UnlockDisplay (dpy);
SyncHandle ();
return 0;
}
xrri->major_version = rep.majorVersion;
xrri->minor_version = rep.minorVersion;
xrri->has_rates = _XRRHasRates (xrri->major_version, xrri->minor_version);
}
*major_versionp = xrri->major_version;
*minor_versionp = xrri->minor_version;
UnlockDisplay (dpy);
SyncHandle ();
return 1;
}
typedef struct _randrVersionState {
unsigned long version_seq;
Bool error;
int major_version;
int minor_version;
} _XRRVersionState;
static Bool
_XRRVersionHandler (Display *dpy,
xReply *rep,
char *buf,
int len,
XPointer data)
{
xRRQueryVersionReply replbuf;
xRRQueryVersionReply *repl;
_XRRVersionState *state = (_XRRVersionState *) data;
if (dpy->last_request_read != state->version_seq)
return False;
if (rep->generic.type == X_Error)
{
state->error = True;
return False;
}
repl = (xRRQueryVersionReply *)
_XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
(SIZEOF(xRRQueryVersionReply) - SIZEOF(xReply)) >> 2,
True);
state->major_version = repl->majorVersion;
state->minor_version = repl->minorVersion;
return True;
}
/* need a version that does not hold the display lock */
static XRRScreenConfiguration *_XRRGetScreenInfo (Display *dpy, Window window)
{
XExtDisplayInfo *info = XRRFindDisplay(dpy);
xRRGetScreenInfoReply rep;
xRRGetScreenInfoReq *req;
_XAsyncHandler async;
_XRRVersionState async_state;
int nbytes, nbytesRead, rbytes;
int i;
xScreenSizes size;
struct _XRRScreenConfiguration *scp;
XRRScreenSize *ssp;
short *rates;
xRRQueryVersionReq *vreq;
XRandRInfo *xrri;
Bool getting_version = False;
RRCheckExtension (dpy, info, 0);
xrri = (XRandRInfo *) info->data;
if (xrri->major_version == -1)
{
/* hide a version query in the request */
GetReq (RRQueryVersion, vreq);
vreq->reqType = info->codes->major_opcode;
vreq->randrReqType = X_RRQueryVersion;
vreq->majorVersion = RANDR_MAJOR;
vreq->minorVersion = RANDR_MINOR;
async_state.version_seq = dpy->request;
async_state.error = False;
async.next = dpy->async_handlers;
async.handler = _XRRVersionHandler;
async.data = (XPointer) &async_state;
dpy->async_handlers = &async;
getting_version = True;
}
GetReq (RRGetScreenInfo, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRGetScreenInfo;
req->window = window;
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
{
if (getting_version)
DeqAsyncHandler (dpy, &async);
SyncHandle ();
return NULL;
}
if (getting_version)
{
DeqAsyncHandler (dpy, &async);
if (async_state.error)
{
SyncHandle();
}
xrri->major_version = async_state.major_version;
xrri->minor_version = async_state.minor_version;
xrri->has_rates = _XRRHasRates (xrri->minor_version, xrri->major_version);
}
/*
* Make the reply compatible with v1.1
*/
if (!xrri->has_rates)
{
rep.rate = 0;
rep.nrateEnts = 0;
}
nbytes = (long) rep.length << 2;
nbytesRead = (long) (rep.nSizes * SIZEOF (xScreenSizes) +
((rep.nrateEnts + 1)& ~1) * 2 /* SIZEOF (CARD16) */);
/*
* first we must compute how much space to allocate for
* randr library's use; we'll allocate the structures in a single
* allocation, on cleanlyness grounds.
*/
rbytes = sizeof (XRRScreenConfiguration) +
(rep.nSizes * sizeof (XRRScreenSize) +
rep.nrateEnts * sizeof (int));
scp = (struct _XRRScreenConfiguration *) Xmalloc(rbytes);
if (scp == NULL) {
_XEatData (dpy, (unsigned long) nbytes);
SyncHandle ();
return NULL;
}
ssp = (XRRScreenSize *)(scp + 1);
rates = (short *) (ssp + rep.nSizes);
/* set up the screen configuration structure */
scp->screen =
ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
scp->sizes = ssp;
scp->rates = rates;
scp->rotations = rep.setOfRotations;
scp->current_size = rep.sizeID;
scp->current_rate = rep.rate;
scp->current_rotation = rep.rotation;
scp->timestamp = rep.timestamp;
scp->config_timestamp = rep.configTimestamp;
scp->nsizes = rep.nSizes;
scp->nrates = rep.nrateEnts;
/*
* Time to unpack the data from the server.
*/
/*
* First the size information
*/
for (i = 0; i < rep.nSizes; i++) {
_XReadPad (dpy, (char *) &size, SIZEOF (xScreenSizes));
ssp[i].width = size.widthInPixels;
ssp[i].height = size.heightInPixels;
ssp[i].mwidth = size.widthInMillimeters;
ssp[i].mheight = size.heightInMillimeters;
}
/*
* And the rates
*/
_XRead16Pad (dpy, rates, 2 /* SIZEOF (CARD16) */ * rep.nrateEnts);
/*
* Skip any extra data
*/
if (nbytes > nbytesRead)
_XEatData (dpy, (unsigned long) (nbytes - nbytesRead));
return (XRRScreenConfiguration *)(scp);
}
XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
{
XRRScreenConfiguration *config;
LockDisplay (dpy);
config = _XRRGetScreenInfo(dpy, window);
UnlockDisplay (dpy);
SyncHandle ();
return config;
}
void XRRFreeScreenConfigInfo (XRRScreenConfiguration *config)
{
Xfree (config);
}
/*
* in protocol version 0.1, routine added to allow selecting for new events.
*/
void XRRSelectInput (Display *dpy, Window window, int mask)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
xRRSelectInputReq *req;
RRSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (RRSelectInput, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRSelectInput;
req->window = window;
req->enable = 0;
if (mask) req->enable = mask;
UnlockDisplay (dpy);
SyncHandle ();
return;
}
Status XRRSetScreenConfigAndRate (Display *dpy,
XRRScreenConfiguration *config,
Drawable draw,
int size_index,
Rotation rotation,
short rate,
Time timestamp)
{
XExtDisplayInfo *info = XRRFindDisplay (dpy);
xRRSetScreenConfigReply rep;
XRandRInfo *xrri;
int major, minor;
RRCheckExtension (dpy, info, 0);
/* Make sure has_rates is set */
if (!XRRQueryVersion (dpy, &major, &minor))
return 0;
LockDisplay (dpy);
xrri = (XRandRInfo *) info->data;
if (xrri->has_rates)
{
xRRSetScreenConfigReq *req;
GetReq (RRSetScreenConfig, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRSetScreenConfig;
req->drawable = draw;
req->sizeID = size_index;
req->rotation = rotation;
req->timestamp = timestamp;
req->configTimestamp = config->config_timestamp;
req->rate = rate;
}
else
{
xRR1_0SetScreenConfigReq *req;
GetReq (RR1_0SetScreenConfig, req);
req->reqType = info->codes->major_opcode;
req->randrReqType = X_RRSetScreenConfig;
req->drawable = draw;
req->sizeID = size_index;
req->rotation = rotation;
req->timestamp = timestamp;
req->configTimestamp = config->config_timestamp;
}
(void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
if (rep.status == RRSetConfigSuccess) {
/* if we succeed, set our view of reality to what we set it to */
config->config_timestamp = rep.newConfigTimestamp;
config->timestamp = rep.newTimestamp;
config->screen = ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
config->current_size = size_index;
config->current_rotation = rotation;
}
UnlockDisplay (dpy);
SyncHandle ();
return(rep.status);
}
Status XRRSetScreenConfig (Display *dpy,
XRRScreenConfiguration *config,
Drawable draw,
int size_index,
Rotation rotation, Time timestamp)
{
return XRRSetScreenConfigAndRate (dpy, config, draw, size_index,
rotation, 0, timestamp);
}
int XRRUpdateConfiguration(XEvent *event)
{
XRRScreenChangeNotifyEvent *scevent;
XConfigureEvent *rcevent;
Display *dpy = event->xany.display;
XExtDisplayInfo *info;
XRandRInfo *xrri;
int snum;
/* first, see if it is a vanilla configure notify event */
if (event->type == ConfigureNotify) {
rcevent = (XConfigureEvent *) event;
snum = XRRRootToScreen(dpy, rcevent->window);
dpy->screens[snum].width = rcevent->width;
dpy->screens[snum].height = rcevent->height;
return 1;
}
info = XRRFindDisplay(dpy);
RRCheckExtension (dpy, info, 0);
switch (event->type - info->codes->first_event) {
case RRScreenChangeNotify:
scevent = (XRRScreenChangeNotifyEvent *) event;
snum = XRRRootToScreen(dpy,
((XRRScreenChangeNotifyEvent *) event)->root);
dpy->screens[snum].width = scevent->width;
dpy->screens[snum].height = scevent->height;
dpy->screens[snum].mwidth = scevent->mwidth;
dpy->screens[snum].mheight = scevent->mheight;
XRenderSetSubpixelOrder (dpy, snum, scevent->subpixel_order);
break;
default:
return 0;
}
xrri = (XRandRInfo *) info->data;
/*
* so the next time someone wants some data, it will be fetched;
* it might be better to force the round trip immediately, but
* I dislike pounding the server simultaneously when not necessary
*/
if (xrri->config[snum] != NULL) {
XFree (xrri->config[snum]);
xrri->config[snum] = NULL;
}
return 1;
}
|