dix/eventconvert.c | 16 ++++- exa/exa_migration_mixed.c | 17 +---- test/input.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 15 deletions(-)
New commits: commit 93a73993708b1345c86ec3ec06b02ed236595673 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Feb 21 15:40:40 2011 +1000 test: write some event → XI1 conversion tests. Don't test everything, but hey, life is short and I'm trying to have one. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> Reviewed-by: Daniel Stone <dan...@fooishbar.org> diff --git a/test/input.c b/test/input.c index 879e14f..e0e9e6a 100644 --- a/test/input.c +++ b/test/input.c @@ -36,6 +36,7 @@ #include "inputstr.h" #include "eventconvert.h" #include "exevents.h" +#include "exglobals.h" #include "dixgrabs.h" #include "eventstr.h" #include "inpututils.h" @@ -285,6 +286,143 @@ static void dix_event_to_core_conversion(void) dix_event_to_core(ET_Motion); } +static void +_dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count) +{ + xEvent *xi; + int count = 0; + int rc; + + rc = EventToXI((InternalEvent*)ev, &xi, &count); + g_assert(rc == expected_rc); + g_assert(count >= expected_count); + if (count > 0){ + deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)xi; + g_assert(kbp->type == IEventBase + ev->type); + g_assert(kbp->detail == ev->detail.key); + g_assert(kbp->time == ev->time); + g_assert((kbp->deviceid & ~MORE_EVENTS) == ev->deviceid); + g_assert(kbp->root_x == ev->root_x); + g_assert(kbp->root_y == ev->root_y); + g_assert(kbp->state == ev->corestate); + g_assert(kbp->event_x == 0); + g_assert(kbp->event_y == 0); + g_assert(kbp->root == ev->root); + g_assert(kbp->event == 0); + g_assert(kbp->child == 0); + g_assert(kbp->same_screen == FALSE); + + while (--count > 0) { + deviceValuator *v = (deviceValuator*)&xi[count]; + g_assert(v->type == DeviceValuator); + g_assert(v->num_valuators <= 6); + } + + + free(xi); + } +} + +/** + * This tests for internal event → XI1 event conversion + * - all conversions should generate the right XI event type + * - right number of events generated + * - extra events are valuators + */ +static void dix_event_to_xi1_conversion(void) +{ + DeviceEvent ev = {0}; + int time; + int x, y; + int state; + int detail; + const int ROOT_WINDOW_ID = 0x100; + int deviceid; + + IEventBase = 80; + DeviceValuator = IEventBase - 1; + DeviceKeyPress = IEventBase + ET_KeyPress; + DeviceKeyRelease = IEventBase + ET_KeyRelease; + DeviceButtonPress = IEventBase + ET_ButtonPress; + DeviceButtonRelease = IEventBase + ET_ButtonRelease; + DeviceMotionNotify = IEventBase + ET_Motion; + DeviceFocusIn = IEventBase + ET_FocusIn; + DeviceFocusOut = IEventBase + ET_FocusOut; + ProximityIn = IEventBase + ET_ProximityIn; + ProximityOut = IEventBase + ET_ProximityOut; + + /* EventToXI callocs */ + x = 0; + y = 0; + time = 12345; + state = 0; + detail = 0; + deviceid = 4; + + ev.header = 0xFF; + + ev.header = 0xFF; + ev.length = sizeof(DeviceEvent); + ev.time = time; + ev.root_y = x; + ev.root_x = y; + SetBit(ev.valuators.mask, 0); + SetBit(ev.valuators.mask, 1); + ev.root = ROOT_WINDOW_ID; + ev.corestate = state; + ev.detail.key = detail; + ev.deviceid = deviceid; + + /* test all types for bad match */ + ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 1); + + /* No axes */ + ClearBit(ev.valuators.mask, 0); + ClearBit(ev.valuators.mask, 1); + ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1); + ev.type = ET_Motion; _dix_test_xi_convert(&ev, BadMatch, 0); + ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, BadMatch, 0); + ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, BadMatch, 0); + + /* more than 6 axes → 2 valuator events */ + SetBit(ev.valuators.mask, 0); + SetBit(ev.valuators.mask, 1); + SetBit(ev.valuators.mask, 2); + SetBit(ev.valuators.mask, 3); + SetBit(ev.valuators.mask, 4); + SetBit(ev.valuators.mask, 5); + SetBit(ev.valuators.mask, 6); + ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 2); + ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 2); + + + /* keycode too high */ + ev.type = ET_KeyPress; + ev.detail.key = 256; + _dix_test_xi_convert(&ev, Success, 0); + + /* deviceid too high */ + ev.type = ET_KeyPress; + ev.detail.key = 18; + ev.deviceid = 128; + _dix_test_xi_convert(&ev, Success, 0); +} + + static void xi2_struct_sizes(void) { #define compare(req) \ @@ -1070,6 +1208,7 @@ int main(int argc, char** argv) g_test_add_func("/dix/input/attributes", dix_input_attributes); g_test_add_func("/dix/input/init-valuators", dix_init_valuators); g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion); + g_test_add_func("/dix/input/event-xi1-conversion", dix_event_to_xi1_conversion); g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values); g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes); g_test_add_func("/dix/input/grab_matching", dix_grab_matching); commit 4cdf1013771bc86fe2f6d9223bc4a46753bc918f Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Feb 21 15:32:57 2011 +1000 dix: a valuator number of 0 is valid (#34510) For all but motion and proximity events, having no valuators is ok. Regression from 1.9, keyboard events are not converted to protocol events. X.Org Bug 34510 <http://bugs.freedesktop.org/show_bug.cgi?id=34510> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Keith Packard <kei...@keithp.com> Reviewed-by: Daniel Stone <dan...@fooishbar.org> Tested-by: Timo Aaltonen <timo.aalto...@canonical.com> diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 7b894f0..dd1ca46 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -263,8 +263,20 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count) num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */ if (num_events <= 0) { - *count = 0; - return BadMatch; + switch (ev->type) + { + case ET_KeyPress: + case ET_KeyRelease: + case ET_ButtonPress: + case ET_ButtonRelease: + /* no axes is ok */ + break; + case ET_Motion: + case ET_ProximityIn: + case ET_ProximityOut: + *count = 0; + return BadMatch; + } } num_events++; /* the actual event event */ commit b4ef34d4664e0eaac7211f7a22a2025958aa1527 Author: Maarten Maathuis <madman2...@gmail.com> Date: Sun Feb 20 11:59:41 2011 +0100 Revert "exa/mixed: Exclude frontbuffer from deferred pixmap handling." This reverts commit 541b25038a5de74411a094570b407c5ae018c2ba. - It turns out that the high latency was a driver problem. - catting a large amount of text turns out to look prettier when the throughput is lower, but it's not worth the loss for a minor improvement that may not even exist on someone else's computer. Reviewed-by: Michel Dänzer <mic...@daenzer.net> Signed-off-by: Maarten Maathuis <madman2...@gmail.com> Signed-off-by: Keith Packard <kei...@keithp.com> diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c index 4f49905..fb47151 100644 --- a/exa/exa_migration_mixed.c +++ b/exa/exa_migration_mixed.c @@ -138,7 +138,6 @@ void exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure) { PixmapPtr pPixmap = closure; - ScreenPtr pScreen = pPixmap->drawable.pScreen; ExaPixmapPriv(pPixmap); /* Move back results of software rendering on system memory copy of mixed driver @@ -150,18 +149,10 @@ exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure) if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) { ExaScreenPriv(pPixmap->drawable.pScreen); - /* Front buffer: Don't wait for the block handler to copy back the data. - * This avoids annoying latency if you encounter a lot of software rendering. - */ - if (pPixmap == pScreen->GetScreenPixmap(pScreen)) - exaMoveInPixmap_mixed(pPixmap); - else { - if (pExaScr->deferred_mixed_pixmap && - pExaScr->deferred_mixed_pixmap != pPixmap) - exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap); - - pExaScr->deferred_mixed_pixmap = pPixmap; - } + if (pExaScr->deferred_mixed_pixmap && + pExaScr->deferred_mixed_pixmap != pPixmap) + exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap); + pExaScr->deferred_mixed_pixmap = pPixmap; } } -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1psepl-0001w3...@alioth.debian.org