Commit Graph

431 Commits

Author SHA1 Message Date
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