302
405
((XAnyEvent *) save)->display = dpy;
306
case XI_DeviceMotionNotify:
308
register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) save;
309
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
311
ev->root = ev2->root;
312
ev->window = ev2->event;
313
ev->subwindow = ev2->child;
314
ev->time = ev2->time;
315
ev->x_root = ev2->root_x;
316
ev->y_root = ev2->root_y;
317
ev->x = ev2->event_x;
318
ev->y = ev2->event_y;
319
ev->state = ev2->state;
320
ev->same_screen = ev2->same_screen;
321
ev->is_hint = ev2->detail;
322
ev->deviceid = ev2->deviceid & DEVICE_BITS;
323
return (DONT_ENQUEUE);
326
case XI_DeviceKeyPress:
327
case XI_DeviceKeyRelease:
329
register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) save;
330
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
332
ev->root = ev2->root;
333
ev->window = ev2->event;
334
ev->subwindow = ev2->child;
335
ev->time = ev2->time;
336
ev->x_root = ev2->root_x;
337
ev->y_root = ev2->root_y;
338
ev->x = ev2->event_x;
339
ev->y = ev2->event_y;
340
ev->state = ev2->state;
341
ev->same_screen = ev2->same_screen;
342
ev->keycode = ev2->detail;
343
ev->deviceid = ev2->deviceid & DEVICE_BITS;
344
if (ev2->deviceid & MORE_EVENTS)
345
return (DONT_ENQUEUE);
348
return (ENQUEUE_EVENT);
352
case XI_DeviceButtonPress:
353
case XI_DeviceButtonRelease:
355
register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) save;
356
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
358
ev->root = ev2->root;
359
ev->window = ev2->event;
360
ev->subwindow = ev2->child;
361
ev->time = ev2->time;
362
ev->x_root = ev2->root_x;
363
ev->y_root = ev2->root_y;
364
ev->x = ev2->event_x;
365
ev->y = ev2->event_y;
366
ev->state = ev2->state;
367
ev->same_screen = ev2->same_screen;
368
ev->button = ev2->detail;
369
ev->deviceid = ev2->deviceid & DEVICE_BITS;
370
if (ev2->deviceid & MORE_EVENTS)
371
return (DONT_ENQUEUE);
374
return (ENQUEUE_EVENT);
379
case XI_ProximityOut:
381
register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) save;
382
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
384
ev->root = ev2->root;
385
ev->window = ev2->event;
386
ev->subwindow = ev2->child;
387
ev->time = ev2->time;
388
ev->x_root = ev2->root_x;
389
ev->y_root = ev2->root_y;
390
ev->x = ev2->event_x;
391
ev->y = ev2->event_y;
392
ev->state = ev2->state;
393
ev->same_screen = ev2->same_screen;
394
ev->deviceid = ev2->deviceid & DEVICE_BITS;
395
if (ev2->deviceid & MORE_EVENTS)
396
return (DONT_ENQUEUE);
399
return (ENQUEUE_EVENT);
403
case XI_DeviceValuator:
405
deviceValuator *xev = (deviceValuator *) event;
406
int save_type = save->type - info->codes->first_event;
408
if (save_type == XI_DeviceKeyPress || save_type == XI_DeviceKeyRelease) {
409
XDeviceKeyEvent *kev = (XDeviceKeyEvent *) save;
411
kev->device_state = xev->device_state;
412
kev->axes_count = xev->num_valuators;
413
kev->first_axis = xev->first_valuator;
414
i = xev->num_valuators;
419
kev->axis_data[5] = xev->valuator5;
421
kev->axis_data[4] = xev->valuator4;
423
kev->axis_data[3] = xev->valuator3;
425
kev->axis_data[2] = xev->valuator2;
427
kev->axis_data[1] = xev->valuator1;
429
kev->axis_data[0] = xev->valuator0;
431
} else if (save_type == XI_DeviceButtonPress ||
432
save_type == XI_DeviceButtonRelease) {
433
XDeviceButtonEvent *bev = (XDeviceButtonEvent *) save;
435
bev->device_state = xev->device_state;
436
bev->axes_count = xev->num_valuators;
437
bev->first_axis = xev->first_valuator;
438
i = xev->num_valuators;
443
bev->axis_data[5] = xev->valuator5;
445
bev->axis_data[4] = xev->valuator4;
447
bev->axis_data[3] = xev->valuator3;
449
bev->axis_data[2] = xev->valuator2;
451
bev->axis_data[1] = xev->valuator1;
453
bev->axis_data[0] = xev->valuator0;
455
} else if (save_type == XI_DeviceMotionNotify) {
456
XDeviceMotionEvent *mev = (XDeviceMotionEvent *) save;
458
mev->device_state = xev->device_state;
459
mev->axes_count = xev->num_valuators;
460
mev->first_axis = xev->first_valuator;
461
i = xev->num_valuators;
466
mev->axis_data[5] = xev->valuator5;
468
mev->axis_data[4] = xev->valuator4;
470
mev->axis_data[3] = xev->valuator3;
472
mev->axis_data[2] = xev->valuator2;
474
mev->axis_data[1] = xev->valuator1;
476
mev->axis_data[0] = xev->valuator0;
478
} else if (save_type == XI_ProximityIn || save_type == XI_ProximityOut) {
479
XProximityNotifyEvent *pev = (XProximityNotifyEvent *) save;
481
pev->device_state = xev->device_state;
482
pev->axes_count = xev->num_valuators;
483
pev->first_axis = xev->first_valuator;
484
i = xev->num_valuators;
489
pev->axis_data[5] = xev->valuator5;
491
pev->axis_data[4] = xev->valuator4;
493
pev->axis_data[3] = xev->valuator3;
495
pev->axis_data[2] = xev->valuator2;
497
pev->axis_data[1] = xev->valuator1;
499
pev->axis_data[0] = xev->valuator0;
501
} else if (save_type == XI_DeviceStateNotify) {
502
XDeviceStateNotifyEvent *sev = (XDeviceStateNotifyEvent *) save;
503
XInputClass *any = (XInputClass *) & sev->data[0];
506
for (i = 0; i < sev->num_classes; i++)
507
if (any->class != ValuatorClass)
508
any = (XInputClass *) ((char *)any + any->length);
509
v = (XValuatorStatus *) any;
510
i = v->num_valuators;
511
j = xev->num_valuators;
516
v->valuators[i + 2] = xev->valuator2;
518
v->valuators[i + 1] = xev->valuator1;
520
v->valuators[i + 0] = xev->valuator0;
522
v->num_valuators += j;
526
return (ENQUEUE_EVENT);
529
case XI_DeviceFocusIn:
530
case XI_DeviceFocusOut:
532
register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
533
deviceFocus *fev = (deviceFocus *) event;
535
*ev = *((XDeviceFocusChangeEvent *) save);
536
ev->window = fev->window;
537
ev->time = fev->time;
538
ev->mode = fev->mode;
539
ev->detail = fev->detail;
540
ev->deviceid = fev->deviceid & DEVICE_BITS;
541
return (ENQUEUE_EVENT);
544
case XI_DeviceStateNotify:
546
XDeviceStateNotifyEvent *stev = (XDeviceStateNotifyEvent *) save;
547
deviceStateNotify *sev = (deviceStateNotify *) event;
551
stev->deviceid = sev->deviceid & DEVICE_BITS;
552
stev->time = sev->time;
553
stev->num_classes = Ones((Mask) sev->classes_reported & InputClassBits);
554
data = (char *)&stev->data[0];
555
if (sev->classes_reported & (1 << KeyClass)) {
556
register XKeyStatus *kstev = (XKeyStatus *) data;
558
kstev->class = KeyClass;
559
kstev->length = sizeof(XKeyStatus);
560
kstev->num_keys = sev->num_keys;
561
memcpy((char *)&kstev->keys[0], (char *)&sev->keys[0], 4);
562
data += sizeof(XKeyStatus);
564
if (sev->classes_reported & (1 << ButtonClass)) {
565
register XButtonStatus *bev = (XButtonStatus *) data;
567
bev->class = ButtonClass;
568
bev->length = sizeof(XButtonStatus);
569
bev->num_buttons = sev->num_buttons;
570
memcpy((char *)bev->buttons, (char *)sev->buttons, 4);
571
data += sizeof(XButtonStatus);
573
if (sev->classes_reported & (1 << ValuatorClass)) {
574
register XValuatorStatus *vev = (XValuatorStatus *) data;
576
vev->class = ValuatorClass;
577
vev->length = sizeof(XValuatorStatus);
578
vev->num_valuators = sev->num_valuators;
579
vev->mode = sev->classes_reported >> ModeBitsShift;
580
j = sev->num_valuators;
585
vev->valuators[2] = sev->valuator2;
587
vev->valuators[1] = sev->valuator1;
589
vev->valuators[0] = sev->valuator0;
591
data += sizeof(XValuatorStatus);
593
if (sev->deviceid & MORE_EVENTS)
594
return (DONT_ENQUEUE);
597
stev = (XDeviceStateNotifyEvent *) re;
598
return (ENQUEUE_EVENT);
602
case XI_DeviceKeystateNotify:
605
XInputClass *anyclass;
606
register XKeyStatus *kv;
607
deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event;
608
XDeviceStateNotifyEvent *kstev = (XDeviceStateNotifyEvent *) save;
610
anyclass = (XInputClass *) & kstev->data[0];
611
for (i = 0; i < kstev->num_classes; i++)
612
if (anyclass->class == KeyClass)
615
anyclass = (XInputClass *) ((char *)anyclass +
618
kv = (XKeyStatus *) anyclass;
620
memcpy((char *)&kv->keys[4], (char *)ksev->keys, 28);
621
if (ksev->deviceid & MORE_EVENTS)
622
return (DONT_ENQUEUE);
625
kstev = (XDeviceStateNotifyEvent *) re;
626
return (ENQUEUE_EVENT);
630
case XI_DeviceButtonstateNotify:
633
XInputClass *anyclass;
634
register XButtonStatus *bv;
635
deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event;
636
XDeviceStateNotifyEvent *bstev = (XDeviceStateNotifyEvent *) save;
638
anyclass = (XInputClass *) & bstev->data[0];
639
for (i = 0; i < bstev->num_classes; i++)
640
if (anyclass->class == ButtonClass)
643
anyclass = (XInputClass *) ((char *)anyclass +
646
bv = (XButtonStatus *) anyclass;
647
bv->num_buttons = 256;
648
memcpy((char *)&bv->buttons[4], (char *)bsev->buttons, 28);
649
if (bsev->deviceid & MORE_EVENTS)
650
return (DONT_ENQUEUE);
653
bstev = (XDeviceStateNotifyEvent *) re;
654
return (ENQUEUE_EVENT);
658
case XI_DeviceMappingNotify:
660
register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
661
deviceMappingNotify *ev2 = (deviceMappingNotify *) event;
663
*ev = *((XDeviceMappingEvent *) save);
665
ev->first_keycode = ev2->firstKeyCode;
666
ev->request = ev2->request;
667
ev->count = ev2->count;
668
ev->time = ev2->time;
669
ev->deviceid = ev2->deviceid & DEVICE_BITS;
670
return (ENQUEUE_EVENT);
673
case XI_ChangeDeviceNotify:
675
register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
676
changeDeviceNotify *ev2 = (changeDeviceNotify *) event;
678
*ev = *((XChangeDeviceNotifyEvent *) save);
680
ev->request = ev2->request;
681
ev->time = ev2->time;
682
ev->deviceid = ev2->deviceid & DEVICE_BITS;
683
return (ENQUEUE_EVENT);
687
case XI_DevicePresenceNotify:
689
XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re;
690
devicePresenceNotify *ev2 = (devicePresenceNotify *) event;
692
*ev = *(XDevicePresenceNotifyEvent *) save;
694
ev->time = ev2->time;
695
ev->devchange = ev2->devchange;
696
ev->deviceid = ev2->deviceid;
697
ev->control = ev2->control;
698
return (ENQUEUE_EVENT);
702
case XI_DevicePropertyNotify:
705
XDevicePropertyNotifyEvent* ev = (XDevicePropertyNotifyEvent*)re;
706
devicePropertyNotify *ev2 = (devicePropertyNotify*)event;
708
*ev = *(XDevicePropertyNotifyEvent*)save;
709
ev->time = ev2->time;
710
ev->deviceid = ev2->deviceid;
711
ev->atom = ev2->atom;
712
ev->state = ev2->state;
713
return ENQUEUE_EVENT;
408
/* Process traditional events */
409
if (type != GenericEvent)
412
case XI_DeviceMotionNotify:
414
register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) save;
415
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
417
ev->root = ev2->root;
418
ev->window = ev2->event;
419
ev->subwindow = ev2->child;
420
ev->time = ev2->time;
421
ev->x_root = ev2->root_x;
422
ev->y_root = ev2->root_y;
423
ev->x = ev2->event_x;
424
ev->y = ev2->event_y;
425
ev->state = ev2->state;
426
ev->same_screen = ev2->same_screen;
427
ev->is_hint = ev2->detail;
428
ev->deviceid = ev2->deviceid & DEVICE_BITS;
429
return (DONT_ENQUEUE);
432
case XI_DeviceKeyPress:
433
case XI_DeviceKeyRelease:
435
register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) save;
436
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
438
ev->root = ev2->root;
439
ev->window = ev2->event;
440
ev->subwindow = ev2->child;
441
ev->time = ev2->time;
442
ev->x_root = ev2->root_x;
443
ev->y_root = ev2->root_y;
444
ev->x = ev2->event_x;
445
ev->y = ev2->event_y;
446
ev->state = ev2->state;
447
ev->same_screen = ev2->same_screen;
448
ev->keycode = ev2->detail;
449
ev->deviceid = ev2->deviceid & DEVICE_BITS;
450
if (ev2->deviceid & MORE_EVENTS)
451
return (DONT_ENQUEUE);
454
return (ENQUEUE_EVENT);
458
case XI_DeviceButtonPress:
459
case XI_DeviceButtonRelease:
461
register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) save;
462
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
464
ev->root = ev2->root;
465
ev->window = ev2->event;
466
ev->subwindow = ev2->child;
467
ev->time = ev2->time;
468
ev->x_root = ev2->root_x;
469
ev->y_root = ev2->root_y;
470
ev->x = ev2->event_x;
471
ev->y = ev2->event_y;
472
ev->state = ev2->state;
473
ev->same_screen = ev2->same_screen;
474
ev->button = ev2->detail;
475
ev->deviceid = ev2->deviceid & DEVICE_BITS;
476
if (ev2->deviceid & MORE_EVENTS)
477
return (DONT_ENQUEUE);
480
return (ENQUEUE_EVENT);
485
case XI_ProximityOut:
487
register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) save;
488
deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
490
ev->root = ev2->root;
491
ev->window = ev2->event;
492
ev->subwindow = ev2->child;
493
ev->time = ev2->time;
494
ev->x_root = ev2->root_x;
495
ev->y_root = ev2->root_y;
496
ev->x = ev2->event_x;
497
ev->y = ev2->event_y;
498
ev->state = ev2->state;
499
ev->same_screen = ev2->same_screen;
500
ev->deviceid = ev2->deviceid & DEVICE_BITS;
501
if (ev2->deviceid & MORE_EVENTS)
502
return (DONT_ENQUEUE);
505
return (ENQUEUE_EVENT);
509
case XI_DeviceValuator:
511
deviceValuator *xev = (deviceValuator *) event;
512
int save_type = save->type - info->codes->first_event;
514
if (save_type == XI_DeviceKeyPress || save_type == XI_DeviceKeyRelease) {
515
XDeviceKeyEvent *kev = (XDeviceKeyEvent *) save;
517
kev->device_state = xev->device_state;
518
kev->axes_count = xev->num_valuators;
519
kev->first_axis = xev->first_valuator;
520
i = xev->num_valuators;
525
kev->axis_data[5] = xev->valuator5;
527
kev->axis_data[4] = xev->valuator4;
529
kev->axis_data[3] = xev->valuator3;
531
kev->axis_data[2] = xev->valuator2;
533
kev->axis_data[1] = xev->valuator1;
535
kev->axis_data[0] = xev->valuator0;
537
} else if (save_type == XI_DeviceButtonPress ||
538
save_type == XI_DeviceButtonRelease) {
539
XDeviceButtonEvent *bev = (XDeviceButtonEvent *) save;
541
bev->device_state = xev->device_state;
542
bev->axes_count = xev->num_valuators;
543
bev->first_axis = xev->first_valuator;
544
i = xev->num_valuators;
549
bev->axis_data[5] = xev->valuator5;
551
bev->axis_data[4] = xev->valuator4;
553
bev->axis_data[3] = xev->valuator3;
555
bev->axis_data[2] = xev->valuator2;
557
bev->axis_data[1] = xev->valuator1;
559
bev->axis_data[0] = xev->valuator0;
561
} else if (save_type == XI_DeviceMotionNotify) {
562
XDeviceMotionEvent *mev = (XDeviceMotionEvent *) save;
564
mev->device_state = xev->device_state;
565
mev->axes_count = xev->num_valuators;
566
mev->first_axis = xev->first_valuator;
567
i = xev->num_valuators;
572
mev->axis_data[5] = xev->valuator5;
574
mev->axis_data[4] = xev->valuator4;
576
mev->axis_data[3] = xev->valuator3;
578
mev->axis_data[2] = xev->valuator2;
580
mev->axis_data[1] = xev->valuator1;
582
mev->axis_data[0] = xev->valuator0;
584
} else if (save_type == XI_ProximityIn || save_type == XI_ProximityOut) {
585
XProximityNotifyEvent *pev = (XProximityNotifyEvent *) save;
587
pev->device_state = xev->device_state;
588
pev->axes_count = xev->num_valuators;
589
pev->first_axis = xev->first_valuator;
590
i = xev->num_valuators;
595
pev->axis_data[5] = xev->valuator5;
597
pev->axis_data[4] = xev->valuator4;
599
pev->axis_data[3] = xev->valuator3;
601
pev->axis_data[2] = xev->valuator2;
603
pev->axis_data[1] = xev->valuator1;
605
pev->axis_data[0] = xev->valuator0;
607
} else if (save_type == XI_DeviceStateNotify) {
608
XDeviceStateNotifyEvent *sev = (XDeviceStateNotifyEvent *) save;
609
XInputClass *any = (XInputClass *) & sev->data[0];
612
for (i = 0; i < sev->num_classes; i++)
613
if (any->class != ValuatorClass)
614
any = (XInputClass *) ((char *)any + any->length);
615
v = (XValuatorStatus *) any;
616
i = v->num_valuators;
617
j = xev->num_valuators;
622
v->valuators[i + 2] = xev->valuator2;
624
v->valuators[i + 1] = xev->valuator1;
626
v->valuators[i + 0] = xev->valuator0;
628
v->num_valuators += j;
632
return (ENQUEUE_EVENT);
635
case XI_DeviceFocusIn:
636
case XI_DeviceFocusOut:
638
register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
639
deviceFocus *fev = (deviceFocus *) event;
641
*ev = *((XDeviceFocusChangeEvent *) save);
642
ev->window = fev->window;
643
ev->time = fev->time;
644
ev->mode = fev->mode;
645
ev->detail = fev->detail;
646
ev->deviceid = fev->deviceid & DEVICE_BITS;
647
return (ENQUEUE_EVENT);
650
case XI_DeviceStateNotify:
652
XDeviceStateNotifyEvent *stev = (XDeviceStateNotifyEvent *) save;
653
deviceStateNotify *sev = (deviceStateNotify *) event;
657
stev->deviceid = sev->deviceid & DEVICE_BITS;
658
stev->time = sev->time;
659
stev->num_classes = Ones((Mask) sev->classes_reported & InputClassBits);
660
data = (char *)&stev->data[0];
661
if (sev->classes_reported & (1 << KeyClass)) {
662
register XKeyStatus *kstev = (XKeyStatus *) data;
664
kstev->class = KeyClass;
665
kstev->length = sizeof(XKeyStatus);
666
kstev->num_keys = sev->num_keys;
667
memcpy((char *)&kstev->keys[0], (char *)&sev->keys[0], 4);
668
data += sizeof(XKeyStatus);
670
if (sev->classes_reported & (1 << ButtonClass)) {
671
register XButtonStatus *bev = (XButtonStatus *) data;
673
bev->class = ButtonClass;
674
bev->length = sizeof(XButtonStatus);
675
bev->num_buttons = sev->num_buttons;
676
memcpy((char *)bev->buttons, (char *)sev->buttons, 4);
677
data += sizeof(XButtonStatus);
679
if (sev->classes_reported & (1 << ValuatorClass)) {
680
register XValuatorStatus *vev = (XValuatorStatus *) data;
682
vev->class = ValuatorClass;
683
vev->length = sizeof(XValuatorStatus);
684
vev->num_valuators = sev->num_valuators;
685
vev->mode = sev->classes_reported >> ModeBitsShift;
686
j = sev->num_valuators;
691
vev->valuators[2] = sev->valuator2;
693
vev->valuators[1] = sev->valuator1;
695
vev->valuators[0] = sev->valuator0;
697
data += sizeof(XValuatorStatus);
699
if (sev->deviceid & MORE_EVENTS)
700
return (DONT_ENQUEUE);
703
stev = (XDeviceStateNotifyEvent *) re;
704
return (ENQUEUE_EVENT);
708
case XI_DeviceKeystateNotify:
711
XInputClass *anyclass;
712
register XKeyStatus *kv;
713
deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event;
714
XDeviceStateNotifyEvent *kstev = (XDeviceStateNotifyEvent *) save;
716
anyclass = (XInputClass *) & kstev->data[0];
717
for (i = 0; i < kstev->num_classes; i++)
718
if (anyclass->class == KeyClass)
721
anyclass = (XInputClass *) ((char *)anyclass +
724
kv = (XKeyStatus *) anyclass;
726
memcpy((char *)&kv->keys[4], (char *)ksev->keys, 28);
727
if (ksev->deviceid & MORE_EVENTS)
728
return (DONT_ENQUEUE);
731
kstev = (XDeviceStateNotifyEvent *) re;
732
return (ENQUEUE_EVENT);
736
case XI_DeviceButtonstateNotify:
739
XInputClass *anyclass;
740
register XButtonStatus *bv;
741
deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event;
742
XDeviceStateNotifyEvent *bstev = (XDeviceStateNotifyEvent *) save;
744
anyclass = (XInputClass *) & bstev->data[0];
745
for (i = 0; i < bstev->num_classes; i++)
746
if (anyclass->class == ButtonClass)
749
anyclass = (XInputClass *) ((char *)anyclass +
752
bv = (XButtonStatus *) anyclass;
753
bv->num_buttons = 256;
754
memcpy((char *)&bv->buttons[4], (char *)bsev->buttons, 28);
755
if (bsev->deviceid & MORE_EVENTS)
756
return (DONT_ENQUEUE);
759
bstev = (XDeviceStateNotifyEvent *) re;
760
return (ENQUEUE_EVENT);
764
case XI_DeviceMappingNotify:
766
register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
767
deviceMappingNotify *ev2 = (deviceMappingNotify *) event;
769
*ev = *((XDeviceMappingEvent *) save);
771
ev->first_keycode = ev2->firstKeyCode;
772
ev->request = ev2->request;
773
ev->count = ev2->count;
774
ev->time = ev2->time;
775
ev->deviceid = ev2->deviceid & DEVICE_BITS;
776
return (ENQUEUE_EVENT);
779
case XI_ChangeDeviceNotify:
781
register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
782
changeDeviceNotify *ev2 = (changeDeviceNotify *) event;
784
*ev = *((XChangeDeviceNotifyEvent *) save);
786
ev->request = ev2->request;
787
ev->time = ev2->time;
788
ev->deviceid = ev2->deviceid & DEVICE_BITS;
789
return (ENQUEUE_EVENT);
793
case XI_DevicePresenceNotify:
795
XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re;
796
devicePresenceNotify *ev2 = (devicePresenceNotify *) event;
798
*ev = *(XDevicePresenceNotifyEvent *) save;
800
ev->time = ev2->time;
801
ev->devchange = ev2->devchange;
802
ev->deviceid = ev2->deviceid;
803
ev->control = ev2->control;
804
return (ENQUEUE_EVENT);
807
case XI_DevicePropertyNotify:
809
XDevicePropertyNotifyEvent* ev = (XDevicePropertyNotifyEvent*)re;
810
devicePropertyNotify *ev2 = (devicePropertyNotify*)event;
812
*ev = *(XDevicePropertyNotifyEvent*)save;
813
ev->time = ev2->time;
814
ev->deviceid = ev2->deviceid;
815
ev->atom = ev2->atom;
816
ev->state = ev2->state;
817
return ENQUEUE_EVENT;
821
printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type);
718
printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type);
722
825
return (DONT_ENQUEUE);
828
static void xge_copy_to_cookie(xGenericEvent* ev,
829
XGenericEventCookie *cookie)
831
cookie->type = ev->type;
832
cookie->evtype = ev->evtype;
833
cookie->extension = ev->extension;
839
XGenericEventCookie *cookie,
842
XExtDisplayInfo *info = XInput_find_display(dpy);
843
XEvent *save = (XEvent *) info->data;
844
xGenericEvent* ge = (xGenericEvent*)event;
846
if (ge->extension != info->codes->major_opcode)
848
printf("XInputWireToCookie: wrong extension opcode %d\n",
854
save->type = event->u.u.type;
855
((XAnyEvent*)save)->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
856
((XAnyEvent*)save)->send_event = ((event->u.u.type & 0x80) != 0);
857
((XAnyEvent*)save)->display = dpy;
859
xge_copy_to_cookie((xGenericEvent*)event, (XGenericEventCookie*)save);
864
case XI_ButtonRelease:
867
*cookie = *(XGenericEventCookie*)save;
868
if (!wireToDeviceEvent((xXIDeviceEvent*)event, cookie))
870
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
874
return ENQUEUE_EVENT;
875
case XI_DeviceChanged:
876
*cookie = *(XGenericEventCookie*)save;
877
if (!wireToDeviceChangedEvent((xXIDeviceChangedEvent*)event, cookie))
879
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
883
return ENQUEUE_EVENT;
884
case XI_HierarchyChanged:
885
*cookie = *(XGenericEventCookie*)save;
886
if (!wireToHierarchyChangedEvent((xXIHierarchyEvent*)event, cookie))
888
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
892
return ENQUEUE_EVENT;
895
case XI_RawKeyRelease:
896
case XI_RawButtonPress:
897
case XI_RawButtonRelease:
899
*cookie = *(XGenericEventCookie*)save;
900
if (!wireToRawEvent((xXIRawEvent*)event, cookie))
902
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
906
return ENQUEUE_EVENT;
911
*cookie = *(XGenericEventCookie*)save;
912
if (!wireToEnterLeave((xXIEnterEvent*)event, cookie))
914
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
918
return ENQUEUE_EVENT;
919
case XI_PropertyEvent:
920
*cookie = *(XGenericEventCookie*)save;
921
if (!wireToPropertyEvent((xXIPropertyEvent*)event, cookie))
923
printf("XInputWireToCookie: CONVERSION FAILURE! evtype=%d\n",
927
return ENQUEUE_EVENT;
929
printf("XInputWireToCookie: Unknown generic event. type %d\n", ge->evtype);
936
* Calculate length in bytes needed for the device event with the given
937
* button mask length, valuator mask length + valuator mask. All parameters
941
sizeDeviceEvent(int buttons_len, int valuators_len,
942
unsigned char *valuators_mask)
946
len = sizeof(XIDeviceEvent);
947
len += sizeof(XIButtonState) + buttons_len;
948
len += sizeof(XIValuatorState) + valuators_len;
949
len += count_bits(valuators_mask, valuators_len) * sizeof(double);
950
len += sizeof(XIModifierState) + sizeof(XIGroupState);
956
* Return the size in bytes required to store the matching class type
957
* num_elements is num_buttons for XIButtonClass or num_keycodes for
960
* Also used from copy_classes in XIQueryDevice.c
963
sizeDeviceClassType(int type, int num_elements)
969
l = sizeof(XIButtonClassInfo);
970
l += num_elements * sizeof(Atom);
971
l += ((((num_elements + 7)/8) + 3)/4) * 4;
974
l = sizeof(XIKeyClassInfo);
975
l += num_elements * sizeof(int);
977
case XIValuatorClass:
978
l = sizeof(XIValuatorClassInfo);
981
printf("sizeDeviceClassType: unknown type %d\n", type);
988
copyHierarchyEvent(XGenericEventCookie *cookie_in,
989
XGenericEventCookie *cookie_out)
991
XIHierarchyEvent *in, *out;
994
in = cookie_in->data;
996
ptr = cookie_out->data = malloc(sizeof(XIHierarchyEvent) +
997
in->num_info * sizeof(XIHierarchyInfo));
1001
out = next_block(&ptr, sizeof(XIHierarchyEvent));
1003
out->info = next_block(&ptr, in->num_info * sizeof(XIHierarchyInfo));
1004
memcpy(out->info, in->info, in->num_info * sizeof(XIHierarchyInfo));
1010
copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
1011
XGenericEventCookie *out_cookie)
1014
XIDeviceChangedEvent *in, *out;
1015
XIAnyClassInfo *any;
1018
in = in_cookie->data;
1020
len = sizeof(XIDeviceChangedEvent);
1021
len += in->num_classes * sizeof(XIAnyClassInfo*);
1023
for (i = 0; i < in->num_classes; i++)
1025
any = in->classes[i];
1029
len += sizeDeviceClassType(XIButtonClass,
1030
((XIButtonClassInfo*)any)->num_buttons);
1033
len += sizeDeviceClassType(XIKeyClass,
1034
((XIKeyClassInfo*)any)->num_keycodes);
1036
case XIValuatorClass:
1037
len += sizeDeviceClassType(XIValuatorClass, 0);
1040
printf("copyDeviceChangedEvent: unknown type %d\n",
1047
ptr = out_cookie->data = malloc(len);
1050
out = next_block(&ptr, sizeof(XIDeviceChangedEvent));
1053
out->classes = next_block(&ptr,
1054
out->num_classes * sizeof(XIAnyClassInfo*));
1056
for (i = 0; i < in->num_classes; i++)
1058
any = in->classes[i];
1064
XIButtonClassInfo *bin, *bout;
1065
bin = (XIButtonClassInfo*)any;
1066
bout = next_block(&ptr, sizeof(XIButtonClass));
1069
bout->state.mask = next_block(&ptr, bout->state.mask_len);
1070
memcpy(bout->state.mask, bin->state.mask,
1071
bout->state.mask_len);
1073
bout->labels = next_block(&ptr, bout->num_buttons * sizeof(Atom));
1074
memcpy(bout->labels, bin->labels, bout->num_buttons * sizeof(Atom));
1075
out->classes[i] = (XIAnyClassInfo*)bout;
1080
XIKeyClassInfo *kin, *kout;
1081
kin = (XIKeyClassInfo*)any;
1083
kout = next_block(&ptr, sizeof(XIKeyClass));
1085
kout->keycodes = next_block(&ptr, kout->num_keycodes * sizeof(int));
1086
memcpy(kout->keycodes, kin->keycodes, kout->num_keycodes * sizeof(int));
1087
out->classes[i] = (XIAnyClassInfo*)kout;
1090
case XIValuatorClass:
1092
XIValuatorClassInfo *vin, *vout;
1093
vin = (XIValuatorClassInfo*)any;
1094
vout = next_block(&ptr, sizeof(XIValuatorClass));
1096
out->classes[i] = (XIAnyClassInfo*)vout;
1106
copyDeviceEvent(XGenericEventCookie *cookie_in,
1107
XGenericEventCookie *cookie_out)
1110
XIDeviceEvent *in, *out;
1111
int bits; /* valuator bits */
1114
in = cookie_in->data;
1115
bits = count_bits(in->valuators.mask, in->valuators.mask_len);
1117
len = sizeDeviceEvent(in->buttons.mask_len, in->valuators.mask_len,
1118
in->valuators.mask);
1120
ptr = cookie_out->data = malloc(len);
1124
out = next_block(&ptr, sizeof(XIDeviceEvent));
1127
out->buttons.mask = next_block(&ptr, in->buttons.mask_len);
1128
memcpy(out->buttons.mask, in->buttons.mask,
1129
out->buttons.mask_len);
1130
out->valuators.mask = next_block(&ptr, in->valuators.mask_len);
1131
memcpy(out->valuators.mask, in->valuators.mask,
1132
out->valuators.mask_len);
1133
out->valuators.values = next_block(&ptr, bits * sizeof(double));
1134
memcpy(out->valuators.values, in->valuators.values,
1135
bits * sizeof(double));
1141
copyEnterEvent(XGenericEventCookie *cookie_in,
1142
XGenericEventCookie *cookie_out)
1145
XIEnterEvent *in, *out;
1148
in = cookie_in->data;
1150
len = sizeof(XIEnterEvent) + in->buttons.mask_len;
1152
ptr = cookie_out->data = malloc(len);
1156
out = next_block(&ptr, sizeof(XIEnterEvent));
1159
out->buttons.mask = next_block(&ptr, in->buttons.mask_len);
1160
memcpy(out->buttons.mask, in->buttons.mask, out->buttons.mask_len);
1166
copyPropertyEvent(XGenericEventCookie *cookie_in,
1167
XGenericEventCookie *cookie_out)
1169
XIPropertyEvent *in, *out;
1171
in = cookie_in->data;
1173
out = cookie_out->data = malloc(sizeof(XIPropertyEvent));
1182
copyRawEvent(XGenericEventCookie *cookie_in,
1183
XGenericEventCookie *cookie_out)
1185
XIRawEvent *in, *out;
1190
in = cookie_in->data;
1192
bits = count_bits(in->valuators.mask, in->valuators.mask_len);
1193
len = sizeof(XIRawEvent) + in->valuators.mask_len;
1194
len += bits * sizeof(double) * 2;
1196
ptr = cookie_out->data = malloc(sizeof(XIRawEvent));
1200
out = next_block(&ptr, sizeof(XIRawEvent));
1202
out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
1203
memcpy(out->valuators.mask, in->valuators.mask, out->valuators.mask_len);
1205
out->valuators.values = next_block(&ptr, bits * sizeof(double));
1206
memcpy(out->valuators.values, in->valuators.values, bits * sizeof(double));
1208
out->raw_values = next_block(&ptr, bits * sizeof(double));
1209
memcpy(out->raw_values, in->raw_values, bits * sizeof(double));
1217
XInputCopyCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out)
1221
XExtDisplayInfo *info = XInput_find_display(dpy);
1223
if (in->extension != info->codes->major_opcode)
1225
printf("XInputCopyCookie: wrong extension opcode %d\n",
1234
switch(in->evtype) {
1236
case XI_ButtonPress:
1237
case XI_ButtonRelease:
1240
ret = copyDeviceEvent(in, out);
1242
case XI_DeviceChanged:
1243
ret = copyDeviceChangedEvent(in, out);
1245
case XI_HierarchyChanged:
1246
ret = copyHierarchyEvent(in, out);
1252
ret = copyEnterEvent(in, out);
1254
case XI_PropertyEvent:
1255
ret = copyPropertyEvent(in, out);
1257
case XI_RawKeyPress:
1258
case XI_RawKeyRelease:
1259
case XI_RawButtonPress:
1260
case XI_RawButtonRelease:
1262
ret = copyRawEvent(in, out);
1265
printf("XInputCopyCookie: unknown evtype %d\n", in->evtype);
1270
printf("XInputCopyCookie: Failed to copy evtype %d", in->evtype);
1275
wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* cookie)
1283
ptr = (unsigned char*)&in[1] + in->buttons_len * 4;
1285
len = sizeDeviceEvent(in->buttons_len * 4, in->valuators_len * 4, ptr);
1287
cookie->data = ptr_lib = malloc(len);
1289
out = next_block(&ptr_lib, sizeof(XIDeviceEvent));
1290
out->type = in->type;
1291
out->extension = in->extension;
1292
out->evtype = in->evtype;
1293
out->send_event = ((in->type & 0x80) != 0);
1294
out->time = in->time;
1295
out->deviceid = in->deviceid;
1296
out->sourceid = in->sourceid;
1297
out->detail = in->detail;
1298
out->root = in->root;
1299
out->event = in->event;
1300
out->child = in->child;
1301
out->root_x = FP1616toDBL(in->root_x);
1302
out->root_y = FP1616toDBL(in->root_y);
1303
out->event_x = FP1616toDBL(in->event_x);
1304
out->event_y = FP1616toDBL(in->event_y);
1305
out->flags = in->flags;
1306
out->mods.base = in->mods.base_mods;
1307
out->mods.locked = in->mods.locked_mods;
1308
out->mods.latched = in->mods.latched_mods;
1309
out->mods.effective = in->mods.effective_mods;
1310
out->group.base = in->group.base_group;
1311
out->group.locked = in->group.locked_group;
1312
out->group.latched = in->group.latched_group;
1313
out->group.effective = in->group.effective_group;
1314
out->buttons.mask_len = in->buttons_len * 4;
1315
out->valuators.mask_len = in->valuators_len * 4;
1317
out->buttons.mask = next_block(&ptr_lib, out->buttons.mask_len);
1320
ptr = (unsigned char*)&in[1];
1321
memcpy(out->buttons.mask, ptr, out->buttons.mask_len);
1322
ptr += in->buttons_len * 4;
1325
out->valuators.mask = next_block(&ptr_lib, out->valuators.mask_len);
1326
memcpy(out->valuators.mask, ptr, out->valuators.mask_len);
1327
ptr += in->valuators_len * 4;
1329
len = count_bits(out->valuators.mask, out->valuators.mask_len);
1330
out->valuators.values = next_block(&ptr_lib, len * sizeof(double));
1332
values = (FP3232*)ptr;
1333
for (i = 0; i < len; i++, values++)
1335
out->valuators.values[i] = values->integral;
1336
out->valuators.values[i] += ((double)values->frac / (1 << 16) / (1 << 16));
1344
size_classes(xXIAnyInfo* from, int nclasses)
1347
xXIAnyInfo *any_wire;
1350
len = nclasses * sizeof(XIAnyClassInfo*); /* len for to->classes */
1351
ptr_wire = (char*)from;
1352
for (i = 0; i < nclasses; i++)
1355
any_wire = (xXIAnyInfo*)ptr_wire;
1356
switch(any_wire->type)
1359
l = sizeDeviceClassType(XIButtonClass,
1360
((xXIButtonInfo*)any_wire)->num_buttons);
1363
l = sizeDeviceClassType(XIKeyClass,
1364
((xXIKeyInfo*)any_wire)->num_keycodes);
1366
case XIValuatorClass:
1367
l = sizeDeviceClassType(XIValuatorClass, 0);
1372
ptr_wire += any_wire->length * 4;
1378
/* Copy classes from any into to->classes and return the number of bytes
1379
* copied. Memory layout of to->classes is
1380
* [clsptr][clsptr][clsptr][classinfo][classinfo]...
1381
* |________|___________^
1382
* |______________________^
1385
copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses)
1387
XIAnyClassInfo *any_lib;
1388
xXIAnyInfo *any_wire;
1396
ptr_wire = (char*)from;
1397
ptr_lib = to->classes;
1398
to->classes = next_block(&ptr_lib, nclasses * sizeof(XIAnyClassInfo*));
1399
len = 0; /* count wire length */
1401
for (i = 0; i < nclasses; i++)
1403
any_lib = (XIAnyClassInfo*)ptr_lib;
1404
any_wire = (xXIAnyInfo*)ptr_wire;
1406
to->classes[i] = any_lib;
1407
any_lib->type = any_wire->type;
1408
any_lib->sourceid = any_wire->sourceid;
1409
switch(any_wire->type)
1413
XIButtonClassInfo *cls_lib;
1414
xXIButtonInfo *cls_wire;
1418
cls_lib = next_block(&ptr_lib, sizeof(XIButtonClassInfo));
1419
cls_wire = (xXIButtonInfo*)any_wire;
1421
cls_lib->num_buttons = cls_wire->num_buttons;
1422
cls_lib->state.mask_len = ((((cls_wire->num_buttons + 7)/8) + 3)/4) * 4;
1423
cls_lib->state.mask = next_block(&ptr_lib, cls_lib->state.mask_len);
1424
memcpy(cls_lib->state.mask, &cls_wire[1],
1425
cls_lib->state.mask_len);
1427
cls_lib->labels = next_block(&ptr_lib, cls_lib->num_buttons * sizeof(Atom));
1428
atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
1429
for (j = 0; j < cls_lib->num_buttons; j++)
1430
cls_lib->labels[j] = *atoms++;
1436
XIKeyClassInfo *cls_lib;
1437
xXIKeyInfo *cls_wire;
1439
cls_lib = next_block(&ptr_lib, sizeof(XIKeyClassInfo));
1440
cls_wire = (xXIKeyInfo*)any_wire;
1442
cls_lib->num_keycodes = cls_wire->num_keycodes;
1443
cls_lib->keycodes = next_block(&ptr_lib,
1444
cls_lib->num_keycodes * sizeof(int));
1445
memcpy(cls_lib->keycodes, &cls_wire[1],
1446
cls_lib->num_keycodes);
1450
case XIValuatorClass:
1452
XIValuatorClassInfo *cls_lib;
1453
xXIValuatorInfo *cls_wire;
1455
cls_lib = next_block(&ptr_lib, sizeof(XIValuatorClassInfo));
1456
cls_wire = (xXIValuatorInfo*)any_wire;
1458
cls_lib->number = cls_wire->number;
1459
cls_lib->label = cls_wire->label;
1460
cls_lib->resolution = cls_wire->resolution;
1461
cls_lib->min = cls_wire->min.integral;
1462
cls_lib->max = cls_wire->max.integral;
1463
cls_lib->value = cls_wire->value.integral;
1464
/* FIXME: fractional parts */
1465
cls_lib->mode = cls_wire->mode;
1470
len += any_wire->length * 4;
1471
ptr_wire += any_wire->length * 4;
1478
wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
1480
XIDeviceChangedEvent *out;
1484
len = size_classes((xXIAnyInfo*)&in[1], in->num_classes);
1486
cookie->data = out = malloc(sizeof(XIDeviceChangedEvent) + len);
1488
out->type = in->type;
1489
out->extension = in->extension;
1490
out->evtype = in->evtype;
1491
out->send_event = ((in->type & 0x80) != 0);
1492
out->time = in->time;
1493
out->deviceid = in->deviceid;
1494
out->sourceid = in->sourceid;
1495
out->reason = in->reason;
1496
out->num_classes = in->num_classes;
1498
out->classes = (XIAnyClassInfo**)&out[1];
1500
info.classes = out->classes;
1502
copy_classes(&info, (xXIAnyInfo*)&in[1], in->num_classes);
1508
wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
1511
XIHierarchyInfo *info_out;
1512
xXIHierarchyInfo *info_in;
1513
XIHierarchyEvent *out;
1515
cookie->data = out = malloc(sizeof(XIHierarchyEvent) + in->num_info * sizeof(XIHierarchyInfo));;
1517
out->info = (XIHierarchyInfo*)&out[1];
1518
out->type = in->type;
1519
out->extension = in->extension;
1520
out->evtype = in->evtype;
1521
out->send_event = ((in->type & 0x80) != 0);
1522
out->time = in->time;
1523
out->flags = in->flags;
1524
out->num_info = in->num_info;
1526
info_out = out->info;
1527
info_in = (xXIHierarchyInfo*)&in[1];
1529
for (i = 0; i < out->num_info; i++, info_out++, info_in++)
1531
info_out->deviceid = info_in->deviceid;
1532
info_out->attachment = info_in->attachment;
1533
info_out->use = info_in->use;
1534
info_out->enabled = info_in->enabled;
1535
info_out->flags = info_in->flags;
1542
wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie)
1550
len = sizeof(XIRawEvent) + in->valuators_len * 4;
1551
bits = count_bits((unsigned char*)&in[1], in->valuators_len * 4);
1552
len += bits * sizeof(double) * 2; /* raw + normal */
1554
cookie->data = ptr = calloc(1, len);
1558
out = next_block(&ptr, sizeof(XIRawEvent));
1559
out->type = in->type;
1560
out->extension = in->extension;
1561
out->evtype = in->evtype;
1562
out->send_event = ((in->type & 0x80) != 0);
1563
out->time = in->time;
1564
out->detail = in->detail;
1565
out->deviceid = in->deviceid;
1566
out->flags = in->flags;
1568
out->valuators.mask_len = in->valuators_len * 4;
1569
out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
1570
memcpy(out->valuators.mask, &in[1], out->valuators.mask_len);
1572
out->valuators.values = next_block(&ptr, bits * sizeof(double));
1573
out->raw_values = next_block(&ptr, bits * sizeof(double));
1575
values = (FP3232*)(((char*)&in[1]) + in->valuators_len * 4);
1576
for (i = 0; i < bits; i++)
1578
out->valuators.values[i] = values->integral;
1579
out->valuators.values[i] += ((double)values->frac / (1 << 16) / (1 << 16));
1580
out->raw_values[i] = (values + bits)->integral;
1581
out->valuators.values[i] += ((double)(values + bits)->frac / (1 << 16) / (1 << 16));
1588
/* Memory layout of XIEnterEvents:
1589
[event][modifiers][group][button]
1592
wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie)
1597
len = sizeof(XIEnterEvent) + in->buttons_len * 4;
1599
cookie->data = out = malloc(len);
1600
out->buttons.mask = (unsigned char*)&out[1];
1602
out->type = in->type;
1603
out->extension = in->extension;
1604
out->evtype = in->evtype;
1605
out->send_event = ((in->type & 0x80) != 0);
1606
out->time = in->time;
1607
out->detail = in->detail;
1608
out->deviceid = in->deviceid;
1609
out->root = in->root;
1610
out->event = in->event;
1611
out->child = in->child;
1612
out->sourceid = in->sourceid;
1613
out->root_x = FP1616toDBL(in->root_x);
1614
out->root_y = FP1616toDBL(in->root_y);
1615
out->event_x = FP1616toDBL(in->event_x);
1616
out->event_y = FP1616toDBL(in->event_y);
1617
out->mode = in->mode;
1618
out->focus = in->focus;
1619
out->same_screen = in->same_screen;
1621
out->mods.base = in->mods.base_mods;
1622
out->mods.locked = in->mods.locked_mods;
1623
out->mods.latched = in->mods.latched_mods;
1624
out->mods.effective = in->mods.effective_mods;
1625
out->group.base = in->group.base_group;
1626
out->group.locked = in->group.locked_group;
1627
out->group.latched = in->group.latched_group;
1628
out->group.effective = in->group.effective_group;
1630
out->buttons.mask_len = in->buttons_len * 4;
1631
memcpy(out->buttons.mask, &in[1], out->buttons.mask_len);
1637
wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie)
1639
XIPropertyEvent *out = malloc(sizeof(XIPropertyEvent));
1643
out->type = in->type;
1644
out->extension = in->extension;
1645
out->evtype = in->evtype;
1646
out->send_event = ((in->type & 0x80) != 0);
1647
out->time = in->time;
1648
out->property = in->property;
1649
out->what = in->what;
1650
out->deviceid = in->deviceid;