It is quite possible for os_create_anonymous_file() to fail when trying
to allocate a new wl_shm buffer. Propagate this failure out from
shm_surface_prepare. Most parts of toytoolkit are already avoiding NULL
cairo surfaces.
If cairo surface allocation fails, do not try to call the widget redraw
functions, those are not prepared to deal with NULL. Also do not
schedule a frame callback, this allows us to retry drawing the next
time.
If redraw fails for the main_surface of a window, restore the widget
geometry to what the compositor currently is showing. This keeps the
window visual appearance in sync with application state, so interacting
with the application does not break too badly.
If the very first draw of any window fails, then forcefully exit the
program. E.g. if weston-desktop-shell fails to allocate buffers for the
unlock dialog, w-d-s exits, and weston unlocks the screen automatically.
This patch allows e.g. weston-terminal to stop from enlarging while
resizing, if new sized buffers can no longer the allocated. Even then,
the application stays usable, as it can often repaint in the last
successful size. It does not crash, and the user is able to resize it
smaller, too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If posix_fallocate is available, use it instead of ftruncate. Unlike
ftruncate, when posix_fallocate succeeds, it guarantees that you cannot
run out of disk space, when later writing to the mmap()'ed file.
With posix_fallocate, if os_create_anonymous_file() succeeds, the
program cannot get a SIGBUS later from accessing this file via mmap. If
there is insufficient disk space, the function fails and errno is set to
ENOSPC.
This is useful on systems, that limit the available buffer space by
having XDG_RUNTIME_DIR on a small tmpfs.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The default can be set by passing WESTON_SHELL_CLIENT as an argument
to configure, similarly to WESTON_NATIVE_BACKEND.
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reset pointer button count in case the driver did not emit appropriate
number of number button released events.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
The purpose of this patch is to move away from separating evdev
functionality from udev functionality in order to rely on a separate
library to do this for us.
This patch is only compile tested and I have no idea how much it breaks.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Always put them as the top-most layer in the layer list of their parent.
This ensures that, for example, the popup menu produced by
right-clicking on a surface (which is not currently at the top of the
stacking order in the current workspace) is displayed at the top of the
stacking order.
This ensures transient surfaces are included in the layer of their
parent, even if the parent later changes layers. It achieves this by
recursively changing the layers of all children of a surface when that
surface’s layer is changed. The recursion is unbounded unless transient
surfaces are restricted to not being children of other popup or transient
surfaces.
This fixes a bug whereby a surface which is transient for a fullscreen
surface could end up being stacked below it.
https://bugs.freedesktop.org/show_bug.cgi?id=69443
It’s tied too deeply into the shell’s window stacking and ordering code
to legitimately be split out into compositor.c. Inline it in the shell,
and refactor some code around it a little, tidying up the stacking
behaviour for fullscreen surfaces.
This will be used more extensively in the next few commits, where shsurf
layering is handled more explicitly when changing the type of a surface.
This commit introduces the minor functional change that map() will now
always add the new surface to a layer list, as
shell_surface_calculate_layer_link() always returns a non-NULL link
element. This affects fullscreen and ‘none’ surfaces (which are now added
to the fullscreen and current workspace’s layer list, respectively).
This is in preparation for unifying how surface layering works. It
introduces the small functional change that fullscreen, maximized and
top-level surfaces now explicitly have no parent surface. Only popup and
transient surfaces have a non-NULL parent.
This fixes two GCC warnings when compiling with -Wswitch-enum
-Wswitch-default, and makes it clearer that those cases have been
thought about explicitly when writing the code, rather than just being
forgotten.
This fixes a load of GCC warnings when compiling with -Wswitch-enum
-Wswitch-default, and makes it clearer that those cases have been
thought about explicitly when writing the code, rather than just being
forgotten.
full screen black_surface doesn't have associated wl_buffer, so
black_surface->width and height can't get value through
weston_surface_commit(). then weston_surface_damage(black_surface)
will be wrong in shell_stack_fullscreen(), the result is that we
can't see a full screen view whe APP window's size isn't equal to
output's size like running weston-gears
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
This is needed for XWayland surfaces with alpha channel, as X will be
sending crap in there that should be discarded.
This is currently done with a copy in the compositor, while we wait for
support in the VideoCore side.
Replace the two functions getting the intended surface dimensions from
the surface's buffer and buffer transformation parameters by a single
function that just set the surface size according to all the buffer
state.
The old functions were always called in pairs, and always assigned to
the surface dimension variables.
This function also deals with a NULL buffer by setting the dimensions to
zero, just like the callers used to do.
The new function has no users outside this source file, so do not export
it. This basically unexports the old functions.
This removes the calls to weston_surface_buffer_width/height() from
input.c, which are the last external calls to them.
Instead, use the cached values from weston_surface::width,height. These
have already been set by weston_surface_commit(), because that is the
only way a weston_surface can get a buffer.
Gather the variables affecting the coordinate transformations between
buffer and local coordinates into a new struct weston_buffer_viewport.
This will be more useful later, when the crop & scale extension is
implemented.
The field is already set - correctly - in the backend switch_mode.
setting output->current_mode to mode in compositor.c leads to bugs,
since mode can be freed by the shell.
For example, the shell allocates it on the stack for
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER
Signed-off-by: Axel Davy <axel.davy@ens.fr>
We no longer receive an exposay_binding() call while exposay
is in-flight as we have grabbed the keyboard, so we need to
listen on the modifiers callback for the modifier press and
release.
We don't want bindings to be run while the keyboard is grabbed.
Otherwise the binding handler may grab the keyboard too, making
the old grab go away without even being cancelled.
The symbol is needed only for the EGL buffer path. If --disable-egl is
given to ./configure, there is no need for it, so fix it to actually not
look for that symbol needlessly.
This should fix the runtime error:
Failed to load module: .../rpi-backend.so: undefined symbol:
vc_dispmanx_set_wl_buffer_in_use
when you use --disable-egl and do not have a recent enough
libraspberrypi package (/opt/vc, a.k.a userland.git) that would provide
vc_dispmanx_set_wl_buffer_in_use. Apparently no released version of
userland yet provides this.
The calls are organized into two helper functions to avoid a boolean
argument, and put the #ifdefs away from the main parts of the code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Previously weston.ini had hardcoded paths for the weston-* clients in
/usr/bin and /usr/libexec. This was a bit annoying when testing Weston
because you wouldn't usually install those in the system prefix. This
patch adds a make rule to automatically generate weston.ini from a
template file with some replacement markers for the paths so that they
can have the right prefix.
Data device interface in client just handle with pointer's dnd.
If a touch screen trigger dnd, it will use pointer struct like i
nput->sx, input->sy, input->pointer_focus. So if pointer is moving
when touch screen trigeer a dnd, wrong behaviore will occur.
Before touch screen start dnd, system call touch_grab()
to mark the following drag and drop operation is generated by
touch screen.
Defined some common variables in struct input to track dnd.
Note, touch screen and pointer can't generate drag and drop at the
same time, becuae data device protocol can't identify the drag
and drop event is generated by touch screen or pointer.
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
Adding the interface for touch screen event in clients/dnd.c, once
user touch down on this app, it will trigger a touch and drag
operation.
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
Adding the drag and drop grab interface for touch screen in
src/data-device.c, so the server can handle touch screen
drag and drop operation.
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
The following error message is generated during compile
In file included from launcher-util.c:43:0:
compositor.h:35:28: fatal error: wayland-server.h: No such file or directory
#include <wayland-server.h>
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
We used to only update it on newline, which breaks when somebody moves
the cursor below terminal->end and writes stuff. Instead update it whenever
we write a character to the terminal.
https://bugs.freedesktop.org/show_bug.cgi?id=71935
If libdrm is available, weston-launch and launcer-util.c will support
getting the drm device and setting and dropping drm master, otherwise
we'll only support getting input devices.