evdev: Combine evdev_handle_device() and evdev_configure_device()

We split the device probing and idenfication somewhat arbitrarily between
these two functions.  This commit combines them into one.  Return of -1
indicates error, 0 success, but succesful probing can return a device
with device->caps == 0, which means we don't handle the device.
evdev: Drop EVDEV_MOTION_REL flag

This is only used inside evdev_configure_device() and we now use a local
has_rel flag instead.
evdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events

We split up has_abs into plain ABS_X/Y and MT events, but this shouldn't
introduce any logic changes.
evdev: Replace EVDEV_MOTION_ABS with local has_abs flag
evdev: Replace EVDEV_BUTTON with local has_button flag
evdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit
evdev: Remove EVDEV_TOUCH and with it evdev_device->caps

We now keep all the configuration intermediate results inside
evdev_configure_device() and the result is device->seat_caps.
evdev: Drop obsolete accelerometer reject rule

This rule triggers for devices with an ABS_X/Y evaluators and no
keyboard or multitouch events.  There is no way we would ever add such
a device as a pointer, keyboard or touch device anyway.  A pointer
device requires has_button (in which case the !has_key condtion would
fail); a keyboard device would also mean !has_key is false and a touch
screen device implies that !device->is_mt is false.
evdev: Reject absolute motion if we're not a pointer or a touch device

Some joysticks have certain buttons that acts keyboard keys.  As such,
we'll reconize them as keyboards but not pointers.  In that case, don't
send pointer motion events when we get absolute joystick events.
evdev: Drop joystick rejection heurstics

We now no longer add joysticks at all.  They show up as absolute motion
devices without has_button, so we don't add them as a pointer.  We may add
a keyboard for the keyboard-style keys, but that's fine.  With the previous
commit, we no longer generate spurious absolute pointer motion for the abs
axes.

https://bugs.freedesktop.org/show_bug.cgi?id=71687
compositor-x11: Only destroy one output when the close button is pressed

Instead of terminating the compositor, destroy the output whose close
button was clicked and move the other outputs, as is done in the drm
backend.
compositor: Remove output from list in weston_output_destroy()

When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.
compositor: Move the logic of moving outputs into the core

Instead of having the backends move the remaining outputs when one is
destroyed, let the core compositor deal with that.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
compositor-headless, compositor-rdp: Don't call weston_output_move()

The call to weston_output_move() when creating the output is
unnecessary. That is already called by wesotn_output_init().
compositor: Move views when outputs are moved

Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.

This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
compositor: Ensure views are visible if their output was unplugged

Use the output destroy signal to move the views in the event the output
was unplugged.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
compositor: Don't repaint outputs being destroyed

Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.
compositor: Make pointers visible when an output is unplugged

Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.
desktop-shell: Invalidate saved position when output is destroyed

If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
shell: Reset fullscreen and maximized state on output unplug

When a view is moved to another output because its current output was
unplugged, remove the fullscreen and maximized state.