XCB and wayland input event handling exists together in xwm, which can
cause problems. weston_wm_handle_button is called via XCB events, while
it calls weston_wm_pick_seat_for_window, which uses info from compositor
(pure wayland). It is also true in setting and removing flags of frames.
Races can happen in between, when resize of moving flag of the frame is
still set while the button has been released, the picked seat will be
NULL in weston_wm_handle_button, causing crash. We can safely ignore
moving or resizing if this happens. The same applies to c06a180d.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=82827
Signed-off-by: Boyan Ding <stu_dby@126.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add a new "numlock-on" option in the [keyboard] section of weston.ini
which, if set to true, is used to enable the numlock of the keyboards
attached at startup.
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This adds a function weston_keyboard_set_locks() which can be used to
change the state of the num lock and the caps locks, changing the leds too.
Only the evdev and libinput backends supports this, since it doesn't make
sense for embedded sessions.
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If weston-desktop-shell dies soon after launch, or maybe cannot be
executed at all, let weston exit rather than letting the user stare at a
black screen.
But, do not exit weston, if weston-desktop-shell dies later, as the user
may already have apps open, and those apps would likely still function
correctly. This gives the user the opportunity to save his work and
close the apps properly.
This should make one class of "I see only black screen" failures obvious.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Toytoolkit resets the opaque region which was set manually using the
wayland protocol directly, so use the widget API instead.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When SIGCHLD fires, we may have more than one zombie to be collected.
Run waitpid() in a loop until no more zombies are found, and clean them
all up.
It looks like the SIGCHLD signalfd does not trigger again for remaining
zombies, so we need the loop.
This works around a crash in text_backend_notified_destroy, which ends
up using stale input_method.client if the sigchld handler is not called.
The crash could be triggered by removing both weston-desktop-shell and
weston-keyboard, so that both would try to respawn and give up, and then
quitting Weston.
Cc: rawoul@gmail.com
Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
The desktop shell plugin registers both a wl_client destroy signal
listener, and a sigchld handler, when launching weston-desktop-shell.
However, nothing guarantees in which order do the wl_client destructor
and the sigchld handler run.
Luckily, the sigchld handler cannot interrupt any code, because we
handle the signal via signalfd, which means it is handled like any event
in the compositor's main event loop.
Still, shell.c has a race, that when lost, can cause a crash, as
described in bug #82957.
If the sigchld handler happens to run first, it will try to launch a new
weston-desktop-shell without removing the destroy listener from the old
wl_client first. This leads to list corruption, that may cause a crash
when the old wl_client gets destroyed.
Simply removing the destroy listener in the sigchld handler is not
enough, because respawning sets shell->child.client pointer, and if
the wl_client destructor runs after, it will reset it to NULL.
OTOH, the wl_client destroy handler cannot reset shell->child.process,
because that would cause the sigchld handler in weston core to not find
the process tracker anymore, and report that an unknown process exited.
Turns out, that to make everything work, we would need to wait for both
the wl_client destructor and the sigchld handler to have run, before
respawn. This gets tricky.
Instead, solve the problem by removing shell->child.process. Use the new
weston_client_start() which automatically creates and manages the struct
weston_process. The shell does not need to know about the process exit,
it only needs to know about the client disconnect. Weston-desktop-shell
will never attempt to reconnect, and it would not work even if it did,
so disconnect is equivalent to weston-desktop-shell exiting.
This should permanently solve the race for weston-desktop-shell.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82957
Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
weston_client_start() is a new wrapper around weston_client_launch(),
that does the process tracking on its own, and logs the process exit
status.
When users of weston_client_start() want to know when the process exits,
they should hook into the wl_client destroy signal. This works for cases
where the client is not expected to disconnect without exiting.
As wl_client destructor and the sigchld handler run in arbitary order,
it is usually difficult for users to maintain both struct weston_process
and a struct wl_client pointer. You would need to wait for both
destructor and handler to have run, before attempting to respawn the
client.
This new function relieves the caller from the burden of maintaining the
struct weston_process, assuming the caller is only interested in client
disconnects.
Cc: Boyan Ding <stu_dby@126.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
When we moved the configure event size to being based on the window
geometry, we changed the coordinates of the configure request to being
frame geometry based. Frame geometry includes titlebar and border, but
not shadow margins.
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
In this case wl_client_add_destroy_listener() was called with a NULL
client, which is invalid.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v2: Different, hopefully better, wording. This patch entirely replaces
the previous similar patch I sent.
v3: Now including the correct patch. Please disregard the "v2" mail.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Obvious this affects the source, not destination.
Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The X cleanup code uses wxs->wm to check if the WM has been created - but that
variable was never initialized. So if X crashes, the WM doesn't get destroyed,
causing a crash when it tries to repaint a window.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Compositor needs the wl_surface error enums and the keyboard repeat info
protocol added in 1.5.91.
weston-info, window.c, and Weston's wayland backend need also the
keyboard repeat info.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed. make check will
currently either fail or run pre-existing versions.
This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The Xwayland test has been broken ever since the migration to the
stand-alone Xwayland server binary.
Disable the test, so 'make distcheck' can actually run.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Boyan Ding <stu_dby@126.com>
According to
http://www.gnu.org/software/automake/manual/html_node/Checking-the-Distribution.html
the DISTCHECK_CONFIGURE_FLAGS is for the user, while
AM_DISTCHECK_CONFIGURE_FLAGS is the one to use in Makefile.am.
Make it so.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Boyan Ding <stu_dby@126.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
The experimental versioning has not been updated when it was supposed
to. Let's try to be better at it now, as xdg-shell is close to have its
first stable version.
Bump the version now to bring the world into the same exact version.
There may be some protocol changes still coming, but we try to land them
before 1.6 gets out. Those changes will bump the experimental version
again as needed.
When 1.6.0 is released, the experimental version will no longer be
bumped, and no incompatible protocol changes will be made. Xdg-shell.xml
file will move to Wayland in 1.7.0, drop the experimental versioning,
and become stable.
Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This adds a description of the screen-share command configuration key to the
weston.ini man page.
[Pekka Paalanen: removed the sentence about default value, because the
default value is empty, and AFAIU cannot work.]
Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Now the client can let us know where the panel is using
desktop_shell.set_panel_position, we can correctly calculate where to
put new views and how big maximized views should be.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Panels are always assumed to be on the top edge of the output. If this
is not the case views will be placed under the panel, wherever it is,
and maximize doesn't use the correct space allocated for views.
By telling the server on which edge the panel is located, it can
correctly calculate where to put new views and how big maximized views
should be.
[Pekka Paalanen: the user of this protocol so far is Maynard.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The master copy of calculate_edges() lives nowadays in gl-renderer.c.
Copy it verbatim from gl-renderer.c into cliptest.c.
Update cliptest.c for the following changes that happened in Weston
core, vertex.clipping.c, and gl-renderer.c:
- replace GLfloat with float
- introduction of weston_view, here replacing weston_surface
- API change of weston_view_to_global_float
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This silences the following warning:
src/vertex-clipping.c:196:22: warning: array subscript is below array
bounds [-Warray-bounds]
ctx->prev.x = src->x[src->n - 1];
[Pekka Paalanen: the src->n < 2 comparison comes from the fact that a
polygon with 0 or 1 points is not a polygon. A polygon with 2 points is
still degenerate, but at least it has two edges that can be clipped.]
Signed-off-by: Ondřej Majerech <oxyd.oxyd@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.
The new names have been available since the first stable xkbcommon
release (0.2.0).
Signed-off-by: Ran Benita <ran234@gmail.com>
Libinput is stabilizing soon, so let's flip the default switch now. The
old input code will still be carried as an option for a while.
Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Previously geometry was changed to leave space for titlebar if a frame
has only buttons but no title. This patch fixes theme_render_frame to
avoid transparent titlebar.
Signed-off-by: Boyan Ding <stu_dby@126.com>
The seat picked in weston_wm_window_handle_moveresize can sometimes
be NULL when it is (somehow) triggered with all buttons released.
This patch checks whether the seat is NULL to avoid NULL dereference.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
Signed-off-by: Boyan Ding <stu_dby@126.com>
Prevent attempting to draw the intersection polygon when it contains no
vertices.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>