profile/ivi/weston-ivi-shell.git
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>
11 years agosimple-shm: honour wl_buffer.release
Pekka Paalanen [Mon, 19 Nov 2012 13:29:09 +0000 (15:29 +0200)]
simple-shm: honour wl_buffer.release

Change simple-shm to properly process the wl_buffer.release event, and
not reuse a buffer until it is released by the server, as specified in
the protocol.

In case the server has not released the buffer, but signals that it has
been shown (frame callback), allocate a second buffer. Simple-shm will
now automatically do double-buffering if needed.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agosimple-egl: Set the right size for the opaque region when fullscreen
Ander Conselvan de Oliveira [Fri, 7 Sep 2012 14:32:16 +0000 (17:32 +0300)]
simple-egl: Set the right size for the opaque region when fullscreen

window.window_size holds the size of the window in windowed mode. Use
window.geometry for setting the opaque region since that holds the
current size.

11 years agocompositor: Move buffer damage fields from weston_output to gl-renderer
Ander Conselvan de Oliveira [Fri, 16 Nov 2012 15:23:52 +0000 (17:23 +0200)]
compositor: Move buffer damage fields from weston_output to gl-renderer

Move fields current_buffer and buffer_damage out of weston_output into
gl_output_state, since they are actually specific to the renderer.

Also bring back the previous_damage field so that the screenshooter
can get the damage for the previous frame in a renderer independent
way.

11 years agoshell/zoom: Increment/decrement disable_planes only when zoom.active changes
Ville Syrjälä [Fri, 16 Nov 2012 09:48:47 +0000 (11:48 +0200)]
shell/zoom: Increment/decrement disable_planes only when zoom.active changes

disable_planes should only be incremented when zoom.active actually
toggles. Otherwise the counter will be incremented too many times,
and planes will no longer get used.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
11 years agocompositor-drm: Don't use overlay when surface alpha != 1.0f
Ville Syrjälä [Fri, 16 Nov 2012 09:48:46 +0000 (11:48 +0200)]
compositor-drm: Don't use overlay when surface alpha != 1.0f

Assume that overlays can't handle alpha blending even with a constant
alpha factor.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
11 years agowcap: Transform damage rectangles according to output tranform
Kristian Høgsberg [Thu, 15 Nov 2012 01:28:30 +0000 (20:28 -0500)]
wcap: Transform damage rectangles according to output tranform

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

11 years agotests: Remove last GLfloat use
Kristian Høgsberg [Wed, 14 Nov 2012 19:42:51 +0000 (14:42 -0500)]
tests: Remove last GLfloat use

With the EGL/GLES2 types out of compositor.h this now fails to compile.

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

11 years agoRename gles2-renderer to gl-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:29 +0000 (19:10 +0100)]
Rename gles2-renderer to gl-renderer.

11 years agoMove EGL and GL includes to a gles2-renderer header.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:28 +0000 (19:10 +0100)]
Move EGL and GL includes to a gles2-renderer header.

11 years agoMove weston_compositor GL and EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:27 +0000 (19:10 +0100)]
Move weston_compositor GL and EGL state into gles2-renderer.

11 years agoMove weston_surface GL and EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:26 +0000 (19:10 +0100)]
Move weston_surface GL and EGL state into gles2-renderer.

11 years agoMoved shader state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:25 +0000 (19:10 +0100)]
Moved shader state into gles2-renderer.

11 years agogles2-renderer: Renaming some functions.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:24 +0000 (19:10 +0100)]
gles2-renderer: Renaming some functions.

11 years agocompositor: Move surface color state to gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:23 +0000 (19:10 +0100)]
compositor: Move surface color state to gles2-renderer.

This moves the surface color state into gles2-renderer. To do this it
adds two new weston_renderer functions. create_surface to be able to
create per-surface renderer state, and surface_set_color to set the
color of a surface and changes it to a color surface.

11 years agoscreenshooter: Use the renderer function for reading out pixels
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:22 +0000 (19:10 +0100)]
screenshooter: Use the renderer function for reading out pixels

This also changes the compositor's read_format to a pixman format.

11 years agocompositor: Add a renderer function to read out pixels
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:21 +0000 (19:10 +0100)]
compositor: Add a renderer function to read out pixels

11 years agoMove compositor-wayland border drawing into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:20 +0000 (19:10 +0100)]
Move compositor-wayland border drawing into gles2-renderer.

11 years agoMove EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:19 +0000 (19:10 +0100)]
Move EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.

This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.

11 years agoMove weston_output EGL state into gles2-renderer.
John Kåre Alsaker [Tue, 13 Nov 2012 18:10:18 +0000 (19:10 +0100)]
Move weston_output EGL state into gles2-renderer.

This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.

11 years agoFix a typo.
Dima Ryazanov [Sun, 11 Nov 2012 08:29:01 +0000 (00:29 -0800)]
Fix a typo.

11 years agocompositor-drm: Use drm_fbs for the sprite code too
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:05 +0000 (14:19 +0200)]
compositor-drm: Use drm_fbs for the sprite code too

This makes drm_fb_get_from_bo() use drmModeAddFB2() if possible so that
drm_output_prepare_overlay_surface() can use this instead of keeping
track of the fbs and buffers itself.

11 years agocompositor-drm: Don't schedule repaint on scanout buffer destroy handler
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:04 +0000 (14:19 +0200)]
compositor-drm: Don't schedule repaint on scanout buffer destroy handler

Let the compositor generic code decide what to do when the buffer goes
away. We still have a valid reference do the bo, so we can still show
the client contents until something else triggers a repaint.

11 years agocompositor-drm: Only request vblank events if needed
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:03 +0000 (14:19 +0200)]
compositor-drm: Only request vblank events if needed

If the sprite is disabled and we're not enabling it on the next frame,
nothing is done in the vblank handler, so there's no need to ask for a
vblank event.

11 years agocompositor-drm: Remove drm_disable_unused_sprites()
Ander Conselvan de Oliveira [Fri, 9 Nov 2012 12:19:02 +0000 (14:19 +0200)]
compositor-drm: Remove drm_disable_unused_sprites()

If a sprite is no longer used, it is disabled on the call to
drmModeSetPlane() when doing the output repaint, since its
pending_fb_id is 0.

11 years agocompositor-x11: Improve fullscreen support
Kristian Høgsberg [Fri, 9 Nov 2012 16:12:21 +0000 (11:12 -0500)]
compositor-x11: Improve fullscreen support

The old implementation didn't work because we set the minimum and maximum
sizes so that the WM can't resize us.  That makes the fullscreen protocol
not work.  Additionally we were requesting fullscreen after mapping, which
requires the more complicated (and potentially flickery) client message
approach.

Now we just set the _NET_WM_STATE before mapping and avoid setting
the size hints in case of fullscreen.  That's all good, but the problem
is that we now have to wait for configure notify before we know
what size our output will be.  For now we just block and pull events from
X until we get the size.

Ideally we would treat the map as an output hotplug event and just add the
output at that point, but we can't start up with no outputs present.
That may be worth fixing, but for now, the block-on-map is fine.

11 years agorpi: Dispmanx elements as planes, completion callback
Pekka Paalanen [Wed, 7 Nov 2012 10:25:15 +0000 (12:25 +0200)]
rpi: Dispmanx elements as planes, completion callback

Dispmanx elements are like hardware overlays. Assign one weston_surface
to each overlay created, and the VideoCore will composite it on screen.
The maximum number of elements is configurable via the command line.
Specifying zero will disable the overlays (planes/elements) altogether,
and use only GLESv2 compositing.

You need an up-to-date Raspberry Pi firmware for:
- vc_dispmanx_resource_create(), that will also take stride. Otherwise
  surfaces ending up in elements may show up as corrupted.
- off-line compositing support. The on-line compositing of elements
  cannot handle too many elements. Look for the comments around
  DEFAULT_MAX_PLANES in the code.

Elements must be double-buffered to avoid tearing. Therefore two buffers
(Dispmanx resources) are allocated for each element. A command line
option is added to allow single-buffering instead to save memory, with
the risk of tearing.

The page flip timer is replaced with the Dispmanx update completion
callback. The callback is executed in a separate thread, therefore a
pipe is set up to integrate properly with Weston core.

If not disabled, usually all surfaces are assigned into planes, and
nothing is composited in GLESv2. Planes do not support surface
transformations though, so compositing will automatically switch the
necessary surfaces to GLESv2 compositing as needed. Switching between
GLESv2 and elements may cause transient visual glitches and jerks.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agorpi: a backend for Raspberry Pi
Pekka Paalanen [Wed, 7 Nov 2012 10:25:14 +0000 (12:25 +0200)]
rpi: a backend for Raspberry Pi

Add a new backend for the Raspberry Pi.

This backend uses the DispmanX API to initialise the display, and create
an EGLSurface, so that GLESv2 rendering is shown on the "framebuffer".
No X server is involved. All compositing happens through GLESv2.

The created EGLSurface is specifically configured as buffer content
preserving, otherwise Weston wouuld show only the latest damage and
everything else was black. This may be sub-optimal, since we are not
alternating between two buffers, like the DRM backend is, and content
preserving may imply a fullscreen copy on each frame.

Page flips are not properly hooked up yet. The display update will
block, and we use a timer to call weston_output_finish_frame(), just
like the x11 backend does.

This backend handles the VT and tty just like the DRM backend does.
While VT switching works in theory, the display output seems to be
frozen while switched away from Weston. You can still switch back.

Seats and connectors cannot be explicitly specified, and multiple seats
are not expected.

Udev is used to find the input devices. Input devices are opened
directly, weston-launch is not supported at this time. You may need to
confirm that your pi user has access to input device nodes.

The Raspberry Pi backend is built by default. It can be build-tested
without the Raspberry Pi headers and libraries, because we provide stubs
in rpi-bcm-stubs.h, but such resulting binary is non-functional. If
using stubs, the backend is built but not installed.

VT and tty handling, and udev related code are pretty much copied from
the DRM backend, hence the copyrights. The rpi-bcm-stubs.h code is
copied from the headers on Raspberry Pi, including their copyright
notice, and modified.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogles2: update texture only if needed
Pekka Paalanen [Wed, 7 Nov 2012 10:25:13 +0000 (12:25 +0200)]
gles2: update texture only if needed

When a surface is on a non-primary plane (overlay), we do not need to
keep the GL texture up-to-date, since we are not using it. Avoid calling
glTex(Sub)Image2D in that case, and accumulate the texture damage
separately.

This is especially useful for backends, that can put wl_shm buffers into
overlays.

The empty damage check has to be moved from surface_accumulate_damage()
into gles2_renderer_flush_damage(), because it really needs to check the
accumulated damage, not only the current damage. Otherwise, if a surface
migrates from a plane to the primary plane, and does not have new
damage, the texture would not be updated even for accumulated damage.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agobuild: make default backend configurable
Pekka Paalanen [Wed, 7 Nov 2012 10:25:12 +0000 (12:25 +0200)]
build: make default backend configurable

Instead of hardcoding drm-backend.so as the default if environment
presents neither Wayland nor X11, have a ./configure option to change
it. It still defaults to drm-backend.so, if not given.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: Remove the old repaint debug mode
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:47 +0000 (17:20 +0200)]
shell: Remove the old repaint debug mode

This was obsoleted by fan repaint debug.

11 years agogles2: Add a debug binding for highlighting shaded content
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:46 +0000 (17:20 +0200)]
gles2: Add a debug binding for highlighting shaded content

Pressing mode-shift-space s will cause the fragment shaders to be
recompiled, adding a green tint to all composited content.

11 years agocompositor: Add debug key bindings infrastructure
Ander Conselvan de Oliveira [Thu, 8 Nov 2012 15:20:45 +0000 (17:20 +0200)]
compositor: Add debug key bindings infrastructure

Add the concept of debug key bindings, that are bindings that activate
debug features in the compositor. The bindings are added to a list in
the compositor, but the triggering them is left to the shell.

On the shell side, a global debug key binding is added. When the user
presses mod-shift-space, the shell will invoke the debug bindings based
on the next key press.

This also converts the debug shortcuts for repaint debugging, fan
repaint debugging and the hide overlays shortcut in compositor-drm to
use the new infrastructure.

11 years agoAdd a headless backend
Ander Conselvan de Oliveira [Mon, 29 Oct 2012 16:19:24 +0000 (18:19 +0200)]
Add a headless backend

Add a headless backend and a noop renderer, mainly for testing
purposes. Although no rendering is performed with this backend,
this allow some of the code paths inside Weston and shm clients
to be tested without any windowing system or any need for drm
access.

11 years agokeyboard: Rename keyboard to weston-keyboard
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:43 +0000 (03:26 +0100)]
keyboard: Rename keyboard to weston-keyboard

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agokeyboard: commit preedit before sending key events
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:42 +0000 (03:26 +0100)]
keyboard: commit preedit before sending key events

Commit the current preedit text before sending control key events.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Remove preedit text on startup
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:41 +0000 (03:26 +0100)]
editor: Remove preedit text on startup

There should not be preedit text when a text entry does not have focus.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Initalize editor struct with 0
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:40 +0000 (03:26 +0100)]
editor: Initalize editor struct with 0

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Fix handling of UTF-8 text
Jan Arne Petersen [Mon, 5 Nov 2012 02:26:39 +0000 (03:26 +0100)]
editor: Fix handling of UTF-8 text

Fix display, cursor movement and text deletion for UTF-8 text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoTerminal: Handle keypad symbols
Daniel Stone [Wed, 7 Nov 2012 06:51:35 +0000 (17:51 +1100)]
Terminal: Handle keypad symbols

XKB provides keypad symbols in a separate namespace.  We don't care
about the distinction, so map them to normal symbols before starting
processing.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agosmoke: Remove unused offset member
Daniel Stone [Wed, 7 Nov 2012 06:51:36 +0000 (17:51 +1100)]
smoke: Remove unused offset member

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoshell: Do not insert input panel layer when locked
Jan Arne Petersen [Wed, 7 Nov 2012 14:32:54 +0000 (15:32 +0100)]
shell: Do not insert input panel layer when locked

Do not try to insert the input panel layer in the layer list when the
shell is locked in show_input_panels(). The layer will already be
insrted in resume_desktop() anyways.

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

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agocompositor: Use pixman_region32_intersect_rect() instead of temp region
Kristian Høgsberg [Thu, 8 Nov 2012 16:36:02 +0000 (11:36 -0500)]
compositor: Use pixman_region32_intersect_rect() instead of temp region

We avoid reusing 'opaque' and don't leak the region.

11 years agoReset pending surface delta x and y on commit
Daniel Stone [Wed, 7 Nov 2012 06:51:44 +0000 (17:51 +1100)]
Reset pending surface delta x and y on commit

The following sequence:
wl_surface::attach(s, b, 1, 2)
wl_surface::commit(s)
wl_surface::commit(s)
would actually result in the surface getting moved by (2,4) as the
pending attach delta wasn't reset on commit, only by another attach.

This only shows up on single-buffered surfaces.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoClip surface damage to the surface area
Daniel Stone [Wed, 7 Nov 2012 06:51:43 +0000 (17:51 +1100)]
Clip surface damage to the surface area

Otherwise glTexSubImage2D will reject our co-ordinates as being out of
bounds.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoSHM: Don't flush damage when there is none
Daniel Stone [Wed, 7 Nov 2012 06:51:42 +0000 (17:51 +1100)]
SHM: Don't flush damage when there is none

Every single frame, we were calling the flush_damage handler in the
renderer.  For GLES2 with subimage, this wasn't too bad as we'd never
call glTexSubImage2D, but without it, we'd upload the entire frame
through glTexImage2D every time.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agoClients: Don't set the cursor when we have no pointer
Daniel Stone [Wed, 7 Nov 2012 06:51:39 +0000 (17:51 +1100)]
Clients: Don't set the cursor when we have no pointer

Avoids a segfault whenever we get a key event, and try to set the
cursor, dereferencing a NULL input->pointer.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
11 years agowindow.c: Move misplaced break to where it belongs
Kristian Høgsberg [Tue, 6 Nov 2012 01:20:53 +0000 (20:20 -0500)]
window.c: Move misplaced break to where it belongs

The break statement wasn't copy and pasted along with the rest of the code
causing menu item before it ("Move to workspace below") to fall through to
the fullscreen case.

11 years agocompositor-drm: Always disable sprites for now
Kristian Høgsberg [Fri, 2 Nov 2012 14:14:40 +0000 (10:14 -0400)]
compositor-drm: Always disable sprites for now

Until the nuclear pageflip work lands in KMS, we can't use sprites
reliably.

11 years agocompositor-x11: verify that detectable repeat was really set
Ran Benita [Wed, 31 Oct 2012 18:14:58 +0000 (20:14 +0200)]
compositor-x11: verify that detectable repeat was really set

Since the XKB says that support for detectable repeat is in fact
optional:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Querying_and_Changing_Per_Client_Flags
we might as well be good citizens and check that it was really set. With
the X server this would never happen, though.

Signed-off-by: Ran Benita <ran234@gmail.com>
11 years agocompositor-x11: properly initialize XKB extension
Ran Benita [Wed, 31 Oct 2012 18:14:57 +0000 (20:14 +0200)]
compositor-x11: properly initialize XKB extension

In order to use XKB capabilities (as we do), the client must issue an
XkbUseExtension request:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Initializing_the_X_Keyboard_Extension

The reason this succeeds currently is that XOpenDisplay from Xlib does
this for us. But it is better not to rely on that, but do it explicitly
in XCB with the rest of the XKB init sequence.

Signed-off-by: Ran Benita <ran234@gmail.com>
11 years agocompositor-x11: free or discard XCB generic_error's
Ran Benita [Wed, 31 Oct 2012 18:14:56 +0000 (20:14 +0200)]
compositor-x11: free or discard XCB generic_error's

Where we don't look at the error details, pass NULL to the 'error'
argument and test using the reply return value instead.
Where we do need it, remember to free it.

Signed-off-by: Ran Benita <ran234@gmail.com>
11 years agocompositor-drm: Add key binding for hidding overlays
Ander Conselvan de Oliveira [Wed, 31 Oct 2012 15:55:46 +0000 (17:55 +0200)]
compositor-drm: Add key binding for hidding overlays

Pressing ctrl-alt-o will cause the overlays to be hidden, but surfaces
will still be assigned to different planes. This helps with debugging
of repaint culling below surfaces in other planes.

11 years agocompositor: Fix culling of repaints behind opaque surfaces
Ander Conselvan de Oliveira [Wed, 31 Oct 2012 15:55:45 +0000 (17:55 +0200)]
compositor: Fix culling of repaints behind opaque surfaces

Culling of the repaint of a surface behind an opaque surface on the
same plane was broken by commit 547149a9 [1]. The idea of that commit
is that the damage obscured by an overlay would remain on the primary
plane damage and be repainted when the overlay moved. However, in the
case the two surfaces are on the same plane, the opaque one is not
obscured, so it ends up being repainted.

This commit adds an opaque field to struct weston_plane, that is built
incrementally when accumulating damage. The opaque region of surfaces
on the same plane are removed from the plane's damage, restoring the
previous culling behavior. But since damage behind opaque region of
other planes is maintained, the bug solved in the mentioned commit is
not regressed.

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

11 years agocompositor-x11: use _checked() with xkb_select_events to test for error
Ran Benita [Tue, 30 Oct 2012 22:13:08 +0000 (00:13 +0200)]
compositor-x11: use _checked() with xkb_select_events to test for error

In order to use xcb_request_check(), given a request without a reply,
you need to use the _checked() variant of the request function.
See xcb-requests(3).

Signed-off-by: Ran Benita <ran234@gmail.com>
11 years agowindow: Fix use-after-free in menu button handler
Kristian Høgsberg [Tue, 30 Oct 2012 22:10:30 +0000 (18:10 -0400)]
window: Fix use-after-free in menu button handler

Commit d2fbb3870cfaea623a87ba28c9587676bbdc93f7 introduced a use-after-free
error in the case where we destroy the menu.

11 years agowindow: Only advertise fullscreen menu item if client supports it
Kristian Høgsberg [Tue, 30 Oct 2012 22:07:02 +0000 (18:07 -0400)]
window: Only advertise fullscreen menu item if client supports it

If the client doesn't set a fullscreen handler, we can't go fullscreen
and shouldn't advertise that in the window menu.  The menu implementation is
a little simplistic, so we just move the "Fullscreen" entry to the end of
the list and don't count it if we don't want it in the menu.

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

11 years agoimage: Set dragging pointer on button press, not first motion
Kristian Høgsberg [Tue, 30 Oct 2012 19:50:37 +0000 (15:50 -0400)]
image: Set dragging pointer on button press, not first motion

We want feedback that we're starting to drag when we press the button
not when we later start dragging the image.

11 years agoimage: Combine clamp_view() and center_view ()
Kristian Høgsberg [Tue, 30 Oct 2012 19:46:25 +0000 (15:46 -0400)]
image: Combine clamp_view() and center_view ()

We need to clamp or center on a per axis basis.  If the window is wider
but the image is taller, we need to center horizontally but
clamp vertically.  We can only do that if by combining the two
functions.

11 years agoimage: Add keyhandler to handle keyboard zoom
Kristian Høgsberg [Tue, 30 Oct 2012 19:42:20 +0000 (15:42 -0400)]
image: Add keyhandler to handle keyboard zoom

11 years agoimage: Set resize handler and center view on resize/fullscreen
Kristian Høgsberg [Tue, 30 Oct 2012 19:09:49 +0000 (15:09 -0400)]
image: Set resize handler and center view on resize/fullscreen

11 years agotoytoolkit: Don't destroy window cairo surface on shm attach.
Scott Moreau [Tue, 30 Oct 2012 18:12:12 +0000 (12:12 -0600)]
toytoolkit: Don't destroy window cairo surface on shm attach.

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

11 years agoshell: End popups if we trigger a shell grab
Kristian Høgsberg [Tue, 30 Oct 2012 18:07:27 +0000 (14:07 -0400)]
shell: End popups if we trigger a shell grab

Clicking outside popups closes them except in case of a shell grab
(move, resize or rotate), in which case we move the parent window away
from under the popup.  Instead, just end the popup in those cases.

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

11 years agocompositor: Fix partial repaints
Ander Conselvan de Oliveira [Tue, 30 Oct 2012 15:44:01 +0000 (17:44 +0200)]
compositor: Fix partial repaints

Partial repaints have been broken since the introduction of the atomic
surface updates. The problem was that surface_commit would set the
geometry dirty flag unconditionally, causing transform updates on every
frame which would in turn cause weston_surface_damage_below() to damage
the whole surface area.

This patch changes this so that flag is only set if the pending buffer
has a different size, the location of the surface changed or the opaque
region changed.

Note that changing the opaque region will cause a full repaint of the
affected surface, because of the transform update.

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

11 years agowindow: Make press-drag-release menu selection mode work
Kristian Høgsberg [Tue, 30 Oct 2012 17:45:22 +0000 (13:45 -0400)]
window: Make press-drag-release menu selection mode work

The intended behavior is that a quick click (press and then release
within 500ms) just pops up the menu and doesn't select anything.  Then
we can mouse around and and click to select an item.  Alternatively, a
click and hold (ie press and release after 500ms) lets you press right
button, mouse down on the menu item you want and release to select it.
This is how menus work in most toolkits.

The handling in weston is fine, it's there to handle the case where
the button release happens outside any client window, since the client
doesn't get those events.  If such a release happens late or we get a
second release outside the popup window we shut down the popup.

The problem is in toytoolkit, where we need to select the item if we
get a release within 500ms or if we get a second release.  A second
release is the case where the first release came after 500ms and
didn't pop down the menu, and the second release event is from a click
on a menu item.

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

11 years agocompositor-x11: Grab pointer on button press, ungrab on release
Kristian Høgsberg [Tue, 30 Oct 2012 15:04:52 +0000 (11:04 -0400)]
compositor-x11: Grab pointer on button press, ungrab on release

This lets us confine the X pointer to the Weston X window, which corresponds
better with the rendered Wayland cursor actually moves.

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

11 years agosimple-egl: Add a default cursor
Kristian Høgsberg [Mon, 29 Oct 2012 21:41:46 +0000 (17:41 -0400)]
simple-egl: Add a default cursor

If clients don't set a cursor, they get whatever the last cursor was
before the pointer entered their window.  That's a little confusing, so
set a pointer on enter to avoid that.  The down-side is that simple EGL
isn't very simple anymore.

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

11 years agoclients: Remove $(toolkit_libs) from weston_screensaver_CFLAGS
Kristian Høgsberg [Mon, 29 Oct 2012 21:15:54 +0000 (17:15 -0400)]
clients: Remove $(toolkit_libs) from weston_screensaver_CFLAGS

The typo that broke the build.

11 years agowindow: Ignore input_set_pointer_image() if we don't have a pointer
Kristian Høgsberg [Mon, 29 Oct 2012 20:42:26 +0000 (16:42 -0400)]
window: Ignore input_set_pointer_image() if we don't have a pointer

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

11 years agocompositor-drm: prefer PCI boot_vga GPU over other GPUs
David Herrmann [Mon, 29 Oct 2012 18:21:16 +0000 (19:21 +0100)]
compositor-drm: prefer PCI boot_vga GPU over other GPUs

If we can find a boot_vga PCI GPU, we should prefer it over any other GPU
that is connected to the system. The boot_vga flag tells us that this GPU
is the primary system GPU.

This fixes problems on two-GPU-systems were the wrong GPU is used. It also
fixes systems were DisplayLink GPUs are available with lower IDs than PCI
GPUs (although, this seems unlikely).

Note that udev_enumerate guarantees that the entry-list is sorted. So for
systems that have platform-GPUs, these should almost always be reported
prior to hotpluggable (PCI, USB, ...) GPUs, as the kernel probes them
first.

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

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
11 years agodnd: Use %zd in the format string for size_t types
Damien Lespiau [Fri, 26 Oct 2012 00:15:44 +0000 (01:15 +0100)]
dnd: Use %zd in the format string for size_t types

len i size_t, so is the result of the sizeof operator.

11 years agocompositor-x11: Inherit initial modifier state from XKB
Kristian Høgsberg [Mon, 29 Oct 2012 18:15:40 +0000 (14:15 -0400)]
compositor-x11: Inherit initial modifier state from XKB

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

11 years agoman: Update XCURSOR_* information a bit
Tiago Vignatti [Fri, 28 Sep 2012 13:29:47 +0000 (16:29 +0300)]
man: Update XCURSOR_* information a bit

This and the previous patch should fix:

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

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoxwm: Fail safely if cursor is not found
Tiago Vignatti [Fri, 28 Sep 2012 13:29:46 +0000 (16:29 +0300)]
xwm: Fail safely if cursor is not found

It will use the stock 'x' cursor instead when the system cursors are not
provided.

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoconfigure.ac: Check for libGLU for screensaver
Kristian Høgsberg [Mon, 29 Oct 2012 17:06:02 +0000 (13:06 -0400)]
configure.ac: Check for libGLU for screensaver

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

11 years agoAdd informal notes file
Pekka Paalanen [Wed, 24 Oct 2012 06:43:10 +0000 (09:43 +0300)]
Add informal notes file

By request on the wayland-devel mailing list, we could start collecting
useful writings here.

However, this is not meant to be a substitute to proper documentation,
though I understand it may very well become one. Better than nothing, I
guess, and hopefully helps in writing real documentation.

Feel free to add stuff.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor-drm: remove a stale comment
Pekka Paalanen [Wed, 24 Oct 2012 06:43:09 +0000 (09:43 +0300)]
compositor-drm: remove a stale comment

This comment became stale in:

commit 65a11e1039e7ea429ff26bdd0058bdf0efd1df2d
Author: Kristian Høgsberg <krh@bitplanet.net>
Date:   Fri Aug 3 11:30:18 2012 -0400

    compositor: Accumulate damage per plane

Now it is just misleading. Remove it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agodesktop-shell: background should be opaque
Pekka Paalanen [Wed, 24 Oct 2012 06:43:08 +0000 (09:43 +0300)]
desktop-shell: background should be opaque

Toytoolkit does not support setting opaqueness for anything else than
the immediate child widget of the frame widget. Backgrounds do not have
frames, so we need to poke it in manually.

This should allow Weston to paint the background without blending.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: remove window_set_transparent() declaration
Pekka Paalanen [Wed, 24 Oct 2012 06:43:07 +0000 (09:43 +0300)]
window: remove window_set_transparent() declaration

The function is not implemented.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogles2: check eglBindWaylandDisplayWL return value
Pekka Paalanen [Wed, 24 Oct 2012 06:43:06 +0000 (09:43 +0300)]
gles2: check eglBindWaylandDisplayWL return value

If the bind fails, do not bother pretending the EGL Wayland extension
is usable, and no need to unbind, either.

Print some important details about the GLESv2 renderer configuration
into the log.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agogles2: log EGL config info
Pekka Paalanen [Wed, 24 Oct 2012 06:43:05 +0000 (09:43 +0300)]
gles2: log EGL config info

Interesting in new environments.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: Clip pointer coordinates on pointer enter as well
Kristian Høgsberg [Tue, 23 Oct 2012 17:04:09 +0000 (13:04 -0400)]
compositor: Clip pointer coordinates on pointer enter as well

When tiling window managers resize a non-resizable window they're violating
ICCCM.  Not some hippie-community standard like EWMH, but ICCCM, which is
about as old and sacred as the constitution.  If they want to force a window
to be a size it wasn't designed for, at least they could have the decency to
reparent the client window into a bigger containing window of whatever size
they think it should be.  But apparently ICCCM compliance is too much to ask.

Anyway, all that just to say that it's really not our fault when we get an
enter event with coordinates outside the valid output region.  But we'll
clip it anyway and work around mis-behaving tiling WMs.

11 years agoconfigure.ac: Bump version to 1.0.0
Kristian Høgsberg [Mon, 22 Oct 2012 22:50:03 +0000 (18:50 -0400)]
configure.ac: Bump version to 1.0.0

11 years agotest-client: Make sure we process pending eevents before we verify state
Kristian Høgsberg [Mon, 22 Oct 2012 02:30:26 +0000 (22:30 -0400)]
test-client: Make sure we process pending eevents before we verify state

Since the send-button-state request comes in on one socket and the
wayland event we're looking for comes in on another socket, the order
that we process the two in is undefined.  Thus, button-test fails
intermittently, depending on which event we process first.

We change wl_display_flush() to wl_display_roundtrip(), to make sure that
we deal with all wayland events before handling test protocol requests.

11 years agocompositor-drm: Disable hw cursor if allocation fails
Kristian Høgsberg [Sun, 21 Oct 2012 17:29:26 +0000 (13:29 -0400)]
compositor-drm: Disable hw cursor if allocation fails

Instead of crashing later, we can just fall back to gl rendered cursors.

11 years agoDefine our own container_of as well
Kristian Høgsberg [Sat, 20 Oct 2012 03:05:37 +0000 (23:05 -0400)]
Define our own container_of as well

Don't rely on libwayland-client/server to define this for us.

11 years agoStop relying on ARRAY_LENGTH being defined in wayland-util.h
Kristian Høgsberg [Fri, 19 Oct 2012 21:12:38 +0000 (17:12 -0400)]
Stop relying on ARRAY_LENGTH being defined in wayland-util.h

Time to break a bad habit.

11 years agowindow: Always pass focused widget to widget motion handlers
Jonas Ådahl [Fri, 19 Oct 2012 17:56:02 +0000 (19:56 +0200)]
window: Always pass focused widget to widget motion handlers

Grabbed widgets should always receive motion events as if it was the
widget that would receive it if no grab was active. This means that the
focused widget should always be passed as the widget argument to widget
motion handlers.

This reverts commit 8c9c8fcf6e294f0446446d8e9bdfeb37294743c3.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
11 years agowindow: Don't set pointer image when requesting to move a surface
Jonas Ådahl [Fri, 19 Oct 2012 06:23:57 +0000 (08:23 +0200)]
window: Don't set pointer image when requesting to move a surface

Since it's the server who moves the surface it's the server who sets the
pointer image.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
11 years agosimple-shm: Don't use ret variable in main() uninitialized
Ander Conselvan de Oliveira [Wed, 17 Oct 2012 10:49:08 +0000 (13:49 +0300)]
simple-shm: Don't use ret variable in main() uninitialized

11 years agoclients: Don't ask for EGL_PIXMAP_BIT when choosing configs
Kristian Høgsberg [Tue, 16 Oct 2012 19:31:31 +0000 (15:31 -0400)]
clients: Don't ask for EGL_PIXMAP_BIT when choosing configs

11 years agoclients: Check return value of wl_display_dispatch()
Kristian Høgsberg [Tue, 16 Oct 2012 17:16:10 +0000 (13:16 -0400)]
clients: Check return value of wl_display_dispatch()

The simple clients all just call wl_display_dispatch() in a while loop
without checking the return value.  Now, if the server dies or other
error occurs, we get a -1 return value instead and need to break the loop.

11 years agoutil: Check result of weston_surface_animation_run.
John Kåre Alsaker [Fri, 12 Oct 2012 10:32:03 +0000 (12:32 +0200)]
util: Check result of weston_surface_animation_run.

11 years agocompositor-x11: Fix a memory leak.
John Kåre Alsaker [Fri, 12 Oct 2012 10:25:11 +0000 (12:25 +0200)]
compositor-x11: Fix a memory leak.

11 years agocompositor: Check if surface creation failed in weston_compositor_fade.
John Kåre Alsaker [Fri, 12 Oct 2012 10:25:09 +0000 (12:25 +0200)]
compositor: Check if surface creation failed in weston_compositor_fade.

11 years agocompositor-x11: Clean up event handling.
John Kåre Alsaker [Fri, 12 Oct 2012 10:25:07 +0000 (12:25 +0200)]
compositor-x11: Clean up event handling.