summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-20 11:17:01 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-20 11:18:21 -0400
commit6cd9605029742d6f42d050edcfd2bf9289e82008 (patch)
treeb49b2595865825af749929e23cf16b05787b487b
parent7b2b62318041ceffc1d629402c4603b7b76d5b01 (diff)
elput: Don't calculate pointer constraints twice
As constraints for pointer movement are already handled in the function which sends the pointer motion event, there is no need to handle them inside the function which gets pointer position. Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
-rw-r--r--src/lib/elput/elput_evdev.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 6f9de940e8..477dc05aea 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -680,7 +680,6 @@ _pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *eve
680{ 680{
681 Elput_Device *edev; 681 Elput_Device *edev;
682 Elput_Pointer *ptr; 682 Elput_Pointer *ptr;
683 double x, y;
684 683
685 edev = libinput_device_get_user_data(idev); 684 edev = libinput_device_get_user_data(idev);
686 if (!edev) return EINA_FALSE; 685 if (!edev) return EINA_FALSE;
@@ -688,21 +687,8 @@ _pointer_motion(struct libinput_device *idev, struct libinput_event_pointer *eve
688 ptr = _evdev_pointer_get(edev->seat); 687 ptr = _evdev_pointer_get(edev->seat);
689 if (!ptr) return EINA_FALSE; 688 if (!ptr) return EINA_FALSE;
690 689
691 x = ptr->x + libinput_event_pointer_get_dx(event); 690 ptr->x += libinput_event_pointer_get_dx(event);
692 y = ptr->y + libinput_event_pointer_get_dy(event); 691 ptr->y += libinput_event_pointer_get_dy(event);
693
694 if (x < ptr->minx)
695 x = ptr->minx;
696 else if (x >= ptr->minx + ptr->maxw)
697 x = ptr->minx + ptr->maxw - 1;
698
699 if (y < ptr->miny)
700 y = ptr->miny;
701 else if (y >= ptr->miny + ptr->maxh)
702 y = ptr->miny + ptr->maxh - 1;
703
704 ptr->x = x;
705 ptr->y = y;
706 ptr->timestamp = libinput_event_pointer_get_time(event); 692 ptr->timestamp = libinput_event_pointer_get_time(event);
707 693
708 _pointer_motion_send(edev); 694 _pointer_motion_send(edev);