Commit graph

25 commits

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