Commit Graph

525 Commits

Author SHA1 Message Date
Kristian Høgsberg
11d0512ce9 compositor: Pull in hash table from protocol
We use it in the X WM implementation, but we don't want it in the core
libraries.
2011-12-27 14:02:40 -05:00
Kristian Høgsberg
e7aaec301a x11: Bridge X11 CLIPBOARD selection to Wayland clients 2011-12-27 13:50:04 -05:00
Kristian Høgsberg
09e2692403 compositor-x11: Use ARRAY_LENGTH macro from wayland-util.h 2011-12-23 13:33:45 -05:00
Kristian Høgsberg
03cb5cf9a7 compositor: Handle disappearing surfaces and input devices for touch 2011-12-22 14:47:44 -05:00
Kristian Høgsberg
558949b67b clients: Add simple-touch client for testing touch events. 2011-12-22 13:45:50 -05:00
Kristian Høgsberg
3937354eef evdev: Store positions for all touch points in the evdev device
We need to store all touchpoint positions so that if we just get an
ABS_MT_POSITION_X or Y event, we can pull the other coordinate from the
cache.  And we need this across invocations of evdev_input_device_data(),
so the accumulator approach doesn't work.

Instead, we go back to the approach of storing all this state in the
evdev device struct and we might as well just move the rel and abs state
there too.
2011-12-22 11:32:39 -05:00
Kristian Høgsberg
3543ff4f82 compositor: Send touch_up before clearing touch focus
Otherwise it never gets sent.
2011-12-22 11:32:39 -05:00
Tiago Vignatti
1f221fff71 compositor: Send out touch events accordingly
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-22 11:13:05 -05:00
Tiago Vignatti
22c6bcec9c evdev: Add ABS_MT_* support for direct touch devices
This adds ABS_MT_* support for direct touch devices and notifies
the compositor.  The compositor has a stub for now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-22 11:13:04 -05:00
Kristian Høgsberg
773d13b543 compositor: Make surface picking not depend on an input device 2011-12-22 11:13:04 -05:00
Pekka Paalanen
3429a72597 compositor: fix uniform handling for fade_output()
fade_output() is strange in that it manufactures a wlsc_surface object
by hand, and then calls wlsc_surface_draw() on it.

Valgrind complained, that wlsc_surface_draw() accesses uninitialised
data: wlsc_surface::alpha. fade_output() forgets to set it.

Initialise surface.alpha in fade_output(). Specifically, set it to
compositor->current_alpha to deliberatly avoid the gluniform1f() call in
wlsc_surface_draw().

fade_output() binds a different GL shader program than
wlsc_surface_draw() expects. This program does not have a uniform called
"alpha", and the uniform location given in glUniform1f() is not for
this program anyway. A hint of that is the runtime error:
Mesa: User error: GL_INVALID_OPERATION in glUniform(type mismatch)

Fixing this seems to get rid of half a thousand of Valgrind errors, and
of course the Mesa user error.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-20 10:59:39 -05:00
Kristian Høgsberg
2a25cd4ffa compositor: Remove shell->activate callback
It's all internal to the shell plugin now.
2011-12-19 15:21:40 -05:00
Kristian Høgsberg
e1a850e5b0 compositor: Move click-to-focus and ctrl-alt-bs bindings to shell.c 2011-12-19 15:21:39 -05:00
Kristian Høgsberg
f47d8fe88c compositor: Move binding code to util.c 2011-12-19 15:21:30 -05:00
Kristian Høgsberg
2bd5b6376c compositor: Consolidate code for finding and running bindings 2011-12-19 14:59:57 -05:00
Kristian Høgsberg
5a5f0077be compositor: Make click to activate behavior a binding 2011-12-19 14:54:11 -05:00
Kristian Høgsberg
42e40ae6dd x11: Ignore FocusOut with mode = NotifyUngrab
Not sure why we get these, but it happens for Alt-click to move a window
(metacity binding) and messes up the idle inhibit counter.
FocusOut event as a result of ungrabbing doesn't really make sense and
fortunately we can safely ignore them.
2011-12-19 14:36:52 -05:00
Tiago Vignatti
ce03ec3fbe evdev: new header file for the driver
Besides the new header file, there's also a change in the main evdev creation
procedure for a more suggestive name (evdev_input_add_devices ->
evdev_input_create). There's no real functional changes in this commit.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-19 01:14:03 +02:00
Tiago Vignatti
6e2d5f14e8 compositor-drm: remove/add evdev devices when vt switches
Reported-by: Ran Benite <ran234@gmail.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-19 01:08:16 +02:00
Tiago Vignatti
9e2be08418 compositor: first destroy backend routines and then display
I caught this when an evdev device fd was trying to trigger the main event
loop, which was already free'd and causing an invalid read.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-19 01:07:52 +02:00
Tiago Vignatti
c349e1d0b0 compositor-drm: destroy evdev driver properly when finishing compositor
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-19 01:07:37 +02:00
Tiago Vignatti
0db1d5f551 evdev: use a separate function for adding devices
Adds new function evdev_add_devices for adding udev devices. No
functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-19 01:00:35 +02:00
Tiago Vignatti
b303a1d3fc compositor: use wl_list_for_each_safe when destroying output
Was causing an invalid read when the output is in fact destroyed. That's only
visible (segfault on my machine) on drm compositor because it's the only
backend trying to finish correct the compositor.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-18 22:27:40 +02:00
Juan Zhao
7bb92f0c03 Activate toplevel fullscreen and menu surfaces
Activate the toplevel, fullscrren and menu surfaces during mapping,
so that the launched applications can get the keyboard focus without
clicking on that window.
2011-12-15 11:31:51 -05:00
Kristian Høgsberg
ef458246b0 desktop-shell: Animate surface opacity in zoom animation as well 2011-12-15 11:24:25 -05:00
Kristian Høgsberg
541e5557ac compositor: Implement surface global alpha
Just a small tweak to the shader and we can control the overall surface alpha.
2011-12-15 11:15:12 -05:00
Kristian Høgsberg
cd9ac1da5f compositor: Remove server side cursors
We always expect the clients to set the cursor and attaching a NULL buffer
hides the cursor.  The cursor starts out hidden.
2011-12-15 09:15:08 -05:00
Pekka Paalanen
7296e7984f compositor: let shell override idle time
Move idle_time variable to struct wlsc_compositor, so that a shell
plugin can change it. Also store the original value from the command
line.

Add "duration" option to the desktop-shell screensaver config. This is
the time the screensaver will be visible, after idle timeout triggers
another time and blanks the screen.

Now you can have different delays to lock the screen, and switch off the
screen while a screensaver is running.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:50:35 +02:00
Pekka Paalanen
e955f1edd1 shell: use desktop-shell ini file for screensaver path
Read the same configuration file in the shell plugin (desktop-shell) as
the desktop-shell client does.

Add a new section "screensaver", where "path" defines the path of the
idle animation client to be executed. Not defining "path" disables the
animation.

Idle animations are not in use by default. It must be configured in
wayland-desktop-shell.ini or launched manually.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:45:49 +02:00
Pekka Paalanen
18027e517a shell: automatic exec and kill of wscreensaver
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:45:33 +02:00
Pekka Paalanen
bce2d3f9a7 compositor: add IDLE state
Add WLSC_COMPOSITOR_IDLE state to the possible compositor internal
states, and fix the drm backend to restore the previous state instead of
forcing ACTIVE.

Normally, the compositor only uses the ACTIVE and SLEEPING states. The
IDLE state is another active state, reserved for the shell, when the
shell wants to have unlock() calls on activity, but the compositor cannot
be SLEEPING.

Use the IDLE state to fix exposing the unlock dialog while a screensaver
is animating. Without this fix, is it impossible to activate the unlock
dialog without waiting for a second idle timeout that really puts the
compositor into SLEEPING.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:44:29 +02:00
Pekka Paalanen
af0e34ce36 shell: center the unlock dialog
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:43:49 +02:00
Pekka Paalanen
2e097ee42a compositor: fix re-fading
Reorder code in fade_frame() to that if shell->lock() calls
wlsc_compositor_wake(), the fade animation will run again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 13:43:42 +02:00
Pekka Paalanen
baeb6a1dc1 shell: let screensaver wake up the compositor
Screensavers become visible the first time only after the compositor has
gone to sleep state. Therefore, to see screensaver in the start, wake up
the compositor. After a second idle timeout, the compositor will stay
sleeping.

We could also not apply this patch. It would mean the screensavers would
be visible only with the unlock dialog, and not become visible
automatically.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 12:56:15 +02:00
Pekka Paalanen
77346a66ec shell: implement screensaver surface type
Implement the basics of screensaver surface management. Exec'ing and
killing the screensaver client is punted for later.

When a surface registered as a screensaver is mapped, it stays hidden
if the screen is not locked, or it is added to the compositor visible
surfaces list if the screen is locked.

The map() is restructured to set initial position first, and stacking
next. This allows SHELL_SURFACE_SCREENSAVER share positioning with
SHELL_SURFACE_FULLSCREEN, while show_screensaver() does its own
wlsc_surface_configure() call.

Also fix centering to the given fullscreen output, not the first output.

Another bug fix: previously configure() would call
wlsc_surface_configure() unconditionally, which assigns an output to
the surface. While the compositor is locked, if an application resizes
its window, we hit configure() and assign an output while the surface is
not in compositor->surface_list. This leads to invalid memory access on
the next call to wlsc_surface_damage_below(). Fix this by not calling
wlsc_surface_configure() for surfaces that are not visible.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 12:51:01 +02:00
Pekka Paalanen
9826223a1b shell: handle surface type reassignment
So far nothing prevented a client for registering a surface as one type
and then as another type. With some special types, this would lead to
corrupted wl_lists.

Add a function, that either resets the surface type or posts an error to
the client. In case of an error, the set type operation must be aborted.

Change the type name SHELL_SURFACE_NORMAL to SHELL_SURFACE_NONE, as
there is nothing normal in the "none" type which just means uninitialised.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 12:27:47 +02:00
Pekka Paalanen
6e16811e5e protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.

When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.

The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-14 11:17:00 +02:00
Tiago Vignatti
12c05b74ad evdev: run flush_motion only when needed
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-12 13:00:03 +02:00
Tiago Vignatti
1c2bcb182b evdev: send old valuator inside event frame when the other is missing
when a motion is being performed on ts device, only one axis can be sent
through the evdev bytestream whereas the other could be omitted. For instance:

   -------------- SYN_REPORT ------------
   type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 22208
   type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 631
   type 3 (EV_ABS), code 0 (ABS_X), value 22208
   -------------- SYN_REPORT ------------

on such case we'd have to send the compositor the old value of Y. Commit
f547bd36 introduced this bug cause it was sending zeroed coordinate and not
the old one.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-12 13:00:03 +02:00
David Herrmann
d7c4551562 compositor-drm: Catch errors in create_output_for_connector
We do not handle errors of gbm-buffer-creation and drm-mode-setting in
create_output_for_connectors. Correctly catch these now and free memory on error
to avoid memory leaks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-08 13:31:00 -05:00
David Herrmann
0f0d54e5c5 compositor-drm: Free output on error in create_output_for_connector
We currently simply return -1 on error in create_output_for_connector. This
correctly frees the output and all modes when we fail to avoid memory leaks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-08 13:30:23 -05:00
David Herrmann
eb8bed5c73 compositor-drm: Fix memory leak in create_output_for_connector
We do not free the encoder structure on failure. Fix that.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-08 13:30:05 -05:00
David Herrmann
7551cff986 compositor-drm: Fix memory leak in update_outputs
We need to correctly free every connector we retrieve. We currently loose them
if they are not connected.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-08 13:29:40 -05:00
Tiago Vignatti
a3a7162b11 compositor-x11: convert (some) of X11 buttons to linux input
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-12-08 13:20:40 -05:00
Pekka Paalanen
01e7b006db shell: fix set_transient
In the wl_shell_surface migration, I forgot to correct one cast in
shell_surface_set_transient(). 'parent_resource' is not a (struct
wlsc_surface *) but (struct shell_surface *).

This bug corrupts a wlsc_surface::output field, which later (in my
experiments) leads to a segmentation fault in surface_frame().

Fix the casts.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-08 13:00:26 -05:00
Kristian Høgsberg
bde5e9fc00 Remove stale comment 2011-12-08 10:24:25 -05:00
Kristian Høgsberg
d42b0c94c3 compositor: Use dup instead of fcntl to get a non-CLOEXEC fd
One less syscall and error path to check, and feels like a cleaner approach.
The commit adds two lines, but that's because we actually handle the
potential error now.
2011-12-08 10:19:52 -05:00
Pekka Paalanen
9b32ed34de Update .gitignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-08 11:36:36 +02:00
Pekka Paalanen
c47ddfd852 compositor: reset signal mask for children
The signal mask is inherited over fork() and exec(), we need to
explicitly reset it.

This allows the children to receive the signals the compositor itself
has blocked, for example SIGINT and SIGTERM.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-08 10:44:56 +02:00
Pekka Paalanen
409ef0a5c8 compositor: refactor client forking code
shell.c and tablet-shell.c had almost the same code for forking their
special shell client. Generalise this code and put it into
wlsc_client_launch() in compositor.c.

Improve error cleanup and reporting in wlsc_client_launch().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-08 10:42:00 +02:00
David Herrmann
7172d9e22d compositor-tty: Fix ioctl error handling
(!x < 0) is always false and doesn't make sense here. Looks like a typo so
remove the negation.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2011-12-05 09:48:42 -05:00
Kristian Høgsberg
4bfb82adf7 compositor: Move a few more utils to util.c 2011-12-04 15:47:16 -05:00
Kristian Høgsberg
2f88a40c57 desktop-shell: Animate surface mapping 2011-12-04 15:32:59 -05:00
Kristian Høgsberg
698c058e2a compositor: Split the animation code out of tablet-shell
Upside: we can now reuse this.  Downside: we now have a util.c file.
2011-12-04 15:30:47 -05:00
Pekka Paalanen
f32f1fc743 shell: forbid multiple wl_shell_surface objects
Do not allow multiple wl_shell_surface objects to be created for a
wl_surface object.

Multiple shell_surface objects would confuse the compositor as they
contain separate instances of the shell-private data.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:56:06 -05:00
Pekka Paalanen
4622967586 shell: rename shell_create_shell_surface
Leftovers from an intermediate patch set, the proper function name is
shell_get_shell_surface. Cosmetic change.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:55:53 -05:00
Pekka Paalanen
92a0dc455a shell: check for missing wl_shell_surface
get_shell_surface() returns NULL, if the client has not created or has
destroyed the wl_shell_surface object.

All but one use of get_shell_surface() just retrieve the surface type,
so just fall back to SHELL_SURFACE_NORMAL there.

Resize hot-key binding really needs the wl_shell_surface object, as that
is the only way to send configure events. For surfaces without a
wl_shell_surface, simply do not resize them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:55:19 -05:00
Pekka Paalanen
ec2b32f49b compositor: eliminate wlsc_surface::shell_priv
Remove shell_priv member from wlsc_surface, and replace it by a search
through the wl_surface destroy_listener_list.

This technique avoids any "extension" members in the wlsc_surface
structure.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:40 -05:00
Pekka Paalanen
068ae944db desktop-shell: update protocol and client to wl_shell_surface
Change desktop-shell protocol to use wl_shell_surface instead of
wl_surface.

Adapt the desktop-shell client and the shell plugin.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:34 -05:00
Pekka Paalanen
9d1613eb4a wl_shell_surface adaptation
Protocol changes in Wayland core introduced a new interface
wl_shell_surface, and moved all wl_shell surface methods into it. Adapt
the compositor and its Wayland backend, shell plugin, and all clients to
the new interface.

Depends on the Wayland core commit "protocol: introduce wl_shell_surface"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:26 -05:00
Kristian Høgsberg
865f9b87c9 evdev: Silence warning 2011-12-02 06:39:13 -05:00
Pekka Paalanen
fe34083023 shell: fix resume_desktop for zero clients
Fix two bugs:

- if there are no backgrounds at all, the background pointer would have
  been bogus. Lead to a segfault.

- if the hidden_surface_list is empty, wl_list_insert_list() would
  corrupt the list. Lead to a hang in pick_surface().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-02 06:31:07 -05:00
Pekka Paalanen
65c74cb18b compositor: add a comment about wlsc_surface::output
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-02 06:31:07 -05:00
Kristian Høgsberg
6336e46e15 tablet-shell: Add a stub tablet-shell client
For a start, this is just to we can run and test the corresponding
compositor plugin and keep it from bit-rotting.
2011-11-26 17:37:54 -05:00
Kristian Høgsberg
47fe08aad5 Implement the new dnd/selection protocol
The new protocol splits dnd/selection from wl_shell and allows us to move
the implementation out of shell.c.
2011-11-23 16:20:28 -05:00
Benjamin Franzke
f02bb64d62 shell: Unmap old backgrounds/panels when setting new ones 2011-11-23 20:46:40 +01:00
Benjamin Franzke
d0f79ab5ab desktop-shell: Make panel and background output dependent 2011-11-23 20:17:54 +01:00
Kristian Høgsberg
d2abb83634 compositor: Move more shell.c state into the new shell_surface 2011-11-23 10:53:08 -05:00
Kristian Høgsberg
f6def545bc Merge remote-tracking branch 'pq/shell-priv' 2011-11-23 10:40:11 -05:00
Kristian Høgsberg
a8873120c4 compositor: The compositor is now jiust a regular global object
We have to provide our own bind callback and add a wlsc_compositor pointer
to wlsc_input_device, but on the whole it's nice cleanup.
2011-11-23 10:39:34 -05:00
Kristian Høgsberg
6b5fc3bac0 compositor: Remove a couple of unused #defines 2011-11-23 10:17:41 -05:00
Kristian Høgsberg
558350a692 compositor: Remove unused resource field from wlsc_output 2011-11-23 10:17:15 -05:00
Pekka Paalanen
57da4a822e shell: introduce shell_surface_purpose
Enumerate the different surface purposes for the shell: background, panel,
lock surface, and normal (other) surfaces.

Instead of testing wlsc_surface pointers against known pointers, check
the purpose field.

This change will ease implementing per-output background, panel, etc.
when the number of "known" surface pointers grows dynamically.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-23 16:43:43 +02:00
Pekka Paalanen
56cdea96f0 shell: add private surface struct
Add a pointer to wlsc_surface for shell-private data. This is a
temporary solution.

Add struct shell_surface, where you can add any shell-private data
members related to a wlsc_surface. The getter function takes care of
creating the private data if it does not exist yet.

Not used anywhere yet.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-23 16:14:12 +02:00
Kristian Høgsberg
2584cb5890 compositor: Set output for cursor surface so damage_below works 2011-11-22 19:47:57 -05:00
Kristian Høgsberg
db0fa54b5a Simplify evdev_flush_motion() a tiny bit 2011-11-22 19:24:25 -05:00
Kristian Høgsberg
f127715ce2 Merge remote-tracking branch 'vignatti/evdev' 2011-11-22 19:21:34 -05:00
Kristian Høgsberg
c5241f5b73 Never include wayland-util.h directly
And fix a missing "" to <> conversion for wayland-client.h include.
2011-11-22 09:35:14 -05:00
Pekka Paalanen
50719bce2a Fix inconsistent #include style
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-22 09:27:03 -05:00
Tiago Vignatti
f547bd36e6 evdev: fetch absolute coordinates inside flush_motion only
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-22 12:05:22 +02:00
Tiago Vignatti
5c900ce08d evdev: remove useless field from device structure
We'll want to enhance later the driver regarding the tool being used, but for
now just remove unused bits.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-21 23:47:26 +02:00
Tiago Vignatti
80885e16b3 evdev: reset accumulator inside evdev_flush_motion
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-21 23:45:30 +02:00
Tiago Vignatti
a52b2e4b20 evdev: use a separate structure to denote accumulated motion events
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-21 23:45:05 +02:00
Tiago Vignatti
a157fc11a9 evdev: use a separate struct for abs information
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-21 23:42:33 +02:00
Tiago Vignatti
280b8a6a3b tty: fix command line parsing
revert typo from evdev commit 8b568806.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-21 18:07:18 +02:00
Kristian Høgsberg
8b568806aa evdev: Reset accumulate values when we flush motion events
Otherwise we end up reporting all motion events twice.
2011-11-18 10:42:34 -05:00
Kristian Høgsberg
eccef6aadd compositor: Queue buffer.release instead of sending immediately 2011-11-18 09:52:57 -05:00
Tiago Vignatti
52e158d46b evdev: fix order of events being sent to the compositor
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-18 15:00:34 +02:00
Tiago Vignatti
8755ff9de7 evdev: remove signed value checks
Very likely that 2.4 kernels won't be used with Wayland compositor so the
check for signal value is pretty much useless.

It's okay to change e->value inside evdev_process_absolute_motion_touchpad
given it's not used later on, and I also rather not touch this snip because it
will be changed when multi-touch support arrives.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-11-18 13:44:17 +02:00
Pekka Paalanen
2ca8630aab shell: fix handle_lock_surface_destroy()
A copy & paste bug, that resulted setting to NULL something else than
shell->lock_surface when that surface was destroyed.

The symptom: let compositor lock down, unlock it, let it lock down
again, and the unlock dialog is never requested again. This bug was
triggered by the previous fix "shell: fix compositor wakeup while
locked".

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-16 08:52:26 -05:00
Pekka Paalanen
d81c216db1 shell: fix compositor wakeup while locked
Compositor is locked, woken up, unlock dialog is shown; if the
compositor does to sleep again, before being unlocked, it will never
wake up again, because unlock() becomes a no-op, yet it should wake the
compositor up.

Fix this by letting unlock() to wake up the compositor, if lock surface
is present.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-16 08:52:07 -05:00
Pekka Paalanen
d3dd6e1752 shell: fix lock surface mapping
When the lock surface was map()'d while the compositor was locked,
wlsc_surface_configure() was never called for the lock surface. Hence,
the surface->output was NULL, and the 'frame' event was never sent,
causing desktop-shell to loop in dri2_swap_buffers().

Fix this by calling wlsc_surface_configure() for the lock surface
always in map().

Additionally, adjust the comments in map() to make it more readable.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-16 08:51:31 -05:00
Kristian Høgsberg
1ec0c31596 compositor: Hide surfaces by setting surface->output to NULL
This way we can still use surface->link when a surface is not in
the main compositor surface list and don't need the hidden_surface
wrapper object.  Also, setting surface->output to NULL will block
the surface frame callback until we put the surface back into the
main list.  This has the effect of blocking animations while a surface
isn't visible.
2011-11-15 16:43:25 -05:00
Pekka Paalanen
f0fc70d72f compositor: implement screen locking
When the compositor is locked, all surfaces are moved from the
compositor's list to a private list in the shell plugin. This prevents
any of those surfaces from being visible or receiving input. All new
surfaces will be moved to the private list, too.

The background surface is an exception, it is left to the compositor's
list, so the background will be painted. It is assumed that the
background surface does not allow any actions while being locked.

When desktop-shell announces a lock surface (an unlock dialog), it is
added to the compositor's list, so the user can interact with it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 16:43:24 -05:00
Pekka Paalanen
d503a0b318 compositor: check wlsc_surface::link before accessing neighbors
Check that wlsc_surface::link is part of a list before assuming it is
part of the compositor->surface_list list.

The shell plugin may want to remove a surface from the compositor's
surface list to hide it. Note, that the shell plugin cannot use
wlsc_surface::link for its own purposes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 16:43:24 -05:00
Pekka Paalanen
ebc598ebf0 compositor: fix repaint on first wakeup
wlsc_compositor_fade() ends up in wlsc_compositor_schedule_repaint(),
which is a no-op if compositor is SLEEPING.

On wakeup, first set status to ACTIVE, then call wlsc_compositor_fade()
to start and actually show the animation.

Before, fade was called first, which reset the animation, but did not
cause a repaint. The following wakeup (any input event) would then cause
a repaint, showing the animation from the middle or end of it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 14:21:46 -05:00
Pekka Paalanen
2841111025 compositor: remove idle_inhibit optimization
With the idle_inhibit optimization, wlsc_compositor_wake() is a no-op if
idle_inhibit > 0.

When the shell is waking up the compositor from SLEEPING state as an
indirect response to input activity, it does not work. The call path is:
notify_key() / notify_button()
	wlsc_compositor_idle_inhibit()
		wlsc_compositor_activity()
			shell->unlock()
				send prepare_lock_surface event
	idle_inhibit++

and when the desktop-shell client responds to the event:

desktop_shell_set_lock_surface() / desktop_shell_unlock()
	wlsc_compositor_wake()
		no-op, because idle_inhibit > 0

Fix this by removing the idle_inhibit check from wlsc_compositor_wake().
The optimization did not work for pointer motion while no keys pressed,
anyway, so the performance hit is probably unobservable.

Now the compositor wakes up also on key or button press.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 14:21:05 -05:00
Kristian Høgsberg
af867cc2f7 compositor: let the shell wake up the compositor
When compositor enters SLEEPING state, the shell plugin goes locked. If
compositor wakes up itself, it will fade in while the shell may not yet
have a lock surface to show.

Fix this by assigning wake-up to be called from the shell, if the
compositor is SLEEPING. The shell may wait for the lock surface request,
and only then wake up the compositor. The compositor will fade in
directly to the lock screen.

krh: original patch for compositor.c
ppaalanen: integration and shell.c changes

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 14:19:32 -05:00
Pekka Paalanen
9ef3e012d6 desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.

After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.

When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.

At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).

When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.

If desktop-shell client dies, the screen is unlocked automatically.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 14:18:50 -05:00
Kristian Høgsberg
496433b541 compositor: Hold on to surface.frame requests until we assign an output
We can't just throw away the callback, so hold on to the requests until
we have an output for the surface.
2011-11-15 13:50:21 -05:00