summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c6
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c86
-rw-r--r--src/lib/ecore_drm/ecore_drm_private.h5
3 files changed, 56 insertions, 41 deletions
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 3e70d24048..9d0442caa4 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -442,12 +442,12 @@ ecore_drm_device_pointer_xy_get(Ecore_Drm_Device *dev, int *x, int *y)
442 { 442 {
443 EINA_LIST_FOREACH(seat->devices, ll, edev) 443 EINA_LIST_FOREACH(seat->devices, ll, edev)
444 { 444 {
445 if (!libinput_device_has_capability(edev->device, 445 if (!libinput_device_has_capability(edev->device,
446 LIBINPUT_DEVICE_CAP_POINTER)) 446 LIBINPUT_DEVICE_CAP_POINTER))
447 continue; 447 continue;
448 448
449 if (x) *x = edev->mouse.dx; 449 if (x) *x = seat->ptr.dx;
450 if (y) *y = edev->mouse.dy; 450 if (y) *y = seat->ptr.dy;
451 451
452 return; 452 return;
453 } 453 }
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index 69b398f5c1..824fb099a8 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -80,8 +80,10 @@ _device_output_set(Ecore_Drm_Evdev *edev)
80 if (libinput_device_has_capability(edev->device, 80 if (libinput_device_has_capability(edev->device,
81 LIBINPUT_DEVICE_CAP_POINTER)) 81 LIBINPUT_DEVICE_CAP_POINTER))
82 { 82 {
83 edev->mouse.dx = edev->output->current_mode->width / 2; 83 edev->seat->ptr.ix = edev->seat->ptr.dx = edev->output->current_mode->width / 2;
84 edev->mouse.dy = edev->output->current_mode->height / 2; 84 edev->seat->ptr.iy = edev->seat->ptr.dy = edev->output->current_mode->height / 2;
85 edev->mouse.dx = edev->seat->ptr.dx;
86 edev->mouse.dy = edev->seat->ptr.dy;
85 } 87 }
86} 88}
87 89
@@ -359,15 +361,18 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
359 361
360 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return; 362 if (!(ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)))) return;
361 363
362 if (edev->mouse.ix < edev->mouse.minx) 364 if (edev->seat->ptr.ix < edev->mouse.minx)
363 edev->mouse.dx = edev->mouse.ix = edev->mouse.minx; 365 edev->seat->ptr.dx = edev->seat->ptr.ix = edev->mouse.minx;
364 else if (edev->mouse.ix >= (edev->mouse.minx + edev->mouse.maxw)) 366 else if (edev->seat->ptr.ix >= (edev->mouse.minx + edev->mouse.maxw))
365 edev->mouse.dx = edev->mouse.ix = (edev->mouse.minx + edev->mouse.maxw - 1); 367 edev->seat->ptr.dx = edev->seat->ptr.ix = (edev->mouse.minx + edev->mouse.maxw - 1);
366 368
367 if (edev->mouse.iy < edev->mouse.miny) 369 if (edev->seat->ptr.iy < edev->mouse.miny)
368 edev->mouse.dy = edev->mouse.iy = edev->mouse.miny; 370 edev->seat->ptr.dy = edev->seat->ptr.iy = edev->mouse.miny;
369 else if (edev->mouse.iy >= (edev->mouse.miny + edev->mouse.maxh)) 371 else if (edev->seat->ptr.iy >= (edev->mouse.miny + edev->mouse.maxh))
370 edev->mouse.dy = edev->mouse.iy = (edev->mouse.miny + edev->mouse.maxh - 1); 372 edev->seat->ptr.dy = edev->seat->ptr.iy = (edev->mouse.miny + edev->mouse.maxh - 1);
373
374 edev->mouse.dx = edev->seat->ptr.dx;
375 edev->mouse.dy = edev->seat->ptr.dy;
371 376
372 ev->window = (Ecore_Window)input->dev->window; 377 ev->window = (Ecore_Window)input->dev->window;
373 ev->event_window = (Ecore_Window)input->dev->window; 378 ev->event_window = (Ecore_Window)input->dev->window;
@@ -378,8 +383,8 @@ _device_pointer_motion(Ecore_Drm_Evdev *edev, struct libinput_event_pointer *eve
378 _device_modifiers_update(edev); 383 _device_modifiers_update(edev);
379 ev->modifiers = edev->xkb.modifiers; 384 ev->modifiers = edev->xkb.modifiers;
380 385
381 ev->x = edev->mouse.ix; 386 ev->x = edev->seat->ptr.ix;
382 ev->y = edev->mouse.iy; 387 ev->y = edev->seat->ptr.iy;
383 ev->root.x = ev->x; 388 ev->root.x = ev->x;
384 ev->root.y = ev->y; 389 ev->root.y = ev->y;
385 390
@@ -404,14 +409,17 @@ _device_handle_pointer_motion(struct libinput_device *device, struct libinput_ev
404 409
405 if (!(edev = libinput_device_get_user_data(device))) return; 410 if (!(edev = libinput_device_get_user_data(device))) return;
406 411
407 edev->mouse.dx += libinput_event_pointer_get_dx(event); 412 edev->seat->ptr.dx += libinput_event_pointer_get_dx(event);
408 edev->mouse.dy += libinput_event_pointer_get_dy(event); 413 edev->seat->ptr.dy += libinput_event_pointer_get_dy(event);
414
415 edev->mouse.dx = edev->seat->ptr.dx;
416 edev->mouse.dy = edev->seat->ptr.dy;
409 417
410 if (floor(edev->mouse.dx) == edev->mouse.ix && 418 if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
411 floor(edev->mouse.dy) == edev->mouse.iy) return; 419 floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
412 420
413 edev->mouse.ix = edev->mouse.dx; 421 edev->seat->ptr.ix = edev->seat->ptr.dx;
414 edev->mouse.iy = edev->mouse.dy; 422 edev->seat->ptr.iy = edev->seat->ptr.dy;
415 _device_pointer_motion(edev, event); 423 _device_pointer_motion(edev, event);
416} 424}
417 425
@@ -422,16 +430,18 @@ _device_handle_pointer_motion_absolute(struct libinput_device *device, struct li
422 430
423 if (!(edev = libinput_device_get_user_data(device))) return; 431 if (!(edev = libinput_device_get_user_data(device))) return;
424 432
425 edev->mouse.dx = 433 edev->mouse.dx = edev->seat->ptr.dx =
426 libinput_event_pointer_get_absolute_x_transformed(event, 434 libinput_event_pointer_get_absolute_x_transformed(event,
427 edev->output->current_mode->width); 435 edev->output->current_mode->width);
428 edev->mouse.dy = 436 edev->mouse.dy = edev->seat->ptr.dy =
429 libinput_event_pointer_get_absolute_y_transformed(event, 437 libinput_event_pointer_get_absolute_y_transformed(event,
430 edev->output->current_mode->height); 438 edev->output->current_mode->height);
431 439
432 if (floor(edev->mouse.dx) == edev->mouse.ix && 440 if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
433 floor(edev->mouse.dy) == edev->mouse.iy) return; 441 floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
434 442
443 edev->seat->ptr.ix = edev->seat->ptr.dx;
444 edev->seat->ptr.iy = edev->seat->ptr.dy;
435 _device_pointer_motion(edev, event); 445 _device_pointer_motion(edev, event);
436} 446}
437 447
@@ -466,8 +476,8 @@ _device_handle_button(struct libinput_device *device, struct libinput_event_poin
466 _device_modifiers_update(edev); 476 _device_modifiers_update(edev);
467 ev->modifiers = edev->xkb.modifiers; 477 ev->modifiers = edev->xkb.modifiers;
468 478
469 ev->x = edev->mouse.ix; 479 ev->x = edev->seat->ptr.ix;
470 ev->y = edev->mouse.iy; 480 ev->y = edev->seat->ptr.iy;
471 ev->root.x = ev->x; 481 ev->root.x = ev->x;
472 ev->root.y = ev->y; 482 ev->root.y = ev->y;
473 483
@@ -548,8 +558,8 @@ _device_handle_axis(struct libinput_device *device, struct libinput_event_pointe
548 _device_modifiers_update(edev); 558 _device_modifiers_update(edev);
549 ev->modifiers = edev->xkb.modifiers; 559 ev->modifiers = edev->xkb.modifiers;
550 560
551 ev->x = edev->mouse.ix; 561 ev->x = edev->seat->ptr.ix;
552 ev->y = edev->mouse.iy; 562 ev->y = edev->seat->ptr.iy;
553 ev->root.x = ev->x; 563 ev->root.x = ev->x;
554 ev->root.y = ev->y; 564 ev->root.y = ev->y;
555 565
@@ -659,8 +669,8 @@ _device_handle_touch_event_send(Ecore_Drm_Evdev *edev, struct libinput_event_tou
659 _device_modifiers_update(edev); 669 _device_modifiers_update(edev);
660 ev->modifiers = edev->xkb.modifiers; 670 ev->modifiers = edev->xkb.modifiers;
661 671
662 ev->x = edev->mouse.ix; 672 ev->x = edev->seat->ptr.ix;
663 ev->y = edev->mouse.iy; 673 ev->y = edev->seat->ptr.iy;
664 ev->root.x = ev->x; 674 ev->root.x = ev->x;
665 ev->root.y = ev->y; 675 ev->root.y = ev->y;
666 676
@@ -734,8 +744,8 @@ _device_handle_touch_motion_send(Ecore_Drm_Evdev *edev, struct libinput_event_to
734 ev->modifiers = edev->xkb.modifiers; 744 ev->modifiers = edev->xkb.modifiers;
735 ev->modifiers = 0; 745 ev->modifiers = 0;
736 746
737 ev->x = edev->mouse.ix; 747 ev->x = edev->seat->ptr.ix;
738 ev->y = edev->mouse.iy; 748 ev->y = edev->seat->ptr.iy;
739 ev->root.x = ev->x; 749 ev->root.x = ev->x;
740 ev->root.y = ev->y; 750 ev->root.y = ev->y;
741 751
@@ -760,9 +770,9 @@ _device_handle_touch_down(struct libinput_device *device, struct libinput_event_
760 770
761 if (!(edev = libinput_device_get_user_data(device))) return; 771 if (!(edev = libinput_device_get_user_data(device))) return;
762 772
763 edev->mouse.ix = edev->mouse.dx = 773 edev->mouse.dx = edev->seat->ptr.ix = edev->seat->ptr.dx =
764 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width); 774 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
765 edev->mouse.iy = edev->mouse.dy = 775 edev->mouse.dy = edev->seat->ptr.iy = edev->seat->ptr.dy =
766 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height); 776 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
767 777
768 edev->mt_slot = libinput_event_touch_get_seat_slot(event); 778 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
@@ -778,16 +788,16 @@ _device_handle_touch_motion(struct libinput_device *device, struct libinput_even
778 788
779 if (!(edev = libinput_device_get_user_data(device))) return; 789 if (!(edev = libinput_device_get_user_data(device))) return;
780 790
781 edev->mouse.dx = 791 edev->mouse.dx = edev->seat->ptr.dx =
782 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width); 792 libinput_event_touch_get_x_transformed(event, edev->output->current_mode->width);
783 edev->mouse.dy = 793 edev->mouse.dy = edev->seat->ptr.dy =
784 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height); 794 libinput_event_touch_get_y_transformed(event, edev->output->current_mode->height);
785 795
786 if (floor(edev->mouse.dx) == edev->mouse.ix && 796 if (floor(edev->seat->ptr.dx) == edev->seat->ptr.ix &&
787 floor(edev->mouse.dy) == edev->mouse.iy) return; 797 floor(edev->seat->ptr.dy) == edev->seat->ptr.iy) return;
788 798
789 edev->mouse.ix = edev->mouse.dx; 799 edev->seat->ptr.ix = edev->seat->ptr.dx;
790 edev->mouse.iy = edev->mouse.dy; 800 edev->seat->ptr.iy = edev->seat->ptr.dy;
791 801
792 edev->mt_slot = libinput_event_touch_get_seat_slot(event); 802 edev->mt_slot = libinput_event_touch_get_seat_slot(event);
793 803
diff --git a/src/lib/ecore_drm/ecore_drm_private.h b/src/lib/ecore_drm/ecore_drm_private.h
index 0153fb37c9..aa97a2025f 100644
--- a/src/lib/ecore_drm/ecore_drm_private.h
+++ b/src/lib/ecore_drm/ecore_drm_private.h
@@ -153,6 +153,11 @@ struct _Ecore_Drm_Seat
153 const char *name; 153 const char *name;
154 Ecore_Drm_Input *input; 154 Ecore_Drm_Input *input;
155 Eina_List *devices; 155 Eina_List *devices;
156 struct
157 {
158 int ix, iy;
159 double dx, dy;
160 } ptr;
156}; 161};
157 162
158struct _Ecore_Drm_Input 163struct _Ecore_Drm_Input