platform/upstream/weston.git
11 years agokeyboard-test: Use wl_display_roundtrip() instead of yield()
Kristian Høgsberg [Wed, 12 Dec 2012 03:00:50 +0000 (22:00 -0500)]
keyboard-test: Use wl_display_roundtrip() instead of yield()

As for button-test, a wl_display_roundtrip is sufficient here.  The
yield() between wl_test_activate_surface() and wl_test_send_key() is
also not needed, since the two requests will arrive at the server in
order, and will activate the surface first, then send a key event.

11 years agobutton-test: Use wl_display_roundtrip instead of yield()
Kristian Høgsberg [Wed, 12 Dec 2012 02:56:13 +0000 (21:56 -0500)]
button-test: Use wl_display_roundtrip instead of yield()

A round trip is sufficient here.  We need to make sure that the server
has received the wl_test request and that we've received the event
that the request triggers.  The wl_display_roundtrip() helper does
exactly that: it sends a wl_display.sync request, which will hit the
server after the wl_test requests and thus the wl_callback.done event
will come back after the server has seen all the previous requests and
after we've handled all preceeding event.

11 years agoweston-test-client-helper: Use a frame callback to flush surface geometry
Kristian Høgsberg [Wed, 12 Dec 2012 02:49:13 +0000 (21:49 -0500)]
weston-test-client-helper: Use a frame callback to flush surface geometry

When moving a test surface, use a frame callback to make sure the
surface has been moved and the geometry updated.  The compositor may
delay updating the transform matrices, but once we get the frame
callback we know the surface has been repainted and the geometry
updated.

11 years agotests: Convert button-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:34 +0000 (13:50 -0800)]
tests: Convert button-test to new test extension

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56821

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Convert event-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:33 +0000 (13:50 -0800)]
tests: Convert event-test to new test extension

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56819

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Convert keyboard-test to new test extension
U. Artie Eoff [Fri, 7 Dec 2012 21:50:32 +0000 (13:50 -0800)]
tests: Convert keyboard-test to new test extension

This adds a weston-test-runner for the weston test extension and
some weston test client helper methods.

Converted keyboard-test to use the new test interface, runner,
and helper methods.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56822

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Allow weston-tests-env to process different test types
U. Artie Eoff [Fri, 7 Dec 2012 21:50:31 +0000 (13:50 -0800)]
tests: Allow weston-tests-env to process different test types

The weston-tests-env script needs to be able to handle weston
test extension style tests as well as module style tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Rename weston-test to weston-tests-env
U. Artie Eoff [Fri, 7 Dec 2012 21:50:30 +0000 (13:50 -0800)]
tests: Rename weston-test to weston-tests-env

Renamed weston-test test environment script to weston-tests-env
to avoid ambiguity with weston-test.c (the weston test extension).

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agotests: Define and implement a test protocol extension.
U. Artie Eoff [Fri, 7 Dec 2012 21:50:29 +0000 (13:50 -0800)]
tests: Define and implement a test protocol extension.

The weston test extension, called weston-test.so, can be loaded
from the "modules" configuration option on the command line
or in the .ini file.

Clients can bind to the "wl_test" interface to interact with
the weston test extension.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
11 years agosimple-egl: Remove old obsolete fbo and color_rbo fields
Kristian Høgsberg [Tue, 11 Dec 2012 20:23:14 +0000 (15:23 -0500)]
simple-egl: Remove old obsolete fbo and color_rbo fields

Finally a commit that actually makes simple-egl simpler.

11 years agoLink matrix.c into weston again
Kristian Høgsberg [Fri, 7 Dec 2012 20:00:32 +0000 (15:00 -0500)]
Link matrix.c into weston again

We want to make sure that the matrix symbols are exported from weston and
that modules get them from there.  To do that, we pull matrix.[ch] out of
libshared and back into weston.  calibrator now also links to matrix.[ch]
and we add a IN_WESTON define to enable the WL_EXPORT macro when compiled
inside weston.

11 years agocompositor-drm: Dont pass ARGB format to addfb2 for primary fbs
Kristian Høgsberg [Fri, 7 Dec 2012 17:37:58 +0000 (12:37 -0500)]
compositor-drm: Dont pass ARGB format to addfb2 for primary fbs

Trying to create a ARGB framebuffer for scanout results in EINVAL when
trying to queue the pageflip.  This patch overrides the format we pass
to addfb2 in case of primary buffers like we do for sprites.

Since we always have to inspect and override the format, don't try to
look up the format in drm_fb_get_from_bo().  Instead return format from
drm_output_check_scanout_format().

Rename drm_surface_format_supported() to drm_output_check_sprite_format()
and make it follow the same convention.

We started scanning out ARGB surfaces in commit e920941032979d.

11 years agocompositor-drm: Use overlays for ARGB surfaces if they are opaque
Ander Conselvan de Oliveira [Fri, 7 Dec 2012 11:18:11 +0000 (13:18 +0200)]
compositor-drm: Use overlays for ARGB surfaces if they are opaque

Since the call to drmModeSetPlane() fails with EINVAL if the supplied
fb has an unsupported format (which is the case of ARGB8888), the fb
format needs to be overridden.

11 years agoshell: Remove confusing case fall-through
Rob Bradford [Thu, 6 Dec 2012 12:07:48 +0000 (12:07 +0000)]
shell: Remove confusing case fall-through

This avoids calling weston_surface_set_position twice on the same surface. The
second call has no effect in many cases because sx and sy
are usually zero on this path.

This change now means that any sx/sy values passed into ::attach will be
ignored on the first attach for popup surfaces. This similar to the behaviour
for other surface types.

11 years agoweston-launch: Add some error reporting for weston-launch
Rob Bradford [Wed, 5 Dec 2012 18:47:11 +0000 (18:47 +0000)]
weston-launch: Add some error reporting for weston-launch

This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc

11 years agocompositor: Cleanup if we can't find the symbol in the module
Rob Bradford [Wed, 5 Dec 2012 18:47:10 +0000 (18:47 +0000)]
compositor: Cleanup if we can't find the symbol in the module

11 years agobacklight: Revamp error handling code to not leak the directory
Rob Bradford [Wed, 5 Dec 2012 18:47:09 +0000 (18:47 +0000)]
backlight: Revamp error handling code to not leak the directory

To neatly free the directory pointer allocated by opendir(), adjust the error
handling paths to go through to the err label.

11 years agotty: Clean up completely if switching vt fails
Rob Bradford [Wed, 5 Dec 2012 18:47:08 +0000 (18:47 +0000)]
tty: Clean up completely if switching vt fails

The code under the "err" label closes the file descriptor and frees the
allocated memory.

11 years agoxwayland: Close fd opened for lockfile on error path
Rob Bradford [Wed, 5 Dec 2012 18:47:07 +0000 (18:47 +0000)]
xwayland: Close fd opened for lockfile on error path

11 years agobacklight: Remove unnecessary and confusing NULL checks
Rob Bradford [Wed, 5 Dec 2012 18:47:06 +0000 (18:47 +0000)]
backlight: Remove unnecessary and confusing NULL checks

At this point path must point to an allocated string since otherwise the
asprintf that makes the allocation would have failed and we would have
returned earlier.

11 years agocompositor: Avoid sending event for invalid point
Rob Bradford [Wed, 5 Dec 2012 18:47:05 +0000 (18:47 +0000)]
compositor: Avoid sending event for invalid point

Avoid sending a touch down event using uninitialised surface x/y co-ordinates.
Instead present a log message about this unexpected case.

11 years agoscreenshooter: Report an error if we fail to open the file
Rob Bradford [Wed, 5 Dec 2012 18:47:04 +0000 (18:47 +0000)]
screenshooter: Report an error if we fail to open the file

11 years agoscreenshooter: Abandon recording rather than use unitialised format
Rob Bradford [Wed, 5 Dec 2012 18:47:03 +0000 (18:47 +0000)]
screenshooter: Abandon recording rather than use unitialised format

Abandon the recording if the format is not known - this prevents the use of an
unitialised member is the header struct.

11 years agorpi: Don't assign planes for surfaces with transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:34:52 +0000 (17:34 +0200)]
rpi: Don't assign planes for surfaces with transformed buffers

Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor-drm: Support overlays with transformed buffers
Ander Conselvan de Oliveira [Wed, 5 Dec 2012 13:14:04 +0000 (15:14 +0200)]
compositor-drm: Support overlays with transformed buffers

Make overlays work when the client uses a buffer with the same
transformation as the output.

In order to calculate the destination rectangle, the same logic in
weston_surface_to_buffer_float() is needed, but with the output
dimensions instead. For that reason, this patch generalizes this
function into weston_transformed_{coord,rect} and moves it to util.c.
The surface functions are then implemented using those.

11 years agowindow: add a note about freeing shm buffers
Pekka Paalanen [Tue, 4 Dec 2012 14:01:16 +0000 (16:01 +0200)]
window: add a note about freeing shm buffers

After a client has been double-buffering, and then switches to
single-buffering, it should release the 2nd buffer. That never happens
in practice here, so just add a comment and a check in case it ever
occurs in the future.

If we implemented the releasing now, it would be difficult to test.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoclients: destroy wl_registry on exit
Pekka Paalanen [Tue, 4 Dec 2012 14:01:15 +0000 (16:01 +0200)]
clients: destroy wl_registry on exit

Plug an insignificant memory leak in demo programs that bother to clean
up at all.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: move texture_damage into renderer private
Pekka Paalanen [Tue, 4 Dec 2012 13:58:16 +0000 (15:58 +0200)]
compositor: move texture_damage into renderer private

Only the gl_renderer uses this field.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: move pitch into renderer private
Pekka Paalanen [Tue, 4 Dec 2012 13:58:15 +0000 (15:58 +0200)]
compositor: move pitch into renderer private

It is not used by anything but the gl-renderer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: add early wl_buffer.release
Pekka Paalanen [Tue, 4 Dec 2012 13:58:14 +0000 (15:58 +0200)]
compositor: add early wl_buffer.release

A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.

Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().

A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.

The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogl: take, hold, and release a buffer reference
Pekka Paalanen [Tue, 4 Dec 2012 13:58:13 +0000 (15:58 +0200)]
gl: take, hold, and release a buffer reference

Instead of relying on the compositor core to keep the wl_buffer around
and unreleased, take a new reference to it in gl-renderer. This makes
sure in the future, that the gl-renderer always has the buffer at hand,
client misbehaviour excluded.

The reference is taken in the attach callback, and released in the
flush_damage callback after copy to texture, or when the next attach
callback with a different buffer occurs.

If the surface is not on the primary plane, the buffer is not released
in flush_damage. This ensures, that the buffer stays valid in case the
surface migrates to the primary plane later.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: introduce weston_buffer_reference
Pekka Paalanen [Tue, 4 Dec 2012 13:58:12 +0000 (15:58 +0200)]
compositor: introduce weston_buffer_reference

The wl_buffer reference counting API has been inconsistent. You would
manually increment the refcount and register a destroy listener, as
opposed to calling weston_buffer_post_release(), which internally
decremented the refcount, and then removing a list item.

Replace both cases with a single function:
weston_buffer_reference(weston_buffer_reference *ref, wl_buffer *buffer)

Buffer is assigned to ref->buffer, while taking care of all the refcounting
and release posting. You take a reference by passing a non-NULL buffer, and
release a reference by passing NULL as buffer. The function uses an
internal wl_buffer destroy listener, so the pointer gets reset on
destruction automatically.

This is inspired by the pipe_resource_reference() of Mesa, and modified
by krh's suggestion to add struct weston_buffer_reference.

Additionally, when a surface gets destroyed, the associated wl_buffer
will send a release event. Often the buffer is already destroyed on
client side, so the event will be discarded by libwayland-client.

Compositor-drm.c is converted to use weston_buffer_reference.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: do not flush shm buffer on destroy
Pekka Paalanen [Tue, 4 Dec 2012 13:58:11 +0000 (15:58 +0200)]
compositor: do not flush shm buffer on destroy

The protocol does not require us to flush_damage() on wl_buffer
destruction. In fact, by the time the server receives this request, the
client may have already clobbered the buffer's storage, so we could be
reading undefined data. Instead, just forget about the buffer. The
protocol already says, that a client must not destroy a buffer that is
being read by the server, or the window contents become undefined.

The practical reason for this change is that the following commit can
consolidate wl_buffer destruction listener handlers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: do not release if re-attaching buffer
Pekka Paalanen [Tue, 4 Dec 2012 13:58:10 +0000 (15:58 +0200)]
compositor: do not release if re-attaching buffer

If a client called wl_surface.attach with the same wl_buffer as
previously, the compositor would mistakenly send a release on that
buffer. This will cause problems only when clients start to properly use
the wl_buffer.release event.

Do not send wl_buffer.release if the same buffer is attached again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: Do not remove input panel layer when locked
Jan Arne Petersen [Mon, 3 Dec 2012 14:36:02 +0000 (15:36 +0100)]
shell: Do not remove input panel layer when locked

Do not remove the input panel layer from the layer list when the
shell is locked in hide_input_panels().

https://bugs.freedesktop.org/show_bug.cgi?id=56543

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agocompositor-drm: Load calibration values from udev
Rob Bradford [Mon, 3 Dec 2012 19:44:17 +0000 (19:44 +0000)]
compositor-drm: Load calibration values from udev

This allows the values to be associated with an specific input device using
udev rules.

11 years agoevdev: Apply calibration values to absolute events
Rob Bradford [Mon, 3 Dec 2012 19:44:16 +0000 (19:44 +0000)]
evdev: Apply calibration values to absolute events

Store a set of calibration values per device - these calibration values are
just applied to the absolute motion events.

11 years agoclients: Add a touchscreen calibration tool
Rob Bradford [Mon, 3 Dec 2012 19:44:15 +0000 (19:44 +0000)]
clients: Add a touchscreen calibration tool

This a basic calibration tool designed for "in factory" calibration of a touch
screen. The constants for the calibration functions:

x' = Ax + By + C and
y' = Dx + Ey + F

Are printed on stdout when the calibration is completed.

11 years agoMove matrix.[ch] to shared
Rob Bradford [Mon, 3 Dec 2012 19:44:14 +0000 (19:44 +0000)]
Move matrix.[ch] to shared

This means it can be used for the calibration tool.

11 years agoevdev: Include the device capabilities in the debugging
Rob Bradford [Mon, 3 Dec 2012 19:44:13 +0000 (19:44 +0000)]
evdev: Include the device capabilities in the debugging

11 years agogl-renderer: Force call to glUseProgram() when activating debug binding
Ander Conselvan de Oliveira [Mon, 3 Dec 2012 15:08:11 +0000 (17:08 +0200)]
gl-renderer: Force call to glUseProgram() when activating debug binding

When redrawing surfaces, use_shader() checks if the desired shader is
already in use to avoid a call to glUseProgram(). However, once the
debug binding is activated, that same check would prevent the usage of
the recompiled shaders until something cause a different shader to be
passed to use_shader().

11 years agoxwayland: Staticize weston_wm_set_selection and read_and_dump_property
Tiago Vignatti [Fri, 30 Nov 2012 19:19:59 +0000 (17:19 -0200)]
xwayland: Staticize weston_wm_set_selection and read_and_dump_property

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwayland: Remove useless structure
Tiago Vignatti [Fri, 30 Nov 2012 19:19:58 +0000 (17:19 -0200)]
xwayland: Remove useless structure

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwm: Rename get_resources function
Tiago Vignatti [Fri, 30 Nov 2012 19:19:57 +0000 (17:19 -0200)]
xwm: Rename get_resources function

It's pure WM-related function, so use the same 'weston_wm_' prefix that others
in the same file are already using.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwayland: Standardize 'wxs' for weston_xserver variables
Tiago Vignatti [Fri, 30 Nov 2012 19:19:56 +0000 (17:19 -0200)]
xwayland: Standardize 'wxs' for weston_xserver variables

It was already being used in most of launcher.c and window-manager.c, so let's
make a standard everywhere now.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agowindow: Add a widget default cursor convenience helper
Kristian Høgsberg [Fri, 30 Nov 2012 19:54:35 +0000 (14:54 -0500)]
window: Add a widget default cursor convenience helper

In a few cases, we set a motion handler just to be able to set a fixed
cursor.  This adds a default cursor helper that can be used in those cases.
In case of the 'transformed' test case, we also avoid a brief flicker
of the pointer cursor, which is set on enter when the move grab is lifted.

11 years agowindow: change boolean to flags in toysurface::prepare()
Pekka Paalanen [Fri, 30 Nov 2012 11:37:27 +0000 (13:37 +0200)]
window: change boolean to flags in toysurface::prepare()

Change the boolean parameter 'resize_hint' into a bitmask 'flags'.

Note, that this flags is very different to the other flags used in
creating the toysurface implementations. They do not make sense to mix
one way or the other. Prepare() cannot change the surface type, and
surface constructors do not care for dynamic hint flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoclients: Replace transformed with a toytoolkit implementation
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:26 +0000 (17:34 +0200)]
clients: Replace transformed with a toytoolkit implementation

11 years agowindow: Add a way to retrieve a window's output transform
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:25 +0000 (17:34 +0200)]
window: Add a way to retrieve a window's output transform

Add the output_get_transform() entry point and an output handler hook.

11 years agowindow: Let clients set buffer transformations
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:24 +0000 (17:34 +0200)]
window: Let clients set buffer transformations

When a window's buffer transformation is set, its buffers are
reallocated with the appropriate size (i.e., with width and height
swapped in case of 90 or 270 degree rotation).

11 years agowindow: Honour opaque field for windows without a frame
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:23 +0000 (17:34 +0200)]
window: Honour opaque field for windows without a frame

Since the opaque region was set in frame_resize_handler(), if a client
created a frameless window setting the toplevel widget as opaque would
have no effect.

This patch fixes this by moving the call wl_surface_set_opaque_region()
to idle_resize(), and changing the latter function to set the whole
window as opaque if its toplevel widget has the opaque flag set.

11 years agocompositor-drm: Allow scanning out of opaque ARGB surfaces
Ander Conselvan de Oliveira [Fri, 30 Nov 2012 15:34:22 +0000 (17:34 +0200)]
compositor-drm: Allow scanning out of opaque ARGB surfaces

11 years agoFix build warnings from image_loader
Pekka Paalanen [Fri, 30 Nov 2012 11:37:28 +0000 (13:37 +0200)]
Fix build warnings from image_loader

Fix the following build warnings, and the build failures due to the
warning fixes:

  CC     libshared_cairo_la-image-loader.lo
image-loader.c:369:1: warning: no previous prototype for 'load_image'

  CC     x11_backend_la-compositor-x11.lo
compositor-x11.c: In function 'x11_output_set_icon':
compositor-x11.c:396:2: warning: implicit declaration of function 'load_image'
compositor-x11.c:396:8: warning: assignment makes pointer from integer without a cast

  CC     wayland_backend_la-compositor-wayland.lo
compositor-wayland.c: In function 'create_border':
compositor-wayland.c:97:2: warning: implicit declaration of function 'load_image'
compositor-wayland.c:97:8: warning: assignment makes pointer from integer without a cast

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: Fix rendering with shm transformed buffers
Ander Conselvan de Oliveira [Wed, 28 Nov 2012 15:10:26 +0000 (17:10 +0200)]
compositor: Fix rendering with shm transformed buffers

The implementation of buffer transformation didn't handle transformed
shm buffers properly. The partial texture upload was broken since the
damage is in surface coordinates that don't necessarily match the
buffer's coordinates. It also wouldn't handle the buffer stride
properly, resulting in incorrect rendering if it didn't match the
buffer's width.

The logic used for converting texture coordinates was generalized and
moved out of the renderer, since this conversion may be useful in other
places, such as the backends.

11 years agoFix a crash when opening two terminal windows and closing the first one.
Dima Ryazanov [Thu, 29 Nov 2012 08:27:09 +0000 (00:27 -0800)]
Fix a crash when opening two terminal windows and closing the first one.

To reproduce, launch the terminal, open a second window using Ctrl-Shift-N,
go back to the first window, and press Ctrl-D. The terminal's master FD gets
events even after being closed, causing terminal_destroy to be called twice
on the same object.

To fix this, I'm adding a function to stop watching an FD.

11 years agocompositor-x11: Link to libshared-cairo for icon loading helper
Kristian Høgsberg [Thu, 29 Nov 2012 22:00:33 +0000 (17:00 -0500)]
compositor-x11: Link to libshared-cairo for icon loading helper

The X11 backend needs the image loader helper to load the window
icon.

11 years agoconfigure.ac: Don't link weston to cairo or image libraries
Kristian Høgsberg [Thu, 29 Nov 2012 17:23:36 +0000 (12:23 -0500)]
configure.ac: Don't link weston to cairo or image libraries

We were pulling in cairo and the image loading libraries through libshared.
Split out libshared into a core libshared and a libshared-cairo that
pulls in the extra libraries.

11 years agoweston.ini: Introduce core section and remove type keys.
Scott Moreau [Tue, 27 Nov 2012 23:54:53 +0000 (16:54 -0700)]
weston.ini: Introduce core section and remove type keys.

Since a6813d288, there is no longer a "type" key in the [shell] config section.
Instead the code accepts a [core] section with a modules key, containing a
comma separated list of modules to load. This patch removes the type keys
and adds a core section in the example weston.ini config file.

11 years agoxwm: Fix xwm opaque region
Scott Moreau [Thu, 22 Nov 2012 22:35:13 +0000 (15:35 -0700)]
xwm: Fix xwm opaque region

Since surface.commit was introduced, opqaue regions are stored in a pending
variable that isn't used until surface.commit. Xwayland uses the surface opaque
region as a way to tell weston what region of the surface should be opaque.
However when this pending opaque region was introduced, xwm was not updated
and so we have the 'black = transparent' problem again. This patch fixes the
problem by having xwm use the pending opaque regions.

11 years agowindow: honour wl_buffer.release
Pekka Paalanen [Mon, 19 Nov 2012 15:16:02 +0000 (17:16 +0200)]
window: honour wl_buffer.release

Listen for wl_buffer.release events in the shm path, and if a previously
posted buffer is still held by the server, allocate another one. The
maximum of two should be enough, since there is no point for a server to
hold more than one buffer at a time.

Buffer allocation happens as needed instead of window creation time.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: fix tooltip text extents
Pekka Paalanen [Mon, 19 Nov 2012 15:16:01 +0000 (17:16 +0200)]
window: fix tooltip text extents

After the toysurface rewrite, windows do not have a valid Cairo surface
outside their repaint cycle, so tooltips are not getting their size
right.

Create a dummy Cairo surface only for querying text extents, so we do
not rely on any window surfaces of parent windows or otherwise.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: simplify window_create_surface
Pekka Paalanen [Mon, 19 Nov 2012 15:16:00 +0000 (17:16 +0200)]
window: simplify window_create_surface

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: convert shm path to toysurface
Pekka Paalanen [Mon, 19 Nov 2012 15:15:59 +0000 (17:15 +0200)]
window: convert shm path to toysurface

Implement shm_surface as a sub-class of toysurface, and unify the
toysurface call sites removing most buffer type specific branching.

Do not destroy and create a surface, if the size does not change.

The resizing optimization of shm surfaces is retained, but the pool is
moved from struct window to struct shm_surface, since it does not apply
to egl_window_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: add toysurface abstraction and port EGL path
Pekka Paalanen [Mon, 19 Nov 2012 15:15:58 +0000 (17:15 +0200)]
window: add toysurface abstraction and port EGL path

We need more structure to the way we handle the backing storage in
toytoolkit, to make it possible to double-buffer the shm case properly.
The existing buffer handling is very complex with the three
different cases:
- EGLSurface backed Cairo surface with a window associated
- wl_shm backed Cairo surface with a window associated
- wl_shm backed Cairo surface without a window, as used by dnd.c

Introduce the toysurface abstraction, which defines the interface for
the both buffer handling cases that have a window associated. It also
means, that windows will not have a valid Cairo surface outside of their
repaint cycle.

Convert the EGLsurface case into toysurface for starters. For EGL-based
Cairo surfaces, the private data is no longer needed. Destroying
egl_window_surface will trigger the destruction of the cairo_surface_t,
not vice versa. This is possible because display_create_surface() is
shm-only.

The shm cases are left untouched.

As a side-effect, display_acquire_window_surface() and
display_release_window_surface() will no longer use the 'display'
argument. Instead, display will be the one inherited from the window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoweston-simple-im: Add a few more compose sequences
Kristian Høgsberg [Tue, 27 Nov 2012 20:11:04 +0000 (15:11 -0500)]
weston-simple-im: Add a few more compose sequences

11 years agoweston-simple-im: Fold struct keyboard_input into struct simple_im
Kristian Høgsberg [Tue, 27 Nov 2012 19:28:19 +0000 (14:28 -0500)]
weston-simple-im: Fold struct keyboard_input into struct simple_im

11 years agoweston-simple-im: Fold keyboard_input_handle_keymap() into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:21:34 +0000 (14:21 -0500)]
weston-simple-im: Fold keyboard_input_handle_keymap() into event handler

11 years agoweston-simple-im: Fold keyboard_input_handle_key() into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:20:31 +0000 (14:20 -0500)]
weston-simple-im: Fold keyboard_input_handle_key() into event handler

11 years agoweston-simple-im: Fold keyboard_input_handle_modifiers into event handler
Kristian Høgsberg [Tue, 27 Nov 2012 19:18:40 +0000 (14:18 -0500)]
weston-simple-im: Fold keyboard_input_handle_modifiers into event handler

11 years agoweston-simple-im: Stop using toytoolkit
Kristian Høgsberg [Tue, 27 Nov 2012 19:07:22 +0000 (14:07 -0500)]
weston-simple-im: Stop using toytoolkit

Toytoolkit doesn't buy us anything in this case, we're not rendering or
handling regular input events.  Just talk directly to wl_display and
look up the 'input_method' global directly.

11 years agoweston-simple-im: Use serial number from incoming events
Kristian Høgsberg [Tue, 27 Nov 2012 18:57:27 +0000 (13:57 -0500)]
weston-simple-im: Use serial number from incoming events

The key events we pass through to the input_method_context has to have
a serial number that corresponds to the key event we got.  The struct display
serial is updated on pointer enter/leave and keyboard events, but not the
input method keyboard events.  So the display serial will never correspond
to the key event we're dealing with and we have to pass through the
serial we get from the key event.

11 years agoweston-simple-im: Create our own xkb_context
Kristian Høgsberg [Tue, 27 Nov 2012 18:47:16 +0000 (13:47 -0500)]
weston-simple-im: Create our own xkb_context

There's no need to use the struct display xkb_context, we can just create
out ow.  This reverts c31288daf1ac379c278a00c3291760ec2639eae7.

11 years agoclients: Move keyboard-utils.[ch] into weston-simple-im
Kristian Høgsberg [Tue, 27 Nov 2012 18:41:48 +0000 (13:41 -0500)]
clients: Move keyboard-utils.[ch] into weston-simple-im

This is the only user of this code, so just include it in the simple im
source.

11 years agonoop-renderer: Remove unused variable
Kristian Høgsberg [Tue, 27 Nov 2012 18:20:40 +0000 (13:20 -0500)]
noop-renderer: Remove unused variable

11 years agotext: Add simple compose input method
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:50 +0000 (19:06 +0100)]
text: Add simple compose input method

Add an input method listening to hardware keyboard input and generating
compose text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Add support for editing text using the keyboard
Rob Bradford [Sun, 18 Nov 2012 18:06:49 +0000 (19:06 +0100)]
editor: Add support for editing text using the keyboard

This simple change allows you to drive the editor using the keyboard
(supporting backspace and delete and left and right arrow keys.) The idea
behind this change is to allow the testing of the interoperation between a
virtual keyboard and real one.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agowindow: Allow to get xkb context from display
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:48 +0000 (19:06 +0100)]
window: Allow to get xkb context from display

Add display_get_xkb_context to get the xkb context from the display.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agowindow: Add utils for xkb keyboard input
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:47 +0000 (19:06 +0100)]
window: Add utils for xkb keyboard input

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add support for forwarding key events
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:46 +0000 (19:06 +0100)]
text: Add support for forwarding key events

Allow an input method to forward (unfiltered) key and modifier events
from the hardware keyboard to the client.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add support for grabbing the keyboard
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:45 +0000 (19:06 +0100)]
text: Add support for grabbing the keyboard

Add support for requesting hardware input into an input method.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Send more information with keysym events
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:44 +0000 (19:06 +0100)]
text: Send more information with keysym events

Send state and modifier from the demo keyboard with the keysym event and
take them into account in the editor example.

Add some helper functions to write and read a modifiers_map array.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename and extend text_model key event
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:43 +0000 (19:06 +0100)]
text: Rename and extend text_model key event

Rename the key event in text_model to keysym and add serial, time and
modifiers arguments. Add a modifiers_map event to transfer an array of
0-terminated modifier names, so that a mapping of modifiers to the
modifier bit mask is possible.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Start input method from configuration
Jan Arne Petersen [Sun, 18 Nov 2012 18:06:42 +0000 (19:06 +0100)]
text: Start input method from configuration

Start the input method specified in the weston.ini configuration file.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoclients: Add a client that renders transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:44 +0000 (17:03 +0200)]
clients: Add a client that renders transformed buffers

This new client, called transformed, renders a cross with the top part
red and the right green, with the same transform as the output the
surface is in.

This is based on simple-egl.

11 years agocompositor-drm: Support scan out of transformed buffers
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:43 +0000 (17:03 +0200)]
compositor-drm: Support scan out of transformed buffers

If a client renders its buffers with the same transform as the output,
we can scan out them when fullscreen.

11 years agocompositor: Implement buffer transformation
Ander Conselvan de Oliveira [Tue, 27 Nov 2012 15:03:42 +0000 (17:03 +0200)]
compositor: Implement buffer transformation

Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.

11 years agoman: fill missing pieces to weston page
Pekka Paalanen [Tue, 27 Nov 2012 14:54:09 +0000 (16:54 +0200)]
man: fill missing pieces to weston page

Config file, WAYLAND_SOCKET, XDG_CONFIG_HOME, segfault handler.

NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoman: add weston-drm page
Pekka Paalanen [Tue, 27 Nov 2012 14:54:08 +0000 (16:54 +0200)]
man: add weston-drm page

Add some documentation about the DRM backend into its own man page, and
refer to it in weston(1).

Environment variable, that are reserved for backends, and currently used
only by the DRM backend, are moved to weston-drm page.

NOTE: This is a candidate for the stable branch
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogl, rpi: consolidate print_egl_error_state()
Pekka Paalanen [Tue, 27 Nov 2012 10:25:25 +0000 (12:25 +0200)]
gl, rpi: consolidate print_egl_error_state()

Rename print_egl_error_state() to gl_renderer_print_egl_error_state()
and exports it.

Remove the copy of that function from the rpi backend, and call
the exported function instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: Move clearing of primary plane damage to the backends
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:57:00 +0000 (15:57 +0200)]
compositor: Move clearing of primary plane damage to the backends

Backends may move surfaces to different planes, in which case damage is
generated in the primary plane. This damage is usually passed to the
renderer, but in some cases the backend may decide to not render
anything (that's the case when drm compositor scans out a client
buffer). In that case the damage on the primary plane would be
discarded, leading to artifacts later.

This patch makes the backend's responsibility to clear the damage on
the primary plane, so that unrendered damage is kept for as long as
necessary.

11 years agocompositor-drm: Add debug binding for toggling sprites
Ander Conselvan de Oliveira [Thu, 22 Nov 2012 13:56:59 +0000 (15:56 +0200)]
compositor-drm: Add debug binding for toggling sprites

While at it, consolidate all the bindings we already have into one
single function.

11 years agocompositor-drm: Add a debug binding for toggling usage of hw cursors
Ander Conselvan de Oliveira [Wed, 21 Nov 2012 13:11:37 +0000 (15:11 +0200)]
compositor-drm: Add a debug binding for toggling usage of hw cursors

11 years agozoom: Don't update the zoom translation if zoom level is 0
Ander Conselvan de Oliveira [Wed, 21 Nov 2012 13:11:36 +0000 (15:11 +0200)]
zoom: Don't update the zoom translation if zoom level is 0

On the first frame with zoom activated, the spring used for animation
will have a current value of zero. The translation calculated with that
value will be invalid (not a number). Using this value later leads to
having an invalid output matrix, so nothing is composited in the first
zoomed frame.

This problem is most evident when a sprite plane is being used. In that
case, enabling the zoom will cause the surface to be moved back to the
primary plane, but because of the bug described above, this surface
would not actually be rendered causing a quick flicker.

11 years agosimple-egl: Reset opaque region if not fullscreen.
Scott Moreau [Mon, 19 Nov 2012 21:17:52 +0000 (14:17 -0700)]
simple-egl: Reset opaque region if not fullscreen.

If simple-egl is toggled fullscreen, the opqaue region is set for the surface
but never removed after exiting fullscreen. This patch resets the opaque region
to 0 if the surface is not fullscreen and -o was not passed. This fixes the
problem introduced sometime since d7f282b84e, when this was last fixed.

11 years agowindow: make display_create_surface() shm-only
Pekka Paalanen [Mon, 19 Nov 2012 15:15:57 +0000 (17:15 +0200)]
window: make display_create_surface() shm-only

Nothing uses it to create EGL-surfaces outside of window.c. This makes
refactoring the EGL-based code easier, since we do not need to support
EGL-based Cairo surfaces without an associated struct window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: use different keys for different cairo privates
Pekka Paalanen [Mon, 19 Nov 2012 13:32:51 +0000 (15:32 +0200)]
window: use different keys for different cairo privates

cairo_surface_t objects have a private set, either struct
shm_surface_data, or struct egl_window_surface_data. Use separate
private keys for each type to avoid mismatch.

This makes display_get_buffer_for_surface() safe, in that it won't
return garbage for an EGL-based cairo surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: merge struct surface_data into shm_surface_data
Pekka Paalanen [Mon, 19 Nov 2012 13:32:50 +0000 (15:32 +0200)]
window: merge struct surface_data into shm_surface_data

Struct surface_data was not really useful, and it definitely was not
used with EGL-based windows.

This also fixes a semantic mistake, where struct shm_surface_data was
put into cairo_surface_t private, but got out as struct surface_data
instead. Due to struct layout, however, this did not cause a real bug.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: remove unused MULT macro
Pekka Paalanen [Mon, 19 Nov 2012 13:32:49 +0000 (15:32 +0200)]
window: remove unused MULT macro

Leftovers from

commit f02a649a3ce5735f5a20103fe6f1002b3a421501
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Mon Mar 12 01:05:25 2012 -0400

    Consolidate image loading code and move to shared/

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: make window_flush() private
Pekka Paalanen [Mon, 19 Nov 2012 13:32:48 +0000 (15:32 +0200)]
window: make window_flush() private

Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: make window_{create,set}_surface private
Pekka Paalanen [Mon, 19 Nov 2012 13:32:47 +0000 (15:32 +0200)]
window: make window_{create,set}_surface private

I do not think these are meant to be called by the applications
directly. Applications certainly do not have to call them.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>