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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
When window_attach_surface() calls window_get_resize_dx_dy(),
window->resize_edges is cleared. However if there is already a pending
surface to be attached, the resize won't be done until the following
call to window_attach_surface(). In this next call, since resize_edges
is now zero, the top-left corner of the window will be unchanged. If
the user is resizing from the top or left border, this causes the
resize to happen in the wrong direction.
This patch changes window_attach_surface() to call
window_get_resize_dx_dy() only if an attach will actually happen.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Change weston_surface_damage*() functions to use the full surface
bounding box or call surface_compute_bbox() to find the bounding box for
an arbitrary rectangle.
This should fix all rendering artifacts for non-opaque (i.e. ARGB)
transformed surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Use the bounding box to compute an approximation of which output
contains most of the surface.
Move the region32 init outside the loop, and fini it, too.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
If we ever have transformed cursor surfaces, we would better use the
bounding box to check if it is on the given output.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Use the proper bounding box in clipping the surface repaint area. Fixes
excessive clipping for transformed surfaces.
Also don't leak the region32 on early return.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>
Compute a surface bounding box, especially for transformed surfaces, for
which one cannot simply use x,y,width,height.
The bounding box depends on width and height, so these are now under the
geometry.dirty flag.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Now that we can insert a transformation before the surface position
translation, we can drop geometry.x,y from the zoom transformation. That
was just undoing and redoing the position translation.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Not sure this check belongs here, but as the position checks are here
too, I added this. Just so we don't forget.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
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>