Lines Matching refs:in
6 * to deal in the Software without restriction, including without limitation
12 * paragraph) shall be included in all copies or substantial portions of the
37 static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
63 g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
64 g_assert(out->time == in->time);
65 g_assert(out->detail == in->detail.button);
66 g_assert(out->deviceid == in->deviceid);
67 g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
73 for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++)
75 g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
76 if (XIMaskIsSet(in->valuators.mask, i))
80 /* length is len of valuator mask (in 4-byte units) + the number of bits
90 g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
91 if (XIMaskIsSet(in->valuators.mask, i))
97 vi.integral = in->valuators.data[i];
98 vi.frac = in->valuators.data_frac[i];
114 vi.integral = in->valuators.data_raw[i];
115 vi.frac = in->valuators.data_raw_frac[i];
134 static void test_XIRawEvent(RawDeviceEvent *in)
139 rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
142 test_values_XIRawEvent(in, out, FALSE);
146 test_values_XIRawEvent(in, swapped, TRUE);
155 DeviceEvent in;
158 in.header = ET_Internal;
159 in.type = ET_Enter;
160 rc = EventToXI2((InternalEvent*)&in, &out);
164 in.header = ET_Internal;
165 in.type = ET_FocusIn;
166 rc = EventToXI2((InternalEvent*)&in, &out);
170 in.header = ET_Internal;
171 in.type = ET_FocusOut;
172 rc = EventToXI2((InternalEvent*)&in, &out);
175 in.header = ET_Internal;
176 in.type = ET_Leave;
177 rc = EventToXI2((InternalEvent*)&in, &out);
184 RawDeviceEvent in;
187 memset(&in, 0, sizeof(in));
190 in.header = ET_Internal;
191 in.type = ET_RawMotion;
192 test_XIRawEvent(&in);
194 in.header = ET_Internal;
195 in.type = ET_RawKeyPress;
196 test_XIRawEvent(&in);
198 in.header = ET_Internal;
199 in.type = ET_RawKeyRelease;
200 test_XIRawEvent(&in);
202 in.header = ET_Internal;
203 in.type = ET_RawButtonPress;
204 test_XIRawEvent(&in);
206 in.header = ET_Internal;
207 in.type = ET_RawButtonRelease;
208 test_XIRawEvent(&in);
211 in.detail.button = 1L;
212 test_XIRawEvent(&in);
213 in.detail.button = 1L << 8;
214 test_XIRawEvent(&in);
215 in.detail.button = 1L << 16;
216 test_XIRawEvent(&in);
217 in.detail.button = 1L << 24;
218 test_XIRawEvent(&in);
219 in.detail.button = ~0L;
220 test_XIRawEvent(&in);
222 in.detail.button = 0;
224 in.time = 1L;
225 test_XIRawEvent(&in);
226 in.time = 1L << 8;
227 test_XIRawEvent(&in);
228 in.time = 1L << 16;
229 test_XIRawEvent(&in);
230 in.time = 1L << 24;
231 test_XIRawEvent(&in);
232 in.time = ~0L;
233 test_XIRawEvent(&in);
235 in.deviceid = 1;
236 test_XIRawEvent(&in);
237 in.deviceid = 1 << 8;
238 test_XIRawEvent(&in);
239 in.deviceid = ~0 & 0xFF;
240 test_XIRawEvent(&in);
243 for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
245 XISetMask(in.valuators.mask, i);
246 test_XIRawEvent(&in);
247 XIClearMask(in.valuators.mask, i);
252 XISetMask(in.valuators.mask, i);
254 in.valuators.data[i] = i;
255 in.valuators.data_raw[i] = i + 10;
256 in.valuators.data_frac[i] = i + 20;
257 in.valuators.data_raw_frac[i] = i + 30;
258 test_XIRawEvent(&in);
259 XIClearMask(in.valuators.mask, i);
262 for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
264 XISetMask(in.valuators.mask, i);
265 test_XIRawEvent(&in);
269 static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
305 g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
306 g_assert(out->time == in->time);
307 g_assert(out->detail == in->detail.button);
310 g_assert(out->deviceid == in->deviceid);
311 g_assert(out->sourceid == in->sourceid);
313 switch (in->type) {
323 g_assert(out->root == in->root);
324 g_assert(out->event == None); /* set in FixUpEventFromWindow */
325 g_assert(out->child == None); /* set in FixUpEventFromWindow */
327 g_assert(out->mods.base_mods == in->mods.base);
328 g_assert(out->mods.latched_mods == in->mods.latched);
329 g_assert(out->mods.locked_mods == in->mods.locked);
330 g_assert(out->mods.effective_mods == in->mods.effective);
332 g_assert(out->group.base_group == in->group.base);
333 g_assert(out->group.latched_group == in->group.latched);
334 g_assert(out->group.locked_group == in->group.locked);
335 g_assert(out->group.effective_group == in->group.effective);
337 g_assert(out->event_x == 0); /* set in FixUpEventFromWindow */
338 g_assert(out->event_y == 0); /* set in FixUpEventFromWindow */
340 g_assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
341 g_assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
344 for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++)
346 if (XIMaskIsSet(in->buttons, i))
354 for (i = 0; i < sizeof(in->buttons) * 8; i++)
355 g_assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i));
359 for (i = 0; i < sizeof(in->valuators.mask) * 8; i++)
360 if (XIMaskIsSet(in->valuators.mask, i))
367 for (i = 0; i < sizeof(in->valuators.mask) * 8 ||
370 if (i > sizeof(in->valuators.mask) * 8)
373 g_assert(!XIMaskIsSet(in->valuators.mask, i));
375 g_assert(XIMaskIsSet(in->valuators.mask, i) ==
382 vi.integral = in->valuators.data[i];
383 vi.frac = in->valuators.data_frac[i];
403 static void test_XIDeviceEvent(DeviceEvent *in)
408 rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
411 test_values_XIDeviceEvent(in, out, FALSE);
415 test_values_XIDeviceEvent(in, swapped, TRUE);
423 DeviceEvent in;
426 memset(&in, 0, sizeof(in));
429 in.header = ET_Internal;
430 in.type = ET_Motion;
431 in.length = sizeof(DeviceEvent);
432 in.time = 0;
433 in.deviceid = 1;
434 in.sourceid = 2;
435 in.root = 3;
436 in.root_x = 4;
437 in.root_x_frac = 5;
438 in.root_y = 6;
439 in.root_y_frac = 7;
440 in.detail.button = 8;
441 in.mods.base = 9;
442 in.mods.latched = 10;
443 in.mods.locked = 11;
444 in.mods.effective = 11;
445 in.group.base = 12;
446 in.group.latched = 13;
447 in.group.locked = 14;
448 in.group.effective = 15;
450 test_XIDeviceEvent(&in);
454 in.detail.button = 1L;
455 test_XIDeviceEvent(&in);
456 in.detail.button = 1L << 8;
457 test_XIDeviceEvent(&in);
458 in.detail.button = 1L << 16;
459 test_XIDeviceEvent(&in);
460 in.detail.button = 1L << 24;
461 test_XIDeviceEvent(&in);
462 in.detail.button = ~0L;
463 test_XIDeviceEvent(&in);
466 in.time = 1L;
467 test_XIDeviceEvent(&in);
468 in.time = 1L << 8;
469 test_XIDeviceEvent(&in);
470 in.time = 1L << 16;
471 test_XIDeviceEvent(&in);
472 in.time = 1L << 24;
473 test_XIDeviceEvent(&in);
474 in.time = ~0L;
475 test_XIDeviceEvent(&in);
478 in.deviceid = 1;
479 test_XIDeviceEvent(&in);
480 in.deviceid = 1 << 8;
481 test_XIDeviceEvent(&in);
482 in.deviceid = ~0 & 0xFF;
483 test_XIDeviceEvent(&in);
486 in.sourceid = 1;
487 test_XIDeviceEvent(&in);
488 in.deviceid = 1 << 8;
489 test_XIDeviceEvent(&in);
490 in.deviceid = ~0 & 0xFF;
491 test_XIDeviceEvent(&in);
494 in.root = 1L;
495 test_XIDeviceEvent(&in);
496 in.root = 1L << 8;
497 test_XIDeviceEvent(&in);
498 in.root = 1L << 16;
499 test_XIDeviceEvent(&in);
500 in.root = 1L << 24;
501 test_XIDeviceEvent(&in);
502 in.root = ~0L;
503 test_XIDeviceEvent(&in);
506 in.root_x = 1;
507 test_XIDeviceEvent(&in);
508 in.root_x = 1 << 8;
509 test_XIDeviceEvent(&in);
510 in.root_x = ~0 & 0xFF;
511 test_XIDeviceEvent(&in);
513 in.root_x_frac = 1;
514 test_XIDeviceEvent(&in);
515 in.root_x_frac = 1 << 8;
516 test_XIDeviceEvent(&in);
517 in.root_x_frac = ~0 & 0xFF;
518 test_XIDeviceEvent(&in);
520 in.root_y = 1;
521 test_XIDeviceEvent(&in);
522 in.root_y = 1 << 8;
523 test_XIDeviceEvent(&in);
524 in.root_y = ~0 & 0xFF;
525 test_XIDeviceEvent(&in);
527 in.root_y_frac = 1;
528 test_XIDeviceEvent(&in);
529 in.root_y_frac = 1 << 8;
530 test_XIDeviceEvent(&in);
531 in.root_y_frac = ~0 & 0xFF;
532 test_XIDeviceEvent(&in);
535 in.mods.base = 1L;
536 test_XIDeviceEvent(&in);
537 in.mods.base = 1L << 8;
538 test_XIDeviceEvent(&in);
539 in.mods.base = 1L << 16;
540 test_XIDeviceEvent(&in);
541 in.mods.base = 1L << 24;
542 test_XIDeviceEvent(&in);
543 in.mods.base = ~0L;
544 test_XIDeviceEvent(&in);
546 in.mods.latched = 1L;
547 test_XIDeviceEvent(&in);
548 in.mods.latched = 1L << 8;
549 test_XIDeviceEvent(&in);
550 in.mods.latched = 1L << 16;
551 test_XIDeviceEvent(&in);
552 in.mods.latched = 1L << 24;
553 test_XIDeviceEvent(&in);
554 in.mods.latched = ~0L;
555 test_XIDeviceEvent(&in);
557 in.mods.locked = 1L;
558 test_XIDeviceEvent(&in);
559 in.mods.locked = 1L << 8;
560 test_XIDeviceEvent(&in);
561 in.mods.locked = 1L << 16;
562 test_XIDeviceEvent(&in);
563 in.mods.locked = 1L << 24;
564 test_XIDeviceEvent(&in);
565 in.mods.locked = ~0L;
566 test_XIDeviceEvent(&in);
568 in.mods.effective = 1L;
569 test_XIDeviceEvent(&in);
570 in.mods.effective = 1L << 8;
571 test_XIDeviceEvent(&in);
572 in.mods.effective = 1L << 16;
573 test_XIDeviceEvent(&in);
574 in.mods.effective = 1L << 24;
575 test_XIDeviceEvent(&in);
576 in.mods.effective = ~0L;
577 test_XIDeviceEvent(&in);
580 in.group.base = 1;
581 test_XIDeviceEvent(&in);
582 in.group.base = ~0 & 0xFF;
583 test_XIDeviceEvent(&in);
585 in.group.latched = 1;
586 test_XIDeviceEvent(&in);
587 in.group.latched = ~0 & 0xFF;
588 test_XIDeviceEvent(&in);
590 in.group.locked = 1;
591 test_XIDeviceEvent(&in);
592 in.group.locked = ~0 & 0xFF;
593 test_XIDeviceEvent(&in);
595 in.mods.effective = 1;
596 test_XIDeviceEvent(&in);
597 in.mods.effective = ~0 & 0xFF;
598 test_XIDeviceEvent(&in);
601 for (i = 0; i < sizeof(in.buttons) * 8; i++)
603 XISetMask(in.buttons, i);
604 test_XIDeviceEvent(&in);
605 XIClearMask(in.buttons, i);
608 for (i = 0; i < sizeof(in.buttons) * 8; i++)
610 XISetMask(in.buttons, i);
611 test_XIDeviceEvent(&in);
615 for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
617 XISetMask(in.valuators.mask, i);
618 test_XIDeviceEvent(&in);
619 XIClearMask(in.valuators.mask, i);
622 for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
624 XISetMask(in.valuators.mask, i);
626 in.valuators.data[i] = i;
627 in.valuators.data_frac[i] = i + 20;
628 test_XIDeviceEvent(&in);
629 XIClearMask(in.valuators.mask, i);
632 for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
634 XISetMask(in.valuators.mask, i);
635 test_XIDeviceEvent(&in);
639 static void test_values_XIDeviceChangedEvent(DeviceChangedEvent *in,
661 g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
662 g_assert(out->time == in->time);
663 g_assert(out->deviceid == in->deviceid);
664 g_assert(out->sourceid == in->sourceid);
696 g_assert(b->num_buttons == in->buttons.num_buttons);
707 g_assert(names[j] == in->buttons.names[j]);
725 g_assert(k->num_keycodes == in->keys.max_keycode -
726 in->keys.min_keycode + 1);
736 g_assert(kc[j] >= in->keys.min_keycode);
737 g_assert(kc[j] <= in->keys.max_keycode);
759 static void test_XIDeviceChangedEvent(DeviceChangedEvent *in)
764 rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
767 test_values_XIDeviceChangedEvent(in, out, FALSE);
771 test_values_XIDeviceChangedEvent(in, swapped, TRUE);
779 DeviceChangedEvent in;
783 memset(&in, 0, sizeof(in));
784 in.header = ET_Internal;
785 in.type = ET_DeviceChanged;
786 in.length = sizeof(DeviceChangedEvent);
787 in.time = 0;
788 in.deviceid = 1;
789 in.sourceid = 2;
790 in.masterid = 3;
791 in.num_valuators = 4;
792 in.flags = DEVCHANGE_SLAVE_SWITCH | DEVCHANGE_POINTER_EVENT | DEVCHANGE_KEYBOARD_EVENT;
795 in.buttons.names[i] = i + 10;
797 in.keys.min_keycode = 8;
798 in.keys.max_keycode = 255;
800 test_XIDeviceChangedEvent(&in);
802 in.time = 1L;
803 test_XIDeviceChangedEvent(&in);
804 in.time = 1L << 8;
805 test_XIDeviceChangedEvent(&in);
806 in.time = 1L << 16;
807 test_XIDeviceChangedEvent(&in);
808 in.time = 1L << 24;
809 test_XIDeviceChangedEvent(&in);
810 in.time = ~0L;
811 test_XIDeviceChangedEvent(&in);
813 in.deviceid = 1L;
814 test_XIDeviceChangedEvent(&in);
815 in.deviceid = 1L << 8;
816 test_XIDeviceChangedEvent(&in);
817 in.deviceid = ~0 & 0xFFFF;
818 test_XIDeviceChangedEvent(&in);
820 in.sourceid = 1L;
821 test_XIDeviceChangedEvent(&in);
822 in.sourceid = 1L << 8;
823 test_XIDeviceChangedEvent(&in);
824 in.sourceid = ~0 & 0xFFFF;
825 test_XIDeviceChangedEvent(&in);
827 in.masterid = 1L;
828 test_XIDeviceChangedEvent(&in);
829 in.masterid = 1L << 8;
830 test_XIDeviceChangedEvent(&in);
831 in.masterid = ~0 & 0xFFFF;
832 test_XIDeviceChangedEvent(&in);
834 in.buttons.num_buttons = 0;
835 test_XIDeviceChangedEvent(&in);
837 in.buttons.num_buttons = 1;
838 test_XIDeviceChangedEvent(&in);
840 in.buttons.num_buttons = MAX_BUTTONS;
841 test_XIDeviceChangedEvent(&in);
843 in.keys.min_keycode = 0;
844 in.keys.max_keycode = 0;
845 test_XIDeviceChangedEvent(&in);
847 in.keys.max_keycode = 1 << 8;
848 test_XIDeviceChangedEvent(&in);
850 in.keys.max_keycode = 0xFFFC; /* highest range, above that the length
852 test_XIDeviceChangedEvent(&in);
854 in.keys.min_keycode = 1 << 8;
855 in.keys.max_keycode = 1 << 8;
856 test_XIDeviceChangedEvent(&in);
858 in.keys.min_keycode = 1 << 8;
859 in.keys.max_keycode = 0;
860 test_XIDeviceChangedEvent(&in);
862 in.num_valuators = 0;
863 test_XIDeviceChangedEvent(&in);
865 in.num_valuators = 1;
866 test_XIDeviceChangedEvent(&in);
868 in.num_valuators = MAX_VALUATORS;
869 test_XIDeviceChangedEvent(&in);
873 in.valuators[i].min = 0;
874 in.valuators[i].max = 0;
875 test_XIDeviceChangedEvent(&in);
877 in.valuators[i].max = 1 << 8;
878 test_XIDeviceChangedEvent(&in);
879 in.valuators[i].max = 1 << 16;
880 test_XIDeviceChangedEvent(&in);
881 in.valuators[i].max = 1 << 24;
882 test_XIDeviceChangedEvent(&in);
883 in.valuators[i].max = abs(~0);
884 test_XIDeviceChangedEvent(&in);
886 in.valuators[i].resolution = 1 << 8;
887 test_XIDeviceChangedEvent(&in);
888 in.valuators[i].resolution = 1 << 16;
889 test_XIDeviceChangedEvent(&in);
890 in.valuators[i].resolution = 1 << 24;
891 test_XIDeviceChangedEvent(&in);
892 in.valuators[i].resolution = abs(~0);
893 test_XIDeviceChangedEvent(&in);
895 in.valuators[i].name = i;
896 test_XIDeviceChangedEvent(&in);
898 in.valuators[i].mode = Relative;
899 test_XIDeviceChangedEvent(&in);
901 in.valuators[i].mode = Absolute;
902 test_XIDeviceChangedEvent(&in);