Commit Graph

2172 Commits

Author SHA1 Message Date
Pekka Paalanen
4ddf1b2c4d android: add basic evdev input support
Android backend needs mtdev now, and evdev-touchpad.c, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:26 -04:00
Pekka Paalanen
d858351a61 compositor-drm, evdev: don't crash on missing keyboard
Weston's notify_keyboard_focus_*() assume that a keyboard is present, if
they are called. With evdev, there might not always be a keyboard.

Also clean up the variable definition in evdev_notify_keyborad_focus().
I read that function through many times and finally had to grep where
does 'all_keys' come from.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:20 -04:00
Pekka Paalanen
81a13a3757 compositor-drm: log enter/leave VT
All input devices are re-added during enter VT, so these messages in the
log will clarify what happened with input.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:10 -04:00
Pekka Paalanen
42b3f6ae64 compositor-drm: log input device hot-unplugs
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:06 -04:00
Pekka Paalanen
d2e69c2c6f compositor-drm: fix leak in evdev_udev_handler()
If the sysname of the udev device did not start with "event", the
function returned without unreferencing udev_device.

The function is refactored to have a common exit path that unrefs
udev_device. The return value semantics are not changed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:03 -04:00
Pekka Paalanen
bf639ab892 evdev: log input devices
Write information about found input devices into the log. Also fetch and
record the device name.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:00 -04:00
Pekka Paalanen
3315697739 evdev: move udev code into compositor-drm.c
Move all udev-related and now drm backend specific code into
compositor-drm.c.

This makes evdev.c free of udev and launcher-util, and allows it to be
used on Android.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:31:30 -04:00
Pekka Paalanen
88594b699f evdev: expose the generic evdev API
This API does not depend on udev or launcher-util.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:26:58 -04:00
Pekka Paalanen
3b003399ce evdev: rename evdev_seat to drm_seat
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:19:22 -04:00
Pekka Paalanen
43f0a1efcb evdev: pass weston_seat to evdev_input_device_create()
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:18:59 -04:00
Pekka Paalanen
3bfb20104d evdev: make evdev_notify_keyboard_focus() independent of evdev_seat
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:18:37 -04:00
Pekka Paalanen
5720e92a20 evdev: make evdev_led_update independent from struct evdev_seat
in preparation of removing evdev_seat

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:18:10 -04:00
Pekka Paalanen
5618d6fa05 evdev: change evdev_seat into weston_seat in struct evdev_input_device
We are phasing out struct evdev_seat.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:17:49 -04:00
Pekka Paalanen
cfa1f6727b evdev: merge evdev-private.h into evdev.h
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:17:12 -04:00
Pekka Paalanen
5a6383ba57 evdev: move device opening out from evdev_input_device_create
This makes the generic evdev code (i.e. the functions not relying on
udev) independent of launcher-util too. The aim is to allow re-using the
generic evdev code in the Android backend, where neither udev nor
launcher-util are available.

evdev_input_device_create() signature is changed:
- add the opened device file descriptor
- remove wl_display as unused

Also add a bit of failure logging.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:16:43 -04:00
Pekka Paalanen
a123e5c46a evdev: rename device_removed() to evdev_input_device_destroy()
evdev_input_device_destroy() will completement the API of
evdev_input_device_create(), both being independent from udev.

Since the udev-specific device_removed() would only call
evdev_input_device_destroy() and do nothing else, device_remove() calls
are simply replaced with evdev_input_device_destroy().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:15:43 -04:00
Rob Bradford
c4f3338745 spring: Avoid looping if time appears to be going backwards
Since the time values are unsigned integers we can check whether the msec is
smaller than spring->timestamp by checking if the subtraction overflows into a
value greater than half the maximum unsigned integer range (ie. top bit set)
2012-08-03 13:13:34 -04:00
Andre Heider
552d12b10e terminal: Don't crash on non-ascii chars
isalpha() and isdigit() don't like huge values.
Noticed with ascii-art in the shell prompt.
2012-08-03 12:54:06 -04:00
Kristian Høgsberg
5626d34d63 compositor-drm: Split cursor handling into prepare and set
Like how we handle overlays, we split drm_output_set_cursor() into
drm_output_prepare_cursor_surface() that will assign the hw cursor to
a suitable surface and drm_output_set_cursor() that will do the actual
work of updating cursor contents and moving it.  This is more in line
with how we handle everything else, and lets us update cursor contents
based on changes to the cursor plane damage.

This works when the cursor content changes but also accumulates
damage when the cursor changes output.  In that case we move the
cursor surface to the cursor plane in the new output and
weston_surface_move_to_plane() will generate the damage that triggers
download of sprite contents there.
2012-08-03 11:50:33 -04:00
Kristian Høgsberg
65a11e1039 compositor: Accumulate damage per plane
When we analyze and accumulate damage prior to repainting, we need to
accumulate damage per plane, so that whatever damage a surface
contributes is accumulated in the plane that it's assigned to.  Before,
we would always accumulate damge in the primary plane, which caused
repaints in the primary plane whenever a surface in a sprite or
framebuffer was damaged.  Eliminating this repaint is a big win for
cases where we pageflip to a client surface or use a sprite overlay.

This also prepares for fixing the missing cursor updates, since we
now track damage to the cursor surface in a dedicated sprite plane.
2012-08-03 11:30:21 -04:00
Kristian Høgsberg
2a1aa4efce terminal: Don't output @ for ASCII NUL
Fixes visual bell in screen.
2012-08-03 09:37:05 -04:00
Rob Bradford
0fb797596a compositor: Use uint32_t for the msecs value consistently 2012-08-02 11:06:44 -04:00
Pekka Paalanen
d9a8e16b7b compositor: remove OpenWFD backend
This backend has not seen even build testing for months, presumably does
not even compile, and is starting to hinder development a little.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Benjamin Franzke <benjaminfranzke@googlemail.com>
2012-08-01 10:09:53 -04:00
Kristian Høgsberg
649e1ce973 compositor: Don't allow setting a NULL cursor without pointer focus 2012-08-01 09:58:22 -04:00
Kristian Høgsberg
ae27737b28 window.c: Use pointer enter serial for setting cursor 2012-08-01 09:58:22 -04:00
Kristian Høgsberg
2e96d3c907 compositor: Check serial number ordering without overflowing 2012-08-01 09:58:17 -04:00
Scott Moreau
c50645c775 Properly free drm configured mode variables. 2012-08-01 00:41:28 -04:00
Kristian Høgsberg
bbe983923d shell: Make it possible to move and raise unresponsive surfaces 2012-08-01 00:20:21 -04:00
Kristian Høgsberg
9e31bff831 shell: Move surface move code back to just after the move grab functions
This chunk of code is what uses the move grab and used to come right
after it.  At some point it got split up, but move it back now.
2012-08-01 00:08:07 -04:00
Kristian Høgsberg
64eca8949b compositor: Fold the log prototypes into compositor.h and drop log.h
We're trying to keep the API exposed by the core compositor in compositor.h
2012-08-01 00:00:57 -04:00
Scott Moreau
8f37e0bc1e Add raw modeline support.
This allows specifying a modeline in the config for the 'mode' key
in the output section, such as one you would get from cvt.
2012-07-31 22:38:21 -04:00
Tiago Vignatti
4f238a590d configure: link image libs with libshared
This fix xwayland.so that was complaining about jpeg symbols from the
libshared.

Note that xwayland is not using the jpeg ones, but now that symbols are read
up front we need to link anyway.. or break apart that library.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-07-31 22:34:21 -04:00
Pekka Paalanen
76fc57e75c simple-touch: use proper damage in touch_paint()
Should reduce update overhead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
0768419393 simple-touch: fix off-by-one in position checks
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.

Fixes a segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
55b7cb24e0 simple-touch: more colors and thicker marks
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
7e94a98e07 simple-touch: respond to ping protocol
Without this, it won't get any input anymore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
e288a0f415 window: warn on cursor load failure 2012-07-31 22:27:23 -04:00
Pekka Paalanen
56464253c0 compositor: rework touch focus
In the wl_seat conversion, struct wl_touch got fields for the focused
surface and the client resource for the input device being focused.
However, the conversion was incomplete: the old fields
weston_seat::touch_focus* we still used by the event dispatching code,
but the new code never set them. Therefore no touch events were ever
sent.

From weston_seat, remove the fields touch_focus, touch_focus_listener,
touch_focus_resource, and touch_focus_resource_listener. They are
replaced by the corresponding fields and listeners from struct
wl_touch.

While doing this, fix touch_set_focus().

If touch_set_focus() was called first with surface A, and then with
surface B, without being called with NULL in between, it would corrupt
the destroy_signal list. It was equivalent of calling wl_signal_add()
for different signal sources with the same listener without removing in
between.

Now, touch_set_focus() first removes focus and listeners, and then
attempts to assign focus if requested. If the target client has not
subscribed for touch events, the touch focus will now be NULL.
Before this patch, the touch focus was left to the previous surface.

NOTE: this patch depends on the patch "server: add lose_touch_focus()"
for Wayland.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
2fc7cce9b1 evdev: query position ranges for MT, too
For a true multi-touch input device, the code ended up using
uninitialised fields of evdev_input_device::abs.

Fix it by querying the corresponding MT ranges.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:20:09 -04:00
Pekka Paalanen
27979b053f weston-launcher: use CLOEXEC on fallback path
If there is no weston-launcher available, launcher-util.c will fall back
to opening the given file itself. It that case it does not set the
close-on-exec flag, and will presumably leak the file descriptor to
children.

Use O_CLOEXEC on the fallback path, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:19:31 -04:00
Kristian Høgsberg
8ff691593c compositor-drm: Handle incomplete [output] sections without crashing 2012-07-31 22:18:28 -04:00
Kristian Høgsberg
e377822c64 shell: Give keyboard focus to top surface when current keyboard focus goes away 2012-07-31 22:18:02 -04:00
Kristian Høgsberg
2f5faff7f9 shell: Always track focus state per workspace
It's a little simpler than always creating and destroying it when we
switch workspace, and we'll need the focus_state soon.
2012-07-31 16:36:37 -04:00
Kristian Høgsberg
3df6384c3a compositor: Set WAYLAND_DISPLAY if we're given a --socket argument
This lets us run multiple compositors (nested or on different VTs).

https://bugs.freedesktop.org/show_bug.cgi?id=46629
2012-07-31 14:54:48 -04:00
Kristian Høgsberg
7b884bc0de compositor: Use a minimal restore handler for crash clean up
When we hit a segv, it's often the case that we might crash again in
the attempt to clean up.  Instead we introduce a minimal restore callback
in the backend abstraction, that shuts down as simply as possible.  Then
we can call that from the segv handler, and then to aid debugging, we
raise SIGTRAP in the segv handler.  This lets us run gdb on weston from
a different vt, and if we tell gdb

  (gdb) handle SIGSEGV nostop

gdb won't stop when the segv happens but let weston clean up and switch vt,
and then stop when SIGTRAP is raised.

It's also possible to just let gdb catch the segv, and then use sysrq+k
followed by manual vt switch to get back.
2012-07-31 14:32:01 -04:00
Kristian Høgsberg
023be102d7 window.c: Set input region after (potentially) adjusting the surface size
Regressed in dd263e546b, spotted by Scott Moreau <oreaus@gmail.com>
2012-07-31 11:59:12 -04:00
Kristian Høgsberg
c94de6450e shell: Remove unused shsurf->focus_state 2012-07-31 10:51:22 -04:00
Kristian Høgsberg
b8e0d0f5ac shell: Use the right destroy listener in focus_state_surface_destroy()
We were dereferencing the seat destroy listener.
2012-07-31 10:30:26 -04:00
Scott Moreau
8ab5d45399 Allow output configuration from config file.
Parse the config file for [output] sections and check for 'name'
and 'mode' keys. The key strings are compared to what is reported
by weston log. The 'mode' key string can be one of the following:

1) WIDTHxHEIGHT - one that is reported by weston log
2) off - Disables the output
3) preferred - Uses the preferred mode
4) current - Uses the mode currently driving the crtc
2012-07-30 21:56:13 -04:00
Wang Quanxian
acb805a356 compositor-drm: Handle unconnected connectors better
If a connector is not attached to a crtc, weston fails to bring it up.
Typically kms fbdev drives all crtc and connectors, but if kms hasn't been
initialzed and weston is the first to set a mode of if a monitor is
hotplugged, we just fail to bring it up.

(krh: reformatted and edited a bit from original patch)
2012-07-30 18:09:46 -04:00