platform/upstream/weston.git
12 years agocompositor: Remove server side cursors
Kristian Høgsberg [Thu, 15 Dec 2011 14:14:34 +0000 (09:14 -0500)]
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.

12 years agocompositor: let shell override idle time
Pekka Paalanen [Wed, 7 Dec 2011 14:22:00 +0000 (16:22 +0200)]
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>
12 years agoshell: use desktop-shell ini file for screensaver path
Pekka Paalanen [Wed, 7 Dec 2011 09:49:52 +0000 (11:49 +0200)]
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>
12 years agoshell: automatic exec and kill of wscreensaver
Pekka Paalanen [Fri, 2 Dec 2011 14:31:49 +0000 (16:31 +0200)]
shell: automatic exec and kill of wscreensaver

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: add IDLE state
Pekka Paalanen [Fri, 2 Dec 2011 11:07:27 +0000 (13:07 +0200)]
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>
12 years agoshell: center the unlock dialog
Pekka Paalanen [Fri, 2 Dec 2011 08:59:17 +0000 (10:59 +0200)]
shell: center the unlock dialog

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: fix re-fading
Pekka Paalanen [Fri, 2 Dec 2011 08:39:49 +0000 (10:39 +0200)]
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>
12 years agoshell: let screensaver wake up the compositor
Pekka Paalanen [Thu, 1 Dec 2011 14:23:57 +0000 (16:23 +0200)]
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>
12 years agoshell: implement screensaver surface type
Pekka Paalanen [Wed, 30 Nov 2011 14:26:35 +0000 (16:26 +0200)]
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>
12 years agoshell: handle surface type reassignment
Pekka Paalanen [Thu, 1 Dec 2011 08:42:22 +0000 (10:42 +0200)]
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>
12 years agowscreensaver: implement screensaver interface
Pekka Paalanen [Wed, 30 Nov 2011 12:45:47 +0000 (14:45 +0200)]
wscreensaver: implement screensaver interface

Create instances from outputs, and register the surfaces as
screensavers. Support multiple "Mode" instances.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: expose outputs to applications
Pekka Paalanen [Wed, 30 Nov 2011 08:52:38 +0000 (10:52 +0200)]
window: expose outputs to applications

Add output_configure_handler as a display property. This exposes only
configured outputs, that is the current mode info is already received,
to applications.

The handler is also called for mode changes on an existing output. This
simplifies the implementation in toytoolkit as we can defer the handler
calls from wl_output binding time to when we receive the current mode.
We do not need separate handlers for "new output" and "mode changed". A
plain "new output" handler would be problematic as the current mode is
not known yet.

Also add delete_handler hook for outputs, but that will never be called
for now, as the protocol lacks a way to signal output disconnections.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoprotocol: add screensaver interface
Pekka Paalanen [Thu, 24 Nov 2011 09:34:05 +0000 (11:34 +0200)]
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>
12 years agoevdev: run flush_motion only when needed
Tiago Vignatti [Thu, 8 Dec 2011 11:20:46 +0000 (13:20 +0200)]
evdev: run flush_motion only when needed

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: send old valuator inside event frame when the other is missing
Tiago Vignatti [Thu, 8 Dec 2011 10:18:16 +0000 (12:18 +0200)]
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>
12 years agocompositor-drm: Catch errors in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:46 +0000 (17:05 +0100)]
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>
12 years agocompositor-drm: Free output on error in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:45 +0000 (17:05 +0100)]
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>
12 years agocompositor-drm: Fix memory leak in create_output_for_connector
David Herrmann [Thu, 8 Dec 2011 16:05:44 +0000 (17:05 +0100)]
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>
12 years agocompositor-drm: Fix memory leak in update_outputs
David Herrmann [Thu, 8 Dec 2011 16:05:43 +0000 (17:05 +0100)]
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>
12 years agocompositor-x11: convert (some) of X11 buttons to linux input
Tiago Vignatti [Thu, 8 Dec 2011 15:03:17 +0000 (17:03 +0200)]
compositor-x11: convert (some) of X11 buttons to linux input

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoshell: fix set_transient
Pekka Paalanen [Thu, 8 Dec 2011 14:42:33 +0000 (16:42 +0200)]
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>
12 years agoUse '-' to separate words in file names
Kristian Høgsberg [Thu, 8 Dec 2011 17:44:27 +0000 (12:44 -0500)]
Use '-' to separate words in file names

Eventually we will want more functionality in the shared library and we
will rename it at that point.  Perhaps we'll name it libnih, but for now
let's stick with libconfig-parser.

12 years agoRemove stale comment
Kristian Høgsberg [Thu, 8 Dec 2011 15:24:25 +0000 (10:24 -0500)]
Remove stale comment

12 years agocompositor: Use dup instead of fcntl to get a non-CLOEXEC fd
Kristian Høgsberg [Thu, 8 Dec 2011 15:19:40 +0000 (10:19 -0500)]
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.

12 years agoUpdate .gitignores
Pekka Paalanen [Fri, 2 Dec 2011 08:23:55 +0000 (10:23 +0200)]
Update .gitignores

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: reset signal mask for children
Pekka Paalanen [Thu, 8 Dec 2011 08:44:56 +0000 (10:44 +0200)]
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>
12 years agocompositor: refactor client forking code
Pekka Paalanen [Fri, 2 Dec 2011 13:30:21 +0000 (15:30 +0200)]
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>
12 years agodesktop-shell: add option to not use locking
Pekka Paalanen [Thu, 8 Dec 2011 08:06:53 +0000 (10:06 +0200)]
desktop-shell: add option to not use locking

Add an option to the desktop-shell ini file that defines whether screen
locking is used or not.

Useful for testing screensaver interactions without a lock surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfigparser: rename BOOL, document types
Pekka Paalanen [Thu, 8 Dec 2011 07:24:24 +0000 (09:24 +0200)]
configparser: rename BOOL, document types

Rename CONFIG_KEY_BOOL to CONFIG_KEY_BOOLEAN, just like
CONFIG_KEY_INTEGER is not CONFIG_KEY_INT, for consistency.

Document the types expected for the void* and name the enum in the
header, so it is clear what config_key::type means.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agomove config parser to a convenience library
Pekka Paalanen [Mon, 5 Dec 2011 13:58:11 +0000 (15:58 +0200)]
move config parser to a convenience library

Create a new directory for convenience librariers that can be shared
between compositor components and clients.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: no need to unset WAYLAND_SOCKET
Pekka Paalanen [Wed, 7 Dec 2011 06:47:49 +0000 (08:47 +0200)]
desktop-shell: no need to unset WAYLAND_SOCKET

As of commit "client: unset WAYLAND_SOCKET env variable",
58bb064afa3bfc706e3b30dd170804235aa272ea, in the Wayland core, the
Wayland library will unset the environment variable automatically.

No need to explicitly unset it again here.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor-tty: Fix ioctl error handling
David Herrmann [Fri, 2 Dec 2011 15:16:40 +0000 (16:16 +0100)]
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>
12 years agocompositor: Move a few more utils to util.c
Kristian Høgsberg [Sun, 4 Dec 2011 20:47:16 +0000 (15:47 -0500)]
compositor: Move a few more utils to util.c

12 years agodesktop-shell: Animate surface mapping
Kristian Høgsberg [Sun, 4 Dec 2011 20:32:59 +0000 (15:32 -0500)]
desktop-shell: Animate surface mapping

12 years agocompositor: Split the animation code out of tablet-shell
Kristian Høgsberg [Sun, 4 Dec 2011 20:20:19 +0000 (15:20 -0500)]
compositor: Split the animation code out of tablet-shell

Upside: we can now reuse this.  Downside: we now have a util.c file.

12 years agoshell: forbid multiple wl_shell_surface objects
Pekka Paalanen [Tue, 29 Nov 2011 14:05:28 +0000 (16:05 +0200)]
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>
12 years agoshell: rename shell_create_shell_surface
Pekka Paalanen [Tue, 29 Nov 2011 13:49:31 +0000 (15:49 +0200)]
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>
12 years agowindow: do not crash without wl_shell
Pekka Paalanen [Tue, 29 Nov 2011 08:25:08 +0000 (10:25 +0200)]
window: do not crash without wl_shell

Since it is the desktop-shell plugin in the compositor that offers both
wl_shell global interface and wl_shell_surface interface, those are not
available on the tablet-shell plugin.

The tablet-shell client uses the toytoolkit, so toytoolkit must work
somehow even without wl_shell.

Turn all operations in toytoolkit that would require wl_shell or
wl_shell_surface into no-ops.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: check for missing wl_shell_surface
Pekka Paalanen [Mon, 28 Nov 2011 13:34:13 +0000 (15:34 +0200)]
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>
12 years agocompositor: eliminate wlsc_surface::shell_priv
Pekka Paalanen [Mon, 28 Nov 2011 13:12:34 +0000 (15:12 +0200)]
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>
12 years agodesktop-shell: update protocol and client to wl_shell_surface
Pekka Paalanen [Mon, 28 Nov 2011 12:11:15 +0000 (14:11 +0200)]
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>
12 years agowl_shell_surface adaptation
Pekka Paalanen [Fri, 25 Nov 2011 10:09:16 +0000 (12:09 +0200)]
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>
12 years agoevdev: Silence warning
Kristian Høgsberg [Fri, 2 Dec 2011 11:39:02 +0000 (06:39 -0500)]
evdev: Silence warning

12 years agowindow: fix segfault in window_handle_key()
Pekka Paalanen [Mon, 28 Nov 2011 14:13:57 +0000 (16:13 +0200)]
window: fix segfault in window_handle_key()

When a window destroyed, if any input had the window in keyboard
focus, the keyboard focus is reset to NULL. A new keyboard focus is set
only, if the user clicks something. If the user presses a key instead of
clicking, the key press event is sent to the client which has NULL
keyboard focus, triggering a segfault in window_handle_key().

Fix the segfault by ignoring the key event, if there is no target
window.

I triggered this segfault by clicking the unlock dialog away, and then
pressing a key.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoshell: fix resume_desktop for zero clients
Pekka Paalanen [Fri, 25 Nov 2011 14:07:52 +0000 (16:07 +0200)]
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>
12 years agocompositor: add a comment about wlsc_surface::output
Pekka Paalanen [Thu, 24 Nov 2011 13:05:07 +0000 (15:05 +0200)]
compositor: add a comment about wlsc_surface::output

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agotablet-shell: Add more interesting lock and home screens
Kristian Høgsberg [Sun, 27 Nov 2011 04:38:41 +0000 (23:38 -0500)]
tablet-shell: Add more interesting lock and home screens

12 years agotablet-shell: Add a stub tablet-shell client
Kristian Høgsberg [Sat, 26 Nov 2011 22:36:23 +0000 (17:36 -0500)]
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.

12 years agowindow.c: Cache outputs
Kristian Høgsberg [Sat, 26 Nov 2011 22:27:37 +0000 (17:27 -0500)]
window.c: Cache outputs

12 years agoImplement the new dnd/selection protocol
Kristian Høgsberg [Fri, 28 Oct 2011 16:26:06 +0000 (12:26 -0400)]
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.

12 years agoshell: Unmap old backgrounds/panels when setting new ones
Benjamin Franzke [Wed, 23 Nov 2011 19:46:40 +0000 (20:46 +0100)]
shell: Unmap old backgrounds/panels when setting new ones

12 years agodesktop-shell: Make panel and background output dependent
Benjamin Franzke [Tue, 22 Nov 2011 11:43:52 +0000 (12:43 +0100)]
desktop-shell: Make panel and background output dependent

12 years agodesktop-shell: Unlock dialog needs to be a custom window
Benjamin Franzke [Wed, 23 Nov 2011 18:35:07 +0000 (19:35 +0100)]
desktop-shell: Unlock dialog needs to be a custom window

Since set_toplevel would overwrite set_lock_surface.

12 years agodesktop-shell: Fix some indents
Benjamin Franzke [Tue, 22 Nov 2011 11:38:48 +0000 (12:38 +0100)]
desktop-shell: Fix some indents

12 years agocompositor: Move more shell.c state into the new shell_surface
Kristian Høgsberg [Wed, 23 Nov 2011 15:52:40 +0000 (10:52 -0500)]
compositor: Move more shell.c state into the new shell_surface

12 years agoMerge remote-tracking branch 'pq/shell-priv'
Kristian Høgsberg [Wed, 23 Nov 2011 15:40:11 +0000 (10:40 -0500)]
Merge remote-tracking branch 'pq/shell-priv'

12 years agocompositor: The compositor is now jiust a regular global object
Kristian Høgsberg [Wed, 23 Nov 2011 15:39:34 +0000 (10:39 -0500)]
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.

12 years agocompositor: Remove a couple of unused #defines
Kristian Høgsberg [Wed, 23 Nov 2011 15:17:41 +0000 (10:17 -0500)]
compositor: Remove a couple of unused #defines

12 years agocompositor: Remove unused resource field from wlsc_output
Kristian Høgsberg [Wed, 23 Nov 2011 15:17:15 +0000 (10:17 -0500)]
compositor: Remove unused resource field from wlsc_output

12 years agoshell: introduce shell_surface_purpose
Pekka Paalanen [Wed, 23 Nov 2011 14:42:16 +0000 (16:42 +0200)]
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>
12 years agoshell: add private surface struct
Pekka Paalanen [Wed, 23 Nov 2011 14:14:12 +0000 (16:14 +0200)]
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>
12 years agocompositor: Set output for cursor surface so damage_below works
Kristian Høgsberg [Wed, 23 Nov 2011 00:47:57 +0000 (19:47 -0500)]
compositor: Set output for cursor surface so damage_below works

12 years agoSimplify evdev_flush_motion() a tiny bit
Kristian Høgsberg [Wed, 23 Nov 2011 00:24:25 +0000 (19:24 -0500)]
Simplify evdev_flush_motion() a tiny bit

12 years agoMerge remote-tracking branch 'vignatti/evdev'
Kristian Høgsberg [Wed, 23 Nov 2011 00:21:34 +0000 (19:21 -0500)]
Merge remote-tracking branch 'vignatti/evdev'

12 years agocairo-util: Dont use non-standard JCS_EXT_BGRX color space
Kristian Høgsberg [Tue, 22 Nov 2011 19:40:00 +0000 (14:40 -0500)]
cairo-util: Dont use non-standard JCS_EXT_BGRX color space

Everytime somebody has to write a channel swizzling loop,
God kills a kitten... and a dolphin and a unicorn.

12 years agoNever include wayland-util.h directly
Kristian Høgsberg [Tue, 22 Nov 2011 14:35:14 +0000 (09:35 -0500)]
Never include wayland-util.h directly

And fix a missing "" to <> conversion for wayland-client.h include.

12 years agoFix inconsistent #include style
Pekka Paalanen [Tue, 22 Nov 2011 12:18:50 +0000 (14:18 +0200)]
Fix inconsistent #include style

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoevdev: fetch absolute coordinates inside flush_motion only
Tiago Vignatti [Tue, 22 Nov 2011 10:05:22 +0000 (12:05 +0200)]
evdev: fetch absolute coordinates inside flush_motion only

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: remove useless field from device structure
Tiago Vignatti [Mon, 21 Nov 2011 16:29:40 +0000 (18:29 +0200)]
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>
12 years agoevdev: reset accumulator inside evdev_flush_motion
Tiago Vignatti [Mon, 21 Nov 2011 15:59:31 +0000 (17:59 +0200)]
evdev: reset accumulator inside evdev_flush_motion

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: use a separate structure to denote accumulated motion events
Tiago Vignatti [Mon, 21 Nov 2011 15:40:30 +0000 (17:40 +0200)]
evdev: use a separate structure to denote accumulated motion events

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: use a separate struct for abs information
Tiago Vignatti [Mon, 21 Nov 2011 14:39:55 +0000 (16:39 +0200)]
evdev: use a separate struct for abs information

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agotty: fix command line parsing
Tiago Vignatti [Mon, 21 Nov 2011 12:55:23 +0000 (14:55 +0200)]
tty: fix command line parsing

revert typo from evdev commit 8b568806.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agowindow: Remove unused variable
Kristian Høgsberg [Fri, 18 Nov 2011 20:24:23 +0000 (15:24 -0500)]
window: Remove unused variable

12 years agoevdev: Reset accumulate values when we flush motion events
Kristian Høgsberg [Fri, 18 Nov 2011 15:42:34 +0000 (10:42 -0500)]
evdev: Reset accumulate values when we flush motion events

Otherwise we end up reporting all motion events twice.

12 years agoMerge remote-tracking branch 'pq/glmatrix'
Kristian Høgsberg [Fri, 18 Nov 2011 14:57:50 +0000 (09:57 -0500)]
Merge remote-tracking branch 'pq/glmatrix'

12 years agocompositor: Queue buffer.release instead of sending immediately
Kristian Høgsberg [Thu, 17 Nov 2011 21:46:19 +0000 (16:46 -0500)]
compositor: Queue buffer.release instead of sending immediately

12 years agoevdev: fix order of events being sent to the compositor
Tiago Vignatti [Fri, 18 Nov 2011 12:56:58 +0000 (14:56 +0200)]
evdev: fix order of events being sent to the compositor

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agowscreensaver: configure glmatrix
Pekka Paalanen [Fri, 18 Nov 2011 12:36:14 +0000 (14:36 +0200)]
wscreensaver: configure glmatrix

Since I have commented out all the config structures in glmatrix.c, it
was not getting proper default values. Hardcode some default there.

Remove glClear from reshape_matrix(), as wscreensaver does not support
rendering commands in reshape call.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclients: add wscreensaver
Pekka Paalanen [Thu, 17 Nov 2011 09:33:06 +0000 (11:33 +0200)]
clients: add wscreensaver

Implement all the required support code for running glmatrix.c.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoclients: import glmatrix.c and matrix3.xpm
Pekka Paalanen [Thu, 17 Nov 2011 09:06:36 +0000 (11:06 +0200)]
clients: import glmatrix.c and matrix3.xpm

Copy hacks/glx/glmatrix.c and hacks/images/matrix3.xpm from
xscreensaver-5.15 distribution package.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoevdev: remove signed value checks
Tiago Vignatti [Thu, 10 Nov 2011 12:47:30 +0000 (14:47 +0200)]
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>
12 years agosimple-shm: Add a wl_shm listener
Kristian Høgsberg [Thu, 17 Nov 2011 15:27:17 +0000 (10:27 -0500)]
simple-shm: Add a wl_shm listener

This way we properly check that WL_SHM_FORMAT_XRGB32 is available.

12 years agoshell: fix handle_lock_surface_destroy()
Pekka Paalanen [Wed, 16 Nov 2011 11:47:35 +0000 (13:47 +0200)]
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>
12 years agoshell: fix compositor wakeup while locked
Pekka Paalanen [Wed, 16 Nov 2011 11:47:34 +0000 (13:47 +0200)]
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>
12 years agoshell: fix lock surface mapping
Pekka Paalanen [Wed, 16 Nov 2011 11:47:33 +0000 (13:47 +0200)]
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>
12 years agocompositor: Hide surfaces by setting surface->output to NULL
Kristian Høgsberg [Tue, 15 Nov 2011 21:39:55 +0000 (16:39 -0500)]
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.

12 years agodesktop-shell: add unlock dialog
Pekka Paalanen [Tue, 15 Nov 2011 11:34:56 +0000 (13:34 +0200)]
desktop-shell: add unlock dialog

The unclock dialog is just a normal window with a green ball in it. When
you click the ball, the screen will be unlocked.

Made for testing the screen locking.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agowindow: clean up redraw and focuses on destroy
Pekka Paalanen [Tue, 15 Nov 2011 11:34:55 +0000 (13:34 +0200)]
window: clean up redraw and focuses on destroy

Currently, the way to destroy a window in a response to an event (e.g.
button click), is to put a task into the deferred list with
display_defer(). The task will then call window_destroy() from outside
event handling code.

As events are handled, it is possible that the deferred list contains
also the redraw task for this window. As the execution order of these
tasks is unknown (redrawing a freed window is a bug) and redrawing
something that goes away immediately is not useful, the redraw task must
be removed on window_destroy().

'struct input' contains pointers to windows currently in focus for that
input device. These pointers must also be cleared on window_destroy().
This fixes a use-after-free bug for the unlock dialog in desktop-shell
(future commit).

As an irrelevant minor cleanup, window::grab_device member is not used
anywhere, and is removed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor: implement screen locking
Pekka Paalanen [Tue, 15 Nov 2011 11:34:54 +0000 (13:34 +0200)]
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>
12 years agocompositor: check wlsc_surface::link before accessing neighbors
Pekka Paalanen [Tue, 15 Nov 2011 11:34:53 +0000 (13:34 +0200)]
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>
12 years agocompositor: fix repaint on first wakeup
Pekka Paalanen [Tue, 15 Nov 2011 11:34:51 +0000 (13:34 +0200)]
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>
12 years agocompositor: remove idle_inhibit optimization
Pekka Paalanen [Tue, 15 Nov 2011 11:34:50 +0000 (13:34 +0200)]
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>
12 years agocompositor: let the shell wake up the compositor
Kristian Høgsberg [Tue, 15 Nov 2011 11:34:49 +0000 (13:34 +0200)]
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>
12 years agodesktop-shell: screen locking protocol
Pekka Paalanen [Tue, 15 Nov 2011 11:34:48 +0000 (13:34 +0200)]
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>
12 years agocompositor: Hold on to surface.frame requests until we assign an output
Kristian Høgsberg [Tue, 15 Nov 2011 18:50:21 +0000 (13:50 -0500)]
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.

12 years agocompositor: Drop unused wlsc_output field 'background'
Kristian Høgsberg [Tue, 15 Nov 2011 16:57:54 +0000 (11:57 -0500)]
compositor: Drop unused wlsc_output field 'background'

12 years agocompositor: fix destroy_frame_callback()
Pekka Paalanen [Tue, 15 Nov 2011 09:45:42 +0000 (11:45 +0200)]
compositor: fix destroy_frame_callback()

Pass the correct pointer to free().

This is just a cosmetic change, because 'resource' happens to be the
first member in wlsc_frame_callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfig: fix boolean parsing
Pekka Paalanen [Tue, 15 Nov 2011 09:45:41 +0000 (11:45 +0200)]
config: fix boolean parsing

The rest of the line contains the newline, so cannot match simply 'true'
or 'false'.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agoconfig: Don't print warning when XDG_CONFIG_HOME isn't set
Kristian Høgsberg [Tue, 15 Nov 2011 14:01:42 +0000 (09:01 -0500)]
config: Don't print warning when XDG_CONFIG_HOME isn't set

According to the spec, it's ok for this not to be set and just means that
we should default to $HOME/.config.