Commit Graph

1596 Commits

Author SHA1 Message Date
Pekka Paalanen
9651678070 compositor: let update_transform deal damage
weston_surface_update_transform() is similar to
weston_surface_configure() in that it changes the surface region on
screen. Unlike configure, update_transform forgets to deal damage at
all, yet it is the only place where we can do damage_below() as needed.

Add a damage_below call to deal damage for the old surface region only
when needed. This uses the cached state from surface->transform to get
the old region.

Add a damage call to deal damage for the new surface region, after
updating the cached state.

Add a repaint call, since we have changed the scene and should render it
out.

This change fixes the rotation not updating the screen properly.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
1d5035c705 compositor: simplify weston_surface_damage_rectangle()
The non-transformed case looked a little odd, calling
weston_surface_to_global(), since it already tests for transform.enabled
and simply uses width, height for the box.

Streamline it, by open-coding weston_surface_to_global(), and avoiding
another call into weston_surface_update_transform(). This way it does
not look suspicious to me.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
219b982ed0 compositor: use floats in computing bounding box
In surface_compute_bbox(), call surface_to_global_float() instead of
weston_surface_to_global(). This avoids the recursion:

weston_surface_update_transform()
  weston_surface_update_transform_enable()
    surface_compute_bbox()
       weston_surface_to_global()
         weston_surface_update_transform()

which might be non-obvious when reading the code.

Computing the min and max coordinates in floats, we can have a tight
rounding margin by using floor() and ceil().

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
ece8a016aa compositor: move surface_to_global_float() definition
Move surface_to_global_float() definition earlier in the file. No code
changes.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
80fb08dc66 compositor: split weston_surface_update_transform()
Split two helper functions out of weston_surface_update_transform() to:
- make the code clearer
- update the bounding box properly even if transformation fails
- unify the return point

Also add a comment on what matrix.d[12] is.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:56 +02:00
Pekka Paalanen
9abf393bd8 compositor: split weston_surface_damage_below()
Extract the core into a function that does not call
weston_surface_update_transform() or schedule repaint.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-10 15:47:55 +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
Eric Anholt
6f82cf5dc5 configure: Fix build on debian by avoiding bashisms in the test command. 2012-02-09 14:17:54 -05:00
Kristian Høgsberg
3b03b3d68e Use dist-xz for tarballs 2012-02-09 14:17:49 -05:00
Kristian Høgsberg
850f24c712 Disable setuid install for distcheck 2012-02-09 09:20:44 -05:00
Kristian Høgsberg
a7313e7cf4 configure: Change project to weston, set version to 0.89 2012-02-09 09:17:47 -05:00
Kristian Høgsberg
aded1f6823 compositor: Don't destroy sprite surface, just hide it 2012-02-08 16:33:57 -05:00
Kristian Høgsberg
0212723185 smoke: Use normal window resize mechanism 2012-02-08 14:47:53 -05:00
Kristian Høgsberg
09a96b5394 window: Don't set the window size in widget_set_size()
We propagate the toplevel widget size to the window size in the
window.c resize code.
2012-02-08 14:45:02 -05:00
Juan Zhao
6665063328 smoke: fix the segment fault error
Add widget_set_size in the initiate time to allow smoke get the
correct surface later. Or it will report segment fault error because
of the null surface.

Also add resize_handler to not allow resizing just like flower.

Signed-off-by: Juan Zhao <juan.j.zhao@linux.intel.com>
2012-02-08 14:17:32 -05:00
Kristian Høgsberg
3d5437c48d Add support for webp image format 2012-02-08 12:46:57 -05:00
Kristian Høgsberg
902865c757 cairo-util: Only look at first two bytes for jpegs
The next two bytes aren't fixed.
2012-02-08 10:11:42 -05:00
Peter Hutterer
035ac94c17 terminal: run $SHELL if set
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-07 16:26:11 -05:00
Jesse Barnes
3bd6917199 configure.ac: fix cairo-glesv2 help text
Finally figured out why --enable-cairo-gles2 wasn't working like
configure --help said it should.
2012-02-07 16:17:51 -05:00
Kristian Høgsberg
9b8a82bf6d Merge remote-tracking branch 'pq/transform-fixes2' 2012-02-07 11:08:03 -05:00
Kristian Høgsberg
546a812004 compositor-wayland: Add window border 2012-02-07 11:02:59 -05:00
Kristian Høgsberg
2e28b10a3f compositor-wayland: Add display sub-option for wayland backend
This lets us launch the compositor on a separate wayland socket that
what we're listening on.
2012-02-07 09:57:25 -05:00
Kristian Høgsberg
d11d944435 compositor-wayland: Hide cursor for compositor surfaces 2012-02-07 09:56:51 -05:00
Kristian Høgsberg
cdd61d0168 compositor-wayland: Destroy wl_callback in callback function 2012-02-07 09:56:15 -05:00
Kristian Høgsberg
eb764841a5 compositor: Drop setuid when launching clients 2012-02-07 09:52:40 -05: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
44ab69cfa3 compositor: add weston_surface transformation doc
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-07 13:18:00 +02:00
Pekka Paalanen
9f9aa1be50 compositor: fix transformed opaque surface repainting
Computing the real maximal opaque screen aligned rectangle of a
transformed surface is hard. Let's drop the opaque optimisation
instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-06 16:26:57 +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
c7b45f68e6 compositor: clear surface damage on draw
Commit a0d6dc4f26 lost one line of code in
the refactoring, and so did not reset the surface damage on repaint
anymore. This causes damage to only accumulate, leading to a full
display redraw every cycle and hiding damage tracking issues.

Put the damage clear back.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-06 12:20:02 +02:00
Pekka Paalanen
f55f544e4f compositor: fix and simplify shader uniform handling
The uniform location variables should be signed, according to the OpenGL
ES 2 specification. Moreover, GL_NONE, i.e. 0, is not an invalid nor
special location; it is actually used as a valid uniform location.

Change struct weston_shader uniform members to signed.

Stop using 0 for identifying a non-existing uniform, use -1 instead.
Furthermore, as the spec says a) glGetUniformLocation() will return -1
for non-active/existing uniforms, and b) glUniform*() function will
simply ignore all calls with location -1, we can simplify the code. We
don't have to avoid locating uniforms that don't exist, and we don't
need to test for them in weston_surface_draw() either.

Remove the micro-optimisation that avoids setting 'alpha' uniform if it
has not changed, in the name of simplification.

Unify shader creation by dropping init_solid_shader(), and calling
weston_shader_init() instead. The downside is that we compile the vertex
shader twice at startup now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-02 16:49:05 +02:00
Pekka Paalanen
0e4452e02a configure: add libpng to client libs
http://lists.freedesktop.org/archives/wayland-devel/2012-January/001975.html
reports a linking problem:

/usr/bin/ld: libtoytoolkit.a(cairo-util.o): undefined reference to
symbol 'png_set_filler@@PNG12_0'
/usr/bin/ld: note: 'png_set_filler@@PNG12_0' is defined in DSO
/usr/lib/i386-linux-gnu/libpng12.so.0 so try adding it to the linker command line
/usr/lib/i386-linux-gnu/libpng12.so.0: could not read symbols: Invalid
operation
collect2: ld returned 1 exit status
make[3]: [weston-terminal] Error 1 (ignored)

A similar problem is diagnosed here:
http://lists.fedoraproject.org/pipermail/devel/2010-March/133601.html

As some distros are shipping linkers, that do not resolve symbols from
implicitly linked libraries, check and link libpng explicitly.

Cc: nerdopolis <bluescreen_avenger@verizon.net>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-02-01 12:12:19 +02:00
Kristian Høgsberg
0452abc820 compositor: Don't just update uniforms when we change shaders
The uniforms change from surface to surface or output to output, so always
set them.
2012-01-31 15:38:43 -05:00
Kristian Høgsberg
2ad3b7f866 window: Fold window_resize into idle_resize 2012-01-31 15:34:15 -05:00
Kristian Høgsberg
0d1c062913 window: Don't overwrite window->allocation until we've done the resize
This way we can actually detect whether or not a window resizes.
2012-01-31 15:30:47 -05:00
Kristian Høgsberg
009ac0a965 window: Dont take width and height in window constructor
Always set this by scheduling an initial resize.
2012-01-31 15:24:48 -05:00
Kristian Høgsberg
8e054f76cc flower: Dont allow resizing 2012-01-31 11:53:20 -05:00
Kristian Høgsberg
c25a1d73fc flower: Redraw flower on middle click, pop up window menu on right click 2012-01-31 09:54:04 -05:00
Kristian Høgsberg
d31fcab989 window: Make window frame menu available to client 2012-01-31 09:53:44 -05:00
Pekka Paalanen
f571d63372 configure: use --disable-tests, since default is enabled
Add a nice help text, too.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 09:41:06 -05:00
Pekka Paalanen
51d2195937 configure: toytoolkit GL apps depend on cairo-egl
Do not build toytoolkit applications that use GL, if Cairo-egl is not
available. These applications (which happen to be also the full GL
clients) do not work at all without Cairo-egl, and fail at runtime with
"unable to acquire window surface".

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 09:40:27 -05:00
Pekka Paalanen
a4f80f34e2 compositor: handle attach request in surface-local coordinates
The x, y offsets in attach request are in surface-local coordinates, as
that is the only coordinate system the clients know about. The offset
must be transformed to global coordinate system to be applied properly.

This approximately fixes the top-left resizing of transformed surfaces.
However, it suffers from drift due to accumulating rounding errors in
continuous resizing.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-01-31 13:12:11 +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
becfcbfbd2 test: Fix out-of-tree builds 2012-01-30 19:17:52 -05:00
Ander Conselvan de Oliveira
a7ef5c85d8 build: fix build of matrix test
This test uses files from src/ so use COMPOSITOR_CFLAGS to find headers
in non-standard locations.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
2012-01-30 19:17:17 -05:00
Scott Moreau
a1a7fefcfe Update config files to reflect new terminal name, weston-terminal
krh: Updated to use /usr/bin/weston-terminal.
2012-01-30 19:10:40 -05:00
Kristian Høgsberg
d1e8625df2 compositor: Allow attaching null buffer
Attaching a null buffer is allowed and takes the surface back to the
unattached state it starts in.
2012-01-30 09:10:17 -05:00
Scott Moreau
fa1de69203 Implement CONFIG_KEY_UNSIGNED_INTEGER
strtol() does not work when trying to assign 32 bits of data into a
regular signed int on 32 bit systems. Use corresponding strtoul()
instead.
2012-01-27 15:34:27 -05: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