Previously, we blindly created a mode for the output based on surface size
and completely ignoring the output transform. This caused modesets to fail
on outputs that were transformed by 90 or 270 degrees. We should be
swapping the width and the height in this case.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.
This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We should be testing device counts, not pointers. The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after the last release.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This breaks weston_output_mode_switch() into 3 functions:
weston_output_mode_set_native()
weston_output_mode_switch_to_temporary()
weston_output_mode_switch_to_native()
Differences from previous behaviour:
SET_NATIVE didn't set current_scale (now it does)
SET_TEMPORARY could set mode and scale independently - now it can't.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Calling weston_output_mode_switch() with WESTON_MODE_SWITCH_RESTORE_NATIVE
will result in the mode being set "back" to the passed in mode - so the
passed mode should be the native mode.
Additionally, weston_output_mode_switch() should be called when
output->original_mode is non-NULL (which indicates we had a temporary
mode set). The comparison to current_mode results in a lot of
log chatter.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>