platform/upstream/weston.git
11 years agowindow: throttle resizing to the main surface
Pekka Paalanen [Thu, 25 Apr 2013 10:57:52 +0000 (13:57 +0300)]
window: throttle resizing to the main surface

In case a toytoolkit application manages to schedule resizes constantly,
throttle them to the main surface display.

When resizing, all surfaces are updated synchronously, so it also makes
sense to synchronize on the main surface's frame callback particularly.
Rendering any faster will not make sense.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: prevent EGL sub-surface deadlock
Pekka Paalanen [Thu, 25 Apr 2013 10:57:51 +0000 (13:57 +0300)]
window: prevent EGL sub-surface deadlock

Mesa's eglSwapBuffers() waits for the frame event from the previous
swapBuffers, before it returns. Apparently eglSwapInterval(), which
should be able to disable the wait, is unimplemented for now.

When a sub-surface contains an EGL widget, and the commit mode is
synchronized, the frame events will not be delivered to EGL until the
parent surface gets committed. Therefore rendering the EGL widget twice
would lead to a deadlock.

When the window is being resized, we need to force a repaint of the EGL
widget, too, to make the whole window consistent. For that, we need to
make sure the frame event from the previous eglSwapBuffers() actually
arrives.

This patch adds an extra wl_surface.commit(parent), when the window is
being resized, which should guarantee, that the previous eglSwapBuffers
gets its event.

To properly handle an EGL widget in a sub-surface, running in its own
thread, the EGL widget's automatic updates should be paused before
sending the extra wl_surface.commit(parent). A natural place for the
pause would be in the widget's resize hook. However, wl_surface.commit
cannot be called right after resize hooks, because it would commit new,
incomplete surface state. Therefore this patch is not enough for
threaded toytoolkit applications.  Luckily those do not exist yet.

When eglSwapInterval() gets implemented, this patch should be reverted.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoclients: add subsurfaces demo
Pekka Paalanen [Thu, 25 Apr 2013 10:57:50 +0000 (13:57 +0300)]
clients: add subsurfaces demo

Add a demo program with:
- a main surface (green)
- a Cairo-image sub-surface (red)
- a raw GLESv2 widget (triangle)

Sub-surface input region is set empty to avoid problems in toytoolkit.

If Cairo links to libGL, then we will end up with also libGLESv2 linked
to subsurfaces program, and both libs getting really used, which leads
to disaster.

Do not build subsurfaces demo, if Cairo links to libGL and cairo-egl is
usable.

The GL rendering loop is not tied to the toytoolkit or the widget, but
runs directly from its own frame callback. Therefore it runs
independent of the rest of the application. This also relies on one of
two things:
- eglSwapInterval(0) is implemented, and therefore eglSwapBuffers never
  blocks indefinitely, or
- toytoolkit has a workaround, that guarantees that eglSwapBuffers will
  return soon, when we force a repaint on resize.
Otherwise the demo will deadlock.

The code is separated into three sections:

1. The library component, using only EGL, GLESv2, and libwayland-client
   APIs, and not aware of any toolkit details of the parent application.
   This runs independently until the parent application tells otherwise.

2. The glue code: a toytoolkit application widget, who has its own
   rendering machinery.

3. The application written in toytoolkit.

This patch also adds new toytoolkit interfaces:
- widget_get_wl_surface()
- widget_get_last_time()
- widget_input_region_add()

Toytoolkit applications have not had a possibility to change the input
region. The frame widget (decorations) set the input region on its own
when used, otherwise the default input region of everything has been
used. If a window does not have a frame widget, it can now use
widget_input_region_add() to set a custom input region.

These are not window methods, because a widget may lie on a different
wl_surface (sub-surface) than the window.

Changes in v3:
- replace set_commit_mode with set_sync and set_desync

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: implement per-surface redraws
Pekka Paalanen [Thu, 25 Apr 2013 10:57:49 +0000 (13:57 +0300)]
window: implement per-surface redraws

Add redraw_needed flag to all surfaces, in addition to having one in
window. The window redraw_needed flag is changed to force a redraw of
the whole window, regardless of frame events.

widget_schedule_redraw() now schedules the redraw only for the surface,
where the widget is on. window_schedule_redraw() is equivalent to
scheduling a redraw for all (sub-)surfaces of the window.

We still use only one deferred task for all redraws.

surface_redraw() will skip the redraw, if the window does not force a
redraw and the surface does not need a redraw. It will also skip the
redraw, if the frame callback from the previous redraw has not triggered
yet. When the frame callback later arrives, the redraw task will be
scheduled, if the surface still needs a redraw.

If the window forces a redraw, the redraw is executed even if there is a
pending frame callback. This is for resizing: resizing should trigger a
window repaint, as it really wants to update all surfaces in one go, to
apply possible sub-surface size and position changes. Resizing is the
only thing that makes a window force a redraw.

With this change, subsurfaces demo can avoid repainting the cairo
sub-surface while still animating the GL sub-surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: create sub-surfaces
Pekka Paalanen [Thu, 25 Apr 2013 10:57:48 +0000 (13:57 +0300)]
window: create sub-surfaces

The new application API window_add_subsurface() will create a plain
widget that is on a new sub-surface.

The sub-surface position is taken from the surface's root widget
allocation. This way widget allocations are always in the main surface
(i.e. window) coordinates. However, Cairo drawing coordinates will now
be different to widget coordinates for sub-surfaces. Cairo coordinates
are fixed by applying a translation in widget_cairo_create(), so that
widget drawing code can simply use the widget allocation as before.

Sub-surfaces are hooked up into resize, window flush, redraw, and
find_widget. Window maintains a list of sub-surfaces in top-first order.

Add a client settable default commit mode, and toggle the mode when
resizing to guarantee in-sync updates of a window and its sub-surfaces.

Changes in v3:
- replaced set_commit_mode with set_sync and set_desync

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agowindow: implement shm triple-buffering
Pekka Paalanen [Thu, 25 Apr 2013 10:57:47 +0000 (13:57 +0300)]
window: implement shm triple-buffering

Increase the maximum number of shm "leaves" to three, and rewrite the
leaf release and pick algorithms. The new algorithms hopefully improve
on buffer re-use while freeing unused buffers.

The goal of the new release algorithm is to always leave one free leaf
with storage allocated, so that the next redraw could start straight on
it.

The new leaf picking algorithm will prefer a free leaf that already has
some storage allocated, instead of just picking the first free leaf that
may need to allocate a new buffer.

Triple-buffering is especially for sub-surfaces, where the compositor
may have one wl_buffer busy on screen, and another wl_buffer busy in the
sub-surface cached state due to the synchronized commit mode. To be
able to forcibly repaint at that situation for e.g. resize, we need a
third buffer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: account for the subsurfaces when going fullscreen or maximizing
Giulio Camuffo [Thu, 25 Apr 2013 10:57:46 +0000 (13:57 +0300)]
shell: account for the subsurfaces when going fullscreen or maximizing

We must calculate the bounding box of the surface + subsurfaces set and use
that when maximizing the window or going fullscreen.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: enable moving and resizing of a surface when clicking on a subsurface
Giulio Camuffo [Thu, 25 Apr 2013 10:57:45 +0000 (13:57 +0300)]
shell: enable moving and resizing of a surface when clicking on a subsurface

[pq: changed to weston_surface_get_main_surface(), and used a temporary
variable to clean up the expressions.]

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoshell: keyboard focus and restacking fixes for sub-surfaces
Pekka Paalanen [Thu, 25 Apr 2013 10:57:44 +0000 (13:57 +0300)]
shell: keyboard focus and restacking fixes for sub-surfaces

The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:

- Move, resize, and rotate bindings always target the parent surface.

- Opacity (full-surface alpha) binding targets the parent surface. This
  is broken, because it should change the opacity of the whole compound
  window, which is difficult to implement in the renderer.

- click_to_activate_binding() needs to check the shell surface type from
  the main surface, because sub-surface would produce SHELL_SURFACE_NONE
  and prevent activation.

- Also activate() needs to check the type from the main surface, and
  restack the main surface. Keyboard focus is assigned to the original
  (sub-)surface.

- focus_state_surface_destroy() needs to handle sub-surfaces: only the
  main surface will be in a layer list. If the destroyed surface is
  indeed a sub-surface, activate the main surface next. This way a
  client that destroys a focused sub-surface still retains focus in the
  same window.

- The workspace_manager.move_surface request can accept also
  sub-surfaces, and it will move the corresponding main surface.

Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
  sub-surfaces in shell, fix focus_state_surface_destroy()

Changes in v3:
- Renamed weston_surface_get_parent() to
  weston_surface_get_main_surface() to be more explicit that this is
  about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
  sub-surface.
- Used a temporary variable in several places to clarify code, instead
  of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agotests: add sub-surface protocol tests
Pekka Paalanen [Thu, 25 Apr 2013 10:57:43 +0000 (13:57 +0300)]
tests: add sub-surface protocol tests

For testing the protocol behaviour only:
- linking a surface to a parent does not fail
- position and placement requests do not fail
- bad linking and arguments do fail
- passing a surface as a sibling from a different set fails
- different destruction sequences do not crash
- setting a surface as its own parent fails
- nesting succeeds

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor: introduce sub-surfaces
Pekka Paalanen [Thu, 25 Apr 2013 10:57:42 +0000 (13:57 +0300)]
compositor: introduce sub-surfaces

Implement the basic protocol for sub-surfaces:
- expose wl_subcompositor global interface
- error checking on protocol calls
- associate a parent wl_surface to a sub-surface
- introduce the sub-surface role, which is exclusive
- an implementation of the wl_subsurface interface
- allow nesting of sub-surfaces
- proper surface transformation inheritance from parent to sub-surfaces
- two different modes of wl_surface.commit for sub-surfaces
- hook sub-surfaces up to repaint by modifying the repaint list code

Struct weston_subsurface is dynamically allocated. For sub-surfaces, it
is completely populated.

For parent surfaces, weston_subsurface acts only as a link for stacking
order purposes. The wl_resource is unused, parent_destroy_listener is
not registered, the transform is not linked, etc.

Sub-surfaces are not added directly into layers for display or input.
Instead, they are hooked up via the sub-surface list present in parent
weston_surface. This way sub-surfaces are inherently linked to the
parent surface, and cannot be displayed unless the parent is mapped,
too. This also eases restacking, as only the parent will be in a layer
list. Also, only the main surface should be subject to shell actions.

The surface list rebuilding in weston_output_repaint() is modified to
process sub-surface lists, if they are non-empty. The sub-surface list
always contains the parent, too, unless empty. The collection of
frame_callback_list is moved to a later loop, to streamline the surface
list rebuild functions.

Features still lacking are:
- full-surface alpha support for compound windows

Changes in v2:
- fix a bug in surface mapping: commit a sub-surface would cause the
  main surface to never be mapped.
- remove debug printfs
- detect attempt of making a surface its own parent
- always zero-alloc weston_subsurface
- apply wl_subsurface.set_position in commit, not immediately
- add weston_surface_to_subsurface()
- implement sub-surface commit modes parent-cached and independent
- implement wl_subcompositor.destroy and wl_subsurface.destroy

Changes in v3:
- rebased, and use the new transform inheritance code
- squashed the commit "add sub-surfaces to repaint list"
- fixed a buffer reference leak in commit_from_cache()
- Rewrite the sub-surface destructor code, and make it leave the
  wl_subsurface protocol object inert, if one destroys the corresponding
  wl_surface.
- replaced set_commit_mode with set_sync and set_desync
- allowed sub-surface nesting, and fixed repaint accordingly
- implemented nested sub-surface commit modes
- Made the sub-surface order changes from wl_subsurface.place_above and
  .place_below to be applied when the parent surface state is applied,
  instead of immediately. This conforms with the protocol specification
  now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agoprotocol: add sub-surfaces
Pekka Paalanen [Thu, 25 Apr 2013 10:57:41 +0000 (13:57 +0300)]
protocol: add sub-surfaces

Add protocol for sub-surfaces, wl_subcompositor as the global interface,
and wl_subsurface as the per-surface interface extension.

This patch is meant to be reverted, once sub-surfaces are moved into
Wayland core.

Changes in v2:

- Rewrite wl_subcompositor.get_subsurface description, and move mapping
  and commit details into wl_subsurface description. Check the wording
  in wl_subsurface.set_position description.

- Add wl_subsurface.set_commit_mode request, and document it, with the
  commit_mode enum. Add bad_value error code for wl_subsurface.

- Moved the protocol into Weston repository so we can land it upstream
  sooner for public exposure. It is to be moved into Wayland core later.

- Add destroy requests to both wl_subcompositor and wl_subsurface, and
  document them. Experience has showed, that interfaces should always
  have a destructor unless there is a good and future-proof reason to not
  have it.

Changes in v3:

- Specify, that wl_subsurface will become inert, if the corresponding
  wl_surface is destroyed, instead of requiring a certain destruction
  order.

- Replaced wl_subsurface.set_commit_mode with wl_subsurface.set_sync and
  wl_subsurface.set_desync. Parent-cached commit mode is now called
  synchronized, and independent mode is desynchronized. Removed
  commit_mode enum, and bad_value error.

- Added support for nested sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
11 years agocompositor-drm: Destroy sprites before destroying the outputs
Kristian Høgsberg [Fri, 10 May 2013 16:36:04 +0000 (12:36 -0400)]
compositor-drm: Destroy sprites before destroying the outputs

11 years agoeditor: Removed unused utf8_characters() function
Kristian Høgsberg [Fri, 10 May 2013 15:04:08 +0000 (11:04 -0400)]
editor: Removed unused utf8_characters() function

I left this in when I merged Jans patches.

11 years agoAdd initial color management framework code
Richard Hughes [Thu, 9 May 2013 19:31:09 +0000 (20:31 +0100)]
Add initial color management framework code

ICC profiles can now be specified in weston.ini for each output, or a CMS
implementation can optionally loaded from a pluggable module.

11 years agocompositor: Move gl-renderer vertex arrays into gl-renderer.c
Kristian Høgsberg [Thu, 9 May 2013 02:38:05 +0000 (22:38 -0400)]
compositor: Move gl-renderer vertex arrays into gl-renderer.c

They were still sitting in struct weston_compositor.

11 years agocompositor: Remove stale prototype
Kristian Høgsberg [Thu, 9 May 2013 02:31:03 +0000 (22:31 -0400)]
compositor: Remove stale prototype

We got rid of this function.

11 years agoinput: Remove unused focus and key fields from keyboard and focus grabs
Kristian Høgsberg [Thu, 9 May 2013 02:10:16 +0000 (22:10 -0400)]
input: Remove unused focus and key fields from keyboard and focus grabs

11 years agoinput: Move surface picking into the pointer grab focus callback
Kristian Høgsberg [Thu, 9 May 2013 02:02:59 +0000 (22:02 -0400)]
input: Move surface picking into the pointer grab focus callback

Currently the core input code does surface picking before calling into
the focus callback of the current grab.  Not all grabs need to pick a
surface however, so we're doing work we don't have to in those cases.

For example, the shell move and resize grabs don't need to pick and the
default grab in implicit grab mode doesn't either.

With this change, the pointer grab mechanism is now very simple:
the focus callback is called whenever the pointer may have a new focus,
the motion callback is called whenever the pointer moves and
the button callback whenever a button is pressed or released.

11 years agoinput: Get rid of grab focus concept
Kristian Høgsberg [Thu, 9 May 2013 01:03:21 +0000 (21:03 -0400)]
input: Get rid of grab focus concept

This was another complication that we had to have to support the
split between libwayland-server and weston.  Different grabs want to send
events relative to different surfaces at different times.  The default
grab switches between sending coordinates relative to the 'current' surface,
that is the surface the pointer is currently above, or the 'clicked'
surface, in case of an implicit grab.

The grab focus was set by the grab implementation and the core input code
would transform the pointer position to surface relative coordinates for the
grab focus and store in grab->x/y.

Now we can just let the grab implementation transform the pointer
coordinates itself, leaving the implementation free to transform
according to whichever surface it wants.  Or not transform at all if
it doesn't need surface relative coordinates (like the shell move and resize
grabs).

11 years agoinput: Remove 'current' and related fields from weston_pointer
Kristian Høgsberg [Wed, 8 May 2013 20:47:00 +0000 (16:47 -0400)]
input: Remove 'current' and related fields from weston_pointer

The current surface field was used to track the surface the pointer was
currently over along with pointer position relative to that surface,
regardless of implicit or explicit grabs.  The main purpose was to restore
the default grab when another grab terminated.  We can now just repick in
that case and avoid keeping that state around, with the destroy listener
overhead that involves.

There was one other use case - we used to optimize out calls to
weston_pointer_set_focus() if the focus didn't actually change.  We can
still do that, but we have to do that in the default_grab_focus() handler
and compare against weston_pointer->focus instead.

11 years agodata-device: Verify that the client has an implicit grab when starting a drag
Kristian Høgsberg [Wed, 8 May 2013 19:53:42 +0000 (15:53 -0400)]
data-device: Verify that the client has an implicit grab when starting a drag

Make sure that the implicit is valid and still in effect as we start
the drag.  Fixes a long standing FIXME.

11 years agodata-device: Eliminate two small helper functions
Kristian Høgsberg [Wed, 8 May 2013 19:47:52 +0000 (15:47 -0400)]
data-device: Eliminate two small helper functions

device_setup_new_drag_surface() and device_release_drag_surface() are both
now fairly small and only called from data_device_start_drag() and
data_device_end_grab() respectively.  Folding the two functions in where
they're called from simplifies the code flow a bit.

11 years agodata-device: Rename generic weston_drag 'surface' field to 'icon'
Kristian Høgsberg [Wed, 8 May 2013 19:30:42 +0000 (15:30 -0400)]
data-device: Rename generic weston_drag 'surface' field to 'icon'

11 years agodata-device: Move all drag-related fields out of weston_seat
Kristian Høgsberg [Wed, 8 May 2013 19:27:47 +0000 (15:27 -0400)]
data-device: Move all drag-related fields out of weston_seat

We can now allocate a temporary weston_drag structure that we keep all
this drag-and-drop related state in.

11 years agoinput: Move sprite fields into weston_pointer from weston_seat
Kristian Høgsberg [Wed, 8 May 2013 19:02:05 +0000 (15:02 -0400)]
input: Move sprite fields into weston_pointer from weston_seat

11 years agosimple-egl: Add support for EGL_EXT_swap_buffer_with_damage
Kristian Høgsberg [Wed, 8 May 2013 15:37:28 +0000 (11:37 -0400)]
simple-egl: Add support for EGL_EXT_swap_buffer_with_damage

This new EGL extension lets us communicate the damage area to the compositor
by using eglSwapBuffersWithDamge() instead of the regular eglSwapBuffer().

http://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_swap_buffers_with_damage.txt

11 years agocompositor: Adapt to wl_surface going away
Kristian Høgsberg [Wed, 8 May 2013 13:54:37 +0000 (09:54 -0400)]
compositor: Adapt to wl_surface going away

struct weston_surface is now the only surface type we have (in core, shell.c
has shell_surface, of course).  A lot of code gets simpler and we never
have to try to guess whether an API takes a wl_surface or a weston_surface.

11 years agoinput: Allocate pointer/keyboard/touch structs
Kristian Høgsberg [Wed, 8 May 2013 03:52:07 +0000 (23:52 -0400)]
input: Allocate pointer/keyboard/touch structs

11 years agoinput: Eliminate weston_seat::has_pointer/keyboard/touch
Kristian Høgsberg [Wed, 8 May 2013 03:17:41 +0000 (23:17 -0400)]
input: Eliminate weston_seat::has_pointer/keyboard/touch

We can just look at weston_seat::pointer/keyboard/touch now.

11 years agodata-device: Update drag icon position from configure and motion handlers
Kristian Høgsberg [Wed, 8 May 2013 02:53:43 +0000 (22:53 -0400)]
data-device: Update drag icon position from configure and motion handlers

We can now update the drag icon position directly from the configure
handler or the grab motion handler, and no longer need
weston_seat_update_drag_surface().

11 years agodata-device: Map drag icon in configure handler
Kristian Høgsberg [Wed, 8 May 2013 02:42:28 +0000 (22:42 -0400)]
data-device: Map drag icon in configure handler

This how we usually do it, and we avoid 'polling' for mapping in
weston_seat_update_drag_surface().

11 years agodata-device: Setup and release drag surface and beginning and end of drag
Kristian Høgsberg [Wed, 8 May 2013 01:06:38 +0000 (21:06 -0400)]
data-device: Setup and release drag surface and beginning and end of drag

Previously we just got the drag_icon signal and had to figure out what
changed.  Now we can directly setup or release the drag icon when the
drag starts and stops.

11 years agodata-device: Fix dnd regression from weston_seat rewrite
Kristian Høgsberg [Wed, 8 May 2013 00:50:26 +0000 (20:50 -0400)]
data-device: Fix dnd regression from weston_seat rewrite

We had a drag_surface in wl_seat and weston_seat which confused me during
the rewrite.

11 years agodata-device: Don't emit a signal for drag icon changes
Kristian Høgsberg [Tue, 7 May 2013 19:30:49 +0000 (15:30 -0400)]
data-device: Don't emit a signal for drag icon changes

The signal used to be in libwayland-server and the listener in weston, but
now they're both in the same file, so lets stop using signal.

11 years agoinput: Move drag handling to data-device.c
Kristian Høgsberg [Tue, 7 May 2013 15:18:46 +0000 (11:18 -0400)]
input: Move drag handling to data-device.c

11 years agocompositor: Move fan_debug to gl-renderer
Kristian Høgsberg [Tue, 7 May 2013 14:50:09 +0000 (10:50 -0400)]
compositor: Move fan_debug to gl-renderer

With the debug binding infrastructure, we can do this all inside
gl-renderer.c.

11 years agoinput: Merge wl_seat into weston_seat
Kristian Høgsberg [Tue, 7 May 2013 03:19:49 +0000 (23:19 -0400)]
input: Merge wl_seat into weston_seat

11 years agoinput: Remove wl_seat destroy signal
Kristian Høgsberg [Tue, 7 May 2013 02:27:40 +0000 (22:27 -0400)]
input: Remove wl_seat destroy signal

We already have one on weston_seat.

11 years agoinput: Fold wl_seat init/release into weston_seat init/release
Kristian Høgsberg [Tue, 7 May 2013 02:24:50 +0000 (22:24 -0400)]
input: Fold wl_seat init/release into weston_seat init/release

11 years agoinput: Rename wl_touch to weston_touch
Kristian Høgsberg [Tue, 7 May 2013 02:19:57 +0000 (22:19 -0400)]
input: Rename wl_touch to weston_touch

This is now a weston object.

11 years agoinput: Rename wl_pointer to weston_pointer
Kristian Høgsberg [Tue, 7 May 2013 02:15:05 +0000 (22:15 -0400)]
input: Rename wl_pointer to weston_pointer

This is now a weston object.

11 years agoinput: Rename weston_device_repick() to weston_seat_repick()
Kristian Høgsberg [Tue, 7 May 2013 01:51:21 +0000 (21:51 -0400)]
input: Rename weston_device_repick() to weston_seat_repick()

Old left-over misnaming.

11 years agoinput: Drop find_resource_for_client()
Kristian Høgsberg [Tue, 7 May 2013 01:49:55 +0000 (21:49 -0400)]
input: Drop find_resource_for_client()

We can use find_resource_for_surface() instead now that it's all in the
same file.

11 years agomove input code from compositor.c into input.c
Kristian Høgsberg [Thu, 18 Apr 2013 19:40:10 +0000 (15:40 -0400)]
move input code from compositor.c into input.c

11 years agofold wl_keyboard into weston_keyboard
Kristian Høgsberg [Thu, 18 Apr 2013 19:25:39 +0000 (15:25 -0400)]
fold wl_keyboard into weston_keyboard

11 years agoImport input structs and helper functions from wayland
Kristian Høgsberg [Thu, 18 Apr 2013 19:07:39 +0000 (15:07 -0400)]
Import input structs and helper functions from wayland

11 years agoeditor: Fix some offsets for multi-byte characters
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:42 +0000 (16:47 +0200)]
editor: Fix some offsets for multi-byte characters

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agokeyboard: Fix offsets when deleting text
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:41 +0000 (16:47 +0200)]
keyboard: Fix offsets when deleting text

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename input_method to wl_input_method
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:39 +0000 (16:47 +0200)]
text: Rename input_method to wl_input_method

Also rename input_method_context to wl_input_method_context,
input_panel to wl_input_panel and input_panel_surface to
wl_input_panel_surface.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Improve protocol documentation.
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:38 +0000 (16:47 +0200)]
text: Improve protocol documentation.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename ::set_panel to ::set_overlay_panel
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:37 +0000 (16:47 +0200)]
text: Rename ::set_panel to ::set_overlay_panel

Also add documentation to input_panel_surface::set_overlay_panel.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename text_input to wl_text_input
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:36 +0000 (16:47 +0200)]
text: Rename text_input to wl_text_input

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agokeyboard: Remove unneded calls
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:35 +0000 (16:47 +0200)]
keyboard: Remove unneded calls

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: delete text on commit_string
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:34 +0000 (16:47 +0200)]
text: delete text on commit_string

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Fix serial handling
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:33 +0000 (16:47 +0200)]
text: Fix serial handling

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Only allow input-method started by weston to bind
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:31 +0000 (16:47 +0200)]
text: Only allow input-method started by weston to bind

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add output argument to set_toplevel
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:29 +0000 (16:47 +0200)]
text: Add output argument to set_toplevel

Allow to specify an output for a toplevel  input panel surface.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add support for panels following the cursor
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:28 +0000 (16:47 +0200)]
text: Add support for panels following the cursor

Add input_panel_surface::set_panel to specify input panel surfaces which
are overlaying the application and are following the input cursor.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Send cursor position to the input method
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:27 +0000 (16:47 +0200)]
editor: Send cursor position to the input method

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Only delete on backspace key released
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:26 +0000 (16:47 +0200)]
editor: Only delete on backspace key released

Do not delete two characters when key is pressed and released.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add "none" preedit-style
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:25 +0000 (16:47 +0200)]
text: Add "none" preedit-style

Use "default" preedit style as default. "None" is used when the
composing text should look like non-composing text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Rename text_model to text_input
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:24 +0000 (16:47 +0200)]
text: Rename text_model to text_input

Also rename text_model_factory to text_input_manager.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Order requests and events in a nice way
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:23 +0000 (16:47 +0200)]
text: Order requests and events in a nice way

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: rename text_model::commit to commit_state
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:22 +0000 (16:47 +0200)]
text: rename text_model::commit to commit_state

Use ::commit_state as a request name to make clear what is commited.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoview: g_type_init() is deprecated in glib >= 2.35
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:21 +0000 (16:47 +0200)]
view: g_type_init() is deprecated in glib >= 2.35

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Fix some text and input-method docs
Krzesimir Nowak [Thu, 18 Apr 2013 14:47:20 +0000 (16:47 +0200)]
text: Fix some text and input-method docs

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Fix password content hint value
Krzesimir Nowak [Thu, 18 Apr 2013 14:47:19 +0000 (16:47 +0200)]
text: Fix password content hint value

0xc in this case was a combination of "autocapitalization" (0x4) and
"lowercase" (0x8) instead of "hidden_text" (0x40) and "sensitive_data"
(0x80).

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoeditor: Reset text model on reset
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:18 +0000 (16:47 +0200)]
editor: Reset text model on reset

There were some reset calls missing, which resulted in wrong preedit
state on input method side.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agokeyboard: Reset state on activate
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:17 +0000 (16:47 +0200)]
keyboard: Reset state on activate

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add example for language/text direction
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:16 +0000 (16:47 +0200)]
text: Add example for language/text direction

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agotext: Add language and text-direction to protocol
Jan Arne Petersen [Thu, 18 Apr 2013 14:47:15 +0000 (16:47 +0200)]
text: Add language and text-direction to protocol

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
11 years agoxwm: Reparent client windows into ARGB windows
Kristian Høgsberg [Thu, 2 May 2013 17:43:24 +0000 (13:43 -0400)]
xwm: Reparent client windows into ARGB windows

We used to rely on an ugly hack where the xwayland server would always
report RGB X windows as having ARGB pixels, so that texturing from these
would also sample the undefined alpha.  We also relied on Xrender rendering
to RGB X windows to write the alpha channel correctly, so that when we
texture from the RGB X window as an ARGB surface we end up getting the
alpha written by Xrender.

That was obviously all broken.  We can instead reparent client windows into
ARGB frame windows.  That way we can render the decorations using a
ARGB render pictformat and sample back those alpha values in a well-defined
way.  We can also unbreak xwayland and let it report RGB pixel format for
RGB windows.  We still need the opaque region or the RGB-only client window
but that's OK.

11 years agoMove the optional output name property from drm_output to weston_output
Richard Hughes [Thu, 2 May 2013 09:10:04 +0000 (10:10 +0100)]
Move the optional output name property from drm_output to weston_output

In the future the CMS plugins will need to read the config file and setup a list
of hardcoded names to ICC profiles.

11 years agoFix not checking return value of drmIoctl function call to map dumb buffer
Chris Michael [Thu, 2 May 2013 01:26:02 +0000 (21:26 -0400)]
Fix not checking return value of drmIoctl function call to map dumb buffer

in drm_fb_create_dumb, the return value of the drmIoctl function call
to map the dumb buffer was never checked, thus the following "if
(ret)" check was invalid as it was checking the previous return value
from the above drmModeAddFB call.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
11 years agoInclude config.h in compositor-drm.c
Richard Hughes [Wed, 1 May 2013 20:52:13 +0000 (21:52 +0100)]
Include config.h in compositor-drm.c

11 years agoAdd a set_gamma vfunc on weston_output
Richard Hughes [Wed, 1 May 2013 20:52:12 +0000 (21:52 +0100)]
Add a set_gamma vfunc on weston_output

11 years agoAdd a output_created_signal on weston_compositor
Richard Hughes [Wed, 1 May 2013 20:52:11 +0000 (21:52 +0100)]
Add a output_created_signal on weston_compositor

11 years agoAdd a destroy_signal on weston_output
Richard Hughes [Wed, 1 May 2013 20:52:10 +0000 (21:52 +0100)]
Add a destroy_signal on weston_output

11 years agoExtract and parse the EDID when outputs are added
Richard Hughes [Wed, 24 Apr 2013 13:58:02 +0000 (14:58 +0100)]
Extract and parse the EDID when outputs are added

At the moment we're only extracting interesting strings. We have to be quite
careful parsing the EDID data, as vendors like to do insane things.

The original EDID parsing code was written by me for gnome-color-manager.

11 years agoweston.ini: document background-type
Emilio Pozuelo Monfort [Mon, 22 Apr 2013 09:00:07 +0000 (11:00 +0200)]
weston.ini: document background-type

11 years agoFix simple-egl tear-down order to prevent a crash on exit time
Yeh, Sinclair [Fri, 19 Apr 2013 17:49:12 +0000 (17:49 +0000)]
Fix simple-egl tear-down order to prevent a crash on exit time

wl_egl_window_destory() destroys the window handle that
dri2_destroy_surface() later uses when eglTerminate() is called.

Reordering the tear down order prevents such case from occuring.

11 years agoconfigure.ac: Bump to 1.1.90 to open master for 1.2 work
Kristian Høgsberg [Mon, 29 Apr 2013 20:33:32 +0000 (16:33 -0400)]
configure.ac: Bump to 1.1.90 to open master for 1.2 work

11 years agowindow: Add a log handler for window.c clients
Kristian Høgsberg [Tue, 16 Apr 2013 15:21:48 +0000 (11:21 -0400)]
window: Add a log handler for window.c clients

This way we can see what kind of error we get if we get an error.

11 years agoconfigure.ac: Bump version to 1.1.0 1.1.0
Kristian Høgsberg [Tue, 16 Apr 2013 01:51:35 +0000 (21:51 -0400)]
configure.ac: Bump version to 1.1.0

11 years agoshell: clear popup grab interface on remove_popup_grab and popup_grab_end
Philipp Brüschweiler [Mon, 15 Apr 2013 19:09:54 +0000 (21:09 +0200)]
shell: clear popup grab interface on remove_popup_grab and popup_grab_end

Fixes a segfault. Steps to reproduce:

* start weston with the x11 backend
* open a terminal
* click on the icon in the top left corner, choose close
* close the x11 window containing weston

11 years agodesktop-shell: better error logging
Philipp Brüschweiler [Mon, 15 Apr 2013 18:10:40 +0000 (20:10 +0200)]
desktop-shell: better error logging

v2: only call cairo_surface_status once

11 years agoCorrectly handle extended RDP keycodes
Hardening [Sat, 6 Apr 2013 21:39:26 +0000 (23:39 +0200)]
Correctly handle extended RDP keycodes

The keycodes received by the FreeRDP server aren't evdev keycodes.
This patch adds the correct convertion to evdev keycodes. After the
patch all keys that are marked as extended in RDP packets become
functionnal (that's the case for the windows key).
Please note that this patch rely on some corrections that have been
pushed on the FreeRDP github tonight.

11 years agoclients: tablet-shell: Wait for set_homescreen hits the server
Tiago Vignatti [Tue, 9 Apr 2013 14:48:06 +0000 (11:48 -0300)]
clients: tablet-shell: Wait for set_homescreen hits the server

This relates to:
    https://bugs.freedesktop.org/show_bug.cgi?id=57634
    https://bugs.freedesktop.org/show_bug.cgi?id=57637

Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
11 years agoMake backends always specify output repaint time 1.0.90
Jonas Ådahl [Fri, 5 Apr 2013 21:07:11 +0000 (23:07 +0200)]
Make backends always specify output repaint time

Most backends relies on gettimeofday(2) for output repaint timestamps
but this is not a requirement. Before this patch repaints coming from
idle_repaint() always used gettimeofday(2) for timestamps. For backends
not using that time source this could cause large jumps between
timestamps.

To fix this, timestamps needs to always come from the backend. This
means that the backend needs to always be responsible of starting the
repaint loop in case that the repaint cannot start immediately.

The drm backend implementation is from the patch by Ander Conselvan de
Oliveira found here:
http://lists.freedesktop.org/archives/wayland-devel/2013-February/007393.html

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
11 years agocompositor-drm: Allow running without launcher if effective UID is 0
Kristian Høgsberg [Fri, 5 Apr 2013 01:36:20 +0000 (21:36 -0400)]
compositor-drm: Allow running without launcher if effective UID is 0

This lets us keep running weston as root or setuid root.

11 years agoFix compiler warnings
Armin K [Wed, 3 Apr 2013 19:29:03 +0000 (21:29 +0200)]
Fix compiler warnings

This prevents compiler warnings when using libpng 1.6 and GCC 4.8

11 years agoautotools: Add a libunwind configure switch
Quentin Glidic [Wed, 3 Apr 2013 18:19:45 +0000 (20:19 +0200)]
autotools: Add a libunwind configure switch

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
11 years agocompositor: Use wl_pointer_set_current to cleanup after surface destruction
Rob Bradford [Wed, 3 Apr 2013 14:21:55 +0000 (15:21 +0100)]
compositor: Use wl_pointer_set_current to cleanup after surface destruction

This API call handles setting the current surface on the wl_pointer and also
maintaining a destroy notification to monitor that surface for destruction.

This is part of the fix for: https://bugzilla.gnome.org/show_bug.cgi?id=696946

11 years agowindow: don't execute the selected menu item when getting popup_done
Giulio Camuffo [Wed, 3 Apr 2013 12:37:00 +0000 (14:37 +0200)]
window: don't execute the selected menu item when getting popup_done

11 years agocompositor: add information about the fbdev backend to --help output
Philipp Brüschweiler [Sat, 30 Mar 2013 14:18:49 +0000 (15:18 +0100)]
compositor: add information about the fbdev backend to --help output

11 years agoRDP compositor take 6
Hardening [Mon, 1 Apr 2013 21:43:58 +0000 (23:43 +0200)]
RDP compositor take 6

This patch is the 6th version of the FreeRDP based compositor.
Changes from last version:
 * use pixman_image_get_stride() when appropriate
 * always realloc

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
11 years agocompositor: add WESTON_COMPOSITOR_OFFSCREEN state
Philipp Brüschweiler [Fri, 29 Mar 2013 12:01:56 +0000 (13:01 +0100)]
compositor: add WESTON_COMPOSITOR_OFFSCREEN state

This state is used when the user switches the vt. It turns of rendering
and frame events, but doesn't set the DPMS state to off.

As a part of this change, also turn off the idle timer when entering
the SLEEPING or OFFSCREEN states, which fixes
https://bugs.freedesktop.org/show_bug.cgi?id=61910 (rpi backend
untested).

11 years agogitignore: Ignore test-driver
Damien Lespiau [Thu, 28 Mar 2013 17:28:22 +0000 (17:28 +0000)]
gitignore: Ignore test-driver

Automake (1.12 here) parallel-tests installs a test-driver file, another
file to add to .gitignore.

While at it, remove the duplicate cscope.out entry and add TAGS (the
result of automake's "make tag")

11 years agosdk: be C++ friendly
Giulio Camuffo [Thu, 28 Mar 2013 17:02:42 +0000 (18:02 +0100)]
sdk: be C++ friendly

This renames the weston_surface's private member to configure_private
and externs "C" the headers of the SDK.