Commit Graph

564 Commits

Author SHA1 Message Date
Kristian Høgsberg 8ae63851dd window.c: Don't ungrab input after displaying the menu
We used to ungrab first to stop any existing grab and then grab after
showing the menu. That was broken in c680e90489, which
moved the ungrab down below the grab, and as a result menus are now
shown without a grab.  This commit moves the grab back up.
2013-10-28 22:06:11 -07:00
Xiong Zhang 83d8ee779e window, desktop-shell: deal with output unplug on client side
when output is removed, weston-desktop-shell should destroy panel
and background surface on destroyed output.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-10-23 22:36:37 -07:00
Kristian Høgsberg 89f4bc4fc4 window.c: Don't put titlebars on menu windows 2013-10-23 22:12:13 -07:00
Kristian Høgsberg c680e90489 window.c: Use frame code for drawing menus
This gives us a nice frame and drop shadows for the menus.
2013-10-23 21:49:30 -07:00
Kristian Høgsberg 67b8215bcb terminal: Add context menu with new terminal/copy/paste 2013-10-23 16:52:05 -07:00
Rui Matos 3eccb8658d clients/window: Dispose of previous keymap and state on keymap change 2013-10-22 15:25:04 -07:00
Kristian Høgsberg afb9828d57 window: Only clamp min size for windows with frame
Also fix width/height typo.
2013-10-21 15:23:23 -07:00
Kristian Høgsberg 53ec560423 window: Set a minimum size for toytoolkit windows
The decorations tiles start to overlap and look weird if we go below
200x200 size windows.  Just set that as a minimum size if the app
doesn't provide a bigger minimum size.

https://bugs.freedesktop.org/show_bug.cgi?id=66794
2013-10-21 15:05:52 -07:00
Kristian Høgsberg 598477d832 window: Set opaque region to window size if we're fullscreen 2013-10-16 16:06:18 -07:00
Jason Ekstrand 3f66cf92ed Use cairo-util frame in tinytoolkit
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-14 12:27:55 -07:00
Jason Ekstrand ee7fefcffc Rename frame_create and frame_set_child_size with a window_ prefix
This is to avoid a collision with an actual frame structure.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Kristian Høgsberg b5c973c8c2 window.c: Free cursor theme name once we're done with it 2013-10-10 16:50:18 -07:00
Kristian Høgsberg 1abe0486bb config-parser: Make weston_config_parse() tkae a file name
Take a basename of the config file to parse instead of an fd.
2013-09-21 23:05:45 -07:00
Kristian Høgsberg 8c079ae052 window.c: Port to use weston_config instead of old parser 2013-09-21 22:26:10 -07:00
Kristian Høgsberg 0749e3f470 terminal: Accept utf-8 text drop 2013-09-04 20:41:06 -07:00
Rob Bradford 080311879e window: Use new wl_pointer/keyboard_release request
Since we bump the version we ask for from the compositor it is also
necessary to implement the new "name" event in the seat listener.
2013-08-30 14:58:04 -07:00
Paul Winwood b22bf57e21 window.c: Fix SIGSEGV in pointer_handle_motion
Move null pointer check and assignments before first window dereference.
2013-08-29 21:17:51 -07:00
Rusty Lynch 1084da506e Add touch support for wl_shell_surface_move 2013-08-16 10:56:00 -07:00
Kristian Høgsberg 69594ccf9c window: Use xzalloc() instead of silently failing to add output 2013-08-16 10:55:59 -07:00
Kristian Høgsberg adcd54bc3c window: Use xzalloc() instead of failing to add input device 2013-08-16 10:55:59 -07:00
Kristian Høgsberg 1a5f0c34ff window: Fix logic for looking up widget default cursor
We may deref a NULL pointer if there is no grab and no focus widget.
2013-08-16 10:55:59 -07:00
Kristian Høgsberg 980b018825 window: Don't check for subcompositor in window_add_subsurface()
Client should check for subcompositor support up front.  Now
window_add_surface() can never return NULL.
2013-08-15 11:56:41 -07:00
Kristian Høgsberg b20b00923a window: Add API to check for subcompositor, use in subsurface example
This way we can fail with a nice error message.
2013-08-15 11:54:03 -07:00
Adrian Negreanu 6d14b14147 remove dependency on EGL_KHR_surfaceless_context
cairo_egl_device_create(), which is called next,
already checks if EGL_KHR_surfaceless_context is
available. If not, it fallbacks to pbuffer.

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
2013-08-12 16:54:10 -07:00
Rusty Lynch 041815aa05 window.c: Add touch handlers
This adds basic infrastructure for handling touch events in the toytoolkit.
2013-08-12 16:50:26 -07:00
Peter Hutterer 3ca59d3968 clients: fix an error message
_GNU_SOURCE is always true as of c228e23b05, so
program_invocation_short_name is available.
2013-08-08 13:46:14 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Brian Lovin bc91926e0c clients: use xmalloc in more places
For the clients continue to use xmalloc() to simplify OOM-handling.

Signed-off-by: Brian Lovin <brian.j.lovin@intel.com>
2013-08-07 16:27:33 -07:00
Tomeu Vizoso bee45a14cd window: Allow hinting of a preference for RGB565 when creating a window
And check if the renderer supports the RGB565 format for wl_shm buffers
before creating the cairo surface and requesting the buffer.

It can save quite some memory with big surfaces such as desktop
backgrounds.
2013-08-06 16:49:27 -07:00
Rob Bradford 5ab9c75d59 window: Free the allocated display if we fail to setup libxkbcommon 2013-07-30 11:05:42 -07:00
Kristian Høgsberg 4162483d74 window.c: Simplify window_create() 2013-07-25 16:53:10 -07:00
Kristian Høgsberg 8eeb30b9d1 window.c: Use xmalloc for frame_create() 2013-07-25 16:25:15 -07:00
Kristian Høgsberg ce27841be5 clients: Introduce xmalloc() and use it a few places
For the sample clients we introduce xmalloc() to simplify OOM-handling.
This patch only converts a few callsites, but this will be our strategy
going forward.
2013-07-25 15:54:20 -07:00
Rob Bradford 5f087746ee window: Disregard motion events outside our current surface dimensions
It is possible to receive a motion event that was generated by the
compositor based on a pick of a surface of old dimensions. This was
triggerable on toytoolkit clients when minimising. The new window
dimensions were propagated through the widget hierarchy before the event
was dispatched.

This issue was triggering a segfault due to the focussed widget being
lost as the client code tried to identify which widget should have the
focus using co-ordinates outside the dimensions of the surface.

https://bugs.freedesktop.org/show_bug.cgi?id=66795
2013-07-13 00:00:49 -04:00
Rob Bradford 3c9d967688 window: Allow popup menu when the window is maximised
https://bugs.freedesktop.org/show_bug.cgi?id=66793
2013-07-12 23:56:18 -04:00
Jason Ekstrand d27cb096ad window: Request version 3 of wl_compositor
Originally window.c was requesting version 1 but several clients were
calling version 2 and 3 events including the desktop shell itself.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-07-03 14:52:06 -04:00
Matt Roper e61561fd9c toytoolkit: Allow operation without a keymap
In preparation for upcoming changes, we want to make sure that apps
written with the toy toolkit continue to operate properly if no XKB
keymap is received.  If there's no XKB keymap, then we shouldn't
try to figure out keyboard modifier states (since we probably don't
even have equivalents of PC-style modifiers).

Reviewed-by: Singh, Satyeshwar <satyeshwar.singh@intel.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
2013-06-28 19:54:53 -04:00
Daniel Stone c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Kristian Høgsberg 1cc5ac34b5 clients: Nested compositor example
A wayland compositor doesn't provide a mechanism for buffer sharing between
clients.  Under X, one client can render to a Pixmap and another can use it
as a source in a subsequent drawing operations.  Wayland doesn't have a
mechanims to share Pixmaps or textures between clients like that, but it's
possible for one client to act as a nested compositor to another client.

This less work than it sounds, since the nested compositor won't have to
provide input devices or even any kind of shell extension.  The nested
compositor and its client can be very tightly coupled and have very specific
expectations of what the other process should provide.

In this example, nested.c is a toytoolkit application that uses cairo-gl
for rendering and forks and execs nested-client.c.  As it execs the client,
it passes it one end of a socketpair that will be the clients connection
to the nested compositor.  The nested compositor doesn't even create a
listening socket.

The client is a minimal GLES2 application, which just renders a spinning
triangle in its frame callback.
2013-06-04 02:47:12 -04:00
Alexander Larsson edddbd14ac Convert all scales to int32_t
The type changed in the protocol, so update weston for this.
2013-05-28 15:27:45 -04:00
Louis-Francis Ratté-Boulianne 6cd1de33ba toytoolkit: Make the window resizing optimization optional
Whether or not a shm pool is used for resizing is now configurable at
build time (--disable-resize-optimization).

[pq: removed an unnecessary hunk from the patch]
2013-05-22 18:07:30 -04:00
Alexander Larsson d68f523f30 window: Add window_get_output_scale()
This lets you find the maximal scale for all the outputs a window
is on, which is useful for picking a buffer_scale.
2013-05-22 16:18:52 -04:00
Alexander Larsson 1818e31001 window: Store server_allocation in surface size
We used to just store the buffer size here which is not right if the
surface has a buffer_transform or a buffer_scale. To fix this we pass
the transform and scale into the toysurface prepare and swap calls and
move both the surface to buffer and the buffer to surface size
conversion there.

Without this interactive resize on the top or left sides of a transformed
or scaled surface will not work correctly.
2013-05-22 16:17:59 -04:00
Alexander Larsson 2aaa8b76cf window: Apply buffer_scale automatically in widget_cairo_create 2013-05-22 16:17:41 -04:00
Alexander Larsson 5e9b652a15 window: allow setting a buffer scale on a window 2013-05-22 16:17:25 -04:00
Alexander Larsson afd319afce window: Track output scales 2013-05-22 16:17:19 -04:00
Alexander Larsson 15901f0377 window: Support transform in widget_cairo_create()
If a buffer_transform it specified in the window we automatically
compensate for it in the cairo_t
2013-05-22 16:16:47 -04:00
Pekka Paalanen 9777744cda window: avoid a gcc warning in buffer release handler
Apparently some compilers complain about set but not used variables
'available' and 'bufs', but I don't get the warning. Still, separate the
debugging code from shm_surface_buffer_release(), so that we only
compute 'bufs' when it is printed. This should fix the warnings.

The debugging code now prints the shm_surface buffer state before and
after, instead of just after.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 14:42:48 -04:00
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
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
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 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
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 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
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 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 5403f5274d window: Allow clients to choose the fullscreen method 2012-12-14 11:27:34 -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
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 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
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 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
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 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
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
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
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 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
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
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
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 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 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 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
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
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
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
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
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 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
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
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
Kristian Høgsberg ae27737b28 window.c: Use pointer enter serial for setting cursor 2012-08-01 09:58:22 -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