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>
The commit 'input: Send leave and enter pair when the surface moves
under the cursor' introduced focused surface local pointer coordinates
to keep track of if a surface had been moved or transformed in a way
that the pointer posititon relative to that surface would change.
Update these coordinates also for the popup grab as otherwise every
pointer motion during a popup grab results in leave and then enter
events.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
At the calculation of the first FPS, gears has initialized last
FPS time with gettimeofday().
But the callback_data passed in the callback of wl_surface_frame()
is the current time, in milliseconds, with an undefined base.
Because of this subtracting last FPS time from callback_data makes no sense.
For example, below is the result of running weston-gears on weston with
drm backend:
$ weston-gears
Warning: FPS count is limited by the wayland compositor or monitor refresh rate
1 frames in 1094460.125 seconds = 0.000 FPS
301 frames in 5.016 seconds = 60.008 FPS
301 frames in 5.016 seconds = 60.008 FPS
301 frames in 5.016 seconds = 60.008 FPS
As you can see, the the first FPS value is something odd.
This patch fixes it by initializing last FPS time with the callback_data passed in
the first callback.
Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
At the moment when surfaces are destroyed they are faded out but let's
make it configurable!
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This option is so we can disable showing any panel at all. The default
is to continue showing the panel and no example is added to weston.ini
because it's an uncommon request.
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>