elput: Fix issue of pointer rotation not being set on startup

elput_input_pointer_rotation_set may be getting called before input
devices are actually added, so we need to be able to set pointer
rotation when a device actually gets added.

To fix this, we will store the requested input rotation value, and
apply it at the time of input device creation.

NB: The current case is that the wl_drm module will apply existing
output rotation before Input has completely initialized, thus any
calls to set the pointer rotation there will not succeed as input
devices have not been created yet.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-10-03 13:25:03 -04:00
parent 11e92cdc86
commit fa2faff41b
2 changed files with 37 additions and 2 deletions

View File

@ -217,12 +217,44 @@ _device_add(Elput_Manager *em, struct libinput_device *dev)
eseat->devices = eina_list_append(eseat->devices, edev);
DBG("Input Device Added: %s", libinput_device_get_name(dev));
if (edev->caps & ELPUT_DEVICE_CAPS_KEYBOARD)
DBG("\tDevice added as Keyboard device");
if (edev->caps & ELPUT_DEVICE_CAPS_POINTER)
DBG("\tDevice added as Pointer device");
{
DBG("\tDevice added as Pointer device");
switch (em->input.rotation)
{
case 0:
edev->swap = EINA_FALSE;
edev->invert_x = EINA_FALSE;
edev->invert_y = EINA_FALSE;
break;
case 90:
edev->swap = EINA_TRUE;
edev->invert_x = EINA_FALSE;
edev->invert_y = EINA_TRUE;
break;
case 180:
edev->swap = EINA_FALSE;
edev->invert_x = EINA_TRUE;
edev->invert_y = EINA_TRUE;
break;
case 270:
edev->swap = EINA_TRUE;
edev->invert_x = EINA_TRUE;
edev->invert_y = EINA_FALSE;
break;
default:
break;
}
}
if (edev->caps & ELPUT_DEVICE_CAPS_TOUCH)
DBG("\tDevice added as Touch device");
{
DBG("\tDevice added as Touch device");
}
_device_event_send(edev, ELPUT_DEVICE_ADDED);
}
@ -578,6 +610,8 @@ elput_input_pointer_rotation_set(Elput_Manager *manager, int rotation)
if ((rotation % 90 != 0) || (rotation / 90 > 3) || (rotation < 0))
return EINA_FALSE;
manager->input.rotation = rotation;
EINA_LIST_FOREACH(manager->input.seats, l, eseat)
{
EINA_LIST_FOREACH(eseat->devices, ll, edev)

View File

@ -82,6 +82,7 @@ typedef struct _Elput_Input
Eldbus_Pending *current_pending;
int pipe;
int pointer_w, pointer_h;
int rotation;
Eina_Bool suspended : 1;
} Elput_Input;