Commit Graph

1112 Commits

Author SHA1 Message Date
Dima Ryazanov
f6128fcd6c Fix missing corner resize cursors in Kubuntu (oxy-white theme)
Looks like that theme uses different names. Also, add the correspoding
horizontal and vertical resize cursors, just for consistency.
2013-05-15 12:15:32 -04:00
Ossama Othman
a50e6e4c50 config-parser: Honor XDG_CONFIG_DIRS
This set of changes adds support for searching for a given config file
in the directories listed in $XDG_CONFIG_DIRS if it wasn't found in
$XDG_CONFIG_HOME or ~/.config.  This allows packages to install custom
config files in /etc/xdg/weston, for example, thus allowing them to
avoid dealing with home directories.

To avoid a TOCTOU race the config file is actually open()ed during the
search.  Its file descriptor is returned and stored in the compositor
for later use when performing subsequent config file parses.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
2013-05-14 14:36:37 -04:00
Pekka Paalanen
7123388b20 window: add DBG code for leaf management and redraws
Aids for debugging and inspecting the algorithms.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-05-10 14:35:54 -04:00
Pekka Paalanen
eebff54c03 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>
2013-05-10 14:35:54 -04:00
Pekka Paalanen
e9297f8e7e 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>
2013-05-10 14:35:54 -04:00
Pekka Paalanen
7ff7a80007 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>
2013-05-10 14:35:53 -04:00
Pekka Paalanen
40cb67b2ac 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>
2013-05-10 14:35:53 -04:00
Pekka Paalanen
35e82631b6 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>
2013-05-10 14:35:53 -04:00
Pekka Paalanen
aef0254dd5 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>
2013-05-10 14:35:53 -04:00
Pekka Paalanen
2396aec684 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>
2013-05-10 14:05:59 -04:00
Kristian Høgsberg
a0868a2d64 editor: Removed unused utf8_characters() function
I left this in when I merged Jans patches.
2013-05-10 12:51:08 -04:00
Kristian Høgsberg
9e885d4bec 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
2013-05-08 11:39:59 -04:00
Jan Arne Petersen
685168661a editor: Fix some offsets for multi-byte characters
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-06 20:26:23 -04:00
Jan Arne Petersen
d8aa3327b3 keyboard: Fix offsets when deleting text
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-06 20:26:20 -04:00
Jan Arne Petersen
cc75ec11ca 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>
2013-05-02 17:18:46 -04:00
Jan Arne Petersen
62ece76b1e text: Rename text_input to wl_text_input
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:06:27 -04:00
Jan Arne Petersen
8f2f764c0c keyboard: Remove unneded calls
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:06:27 -04:00
Jan Arne Petersen
919bc149e1 text: delete text on commit_string
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:06:26 -04:00
Jan Arne Petersen
00191c7c4a text: Fix serial handling
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:41:48 -04:00
Jan Arne Petersen
7cd29e199a 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>
2013-05-02 16:41:47 -04:00
Jan Arne Petersen
fe89e713ca editor: Send cursor position to the input method
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:24:57 -04:00
Jan Arne Petersen
dfd344609a 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>
2013-05-02 16:24:02 -04:00
Jan Arne Petersen
85ecaa5d75 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>
2013-05-02 16:23:46 -04:00
Jan Arne Petersen
78d00e45cc 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>
2013-05-02 16:23:35 -04:00
Jan Arne Petersen
7ef8effca5 text: Order requests and events in a nice way
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:23:14 -04:00
Jan Arne Petersen
fa3573852d 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>
2013-05-02 16:22:36 -04:00
Jan Arne Petersen
d160a309e6 view: g_type_init() is deprecated in glib >= 2.35
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:22:27 -04:00
Jan Arne Petersen
08015b6ba0 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>
2013-05-02 16:21:59 -04:00
Jan Arne Petersen
b8b76a603f keyboard: Reset state on activate
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:52 -04:00
Jan Arne Petersen
9d41913eff text: Add example for language/text direction
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:34 -04:00
Jan Arne Petersen
ece6b5af51 text: Add language and text-direction to protocol
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:18 -04:00
Yeh, Sinclair
952e6df8fc 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.
2013-05-01 13:40:50 -04:00
Kristian Høgsberg
2e43720743 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.
2013-04-16 20:46:59 -04:00
Philipp Brüschweiler
96386b8e5e desktop-shell: better error logging
v2: only call cairo_surface_status once
2013-04-15 20:57:55 -04:00
Tiago Vignatti
b67c91d46d 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>
2013-04-09 15:05:32 -04:00
Giulio Camuffo
319b91b97a window: don't execute the selected menu item when getting popup_done 2013-04-03 08:48:31 -04:00
Emilio Pozuelo Monfort
ab44b0c61e toytoolkit: implement cursor-size config key 2013-03-19 14:42:43 -04:00
MoD
063a882dc7 toytoolkit: avoid redrawing a window between maximize and configure
Resolve a bad frame visible when maximizing toytoolkit programs with the the
maximize button in decorations. Windows now use wl_display.sync requests to
wait for a maximize to finish before drawing again, following suggestions from
http://lists.freedesktop.org/archives/wayland-devel/2013-February/007650.html
2013-03-19 14:19:53 -04:00
Rafal Mielniczuk
c1a3cd1851 window: restore maximized state from fullscreen mode if necessary
This patch sets back maximized mode, if that was its state before going
fullscreen.
2013-03-19 14:07:57 -04:00
Rafal Mielniczuk
fc22be0bb9 window: save allocation only for toplevel window
Thanks to that we will not overwrite saved allocation, when going
fullscreen from maximized state
2013-03-19 14:06:57 -04:00
Kristian Høgsberg
e7144fd175 compositor: Only send release event in response to wl_surface.attach
The current semantics would implicitly attach the most recently attached
buffer at commit time and send a release event when the buffer enventually
was released.  The implicit attach is a little too subtle though and this
patch changes the semantics to always only send release events in response
to an attach event.  As a consequence, once a compositor releases a buffer,
it no longer has a reference to it and wl_surfcea.damage is undefined.
Thus, the client side visible change is that damage request must always
be preceeded by a wl_surface.attach request, to ensure there's a valid buffer,
even if that means attaching the same buffer again.
2013-03-05 15:35:47 -05:00
Kristian Høgsberg
4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Pekka Paalanen
6f41b0727c window: fix display_acquire_window_surface()
Make sure that display_acquire_window_surface() creates the Cairo
surface as necessary. Otherwise surface->toysurface can be NULL.

This fixes weston-screensaver fullscreen mode. Demo mode was not
affected as it uses window decorations, and so the Cairo surface is
created. This regression was introduced by:

commit 0c4445ba57
Author: Pekka Paalanen <ppaalanen@gmail.com>
Date:   Wed Feb 13 16:17:23 2013 +0200

    window: create Cairo surfaces on demand for redraw

Reported-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-20 14:13:41 -05:00
Jan Arne Petersen
1cc9e08d2f text: Split out cursor_position
Add an extra cursor_position, which also allows to change the anchor
(for slections). Change the index type to int to allow setting it before
the beginning of a commited string.

The cursor should not be moved as a direct repsonse to this event but
atomically on the next commit_string event.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:08:01 -05:00
Jan Arne Petersen
6138197337 text: Add show/hide_input_panel requests
Allows to show/hide the input panel (virtual keyboard) more independent
of focus (some applications might to require additionaly click on a
focused entry to show the input panel).

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:07:35 -05:00
Jan Arne Petersen
0eabcaafae text: Add commit request
Allows for atomic state changes. Updated surrounding text, content type
and micro focus is taken into account all at once at commit.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:07:03 -05:00
Jan Arne Petersen
f255165bd4 text: Remove unused requests/events
Put them back in, when we know what arguments they will have.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:06:48 -05:00
Jan Arne Petersen
ffbb20f730 text: Move input_panel interface to input-method
Move the input_panel interface from desktop-shell to input-method (since
it is not really tied to desktop-shell).

Add an input_panel_surface interface like wl_shell_surface to make it
easier to extend it. Also add a parameter to the set_toplevel request to
be able to specify where to show an input panel surface on the screen.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:05:04 -05:00
Jan Arne Petersen
3fb6e71814 editor: Add support for backspace keysym events
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:02:48 -05:00
Jan Arne Petersen
ab2b01429e simple-im: fix for protocol changes
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:01:20 -05:00
Jan Arne Petersen
2dc3b3fc9f keyboard: add support for invoke_action
Set the pre-edit cursor on the clicked index on invoke_action.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:01:12 -05:00
Jan Arne Petersen
3489ba9c21 editor: add support for invoke_action
Call invoke_action request when a currently composed word is clicked.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:00:54 -05:00
Jan Arne Petersen
0558a93eee editor: Add content type example
Set the content type purpose to numeric of the second entry.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:00:29 -05:00
Jan Arne Petersen
e475f29330 keyboard: Add support for a numeric layout
Add support for a numeric key layout, which is used for some numeric
content purpose types.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:00:20 -05:00
Jan Arne Petersen
0a1cf393c6 editor: add support for pre-edit styling
Add pango dependency to the example and use pango for text handling.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:57:37 -05:00
Jan Arne Petersen
49a3fb3d1d keyboard: Add support for pre-edit styling
Adds a button to the keyboard to support different styles of pre-edit
styling.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:55:58 -05:00
Jan Arne Petersen
4a17fae8e7 editor: support commit on reset
Commit pending pre-edit text when focus-out or changing the cursor
location.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:55:47 -05:00
Jan Arne Petersen
c7d2a9839b text: add serial argument to text protocol
The serial argument will allow to ignore outdated events from before a
reset request.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:55:37 -05:00
Jan Arne Petersen
4653531e7a text: add pre-edit styling support to protocol
Also add a separate preedit-cursor event and add a commit argument to
preedit-string to allow to support commit on reset. Fix editor and
keyboard example to adapt to the protocol changes.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 16:55:27 -05:00
Kristian Høgsberg
e994eddafc window.c: Don't allow moving a maximized window
Ideally the shell would send an unmaximize event to the client when
we try to move a maximized window, but for now, let's just prevent
moving maximized windows.

https://bugs.freedesktop.org/show_bug.cgi?id=56296
2013-02-14 16:31:42 -05:00
Pekka Paalanen
0c4445ba57 window: create Cairo surfaces on demand for redraw
This introduces the function widget_cairo_create().

Instead of directly referencing surface->cairo_surface, use the function
widget_cairo_create(), which will create the cairo_surface as necessary,
and just returns a Cairo drawing context. Also fix window_get_surface()
similarly.

Now we can go through idle_redraw() without always creating Cairo
surfaces and committing them. This will be useful with sub-surfaces,
where repainting one sub-surface does not need to force the repaint of
all surfaces of a window.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:35:14 -05:00
Pekka Paalanen
0a9686f51c window: let menu and tooltip redraw use widget size
Menu and tooltip redraw functions were using the surface size directly.
For consistency, make them use the widget size instead, it is the same.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:45 -05:00
Pekka Paalanen
61e028c953 window: remove the transparent flag as unused
This flag was always true, and never false.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:31 -05:00
Pekka Paalanen
89dee00e5e window: move cairo_surface into struct surface
Widgets should be rendering to a cairo_surface for a particular
wl_surface, just like buffers are per surface.

window_flush() has a change in behaviour: it will now send
wl_shell_surface.set_toplevel also without a cairo_surface to be
attached. This shouldn't change anything in practice.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:22 -05:00
Pekka Paalanen
2d8a32a9e4 window: add surface pointer to widget
So that given a widget, we can access the surface specific data, like
buffers, and input and opaque regions.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:34:03 -05:00
Pekka Paalanen
b1cd9b17bf window: move input and opaque regions into struct surface
They are per wl_surface state.

The frame widget is always on the main surface, since it can be created
only for the window. That is why frame_resize_handler() can simply
assume that the surface is the main_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:48 -05:00
Pekka Paalanen
ac95f3ee9d window: move 'widget' member into struct surface
Repaint and resizing widget recursions must start from the root widget
of each (sub-)surface, so that buffers and regions get initialized
correctly. Make it easier by moving the widget field from struct window
to struct surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:30 -05:00
Pekka Paalanen
7bcfeade53 window: assimilate window_get_resize_dx_dy() into the call site
Not used elsewhere, just cleanup.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:33:11 -05:00
Pekka Paalanen
02bba7ceb0 window: move buffer type and transform into struct surface
These are surface specifics, since buffers are surface specific.

SURFACE_HINT_RESIZE is moved together to the other SURFACE_* flags, so
that surface_create_surface() would not need two flags arguments.
struct toysurface::prepare vfunc checks for SURFACE_HINT_RESIZE, and
egl_window_surface_create() and shm_surface_create() check for the
non-HINT flags.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:32:49 -05:00
Pekka Paalanen
811ec4ff31 window: move toysurface and allocation to struct surface
Fields 'allocation' and 'server_allocation' are surface specific. Fields
'saved_allocation', 'min_allocation', and 'pending_allocation' are
window specific, and will not be moved.

Field 'toysurface' is naturally surface specific, since it provides the
backing storage for the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:30:27 -05:00
Pekka Paalanen
4e37374875 window: create new struct surface with wl_surface
Struct window has many fields that are directly related to the
wl_surface, more than to the window as a whole. When we start composing
a window from several wl_surfaces, these fields need to be per
wl_surface, not per window.

Start separating such fields from struct window into struct surface by
moving the wl_surface.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:30:04 -05:00
Pekka Paalanen
550d66bcb1 window: destroy the 2nd shm buffer, if both released
Handle the case when we the compositor somehow migrates from requiring
double buffering into working on single buffering, so we release the
extra shm buffer.

Currently, I do not think this can happen in practice, but in the future
it may happen with sub-surfaces.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:28:42 -05:00
Pekka Paalanen
33a68eaaf4 window: check the initial wl_display_dispatch()
Check for errors in the first wl_display_dispatch() call. Otherwise
doing something silly like
  $ WAYLAND_SOCKET=999 ./clickdot
will segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:25:30 -05:00
Pekka Paalanen
4e1065491b window: improve EGL-related error messages
Make them explicitly mention EGL, otherwise one can easily think that
"failed to initialize display" refers to Wayland display.

Also explicitly mention falling back to wl_shm. I tested this with a
LD_PRELOAD trick that overrides eglBindAPI and makes it fail.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-02-14 12:16:20 -05:00
Kristian Høgsberg
c4a42ca6b5 screenshot: Print warning if we're not launched from weston
weston-screenshooter is a helper binary that weston launches to write the
screenshot to disk.  If somebody tries to launch it by hand, print a
warning and mention the screenshot keybinding.
2013-02-13 13:41:07 -05:00
Kristian Høgsberg
15336e8b5c toytoolkit: Remove left-over pixman dependency
toytoolkit doesn't use pixman.  Remove the pixman.h include and the
LDADD.

https://bugs.freedesktop.org/show_bug.cgi?id=57812
2013-01-28 16:05:06 -05:00
Kristian Høgsberg
78fd32b7a2 clients: Make libtoytoolkit a libtool library
This way libtool will remember the libtoytoolkit LIBADD libraries.
We can drop the toolkit_libs hack and just link to libtoytoolkit.la and
libtool will add the dependencies.
2013-01-28 16:02:04 -05:00
Dima Ryazanov
d20fd4db60 terminal: Handle the window close event
There may be multiple windows open, so destroy the terminal instead of exiting.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
2013-01-28 12:26:54 -05:00
Pekka Paalanen
0eab05d2a7 clients: add global_remove handler stubs
All the clients here were missing the global_remove handler. Because
window.c did not have it, weston-desktop-shell and weston-keyboard
segfaulted on compositor exit, as they received some
wl_registry.global_remove events.

Add more or less stub global_remove handlers, so that clients do not
crash on such events. Toytoolkit and all applications would need a lot
more code to properly handle the global object removal.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-01-24 16:42:38 -05:00
Rob Bradford
409f79a2c7 image: Free allocated memory on error path 2013-01-10 16:07:23 -05:00
Rob Bradford
f0a1af9f02 window: Free allocated memory on error path 2013-01-10 16:07:18 -05:00
Kristian Høgsberg
4e51b44c53 window: Fall back to cairo image when cairo EGL isn't available 2013-01-07 15:47:47 -05:00
Ander Conselvan de Oliveira
b77aa062c9 transformed: Add options for using debuging driver fullscreen method
Add options for setting width, height and using the driver fullscreen
method.
2012-12-14 11:27:38 -05:00
Ander Conselvan de Oliveira
5403f5274d window: Allow clients to choose the fullscreen method 2012-12-14 11:27:34 -05:00
Kristian Høgsberg
038b9dc8ec clients: Add screenshooter-client-protocol.h to screenshooter sources 2012-12-14 10:18:39 -05:00
Pekka Paalanen
c660821918 update git ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:45 -05:00
Kristian Høgsberg
bc2312c7c6 simple-egl: Remove old obsolete fbo and color_rbo fields
Finally a commit that actually makes simple-egl simpler.
2012-12-11 15:23:22 -05:00
Kristian Høgsberg
3a8d3f2e98 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.
2012-12-07 15:00:36 -05:00
Pekka Paalanen
4dd0c412db 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>
2012-12-06 17:02:13 -05:00
Pekka Paalanen
aac1c13332 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>
2012-12-06 17:02:00 -05:00
Rob Bradford
bf33b1cced 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.
2012-12-06 15:53:08 -05:00
Kristian Høgsberg
bf74d5242a 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.
2012-11-30 14:54:35 -05:00
Pekka Paalanen
ec07669a08 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>
2012-11-30 14:25:18 -05:00
Ander Conselvan de Oliveira
a06a86066d clients: Replace transformed with a toytoolkit implementation 2012-11-30 14:24:18 -05:00
Ander Conselvan de Oliveira
15256f66ab window: Add a way to retrieve a window's output transform
Add the output_get_transform() entry point and an output handler hook.
2012-11-30 14:24:08 -05:00
Ander Conselvan de Oliveira
6d4cb4e8c4 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).
2012-11-30 14:24:04 -05:00
Ander Conselvan de Oliveira
ddd3e27ab8 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.
2012-11-30 14:24:00 -05:00
Dima Ryazanov
a85292e73c 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.
2012-11-30 14:11:41 -05:00
Kristian Høgsberg
6006ecb497 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.
2012-11-29 13:32:11 -05:00
Pekka Paalanen
a4eda73607 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>
2012-11-27 15:57:54 -05:00
Pekka Paalanen
3cbb08944b 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>
2012-11-27 15:50:53 -05:00
Pekka Paalanen
b362736bb2 window: simplify window_create_surface
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 15:50:26 -05:00
Pekka Paalanen
9943686be3 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>
2012-11-27 15:49:37 -05:00
Pekka Paalanen
03fc316000 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>
2012-11-27 15:49:34 -05:00
Kristian Høgsberg
b88b68fa42 weston-simple-im: Add a few more compose sequences 2012-11-27 15:11:04 -05:00
Kristian Høgsberg
504e8f109a weston-simple-im: Fold struct keyboard_input into struct simple_im 2012-11-27 14:28:19 -05:00
Kristian Høgsberg
aec12b806c weston-simple-im: Fold keyboard_input_handle_keymap() into event handler 2012-11-27 14:21:34 -05:00
Kristian Høgsberg
6aae61483b weston-simple-im: Fold keyboard_input_handle_key() into event handler 2012-11-27 14:20:31 -05:00
Kristian Høgsberg
3a3704db20 weston-simple-im: Fold keyboard_input_handle_modifiers into event handler 2012-11-27 14:18:54 -05:00
Kristian Høgsberg
de318ab25f 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.
2012-11-27 14:18:54 -05:00
Kristian Høgsberg
79bfde20bd 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.
2012-11-27 13:57:27 -05:00
Kristian Høgsberg
8c03616c39 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 c31288daf1.
2012-11-27 13:48:09 -05:00
Kristian Høgsberg
1199b16f02 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.
2012-11-27 13:42:04 -05:00
Jan Arne Petersen
e9fba2b737 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>
2012-11-27 13:19:39 -05:00
Rob Bradford
9d1d32bdd0 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>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen
c31288daf1 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>
2012-11-27 13:19:38 -05:00
Jan Arne Petersen
257201d2cc window: Add utils for xkb keyboard input
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-27 13:14:08 -05:00
Jan Arne Petersen
cd99706b61 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>
2012-11-27 13:06:21 -05:00
Jan Arne Petersen
d9be93b964 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>
2012-11-27 13:02:26 -05:00
Ander Conselvan de Oliveira
1b4312d326 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.
2012-11-27 11:30:09 -05:00
Scott Moreau
6655e00e03 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.
2012-11-19 17:23:59 -05:00
Pekka Paalanen
768117f90b 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>
2012-11-19 16:00:01 -05:00
Pekka Paalanen
32127ca86d 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>
2012-11-19 15:55:28 -05:00
Pekka Paalanen
0c6a34378a 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>
2012-11-19 15:55:26 -05:00
Pekka Paalanen
f86504c881 window: remove unused MULT macro
Leftovers from

commit f02a649a3c
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>
2012-11-19 15:55:24 -05:00
Pekka Paalanen
a8d4c84693 window: make window_flush() private
Not called from any client.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:17 -05:00
Pekka Paalanen
ce36f6dff4 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>
2012-11-19 15:55:12 -05:00
Pekka Paalanen
99b705bb17 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>
2012-11-19 15:55:09 -05:00
Ander Conselvan de Oliveira
edce9c295c 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.
2012-11-16 19:24:09 -05:00
Jan Arne Petersen
1f1b39792b keyboard: Rename keyboard to weston-keyboard
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:27:37 -05:00
Jan Arne Petersen
5ec05fb251 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>
2012-11-08 14:27:26 -05:00
Jan Arne Petersen
8083e019cd 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>
2012-11-08 14:26:43 -05:00
Jan Arne Petersen
25f6db51f0 editor: Initalize editor struct with 0
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-11-08 14:26:30 -05:00
Jan Arne Petersen
6345faa39a 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>
2012-11-08 14:26:21 -05:00
Daniel Stone
a84687174c 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>
2012-11-08 14:08:53 -05:00
Daniel Stone
4eb445abba smoke: Remove unused offset member
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-11-08 14:08:53 -05:00
Daniel Stone
8097274ce6 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>
2012-11-08 11:31:37 -05:00
Kristian Høgsberg
0f7a285fe1 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.
2012-11-05 20:24:32 -05:00
Kristian Høgsberg
e77d7577a2 window: Fix use-after-free in menu button handler
Commit d2fbb3870c introduced a use-after-free
error in the case where we destroy the menu.
2012-10-30 18:10:32 -04:00
Kristian Høgsberg
efb948846f 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
2012-10-30 18:07:02 -04:00
Kristian Høgsberg
9468708f70 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.
2012-10-30 15:50:37 -04:00
Kristian Høgsberg
d3bf6766ab 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.
2012-10-30 15:46:39 -04:00
Kristian Høgsberg
719b2158e7 image: Add keyhandler to handle keyboard zoom 2012-10-30 15:42:20 -04:00
Kristian Høgsberg
a369ff5273 image: Set resize handler and center view on resize/fullscreen 2012-10-30 15:09:49 -04:00
Scott Moreau
1bdb477522 toytoolkit: Don't destroy window cairo surface on shm attach.
https://bugs.freedesktop.org/show_bug.cgi?id=52454
2012-10-30 14:18:49 -04:00
Kristian Høgsberg
d2fbb3870c 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
2012-10-30 13:45:31 -04:00
Kristian Høgsberg
191e0eee77 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
2012-10-29 17:41:46 -04:00
Kristian Høgsberg
6326c5de82 clients: Remove $(toolkit_libs) from weston_screensaver_CFLAGS
The typo that broke the build.
2012-10-29 17:15:54 -04:00
Kristian Høgsberg
e530a0a240 window: Ignore input_set_pointer_image() if we don't have a pointer
https://bugs.freedesktop.org/show_bug.cgi?id=55782
2012-10-29 16:42:26 -04:00
Damien Lespiau
4df7e27055 dnd: Use %zd in the format string for size_t types
len i size_t, so is the result of the sizeof operator.
2012-10-29 16:28:19 -04:00
Kristian Høgsberg
b98905e810 configure.ac: Check for libGLU for screensaver
https://bugs.freedesktop.org/show_bug.cgi?id=56376
2012-10-29 13:44:33 -04:00
Pekka Paalanen
9564c75163 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>
2012-10-25 14:59:23 -04:00
Pekka Paalanen
fedc527723 window: remove window_set_transparent() declaration
The function is not implemented.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:59:08 -04:00
Kristian Høgsberg
8c31a4c025 Define our own container_of as well
Don't rely on libwayland-client/server to define this for us.
2012-10-19 23:05:37 -04:00
Kristian Høgsberg
5717b6dbf1 Stop relying on ARRAY_LENGTH being defined in wayland-util.h
Time to break a bad habit.
2012-10-19 17:12:38 -04:00
Jonas Ådahl
f461eee2b0 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 8c9c8fcf6e.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-19 16:56:08 -04:00
Jonas Ådahl
f82eda5247 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>
2012-10-19 16:54:42 -04:00
Ander Conselvan de Oliveira
d0f24cf6ec simple-shm: Don't use ret variable in main() uninitialized 2012-10-17 16:51:07 -04:00
Kristian Høgsberg
3146756adf clients: Don't ask for EGL_PIXMAP_BIT when choosing configs 2012-10-16 15:31:31 -04:00
Kristian Høgsberg
a17f7a13fd 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.
2012-10-16 13:17:16 -04:00
John Kåre Alsaker
011a1ce350 Remove some dead code. 2012-10-16 11:29:10 -04:00
Pekka Paalanen
379d3d140d configure: build tablet-shell client conditionally
Do not build the tablet-shell client if --disable-tablet-shell is given.

Change --enable-tablet-shell to --disable-tablet-shell in ./configure
--help output, since it is enabled by default. Add a description.

Use proper quoting in the conditional.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:49:08 -04:00
Pekka Paalanen
392c5f275d simple-touch: do not include GL headers
since it doesn't use any of them. Fixes a build failure on systems,
where (E)GL headers are in non-standard path.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:48:55 -04:00
Pekka Paalanen
5f8a67cce8 configure: separate simple EGL clients from others
Separate simple EGL clients from other simple clients. This allows to
build either simple-shm or simple-egl, whichever you want. We avoid
linking libEGL and GLESv2 into simple-shm, and we can build simple-shm
even if nothing provides EGL, GLESv2, or wayland-egl APIs.

Change the options in configure --help from --enable to --disable, since
these are enabled by default, and you would normally only ever give the
--disable flavor. Add descriptions.

Remove the #define BUILD_SIMPLE_CLIENTS since it is not used.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:48:19 -04:00
Pekka Paalanen
fb39d8d23c toytoolkit: make all EGL code dependant on cairo-egl
configure.ac: The toytoolkit clients used to get libEGL linked to them
even if there was no cairo-egl. This is useless, and actually harmful on
platforms, where libEGL absolutely requires one of the GL ES libraries
to be linked in, too.

Look for EGL-related packages only for cairo-egl with toytoolkit.

window.c: protect all GL header includes with HAVE_CAIRO_EGL, since that
is the only case we can support EGL, GL, or GLESv2 at all. In the case
we do not have cairo-egl, add enough definitions to let us build the
stubs for EGL-related functions.

Remove some #ifdefs that were inside of the same #ifdef already.

These changes allow to build sorfware rendering toytoolkit clients
without any bits of EGL libs or headers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:47:22 -04:00
Pekka Paalanen
53e58485a5 window: remove dead EGL code
- remove unimplemented function from header
- remove the egl function pointers that were not used

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-16 10:46:15 -04:00
Kristian Høgsberg
3fb613effe window: Set input region also when we go fullscreen
We used to rely on the compositor resetting this as a side effect of
changing size, but it doesn't work like that any more.
2012-10-15 20:54:43 -04:00
Jonas Ådahl
972d506de3 clients: image: Add support for panning and zooming
Support for zooming by using ctrl + the vertical axis (scrolling upwards
zooms in) and panning by both the horizontal and vertical axis as well
as click and drag was added to demonstrate how axis should work.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-15 20:54:43 -04:00
Jonas Ådahl
d9f6b078b6 window: Update modifier state directly after receiving a modifier event
If the keyboard modifier event was received after the key event the
modifier state would end up incorrect.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-15 20:54:43 -04:00
Pekka Paalanen
b2f957a9f1 window: don't call output configure uninitialised
Callbacks registered via display_set_output_configure_handler() are
promised to be called when we know the current mode for the output. If
the following order of events happens:
1. toytoolkit binds to a wl_output global
2. application registers an output configure handler
3. the wl_output.mode events are received

Then in step 2 we would call the callback with uninitialised output
informations, giving it a 0x0 size.

To avoid such race, do not call the callback from
display_set_output_configure_handler() if the output has 0x0 size.

The wl_output.mode event will be received later, and that will trigger
the right call to the callback.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-15 20:54:43 -04:00
Kristian Høgsberg
feb3c1d33b clients: Use wl_display_dispatch_pending() 2012-10-15 20:54:43 -04:00
Pekka Paalanen
bc10638cd9 compositor, clients: apply wl_surface.frame on commit
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:39:11 -04:00
Pekka Paalanen
0cbd3b5059 compositor, clients: double-buffer input region
Make input region double-buffered as specified in the new protocol.

While doing it, get rid of the undef region code, and instead use a
maximum sized real pixman region. This avoids special-casing regions
that might sometimes be undef.

As the input region is now usable by default instead of undef,
weston_surface_update_transform() does not need to reset the input
region anymore.

weston_surface_attach() no longer resets the input region on surface
size change. Therefore, also weston_seat_update_drag_surface() does not
need to reset it.

Update toytoolkit to set input region before calling wl_surface_commit()
or swapBuffers (which does commit).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:44 -04:00
Pekka Paalanen
512dde8ce9 compositor, clients: double-buffer opaque region
Make wl_surface.set_opaque_region double-buffered as required by the new
protocol. Also, do not reset the opaque region on surface size changes
anymore. Only explicit requests from the client will change the region
now.

In clients, make sure commit happens after setting the opaque region.

Mesa does not need a fix, as it never touches the opaque region.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:40 -04:00
Pekka Paalanen
8e159180cc compositor, clients: make damage double-buffered
This change depends on the Wayland commit
"protocol: double-buffered state for wl_surface".

Implement double-buffering of damage in the compositor as required by
the new protocol.

Ensure all Weston demo clients call wl_surface_commit() after
wl_surface_damage().

Mesa does not need a fix for this, as the patch adding
wl_surface_commit() call to Mesa already takes care of damage, too;
Mesa commit: "wayland: use wl_surface_commit()"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:31 -04:00
Pekka Paalanen
c9e00c06e9 clients: use wl_surface_commit
Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.

NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.

simple-shm and simple-touch OTOH will work now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:17 -04:00
Kristian Høgsberg
fa80e11c84 Update to new fd and wl_registry APIs
This commit updates the clients and the wayland compositor backend to
use the new wl_registry mechanism and the thread safe fd API.
2012-10-10 21:34:38 -04:00
Scott Moreau
4e07236e87 toytoolkit: Take into account transform when sending output allocation. 2012-10-10 13:02:11 -04:00
Kristian Høgsberg
b36f7ef99e terminal: Don't snap resize if we're maximized
We allow fullscreen to fill the requested size, do the same for maximize.
2012-10-10 11:41:21 -04:00
Kristian Høgsberg
b7ed4cbbc7 terminal: Use window_get_fullscreen() instead of tracking that state manually 2012-10-10 11:37:46 -04:00
Kristian Høgsberg
1671e1129d window: Add getters for fullscreen and maximized state
This lets us eliminate a bit of redundancy in the clienst where they track
fullscreen state themselves.
2012-10-10 11:36:24 -04:00
Scott Moreau
c6a7e4b277 toytoolkit: Don't draw shadows for maximized windows.
Add THEME_FRAME_MAXIMIZED flag so the theming system can know not to draw
shadows for maximized windows. This allows maximized surfaces' content to be
sized and placed in a more expectable fashion.
2012-10-10 11:23:41 -04:00
Scott Moreau
01a9f1b992 clients: Set title for all shell surface demos. 2012-10-09 23:13:01 -04:00
Rob Bradford
053fe7652b keyboard: Avoid access beyond end off buffer
If the for loop does not match on a button it will fall through and try and
dereference into the array using the terminating value of the loop. This
terminating value of the loop is the dimension of the array and thus beyond
its bounds.

Cc: Jan Arne Petersen <jpetersen@openismus.com>
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-10-09 22:56:46 -04:00
Jonas Ådahl
f77beeb981 window: Initialize workspace state before first roundtrip
The workspace state parameters were initialized after the first
roundtrip. If a workspace manager state event was received during this
roundtrip the state parameters were cleared leaving an incorrect state.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-10-09 22:47:24 -04:00
U. Artie Eoff
44874d9f02 desktop-shell: destroy data before exiting.
desktop-shell never returned from display_run() since it
was essentially killed when weston exited.  To fix this,
it is necessary to watch for EPOLLHUP in window.c so that
toytoolkit clients will return from display_run() when
weston quits.  This allows for clients to clean up
as needed.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-10-04 11:37:40 -04:00
Rob Bradford
371805f76e simple-shm: Draw the test motif surrounded by a white border
We can then use a wl_surface_damage to just trigger the compositor to update
just a selected region of the buffer and thus test damaging a sub region.
2012-10-04 11:34:09 -04:00
Rob Bradford
fecf332e19 simple-shm: Don't attach the buffer to the surface for every redraw
This will allow us to change just a sub region of the buffer.
2012-10-04 11:34:05 -04:00
Philipp Brüschweiler
70f83679ee editor: more intuitive cursor positioning
Compute the nearest glyph edge instead of taking the one to the
left of the cursor.

Also fixes a segfault when trying to compute the position for an empty
buffer.
2012-10-04 11:31:21 -04:00
Philipp Brüschweiler
9f897c7a5f editor: take text offset into account when computing cursor position 2012-10-04 11:31:19 -04:00
Philipp Brüschweiler
b8911dcdd7 editor: make selection a lighter shade of blue, much easier to read 2012-10-04 11:31:17 -04:00
Philipp Brüschweiler
237358be93 editor: fix assert to take preedit string into account 2012-10-04 11:31:14 -04:00
Martin Olsson
3b132e358f Fix spelling errors 2012-10-04 11:24:50 -04:00
Tiago Vignatti
6f09338b0f toytoolkit: Process deferred tasks on fifo order instead
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2012-09-27 21:23:34 -04:00
Pekka Vuorela
4e363d21bb Require mouse release on top of frame button to trigger action
As common UI convention, allows action to be avoided by dragging
outside the button after mouse press.
2012-09-26 11:22:30 -04:00
Pekka Vuorela
6e1e385d51 Protect window callbacks from deleted windows
Calling window_destroy() was able to cause segfault for
callbacks triggering afterwards.
2012-09-26 10:20:32 -04:00
Jan Arne Petersen
680275fbf1 text: Rename de/activate to enter/leave
Also add a surface argument to the enter event.
2012-09-25 11:24:49 -04:00
Pekka Vuorela
64988feb13 PDF viewer to run until and only when it has existing windows
I.e. not to close whole application when one of the windows
is closed.
2012-09-25 11:24:49 -04:00
Pekka Vuorela
2dbe4c632e Fix memory leak in PDF viewer 2012-09-25 11:24:49 -04:00
Pekka Vuorela
2bd429b734 Fix PDF viewer not to produce garbage windows for nonexistent files
Was calling window_flush() on redraw handler which already happens on
window redrawing.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
80ad1a943d editor: Fix selection anchor on text deletion
When text is deleted adjust selection anchor.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
e386dd22c4 editor: Delete selected text before adding new
When inserting new text, delete selected text first.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
633c83de2c keyboard: Allow backspace for pre-edit text
When there is a pre-edit text delete the last character of the pre-edit
text with the backspace key.
2012-09-25 11:24:49 -04:00
Jan Arne Petersen
8aba11d057 editor, keyboard: Add support for arrow keys
Add support for arrow keys on the virtual keyboard and make it possible
to move around the cursor in the editor example.
2012-09-25 11:24:49 -04:00
Ander Conselvan de Oliveira
d7f282b84e simple-egl: Set the opaque region if windowed and -o is passed
Since commit 6a615d2621 [1], the opaque
region would be set only when running fullscreen. Having it set
properly for the windowed case is helpful to test the overlay path in
compositor-drm.

What this patch does is:

 - reverts the above commit;
 - remove the "if fullscreen make the window opaque" conditional, that
   should have been removed when -o was introduced and was actually the
   cause for the bug solved in [1];
 - sets the opaque region when running fullscreen, regardless of the -o
   switch.

[1] commit 6a615d2621
    Author: Scott Moreau <oreaus@gmail.com>
    Date:   Thu Aug 30 14:44:16 2012 -0600

        simple-egl: Only set alpha_size=0 when -o is passed.

v2: - Clarify in the commit message that this does not regress the bug
      solved in [1].
    - Use the correct sha1 for the reverted commit.
2012-09-14 13:54:28 -04:00
Jan Arne Petersen
c1e481efb1 text: Add reset requets to protocol
Add a reset request to the text_model interface and a reset event to the
input_method_context interface. Use it to reset the pre-edit buffers in
the example keyboard when the cursor is moved in the example editor
client.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:52:53 -04:00
Jan Arne Petersen
ce8a4433f5 text: Add support for control keys to the protocol
Add key event to the text_model interface and a key request to the
input_method_context interface. Implement it in the example editor
client and the example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:52:41 -04:00
Jan Arne Petersen
e202bae9d3 text: Add delete_surrounding_text to protocol
Add delete_surrounding_text event in the text_model interface and the
request in the input_method_context interface. Implement it in the
example editor client and in the example keyboard so that the backspace
key works with it.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:51:08 -04:00
Jan Arne Petersen
43f4aa8cab text: Add support for pre-edit string
Add support of preedit-string to the example editor client. Also add a
preedit_string request to the input_method_context interface and use
that in the example weston keyboard to first create a pre-edit string
when entering keys and commit it on space.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:50:44 -04:00
Jan Arne Petersen
892f1c3975 keyboard: Use a qwerty virtual keyboard layout
Add support for a proper qwerty virtual keyboard layout with lowercase
and uppercase state, space and enter button.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:49:43 -04:00
Jan Arne Petersen
30b66ef1fd text: Split text and input-method protocols
It makes sense to split the interfaces in a text and a input-method
protocol for now (only the text protocol needs to be used in toolkits).

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:48:59 -04:00
Jan Arne Petersen
cb08f4d844 text: Fix set_surrounding_text request
Add cursor and anchor positions as arguments to the set_surrounding_text
request. The cursor and anchor positions are relative to the surrounded
text, so it does not make sense to have that separate. Remove the
separate set_cursor_index and set_selected_text requests. Also update
the corresponding event in input-method-context and add support for it
in the weston example keyboard.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:38:00 -04:00
Jan Arne Petersen
c1fbcb7c38 editor: Add support for setting a preedit
Add support for setting a preedit text to the editor example.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:36:04 -04:00
Jan Arne Petersen
0e5bd45100 editor: Add support for selection
Make it possible to select text and render the selection to the editor
example.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:56 -04:00
Jan Arne Petersen
09e7c96574 editor: Insert commit-string at cursor
Instead of appending at the end, insert the commit-string at the cursor
position.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:49 -04:00
Jan Arne Petersen
7e634a0ea7 editor: Add support for cursor
Add support for setting, moving and rendering a cursor.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:42 -04:00
Jan Arne Petersen
b9eb02c46f editor: Extract text handling into text_layout
Create a text_layout struct and functions for handling simple text
layouts.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:37 -04:00
Jan Arne Petersen
f80bc06a8e editor: Make text_entry a widget
Simplify the example client by making text_entry a widget.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:35:20 -04:00
Jan Arne Petersen
620cd62cbd text: Introduce input_method_context interface
Add an input_method_context interface which is the representation of a
text_model on input_method side.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:34:59 -04:00
Jan Arne Petersen
4c26518ad1 text: Remove surface arg in create_text_model
Remove the wl_surface argument from create_text_model request. The
wl_surface is specified as an argument in the activate request instead.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2012-09-12 16:28:04 -04:00
Pekka Paalanen
0d64a0fa29 compositor: new intersection algorithm
The existing algorithm had some corner cases (pun!), where it failed to
produce correct vertices in the right order. This appeared only when the
surface was transformed (rotated). It also produced degenerate polygons
(3 or more vertices with zero polygon area) for non-transformed cases
where the clipping and surface rectangles were adjacent but not
overlapping.

Introduce a new algorithm for finding the boundary vertices of the
intersection of a coordinate axis aligned rectangle and an arbitrary
polygon (here a quadrilateral). The code is based on the
Sutherland-Hodgman algorithm, where a polygon is clipped by infinite
lines one at a time.

This new algorithm should always produce the correct vertices in the
clockwise winding order, and discard duplicate vertices and degenerate
polygons. It retains the fast paths of the existing algorithm for the
no-hit and non-transformed cases.

Benchmarking with earlier versions showed that the new algorithm is
a little slower (56 vs. 68 us/call) than the existing algorithm, for
the transformed case.  The 'cliptest f' command before and after this
commit can be used to compare the speed of the transformed case only.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Rob Clark <rob.clark@linaro.org>
2012-09-12 12:27:35 -04:00
Pekka Paalanen
8c492b1293 clients: add cliptest program
Cliptest is for controlled testing of the calculate_edges() function in
compositor.c. The function is copied verbatim into cliptest.c.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-12 12:24:40 -04:00
Pekka Paalanen
84ec19a758 update .gitignores
Add workspaces-protocol.c, workspaces-server-protocol.h,
workspaces-client-protocol.h.

Remove wscreensaver.

Alphabetaize clients/.gitignore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-09-12 12:24:23 -04:00
Philipp Brüschweiler
774c34a381 screensaver: fix decoding of transparency in xpm files
Use 0 as transparent pixel. This is needed when using premultiplied
alpha.
2012-09-06 21:08:12 -04:00
Philipp Brüschweiler
8c9c8fcf6e toytoolkit: supply correct widget in motion_handler callback 2012-09-04 15:56:37 -04:00
Philipp Brüschweiler
067abf67cd workspaces: don't segfault on invalid move_surface_to_workspace request
Also fixes the off-by-one in toytoolkit that exposed the issue.
2012-09-04 15:56:24 -04:00
Jonas Ådahl
14c92ff072 toytoolkit: Implement support for the workspace manager interface
Two buttons are added to the right-click menu of the window frame for
moving a surface either up or down.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2012-08-31 19:51:53 -04:00
Scott Moreau
7e300dbc58 simple-egl: Avoid race condition.
After explaining the problem on irc, Pekka dictated this solution which works.
The problem is that simple-egl can hang when toggling fullscreen because of a
race where (quoting Pekka) "if it dispatches the frame callback simple-egl
itself requested before the Mesa's own frame callback came, simple-egl will go
to its redraw routing and call eglSwapBuffers so you end up effectively calling
eglSwapBuffers from within eglSwapBuffers, and deadlock". This patch avoids
redrawing (which calls eglSwapBuffers) when there is a pending frame callback.
2012-08-31 19:49:08 -04:00
Scott Moreau
6a615d2621 simple-egl: Only set alpha_size=0 when -o is passed.
When starting simple-egl with -f for fullscreen and toggling to 'windowed' mode with F11,
the surface is opaque instead of semi-trnasparent as it is when starting without -f. We
only want to create the surface with alpha_size=0 when the user explicitly passes -o
because otherwise it will never have the ability to use alpha.
2012-08-31 19:43:08 -04:00
Scott Moreau
1ee53e78db simple-egl: Remove unused variable. 2012-08-31 19:40:09 -04:00
Philipp Brüschweiler
467668c9a4 desktop-shell: don't segfault on invalid icon path
Instead draw a fallback icon and proceed as normal.

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

v2: coding style fixes
v3: memory leak, draw icon instead of relying on external files
2012-08-29 15:31:25 -04:00
Philipp Brüschweiler
16d59d7780 desktop-shell: respect CURSOR_NONE as grab cursor 2012-08-29 15:12:57 -04:00
Philipp Brüschweiler
bd3f219344 toytoolkit: try multiple names when loading cursors
The correspondence between cursor functions and names of cursors has
never been standardized. As a consequence, each cursor function can be
represented as a cursor with one of several names. Be more robust when
loading cursor by trying all known names that correspond to a cursor.

This should fix https://bugs.freedesktop.org/show_bug.cgi?id=50487
and https://bugs.freedesktop.org/show_bug.cgi?id=52609 a bit more
thoroughly.
2012-08-29 15:06:09 -04:00
Scott Moreau
bb5898341c screenshot: Use correct buffer size for transformed outputs.
This is a workaround for screenshots with transformed outputs. It reorders
the output positions so the correct buffer size is determined for the final
image. This assumes the outputs are in succession on the x axis. The outputs
are rendered in their transformed state.
2012-08-29 14:47:30 -04:00
Philipp Brüschweiler
fdb4b02501 terminal: support entering non-ascii characters
Unless the alt modifier is active and the MODE_ALT_SENDS_ESC mode is not
set, any value over 127 is converted to a UTF8 sequence.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=53648 should be
fixed with this.

Part of https://bugs.freedesktop.org/show_bug.cgi?id=52419 is fixed, but
interestingly it depends on the activated keymap (i.e. it works with
dvorak, but not with ch).
2012-08-29 14:47:07 -04:00
Philipp Brüschweiler
5418a904ca toytoolkit: don't ignore resizes with negative width or height
E.g. this can happen when you grab the lower right corner of a window
and move over the top of the window when resizing. In this case, the
changed width is still important and should be acted upon.

https://bugs.freedesktop.org/show_bug.cgi?id=53560
2012-08-16 10:33:56 -04:00
Philipp Brüschweiler
97cb62afb7 weston-info: an output can have multiple modes 2012-08-15 16:06:46 -04:00
Philipp Brüschweiler
bb0d4b9218 weston-info: remove timerfd termination hack
Use wl_display_roundtrip to listen exactly as long as necessary.
2012-08-15 16:04:44 -04:00
Kristian Høgsberg
70fc4a4cd6 clients: Move weston-info to bin_PROGRAMS
It's properly prefixed and pretty useful; let's install it.
2012-08-15 12:12:33 -04:00
Philipp Brüschweiler
585acb0013 weston-info: client that print out information about the running compositor
This includes seat capabilities, shm formats and output information.
2012-08-15 11:40:42 -04:00
Philipp Brüschweiler
7e0cc54fca toytoolkit: add axis handler 2012-08-14 15:51:13 -04:00
Philipp Brüschweiler
b8a8aff357 toytoolkit: remove unused actions from titlebar menu
They were introduced in b3cca0a411
but never actually implemented. Removing them should at least stop
users from wondering if weston is broken.

https://bugs.freedesktop.org/show_bug.cgi?id=52455
2012-08-14 10:17:07 -04:00
Philipp Brüschweiler
70cc73b8d8 eventdemo: add axis logging
https://bugs.freedesktop.org/show_bug.cgi?id=52453
2012-08-14 10:17:06 -04:00
Philipp Brüschweiler
a306a2691a eventdemo: fix --no-border
This was broken by commit 29af3ebce6
2012-08-14 10:17:06 -04:00
Philipp Brüschweiler
850f504aa2 eventdemo: fix incorrect comments 2012-08-14 10:17:06 -04:00
Kristian Høgsberg
86adef9d54 window.c: Handle multiple keyboard foci
Keep a count of number of wl_keyboard focus we have instead of
tracking the more recent wl_keyboard.
2012-08-13 22:28:10 -04:00
Philipp Brüschweiler
1f54f17ef8 image: handle multiple images correctly
Don't stop the application when only one window is closed. Don't stall
indefinitely if no valid image file is given as input.
2012-08-13 16:30:55 -04:00
Philipp Brüschweiler
f22d0ecd97 dnd: fix segfault on grabbing
Some cursor themes don't include a "grabbing" icon, causing a segfault.
This patch fixes this by just reverting to the stardard cursor instead.

https://bugs.freedesktop.org/show_bug.cgi?id=50487
2012-08-13 14:39:41 -04:00
Christopher Michael
ac3e5f2feb Add support in Weston for X cursor themes.
This patch, along with the wayland patch, adds the ability to specify
a cursor theme in the weston.ini file:

[cursors]
theme=THEME_NAME

If specified, than Weston can use a specific X cursor theme for the
pointer. This relies on the 0001-Add-support-for-X-cursor-themes.patch
for wayland.

[krh: edited to use shell section and key name cursor-theme]
2012-08-13 11:12:17 -04:00
Kristian Høgsberg
b29798bcab window.c: Rearrange input handlers so they appear in the right order
They were all over the place before, now they appear in protocol order.
2012-08-13 10:01:46 -04:00
Jan Arne Petersen
e829adc514 text: Assign text_model to a wl_seat
Add a wl_seat argument to the activate and deactivate requests of
text_method.

On activation a text_model gets assigned to the input_method of the
wl_seat specified in the activate request.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
de3b6a15c0 text: Add activate/deactivate events
Let the client know when a text model gets activated or deactiavted.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
5196374218 text: Rename text_model_manager to factory
The text_model_manager interface is just used to create text_model
instances. It is more a factory than a manager so rename it to
text_model_factory.
2012-08-10 13:00:52 -04:00
Jan Arne Petersen
72f6082313 text: Add missing callbacks for text_model events
Add all required callbacks for the text_model_listener in the editor
example.
2012-08-10 13:00:52 -04:00
Juan Zhao
19a4c2db26 image: Don't segfault when the file doesn't exist
Don't create a window when the file doesn't exist.

https://bugs.freedesktop.org/show_bug.cgi?id=52450
2012-08-09 10:55:40 -04:00
Kristian Høgsberg
bcf4864bb7 simple-egl: Add help message 2012-08-03 16:32:55 -04:00
Kristian Høgsberg
45ce98829b simple-egl: Set opaque region when running opaque 2012-08-03 16:32:52 -04:00
Pekka Paalanen
b6df4f7de4 desktop-shell: use the standard 'environ' variable
The variable '__environ' seems to be libc implementation specific, and
not avaible on Android.

Use the POSIX standard variable 'environ', which also luckily happens to
be available on Android, which is not POSIX.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-08-03 13:32:36 -04:00
Andre Heider
552d12b10e terminal: Don't crash on non-ascii chars
isalpha() and isdigit() don't like huge values.
Noticed with ascii-art in the shell prompt.
2012-08-03 12:54:06 -04:00
Kristian Høgsberg
2a1aa4efce terminal: Don't output @ for ASCII NUL
Fixes visual bell in screen.
2012-08-03 09:37:05 -04:00
Kristian Høgsberg
ae27737b28 window.c: Use pointer enter serial for setting cursor 2012-08-01 09:58:22 -04:00
Pekka Paalanen
76fc57e75c simple-touch: use proper damage in touch_paint()
Should reduce update overhead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
0768419393 simple-touch: fix off-by-one in position checks
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.

Fixes a segfault.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
55b7cb24e0 simple-touch: more colors and thicker marks
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
7e94a98e07 simple-touch: respond to ping protocol
Without this, it won't get any input anymore.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-07-31 22:27:23 -04:00
Pekka Paalanen
e288a0f415 window: warn on cursor load failure 2012-07-31 22:27:23 -04:00
Kristian Høgsberg
023be102d7 window.c: Set input region after (potentially) adjusting the surface size
Regressed in dd263e546b, spotted by Scott Moreau <oreaus@gmail.com>
2012-07-31 11:59:12 -04:00
Kristian Høgsberg
321e8b7fd3 gears: Exit on ESC 2012-07-30 15:40:57 -04:00
Ander Conselvan de Oliveira
69f9840bed simple-egl: Add keyboard fullscreen toggle
Make simple-egl toggle the fullscreen state whenever the key F11 is
pressed. A sync callback is used to stop drawing while the surface has
not received the configure event, to prevent a buffer with the windowed
size to be attached to the surface after the set_fullscreen request.
2012-07-27 16:11:40 -04:00
Kristian Høgsberg
2995c517c5 gears: Keep gears inside screen in fullscreen mode 2012-07-26 23:53:05 -04:00
Olivier Blin
7679d9a62e gears: add a warning about refresh rate limitation 2012-07-26 22:03:41 -04:00
Olivier Blin
a1d0cf5d69 gears: show FPS count (as in glxgears from mesa/demos) 2012-07-26 22:03:21 -04:00
Kristian Høgsberg
4fc1535c0a window: Handle Alt-F4 to close windows 2012-07-25 16:35:28 -04:00
Andre Heider
82b4c1bc6b window.c: Remove xkb leftovers 2012-07-25 16:24:49 -04:00
Olivier Blin
fa820efaf0 gears: add fullscreen support 2012-07-25 16:21:13 -04:00
Kristian Høgsberg
d1936b9e2b desktop-shell: Break command lines into env vars, executable and arguments
We now support specifying environment variables and arguments in launchers
by saying

  path=GDK_BACKEND=wayland gnome-terminal --full-screen

for example.

https://bugs.freedesktop.org/show_bug.cgi?id=47920
2012-07-23 22:59:33 -04:00
Kristian Høgsberg
df0faf7983 image: Add fullscreen support 2012-07-23 22:00:21 -04:00
Kristian Høgsberg
67ace20f8e window.c: Add fullscreen handler to keep fullscreen state consistent 2012-07-23 21:56:31 -04:00
Kristian Høgsberg
0fd49aa886 dnd: Clip flowers to window content area
https://bugs.freedesktop.org/show_bug.cgi?id=52420
2012-07-23 21:32:46 -04:00
Scott Moreau
ec116022ec desktop-shell: Declare grab_cursor as enum cursor_type. 2012-07-23 10:48:45 -04:00
Kristian Høgsberg
0e696478a9 Handle new transform argument in wl_output.geometry event 2012-07-22 15:49:57 -04:00
Philipp Brüschweiler
f25602bdc0 Extract the text_model_manager interface from input_method
This is necessary because all clients need a way to create
text_models, but only one client at a time can be bound to
the input_method global (else we don't know to whom we are
supposed to send events).
2012-07-22 12:06:10 -04:00
Philipp Brüschweiler
591cfca4e8 editor: deactivate old text model before activating the new one 2012-07-22 11:47:31 -04:00
Kristian Høgsberg
d3a1965a3d clients: Implement minimum size for toy toolkit clients
We default to setting the minimum size to the initial size.  To set a
different minimum size than the initial size, set the minimum size first
then then initial size.  Good enough for a toy toolkit.

https://bugs.freedesktop.org/show_bug.cgi?id=50263
2012-07-20 11:33:02 -04:00
Ander Conselvan de Oliveira
07a91cd9fd desktop-shell: Don't get a shell surface for the grab surface
The grab surface does not depend on any of the shell surface
functionality, so don't allocated one.
2012-07-16 13:35:26 -04:00
Ander Conselvan de Oliveira
ddca49600f window: Workaround a stuck frame callback on the cursor surface
It is possible that a client loses the focus between receiving a
pointer.enter event and sending a pointer.set_cursor request. In that
case, the cursor surface might not be mapped and the frame callback
requested on it will never trigger.

Work around this by trying to remap the cursor surface whenever there
is a frame callback and the serial for the enter event is higher than
the cursor serial.
2012-07-16 13:35:25 -04:00
Scott Moreau
fe89f07e33 toytoolkit: Remove obsolete function window_set_custom(). 2012-07-12 09:18:49 -04:00
Scott Moreau
a6e24d3104 wscreensaver: Fix --demo mode. 2012-07-12 09:18:45 -04:00
Philipp Brüschweiler
c547477e27 Remove dead code
window->title is always NULL inside window_create_internal
2012-07-11 15:46:37 -04:00
Kristian Høgsberg
dd263e546b window.c: Only set input region when we have a decoration
https://bugs.freedesktop.org/show_bug.cgi?id=50490
2012-07-09 22:23:39 -04:00
Daniel Stone
d4756b7955 toytoolkit: Remove redundant XKB free
We already unref these in fini_xkb().

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-09 18:03:06 -04:00
Martin Olsson
c663b22c20 clients: Free resources on exit in eventdemo 2012-07-09 17:50:57 -04:00
Martin Olsson
8df662ad87 clients: Silence 2x gcc 4.6.3 "warn_unused_result" compiler warnings
window.c:1173:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
desktop-shell.c:305:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
2012-07-09 17:50:46 -04:00
Martin Olsson
444799adbb clients: Don't leak "menu" on error path in clients/window.c 2012-07-09 17:50:44 -04:00
Martin Olsson
ff52193ee8 clients: Add clients/weston-screensaver to clients/.gitignore 2012-07-09 17:41:26 -04:00
Kristian Høgsberg
0fe782bdb5 terminal: Extend selection to end of line when selecting past last char 2012-07-01 23:59:08 -04:00
Kristian Høgsberg
0dee6475bd terminal: Insert newlines when copying multiple lines 2012-07-01 21:25:41 -04:00
Kristian Høgsberg
8268d41410 terminal: Handle selection for pointer positions outside widget correctly
That is, don't crash and select entire first/last line when the pointer
is above or below widget.
2012-06-29 12:28:41 -04:00
Kristian Høgsberg
8733b33f9f window.c: Don't allocate proxy manually
With the wayland change to automatically allocate the client side proxy
manually, we can now drop the code (and the FIXME) that did that and just
receive the proxy from the callback arguments.
2012-06-28 22:04:06 -04:00
Kristian Høgsberg
29784402e1 terminal: Add a terminal enter handler for setting I-beam cursor
Now that the mod+click shortcuts change the cursor, this was suddenly obvious.
2012-06-28 14:27:02 -04:00