Commit graph

221 commits

Author SHA1 Message Date
Daniel Stone 351eb61fbc Support wl_keyboard::modifiers event
This event lets the compositor inform clients of the canonical keyboard
modifier/group state.  Make sure we send it at appropriate moments from
the compositor, and listen for it in clients as well.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-31 15:27:47 -04:00
Scott Moreau 7a1b32a198 Implement text cursor position protocol.
Here we create a new client/compositor interface in weston to allow
clients to report their x/y cursor position to the compositor. These
values are then used to center the zoom area on this point. This
is useful for everyone, especially people who are visually impaired.
2012-05-31 13:10:22 -04:00
Kristian Høgsberg 92a57db6f2 shell: Add keybinding to force-close (SIGKILL) inactive clients 2012-05-26 13:41:06 -04:00
Tiago Vignatti 99aeb1e72d shell: use transient flags for activate or not new surfaces
Inactive surfaces doesn't set keyboard focus, so it can be used for tooltips,
toolbars and some other type of windows.

This requires protocol side changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-25 22:52:03 -04:00
Kristian Høgsberg c1693f209a xwm: Implement resizing by frame borders 2012-05-22 16:56:23 -04:00
Kristian Høgsberg a61ca06b49 xwm: Add window resize support 2012-05-22 16:05:52 -04:00
Kristian Høgsberg 9b68af0608 shell: Add back mod+pageup/down keybindings for zoom
This way we can use zoom without a scrollwheel/touchpad.
2012-05-22 12:58:47 -04:00
Scott Moreau 850ca42b9b Restructure output zoom.
A quick clean-up of zoom to prepare for the other patches in this series.
2012-05-22 12:58:47 -04:00
Scott Moreau 02709afb51 shell: Update relevant bits to work with recent alpha value changes. 2012-05-22 11:33:36 -04:00
Kristian Høgsberg 9540ea61a0 shell: Fix broken indentation in shell_get_shell_surface() 2012-05-21 17:03:16 -04:00
Kristian Høgsberg 45ba869ff3 shell: Make create_shell_surface() just return the shsurf 2012-05-21 17:03:16 -04:00
Kristian Høgsberg a416fa15d5 xwm: Switch alpha, brightness and saturation to GLfloat 2012-05-21 17:03:06 -04:00
Rob Bradford 579f2934de shell: Remove fading animation from animation list when surface destroyed
Fixes crash with a backtrace like this:

==2418== Invalid read of size 8
==2418==    at 0x8AC5B70: unresponsive_fade_frame (shell.c:374)
==2418==    by 0x409FE0: weston_output_finish_frame (compositor.c:1060)
==2418==    by 0x567043B: wl_event_loop_dispatch (event-loop.c:389)
==2418==    by 0x566E84C: wl_display_run (wayland-server.c:1003)
==2418==    by 0x4055EB: main (compositor.c:2937)
==2418==  Address 0x8aba650 is 80 bytes inside a block of size 656 free'd
==2418==    at 0x4A0662E: free (vg_replace_malloc.c:366)
==2418==    by 0x566D93B: wl_resource_destroy (wayland-server.c:408)
==2418==    by 0x566D30E: destroy_resource (wayland-server.h:166)
==2418==    by 0x566D93B: wl_resource_destroy (wayland-server.c:408)
==2418==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
==2418==    by 0x34ECE05784: ffi_call (ffi64.c:486)
==2418==    by 0x5671AAE: wl_closure_invoke (connection.c:770)
==2418==    by 0x566DBAA: wl_client_connection_data (wayland-server.c:255)
==2418==    by 0x5670497: wl_event_loop_dispatch (event-loop.c:410)
==2418==    by 0x566E84C: wl_display_run (wayland-server.c:1003)
==2418==    by 0x4055EB: main (compositor.c:2937)a

and

==2418== Invalid read of size 8
==2418==    at 0x34F1E180E1: pixman_region32_union (pixman-region.c:1405)
==2418==    by 0x407F66: weston_surface_damage (compositor.c:551)
==2418==    by 0x409FE0: weston_output_finish_frame (compositor.c:1060)
==2418==    by 0x567043B: wl_event_loop_dispatch (event-loop.c:389)
==2418==    by 0x566E84C: wl_display_run (wayland-server.c:1003)
==2418==    by 0x4055EB: main (compositor.c:2937)
==2418==  Address 0x851dfe8 is 136 bytes inside a block of size 680 free'd
==2418==    at 0x4A0662E: free (vg_replace_malloc.c:366)
==2418==    by 0x566D93B: wl_resource_destroy (wayland-server.c:408)
==2418==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
==2418==    by 0x34ECE05784: ffi_call (ffi64.c:486)
==2418==    by 0x5671AAE: wl_closure_invoke (connection.c:770)
==2418==    by 0x566DBAA: wl_client_connection_data (wayland-server.c:255)
==2418==    by 0x5670497: wl_event_loop_dispatch (event-loop.c:410)
==2418==    by 0x566E84C: wl_display_run (wayland-server.c:1003)
==2418==    by 0x4055EB: main (compositor.c:2937)
2012-05-21 13:59:00 -04:00
Tiago Vignatti 491bac19c7 shell: Expose set_transient in shell interface 2012-05-18 16:37:43 -04:00
Kristian Høgsberg 938b8fa3c2 shell: Expose surface move functionality in shell interface 2012-05-18 13:47:15 -04:00
Daniel Stone 37816df646 Convert wl_input_device to wl_seat (and friends)
wl_input_device has been both renamed and split.  wl_seat is now a
virtual object representing a group of logically related input devices
with related focus.

It now only generates one event: to let clients know that it has new
capabilities.  It takes requests which hand back objects for the
wl_pointer, wl_keyboard and wl_touch interfaces it exposes which all
provide the old input interface, just under different names.

This commit tracks these changes in weston and the clients, as well as
similar renames (e.g. weston_input_device -> weston_seat).  Some other
changes were necessary, e.g. renaming the name for the visible mouse
sprite from 'pointer' to 'cursor' so as to not conflict.

For simplicity, every seat is always exposed with all three interfaces,
although this will change as time goes on.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-16 15:29:06 -04:00
Scott Moreau dc549932b7 Convert wl_fixed_t to int in weston_output_update_zoom().
This way, we don't have to use wl_fixed_to_int() for each
call to weston_output_update_zoom(). It accepts wl_fixed_t
types and converts internally.
2012-05-16 11:04:04 -04:00
Kristian Høgsberg 88c1607fb7 shell: Remove lock/unlock listeners on shutdown 2012-05-16 08:04:19 -04:00
Kristian Høgsberg b71302e1db Fix a few -pedantic warnings
We're not enabling -pedantic by default, but a quick test brought up a few
issues that we should fix.
2012-05-10 14:11:44 -04:00
Daniel Stone 103db7fb56 Convert wire input co-ordinates to fixed-point
To add greater precision when working with transformed surfaces and/or
high-resolution input devices.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 14:41:01 -04:00
Tiago Vignatti 52e598cf51 shell: use own struct for transient surfaces
No functional changes; it's only opening space for modifications coming along
on the next commits.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-07 16:54:53 -04:00
Tiago Vignatti 70e5c9cc42 shell: fix uninitialized variable warning
and shut-up valgrind:
 Conditional jump or move depends on uninitialised value(s)
    at 0xB5AFB05: shell_surface_configure (shell.c:2162)
    by 0x407B0C: surface_attach (compositor.c:1225)
    by 0x621FA13: ffi_call_unix64
    by 0x621F434: ffi_call
    by 0x4E3D3F5: wl_closure_invoke (connection.c:758)
    by 0x4E3786C: wl_client_connection_data (wayland-server.c:255)
    by 0x4E3AA19: wl_event_source_fd_dispatch (event-loop.c:78)
    by 0x4E3B533: wl_event_loop_dispatch (event-loop.c:460)
    by 0x4E38D2C: wl_display_run (wayland-server.c:907)
    by 0x40B5DD: main (compositor.c:2748)

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-05-07 16:54:32 -04:00
Daniel Stone e5a0120757 Rename 'state' in axis (or ambiguous) bindings to 'value'
Since it's usually an axis value rather than a boolean, be slightly more
explicit about it.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 13:03:48 -04:00
Daniel Stone da5b93c8d7 Change key/button grab bindings to take unsigned state
'state' here meaning 'is it up or down?', obviously.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-07 12:54:14 -04:00
Kristian Høgsberg e7afd919c9 shell: Handle set_title and set_class 2012-05-02 09:47:44 -04:00
Kristian Høgsberg f7e23d5c88 shell: Always configure when surface type changes
We can drop the force_configure hack.
2012-04-27 17:51:59 -04:00
Kristian Høgsberg 7f366e7053 shell: Don't move or reconfigure surfaces until we get the new buffer
Going from fullscreen to toplevel will restore the surface position
immediately.  This will move the fullscreen surface to where the toplevel
surface was before, which will flicker for a frame of two before the
resized, non-fullscreen buffer is attached.

Instead, only change the surface geometry when we get the new buffer.
2012-04-27 17:49:40 -04:00
Alex Wu 7bcb8bd30e shell: Fix not remove rotation for fullscreen surf
Remove rotation when entering fullscreen and restore rotation when exiting.

https://bugs.freedesktop.org/show_bug.cgi?id=48906
2012-04-27 15:10:37 -04:00
Ander Conselvan de Oliveira fb9808993b shell: allocate enough memory for shsurf->ping_timer 2012-04-27 15:06:18 -04:00
Juan Zhao e10d279017 shell-animation: add conf option in shell
Now we can choose zoom or fade in weston.ini
to fulfill and customize the user experence easier.

Signed-off-by: Juan Zhao <juan.j.zhao@intel.com>
2012-04-25 10:38:19 -04:00
Kristian Høgsberg ca535c1998 shell: Don't ping internal shell surfaces
This is a hack for now to get xserver surfaces working again.
2012-04-21 23:21:33 -04:00
Tiago Vignatti bc052c99f9 compositor: introduce internal shell_interface
We're able now to create shell_surfaces inside Weston. This makes possible the
glue needed between shell and xserver-launcher.

On the desktop-shell, it was split the protocol part from shell_surface
specific functions to make this possible.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-21 23:21:08 -04:00
Kristian Høgsberg a4e8b33704 shell: Move binding-modifier to shell section 2012-04-20 16:48:21 -04:00
Tiago Vignatti 0b52d4810d shell: modifier bindings configurable
This patch makes the main modifier configurable.  We used to hardcode super
(windows key) for most bindings, but now that can be changed.

The change affects two key bindings: rotation moves to mod+right click
and backlight moves to from ctrl+f9/f10 to mod+f9/f10.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-20 16:38:35 -04:00
Scott Moreau 9521d5e553 shell: Cleanup ping_timer code.
- Added ping_timer_destroy() to simplify cleanup.
 - Changed timeout and fade step to more realistic values.
 - Renamed ping_timeout_fade_frame() to unresponsive_fade_frame().
2012-04-19 15:12:43 -04:00
Scott Moreau c3e54eb8f0 Dim unresponsive windows
If a client is not responding, lower the brightness and
saturation to indicate it's stalled. The surface is restored
to it's original color values if the client later becomes
responsive.
2012-04-19 12:51:01 -04:00
Scott Moreau ff1db4a4f3 Install structuring for ping-pong protocol 2012-04-19 12:50:47 -04:00
Alex Wu bd3354b8b2 shell: Implement "driver" method of fullsceen.
Switching display mode may happen when:
1. The fullscreen surface is at top most in fullscreen layer and with
   "driver" method. Shell will switch output mode to match the surface
   size. If no matched mode found, fall back to "fill" method.
2. The top fullscreen surface is destroyed or unset. Switch back to the
   origin mode.
2012-04-17 14:38:45 -04:00
Tiago Vignatti be14326efd desktop-shell: use more consistent name for the main structure
wl_shell is more likely to be used for core protocol specific. Now it follows
pretty much the same style of what tablet-shell is using.

No functional changes.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-04-16 11:55:24 -04:00
Kristian Høgsberg 3730f36c6e shell: Tighten shell.set_popup semantics
We need to use the input device from the request, and check that the
serial matches the serial from the latest button press.
2012-04-13 12:40:18 -04:00
Kristian Høgsberg 02e79dc935 compositor: Add a destroy signal and turn weston_shell into signals 2012-04-12 16:16:38 -04:00
Kristian Høgsberg 27e30526db Use wl_signal mechanism
Mostly mechanical rewrite to track waylands change to struct wl_signal.
2012-04-12 16:15:56 -04:00
Kristian Høgsberg eae5de7609 Follow wayland change to serial numbers 2012-04-11 22:42:15 -04:00
Ander Conselvan de Oliveira fe0444a9a9 shell: handle surface destruction during move, resize and rotate grabs
When the surface being moved, resized or rotated was destroyed, the
compositor would crash.

Fix this by using a destroy listener on the referenced surface. To
reduce code duplication, the surface reference and the destroy
listener is added to a new struct shell_grab.
2012-04-10 01:40:11 -04:00
Kristian Høgsberg 32e568600f shell: Break up a few long lines 2012-04-02 22:18:58 -04:00
Alex Wu 1659daa21f shell: set black surface alpha properly in switcher_next()
Make the black surfaces semitransparent when switching surface, and
if associated fullscreen surface is chosen, make black surface opaque.
2012-04-02 22:17:04 -04:00
Alex Wu 2185843ced shell: Add fullscreen path into activate()
Use shell_stack_fullscreen() to raise fullscreen surface in activate(),
and before activate() a regular surface, move all the fullscreen
surfaces from fullscreen_layer to toplevel_layer.

Also add a void *private into struct wesont_surface since we already
have a configure() vfunc. That helps to get the associated fullscreen
surface of black surface.
2012-04-02 22:15:40 -04:00
Kristian Høgsberg 875ab9e735 Add signedness warning flag and fix fallout 2012-03-30 11:52:39 -04:00
Kristian Høgsberg ed92f79655 Fix warnings resulting from wayland signedness fixes 2012-03-30 11:31:25 -04:00
Kristian Høgsberg 3448616bc3 Remove weston_shell map and configure function pointers 2012-03-29 13:08:32 -04:00
Kristian Høgsberg 56d23bc3ee shell: Remove obsolete workaround
Cursor surface now are properly initialized.
2012-03-29 11:35:32 -04:00
Ander Conselvan de Oliveira 7fb9f95dce compositor: move force_configure field to shell_surface 2012-03-27 16:36:54 -04:00
Ander Conselvan de Oliveira 093bfa3793 compositor: make surface_configure() a vfunc
This allows us to move the logic that calls shell->map() or
shell->configure() into shell while allowing it to be overriden for
surfaces that should not be handle by the shell, such as drag icons.

This patch adds a pointer function called configure to weston_surface,
moves the currsent surface_configure() code into shell and implements
a separate configure() for drag surfaces.
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira d6ea33dfd6 compositor: use new drag icon listener for setting up drag surfaces
That way we can get rid of the call to
weston_compositor_update_drag_surfaces() on shell->map().
2012-03-27 16:36:53 -04:00
Ander Conselvan de Oliveira b8ab14fe04 compositor: add a weston_surface_is_mapped() helper 2012-03-27 16:36:53 -04:00
Tiago Vignatti 9a206c4da5 config-parser: consolidate shell files into weston.ini only
The shell choice happens in the configuration file now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-25 08:49:30 -04:00
Rafal Mielniczuk 2d7ab82d74 shell: fix matrix invertible bug in rotation handler
While activating and deactivating rotation mechanism without moving
the pointer, rotation matrix from rotate_grab object is not being
initialised and damage shell surface rotation matrix in
rotate_grab_button handler, making it invertible.

This patch initialise rotate matrix in rotate_binding
and moves surface position check to rotate_grab_motion handler.
2012-03-22 22:34:11 -04:00
Scott Moreau a3aa9c9dd6 Add surface opacity controls. 2012-03-22 11:03:41 -06:00
Scott Moreau 1b45a79a0a Switch zoom binding to <Super>+Scroll. 2012-03-22 11:03:41 -06:00
Scott Moreau 6a3633d2bb Modify bindings for axis event detection. 2012-03-22 11:03:41 -06:00
Rafal Mielniczuk 778e629b95 shell: correct position of a surface before rotating it.
How to reproduce: rotate the surface to something like 45 degrees,
resize it drastically, continue to rotate. The surface will jump
some space and the rotation point will not be in the center
of the surface.

Fix is to shift the surface position to match the rotation point
2012-03-22 10:44:27 -04:00
Tiago Vignatti 5ab91ad845 compositor: use smoother range for backlight control
now it goes from 0 to 255.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-03-20 22:43:54 -04:00
Alex Wu 07b2606c7a shell: Fix 2 switcher crashes.
In case of no regular window, switcher will crash in switch_next()
due to "next == NULL" and in switcher_destroy() due to
"switcher->current == NULL".
2012-03-20 22:43:54 -04:00
Kristian Høgsberg aa6019e125 Fix picking crashes
The surface list is only valid after repaint, so we need to do picking and
input delivery there.
2012-03-12 01:28:50 -04:00
Ander Conselvan de Oliveira de56c311d9 shell: don't assign output for surface of type none
If map is called with a surface of type none it will call
weston_surface_assign_output, even though the surface will
not be mapped.

This change was lost with the changes for using wl_layers.
2012-03-08 13:10:18 -05:00
Alex Wu 9c35e6b47d shell: Fix segment fault when clicking to activate a NULL pointer_focus
This can happen for instance running a toytoolkit application, launching
the popup menu and then clicking on a surface that does not belong to
the client that create the popup surface.
2012-03-08 13:08:00 -05:00
Alex Wu aa08e2d56d shell: Fix not destroy black surface when fullscreen surface exit abnomally.
When a client with fullscreen surface displayed was aborted by Ctrl-C, the
black surface still be there. Destroy the black surface in
destroy_shell_surface().
2012-03-08 12:57:54 -05:00
Kristian Høgsberg 60c4954b8a shell: Put popups and transients on top of their parent
In other words, don't map the panel menu under the panel.
2012-03-05 20:51:34 -05:00
Kristian Høgsberg abcef3cf7a compositor: Swallow binding key for bindings that don't set up a grab
This prevents passing the key press and release to the keyboard focus client.
2012-03-05 17:47:15 -05:00
Kristian Høgsberg 0b5cd0cb4c Use typesafe server-side stubs 2012-03-04 21:57:37 -05:00
Kristian Høgsberg b41c0810ea compositor: Add a repaint debugging mechanism
Toggle on/off with Super+SPACE.
2012-03-04 14:53:40 -05:00
Kristian Høgsberg 32bed57d5a shell: Don't launch a new screensaver if the old one is still running 2012-03-01 17:33:52 -05:00
Kristian Høgsberg 3be2ce9e49 compositor: Organize surface stack using new struct weston_layer
The surface data structure is now a list of list of surfaces.  The core
compositor defines the fade and cursor layer, and it's up to the shell to
provide more layers for the various surface types it implements.
2012-03-01 17:33:51 -05:00
Alex Wu 4539b0874f shell: Add implementation of fullscreen.
Undo fullscreen in shell_unset_fullscreen(), do all the stacking order
in shell_stack_fullscreen(), and configure black surface, method in
shell_configure_fullscreen().

Signed-off-by: Alex Wu <zhiwen.wu@linux.intel.com>
Signed-off-by: Juan Zhao <juan.j.zhao@linux.intel.com>
2012-03-01 12:47:23 -05:00
Tiago Vignatti 8e53c7f566 compositor: add dpms and backlight support
DPMS kicks in only when wscreensaver is launched, in the moment that shell
call lock() for the second time. Backlight control internals are managed by
libbacklight:

	http://cgit.freedesktop.org/~vignatti/libbacklight/

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-02-29 14:01:56 -05:00
Kristian Høgsberg cacb7cd0f6 shell: Mark geometry dirty when we change surface alpha
We need to recompute the opaque region when the alpha changes.
2012-02-28 09:23:23 -05:00
Scott Moreau c6d7f60b19 Restructure output zoom key handling.
This effectively eats the keybinding events, as we don't want them sent
to clients.
2012-02-26 13:43:11 -05:00
Scott Moreau ccbf29dcb4 Introduce output zoom.
Ideally, we would want to use <modifier>+Scroll binding but that will have
to wait for axis events. For now we just use keybindings. Zoom in/out with
Super+Up/Down.
2012-02-23 17:45:49 -05:00
Ander Conselvan de Oliveira ba727bd1d9 shell: don't assign output for surface of type none
If map is called with a surface of type none it will call
weston_surface_assign_output, even though the surface will
not be mapped.
2012-02-23 16:06:06 -05:00
Alex Wu 88277d1422 shell: Fix never map fullscreen/transient surface.
If client send set_fullscreen/set_transient request before the first attach,
       compositor has no chance to map the surface due to "if (es->output == NULL)".

       You can pull it from git://gitorious.org/wayland-for-krh/weston.git map-bug
2012-02-22 12:33:43 -05:00
Kristian Høgsberg 0704539ec4 shell: Revive super-tab application switcher
We can do this right, now that we have keyboard grabs.
2012-02-19 21:04:08 -05:00
Scott Moreau 447013d718 Track server changes. 2012-02-18 11:55:51 -05:00
Kristian Høgsberg 1cbf3262dd compositor: Move fullscreen_output to shell_surface 2012-02-17 23:49:07 -05:00
Kristian Høgsberg 6a8b553119 shell: Set geometry directly in configure
We already set half of it directly, and overwrite it in other cases, so
just skip weston_surface_configure().
2012-02-16 23:43:59 -05:00
Kristian Høgsberg d5ae9f4f85 shell: Restore basic fullscreen functionality
This just fixes the default case.
2012-02-16 23:38:14 -05:00
Pekka Paalanen b29f412eb8 protocol: remove absolute coordinates from pointer
This change depens on the Wayland core commit:
"protocol: remove absolute coordinates from pointer".

Remove the absolute coordinates from pointer motion and pointer_focus
events.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-16 23:19:40 -05:00
Ander Conselvan de Oliveira 30eebc7c21 compositor: implement drag'n'drop icons
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira e9e0515cec shell: update position of surfaces with type none on map()
Needed for implementing drag'n'drop icons. When a drag starts, the
compositor will position the top-left corner of the client supplied
icon surface at the cursor hotspot. On the first attach to that
surface, the client may want to reposition it but shell->map did not
take sx and sy parameters.

This changes shell->map interface to take sx and sy parameters and
change dekstop shell implementation to update the position of a
surface of type none according to those parameters. Since a surface
of type none won't actually be mapped, the effect of this change is
only visible for surfaces that are made visible by the compositor.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Ander Conselvan de Oliveira a1ff53b31a shell: don't map surfaces with type NONE
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-02-16 23:19:39 -05:00
Kristian Høgsberg f856fd2f93 Follow set_fullscreen protocol change 2012-02-16 23:19:38 -05:00
Juan Zhao 96879dfe52 shell: Add the set_maximized implementation 2012-02-16 16:00:02 -05:00
Pekka Paalanen 8fb8d3b1b5 compositor, shell: add and use weston_surface_set_position()
Another shorthand like weston_surface_configure().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 13:03:59 +02:00
Pekka Paalanen d882779aa9 shell: remove two redundant statements from map()
I stared at this function for some time, and these were the only lines
I could sanely remove.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:52:24 +02:00
Tiago Vignatti 0f997016a7 shell: remove duplicated code
This clean-up seems alright, but someone with better knowledge has to
doublecheck this function. I guess there's a lot of space for clean-up
there.

[pq: looks ok, redone since did not apply after my changes]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:52:24 +02:00
Pekka Paalanen 8980f7c7d8 shell: do not apply damage on window type set
Setting a window type is a non-visual operation, it is not supposed to
affect the rendering immediately. Therefore it does not need to apply
surface damage.

The proper surface damage is applied on an attach request following a
window type change.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-13 11:41:24 +02:00
Pekka Paalanen fc6d91a568 shell: replace identity calls to weston_surface_configure()
In the past, weston_surface_configure() was used to change the geometry,
apply damage, and assign an output.

Remove all calls to weston_surface_configure() that do not change the
surface geometry. Add damage calls where needed to keep the wanted
configure side-effects.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:50:27 +02:00
Pekka Paalanen f07cb5d5f0 compositor: move output assignment to update_transform
Move the call to assign an output from weston_surface_configure() to
weston_surface_update_transform().

As update_transform takes new geometry into use, it should also reassign
the output for the surface, but only if an output was already assigned.

Add explicit assing output calls to where we relied on
weston_surface_configure() unconditionally assigning the output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:50:27 +02:00
Pekka Paalanen b45ac5eada compositor: clarify update_transform vs. repaint
Remove redundant weston_surface_update_transform() calls from within
output repaint paths, and add a comment that we need to rely on
surface->geometry.dirty == 0 within the repaint sub-functions.

Now that weston_surface_update_transform() does damage as needed, and
weston_output_repaint() explicitly calls update_transform, we can reduce
the updates in rotate_grab_motion() to simply scheduling a repaint. This
will guarantee that the change in rotation ends up on screen ASAP.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen 25dacab718 shell: remove excessive damage from rotating
Rotating a surface should not force a full display repaint, so remove
that.

This change exposes a bug: weston_surface_update_transform() does not
apply damage, but it does change surface geometry. While you rotate a
surface, repaints do not work.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:55 +02:00
Pekka Paalanen 938269af21 compositor: simple menu transform
Transform a menu popup the same as its parent surface.

The parent's transformation is snapshotted at the popup map() time, and
does not follow further parent motion.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-07 14:19:01 +02:00
Pekka Paalanen ddae03cf9b compositor: q&d solution for surface drift
When a transformed (rotated) surface is continuously resized from its
top-left corner, its location will drift. This is due to accumulating
rounding errors in transforming an offset from surface-local to global
coordinates in surface_attach().

Diminish the drift down to unobservable level by changing the
weston_surface global position from integer to float.

The offset transformation is now done without rounding. To preserve the
precision, wl_shell::configure() interface must use floats, and so does
weston_surface_configure(), too.

The con of this patch is that it adds inconsistency to the surface
position coordinates: sometimes they are floats, sometimes integers.
2012-02-06 14:54:20 +02:00
Pekka Paalanen 5c97ae7b82 shell: fix resize for transformed surfaces
This fixes the resize pointer motion vs. surface size mismatch for
right/bottom direction resizes. Top/left resizes need further fixes in
surface motion.

Additionally there is some clean-up in weston_surface_resize() to
eliminate a failure path, and fixing the Weston resize binding's resize
direction heuristic to follow transformations.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +02:00
Pekka Paalanen 7b3bd3d8b6 shell: fix move of transformed surfaces
In the stack of transformations, change the rotation to be applied
to the surface before the absolute positioning. Doing so avoids having
to undo and redo the absolute positioning, and we can simply use the
surface center in local coordinates as the origin.

This fixes the surface move. Before, the surface moved along the surface
local axis, but the user expects it to move along the global axis with
the pointer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +02:00
Kristian Høgsberg 765e27b9e2 shell: Rotate relative to current rotation
This avoids the surface jumping around when you start rotating it.
2012-01-27 13:36:13 -05:00
Pekka Paalanen d581a8fcc8 Collabora copyright updates
which I forgot to add while working on these files.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:26:17 +02:00
Pekka Paalanen 60921e5787 compositor: move weston_surface::width,height into geometry
weston_surface::transform.boundingbox depends on width and height, and
therefore geometry.dirty flag, so move width and height into geometry.

Fix all users and check that the dirty flag is set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen ba3cf95c0e compositor: move weston_surface::x,y into geometry
weston_surface::transform.position depends on x,y, and therefore the
dirty flag, so move x and y into geometry.

Also add the missing dirty flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen e0f3cb25e8 compositor: rewrite draw and input coordinate transformations
For unifying the coordinate system handling, introduce functions for
converting explicitly between the global and the surface local
coordinate systems.

Use these functions in the input path, replacing
weston_surface_transform().

In the draw path, rewrite transform_vertex() to take in surface local
coordinates.

As shell now uses the new functions, the rotation origin is properly
placed in the middle of the surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen bc0b7e7756 compositor: restructure weston_surface::transform
Separate mutable data and cached immutable data in struct
weston_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Pekka Paalanen 460099f143 shell: add key binding for rotating a surface
Add the key binding Super+Alt+MouseLeftButton to start rotating a
surface by dragging. The rotation is removed, when the drag is near the
rotation origin.

Rotated surface are a stress test for input event coordinate
transformations, damage region tracking, draw transformations, and
window move and resize orientation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-27 16:15:02 +02:00
Kristian Høgsberg a82c4860a1 compositor: Compute overlapped early and base hw cursor decision on that 2012-01-26 01:03:58 -05:00
Kristian Høgsberg 6af8eb9c7f desktop-shell: Build in sensible defaults
This adds a default background pattern and a terminal launcher in case
we don't have a config file.
2012-01-25 20:53:08 -05:00
Pekka Paalanen cb108439d2 shell: deal with weston_compositor_pick_surface() = NULL
I could crash Weston by trying to open another menu from a panel while
one menu from it was already showing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
440		if (surface->resource.client == client) {
(gdb) bt
 0  0x00007ffff40a9872 in popup_grab_focus (grab=0x761968, time=4130706528, surface=0x0, x=-227, y=15) at shell.c:440
 1  0x0000000000406977 in weston_device_repick (device=0x70b4e0, time=4130706528) at compositor.c:360
 2  0x0000000000406a36 in weston_compositor_repick (compositor=0x619960) at compositor.c:382
 3  0x0000000000406ac8 in destroy_surface (resource=0x6fc6f0) at compositor.c:397
 4  0x00007ffff7bd33d8 in destroy_resource (element=0x6fc6f0, data=0x7fffffffd9fc) at wayland-server.c:355
 5  0x00007ffff7bd8d98 in for_each_helper (entries=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:264
 6  0x00007ffff7bd8dd4 in wl_map_for_each (map=0x757808, func=0x7ffff7bd332c <destroy_resource>, data=0x7fffffffd9fc)
    at wayland-util.c:270
 7  0x00007ffff7bd34dc in wl_client_destroy (client=0x7577d0) at wayland-server.c:385
 8  0x00007ffff7bd2e36 in wl_client_connection_data (fd=17, mask=1, data=0x7577d0) at wayland-server.c:187
 9  0x00007ffff7bd5bde in wl_event_source_fd_dispatch (source=0x74cda0, ep=0x7fffffffdae0) at event-loop.c:76
 10 0x00007ffff7bd665b in wl_event_loop_dispatch (loop=0x618900, timeout=-1) at event-loop.c:462
 11 0x00007ffff7bd42a9 in wl_display_run (display=0x6188b0) at wayland-server.c:785
 12 0x000000000040b1e1 in main (argc=1, argv=0x7fffffffdef8) at compositor.c:2182

Modify popup_grab_focus() to deal with a NULL surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-19 10:18:49 -05:00
Kristian Høgsberg f03a616c21 shell: Set desktop-shell deathstamp at initial launch
Timestamp 0 is a valid timestamp and we can't use that as an uninitialized
timestamp.
2012-01-17 11:07:42 -05:00
Pekka Paalanen 4d733ee246 shell: respawn desktop-shell if it dies
If the desktop-shell client goes away for any reason, respawn it. To
avoid harmful looping, limit the respawning to 5 times within 30
seconds, and then give up.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-17 10:58:52 -05:00
Kristian Høgsberg b3cca0a411 shell: Start implementing the popup surface type
This lands the basic behavior of the popup surface type, but there are still
a number of details to be worked out.  Mainly there's a hardcoded timeout
to handle the case of releasing the popup button outside any of the
client windows, which triggers popup_end if it happens after the timeout.
Maybe we just need to add that as an argument, or we could add a new event
that fires in this case to let the client decide whether it ends the popup
or not.
2012-01-06 11:41:55 -05:00
Kristian Høgsberg 9ddb826077 Use new grab api 2012-01-05 11:00:01 -05:00
Pekka Paalanen 61b5c67268 shell: free memory on move/resize error paths
Memory leaks noticed by Valgrind, when wl_input_device_update_grab()
fails.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-05 09:10:49 +02:00
Kristian Høgsberg 9724b51750 More weston rename fixes 2012-01-03 14:35:49 -05:00
Kristian Høgsberg 3466bc8042 Merge remote-tracking branch 'pq/compositor-dtors-v1'
This collided with the big weston rename, but git did a good job of fixing
most cases.

Conflicts:
	compositor/compositor.h
	src/compositor-x11.c
	src/compositor.c
	src/screenshooter.c
	src/util.c
2012-01-03 11:36:37 -05:00
Kristian Høgsberg 8334bc1ef9 Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.

1) Initially, we had one big repository with protocol code, sample
compositor and sample clients.  We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code.  At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message.  The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.

2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor.  Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example.  Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.

We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 11:04:04 -05:00
Renamed from compositor/shell.c (Browse further)