Commit Graph

1191 Commits

Author SHA1 Message Date
Pekka Paalanen 8260f460d7 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>
2011-11-18 14:45:04 +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
Kristian Høgsberg a3cdf59cee simple-shm: Add a wl_shm listener
This way we properly check that WL_SHM_FORMAT_XRGB32 is available.
2011-11-17 10:27:17 -05: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 bfbb26bdb2 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>
2011-11-15 16:43:25 -05:00
Pekka Paalanen 77cbc951cb 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>
2011-11-15 16:43:24 -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
Kristian Høgsberg 3164c946ac compositor: Drop unused wlsc_output field 'background' 2011-11-15 11:57:54 -05:00
Pekka Paalanen 8c19645e69 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>
2011-11-15 09:06:09 -05:00
Pekka Paalanen 09d65d0e64 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>
2011-11-15 09:04:56 -05:00
Kristian Høgsberg fc32c394e7 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.
2011-11-15 09:02:24 -05:00
Pekka Paalanen 668dd56918 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>
2011-11-15 08:57:01 -05:00
Kristian Høgsberg b38666e6d7 desktop-shell: Add sample ini file 2011-11-14 22:57:14 -05:00
Kristian Høgsberg ac3a59a0d1 window: Add a cheesy parser for ini-files, use it in desktop-shell 2011-11-14 22:51:02 -05:00
Kristian Høgsberg 64f1c3fd52 De-brand the tablet shell
Drop the MeeGo part of the name.
2011-11-14 15:57:59 -05:00
Kristian Høgsberg c4693c4ab4 Install desktop-shell in $prefix/libexec 2011-11-14 14:57:17 -05:00
Kristian Høgsberg d826404472 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.
2011-11-11 11:48:15 -05:00
Kristian Høgsberg 46770139bc shell: Set initial toplevel position in map callback 2011-11-09 12:40:08 -05:00
Kristian Høgsberg 32e24cc628 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.
2011-11-09 12:07:35 -05:00
David Herrmann 63ff706c0e 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>
2011-11-05 22:04:03 -04:00
Pekka Paalanen bbe605241d 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>
2011-11-03 15:16:39 -04:00
Pekka Paalanen 6cd281a023 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>
2011-11-03 15:16:19 -04:00
Ander Conselvan de Oliveira ef7c8d9ddf 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>
2011-11-01 11:18:39 -04:00
Kristian Høgsberg d3ef7be781 compositor: Tweak fade spring to not overshoot 2011-10-29 15:04:42 -04:00
Kristian Høgsberg 06a670f2e7 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.
2011-10-29 14:39:13 -04:00
Kristian Høgsberg 3ff589df78 compositor: Make spring model always use the same time step 2011-10-29 13:41:18 -04:00
Kristian Høgsberg ff298d9834 compositor: Clear cursor buffer in create_sprite_from_png() 2011-10-28 20:41:28 -04:00
Ander Conselvan de Oliveira 0de0aafa7f 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>
2011-10-28 14:36:28 -04:00
Casey Dahlin fb39963cc9 Update .gitignores 2011-10-28 13:32:17 -04:00
Tiago Vignatti ac9cfd3065 evdev: Simplify error path for device creation
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-10-28 13:15:25 -04:00
Tiago Vignatti d9f7d1f0c5 evdev: Delete unused fields from evdev_input_device
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-10-28 13:09:42 -04:00
Tiago Vignatti ac2dc6aafe evdev: Add hotplug support
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-10-28 13:05:06 -04:00
Ander Conselvan de Oliveira 9a38a0a191 compositor: page flip away from a client buffer if it's destroyed
If the current or pending scanout buffer is destroyed, the client frame
will remain being displayed until something else causes a repaint to be
scheduled.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2011-10-28 12:43:47 -04:00
Kristian Høgsberg ac5098f11a Merge remote-tracking branch 'robster/rob/pointer-fixes' 2011-10-25 09:07:12 -04:00
Rob Bradford 1d72447d9b compositor: Report an error if we cannot the load the pointer image files 2011-10-25 13:43:44 +01:00
Rob Bradford d354711fc7 compositor: Don't try and use a NULL sprite for the device pointer
If loading the pointer images to the sprites fails then do not try and use
those NULL sprites for the pointer.
2011-10-25 13:38:31 +01:00
Rob Bradford 8bd35c7770 window: Avoid setting an invalid surface for the pointer
If we failed to load the pointer image to the surface then do not create a
buffer from a NULL surface and do not attach that to the device.
2011-10-25 12:20:51 +01:00
Rob Bradford 21223bf6d1 window: Report an error if we cannot load the pointer files 2011-10-25 12:19:36 +01:00
Kristian Høgsberg 2459694ab2 compositor: Clean up resource destroy callback handling 2011-10-24 17:51:02 -04:00
Pekka Paalanen 02ebfb1276 compositor: fix drag segfault
Without this fix, the dnd demo would make the demo compositor crash in
shell.c:drag_offer() because resource->data is NULL.

Initialise resource->data in shell_create_drag().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-10-24 15:35:09 -04:00
Ander Conselvan de Oliveira 02924bc0b6 compositor: fix whitespace error in wlsc_output_set_cursor
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2011-10-24 15:32:16 -04:00