platform/upstream/weston.git
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.

12 years agowindow: add a helper for config file paths
Pekka Paalanen [Tue, 15 Nov 2011 09:45:40 +0000 (11:45 +0200)]
window: add a helper for config file paths

Add a helper function, that constructs a path to a config file from
XDG_CONFIG_HOME environment variable, by the rules of
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Make desktop-shell find its config file from XDG_CONFIG_HOME. This
allows to have a personal config file without continuously fighting with
git about wayland-desktop-shell.ini.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: Add sample ini file
Kristian Høgsberg [Tue, 15 Nov 2011 03:56:50 +0000 (22:56 -0500)]
desktop-shell: Add sample ini file

12 years agowindow: Add a cheesy parser for ini-files, use it in desktop-shell
Kristian Høgsberg [Tue, 15 Nov 2011 03:43:37 +0000 (22:43 -0500)]
window: Add a cheesy parser for ini-files, use it in desktop-shell

12 years agoDe-brand the tablet shell
Kristian Høgsberg [Mon, 14 Nov 2011 20:50:03 +0000 (15:50 -0500)]
De-brand the tablet shell

Drop the MeeGo part of the name.

12 years agoInstall desktop-shell in $prefix/libexec
Kristian Høgsberg [Mon, 14 Nov 2011 19:57:17 +0000 (14:57 -0500)]
Install desktop-shell in $prefix/libexec

12 years agocompositor: Drop redundant compositor->damage
Kristian Høgsberg [Fri, 11 Nov 2011 16:48:12 +0000 (11:48 -0500)]
compositor: Drop redundant compositor->damage

This is the same as the damage of the top-level surface so just use that.
There's a problem that if we change the stacking, the damage layering breaks,
but that's a problem we already have.

12 years agoshell: Set initial toplevel position in map callback
Kristian Høgsberg [Wed, 9 Nov 2011 17:38:53 +0000 (12:38 -0500)]
shell: Set initial toplevel position in map callback

12 years agocompositor: Split shell->attach into map and configure
Kristian Høgsberg [Wed, 9 Nov 2011 17:07:35 +0000 (12:07 -0500)]
compositor: Split shell->attach into map and configure

The shell module only needs to deal with attach when it's either the initial
attach or when the attach changes the size of the surface.  In case of
initial attach, the shell needs to pick a position for the surface and a
place in the surface stack.  We split this case out as a new shell->map
callback.  The other case is split into the shell->configure callback,
where the shell may adjust the surface position or reject the new size.

12 years agocompositor-drm: Fix setting O_CLOEXEC
David Herrmann [Sat, 5 Nov 2011 17:46:01 +0000 (18:46 +0100)]
compositor-drm: Fix setting O_CLOEXEC

The third parameter of open() is for file-creation modes. File flags are passed
in the second paramater.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
12 years agocompositor: only authorized client can bind desktop_shell
Pekka Paalanen [Thu, 3 Nov 2011 12:11:33 +0000 (14:11 +0200)]
compositor: only authorized client can bind desktop_shell

Check, that only the desktop-shell client spawned by the compositor
(desktop-shell plugin) is allowed to bind to desktop_shell interface.
Other clients will receive an error like:

  wl_display@1.error(desktop_shell@20, 0,
  "permission to bind desktop_shell denied")

The error has the proper object id and interface type.

Note: desktop-shell cannot be started manually anymore, it has to be
started by the compositor automatically.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agodesktop-shell: launch from the compositor
Pekka Paalanen [Thu, 3 Nov 2011 12:11:32 +0000 (14:11 +0200)]
desktop-shell: launch from the compositor

Fork and exec desktop-shell in the compositor. This is a way to create
an authenticated client. Later, the desktop-shell interface will be
reserved for this client only.

For exec to work, the compositor should be started from the
wayland-demos' root directory.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
12 years agocompositor-*: check for surfaceless_gles2 instead of surfaceless_opengl
Ander Conselvan de Oliveira [Tue, 1 Nov 2011 14:37:41 +0000 (16:37 +0200)]
compositor-*: check for surfaceless_gles2 instead of surfaceless_opengl

All the compositors are using GLES2 so check for the appropriate
surfaceless extension.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agocompositor: Tweak fade spring to not overshoot
Kristian Høgsberg [Sat, 29 Oct 2011 19:04:42 +0000 (15:04 -0400)]
compositor: Tweak fade spring to not overshoot

12 years agocompositor-x11: Call finish_frame from a timer callback
Kristian Høgsberg [Sat, 29 Oct 2011 18:39:13 +0000 (14:39 -0400)]
compositor-x11: Call finish_frame from a timer callback

The repaint logic breaks when finish_frame is called from the present
callback.  Ideally we should throttle to vsync (or even better, the
compositor repaint cycle, but hey, X is X), but this goes a long way.

12 years agocompositor: Make spring model always use the same time step
Kristian Høgsberg [Sat, 29 Oct 2011 17:41:18 +0000 (13:41 -0400)]
compositor: Make spring model always use the same time step

12 years agocompositor: Clear cursor buffer in create_sprite_from_png()
Kristian Høgsberg [Sat, 29 Oct 2011 00:41:28 +0000 (20:41 -0400)]
compositor: Clear cursor buffer in create_sprite_from_png()

12 years agocomposior: fix tiny cursor bug with drm compositor
Ander Conselvan de Oliveira [Thu, 27 Oct 2011 14:09:17 +0000 (17:09 +0300)]
composior: fix tiny cursor bug with drm compositor

The drm compositor always creates a 64x64 bo for the cursor image
regardless of the size of the actual cursor. When the fade animation
kicks in it disables the hardware cursor so that it is rendered as a
regular surface. This surface is rendered to a 32x32 region but using
a 64x64 texture so the cursor gets scaled down.

Fix this by making create_cursor_image return the actual size of the
image created to the compositor.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
12 years agoUpdate .gitignores
Casey Dahlin [Tue, 25 Oct 2011 22:58:56 +0000 (18:58 -0400)]
Update .gitignores

12 years agoevdev: Simplify error path for device creation
Tiago Vignatti [Fri, 28 Oct 2011 17:15:25 +0000 (13:15 -0400)]
evdev: Simplify error path for device creation

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: Delete unused fields from evdev_input_device
Tiago Vignatti [Fri, 28 Oct 2011 17:09:42 +0000 (13:09 -0400)]
evdev: Delete unused fields from evdev_input_device

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
12 years agoevdev: Add hotplug support
Tiago Vignatti [Fri, 28 Oct 2011 17:05:06 +0000 (13:05 -0400)]
evdev: Add hotplug support

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>