summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-06 14:11:25 -0800
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-12-06 14:11:25 -0800
commit70930f6d31cc2ca16b40c17e101b106506a8337a (patch)
tree4a7c77127abdd889169343bce4fc51d8d69fe230
parent9ac2e68d86ed1eb6e3f6c900c60908813eca140e (diff)
XQuartz: darwinPointer reports the actual pixel position now rather than a relative position
(cherry picked from commit a41e7f75decd340d064fdc0d2c4fe6c88d7dbc82)
-rw-r--r--hw/xquartz/darwin.c6
-rw-r--r--hw/xquartz/darwinEvents.c35
2 files changed, 24 insertions, 17 deletions
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 97791e6f4..07b243ba4 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -347,10 +347,10 @@ static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
347 InitPointerDeviceStruct((DevicePtr)pPointer, map, 7, 347 InitPointerDeviceStruct((DevicePtr)pPointer, map, 7,
348 (PtrCtrlProcPtr)NoopDDA, 348 (PtrCtrlProcPtr)NoopDDA,
349 GetMotionHistorySize(), 2); 349 GetMotionHistorySize(), 2);
350 InitAbsoluteClassDeviceStruct(pPointer);
351 pPointer->valuator->mode = Absolute; // Relative 350 pPointer->valuator->mode = Absolute; // Relative
352 InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); 351 InitAbsoluteClassDeviceStruct(pPointer);
353 InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1); 352// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
353// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
354 break; 354 break;
355 case DEVICE_ON: 355 case DEVICE_ON:
356 pPointer->public.on = TRUE; 356 pPointer->public.on = TRUE;
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 21fd76826..7fc390d1e 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -370,7 +370,7 @@ static void DarwinPokeEQ(void) {
370 * Note: pointer_x and pointer_y are relative to the upper-left of primary 370 * Note: pointer_x and pointer_y are relative to the upper-left of primary
371 * display. 371 * display.
372 */ 372 */
373static void DarwinPrepareValuators(int *valuators, ScreenPtr screen, 373static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr screen,
374 float pointer_x, float pointer_y, 374 float pointer_x, float pointer_y,
375 float pressure, float tilt_x, float tilt_y) { 375 float pressure, float tilt_x, float tilt_y) {
376 /* Fix offset between darwin and X screens */ 376 /* Fix offset between darwin and X screens */
@@ -382,14 +382,21 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen,
382 382
383 if(pointer_y < 0.0) 383 if(pointer_y < 0.0)
384 pointer_y = 0.0; 384 pointer_y = 0.0;
385
386 /* Setup our array of values */
387 valuators[0] = pointer_x * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->width;
388 valuators[1] = pointer_y * XQUARTZ_VALUATOR_LIMIT / (float)screenInfo.screens[0]->height;
389 valuators[2] = pressure * XQUARTZ_VALUATOR_LIMIT;
390 valuators[3] = tilt_x * XQUARTZ_VALUATOR_LIMIT;
391 valuators[4] = tilt_y * XQUARTZ_VALUATOR_LIMIT;
392 385
386 if(pDev == darwinPointer) {
387 valuators[0] = pointer_x;
388 valuators[1] = pointer_y;
389 valuators[2] = 0;
390 valuators[3] = 0;
391 valuators[4] = 0;
392 } else {
393 /* Setup our array of values */
394 valuators[0] = XQUARTZ_VALUATOR_LIMIT * (pointer_x / (float)screenInfo.screens[0]->width);
395 valuators[1] = XQUARTZ_VALUATOR_LIMIT * (pointer_y / (float)screenInfo.screens[0]->height);
396 valuators[2] = XQUARTZ_VALUATOR_LIMIT * pressure;
397 valuators[3] = XQUARTZ_VALUATOR_LIMIT * tilt_x;
398 valuators[4] = XQUARTZ_VALUATOR_LIMIT * tilt_y;
399 }
393 //DEBUG_LOG("Pointer (%f, %f), Valuators: {%d,%d,%d,%d,%d}\n", pointer_x, pointer_y, 400 //DEBUG_LOG("Pointer (%f, %f), Valuators: {%d,%d,%d,%d,%d}\n", pointer_x, pointer_y,
394 // valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]); 401 // valuators[0], valuators[1], valuators[2], valuators[3], valuators[4]);
395} 402}
@@ -446,7 +453,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa
446 darwinFakeMouseButtonDown = 0; 453 darwinFakeMouseButtonDown = 0;
447 } 454 }
448 455
449 DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y); 456 DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y);
450 darwinEvents_lock(); { 457 darwinEvents_lock(); {
451 num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, 458 num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button,
452 POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators); 459 POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators);
@@ -473,7 +480,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) {
473void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { 480void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
474 int i, num_events; 481 int i, num_events;
475 ScreenPtr screen; 482 ScreenPtr screen;
476 DeviceIntPtr dev = darwinTabletCurrent; 483 DeviceIntPtr pDev = darwinTabletCurrent;
477 int valuators[5]; 484 int valuators[5];
478 485
479 DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y); 486 DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y);
@@ -483,17 +490,17 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
483 return; 490 return;
484 } 491 }
485 492
486 screen = miPointerGetScreen(dev); 493 screen = miPointerGetScreen(pDev);
487 if(!screen) { 494 if(!screen) {
488 DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n"); 495 DEBUG_LOG("DarwinSendPointerEvents called before screen was initialized\n");
489 return; 496 return;
490 } 497 }
491 498
492 DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f); 499 DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f);
493 darwinEvents_lock(); { 500 darwinEvents_lock(); {
494 num_events = GetProximityEvents(darwinEvents, dev, ev_type, 501 num_events = GetProximityEvents(darwinEvents, pDev, ev_type,
495 0, 5, valuators); 502 0, 5, valuators);
496 for(i=0; i<num_events; i++) mieqEnqueue (dev,darwinEvents[i].event); 503 for(i=0; i<num_events; i++) mieqEnqueue (pDev,darwinEvents[i].event);
497 DarwinPokeEQ(); 504 DarwinPokeEQ();
498 } darwinEvents_unlock(); 505 } darwinEvents_unlock();
499} 506}