Most of the code only puts WL_EXPORT in .c files. Remove the few
instances in header files.
If it's missing form the associated .c, put it there instead.
When a toytoolkit client redraws, the toolkit syncs the parent and
geometry. If a client redraws often (such as the terminal drawing a huge
amount of output), this can spam the compositor with requests and may
result in the client's eventual being killed.
We don't need to send requests for changing the geometry or parent if
these haven't changed. So remember the last geometry and parent, and
update them only if needed.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83297
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Set the default logging level from libinput to INFO. This matches better
the behaviour of the old input backend, and prints the found input
devices into Weston's log.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
Initial key state is no pressed keys, and the libinput_device_get_keys
function was deprecated in libinput 0.6.0.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
WL_CALIBRATION, introduced in weston-1.1, requires the translation component
of the calibration matrix to be in screen coordinates. libinput does not have
access to this and it's not a very generic way to do this anyway. So with
the libinput backend, WL_CALIBRATION support is currently broken (#82742).
This cannot be fixed in libinput without changing its API for this specific
use-case.
This patch lets weston take care of WL_CALIBRATION. It takes the original
format and normalizes it before passing it to libinput. This way libinput
still does the coordinate transformation, weston just needs to provide the
initial configuration.
Note that this needs an updated libinput, otherwise libinput will try to
transform coordinates as well.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82742
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When backend_init returns NULL, we goto out_signals, which wants to
free(modules), but in this particular code path, modules hasn't been
initialised leading to a "Double-free or corruption" error message.
Initialising modules to NULL makes the free a no-op in this scenario.
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
It was rather inconsistent before. This may help users figure out why
backgrounds and icons don't show up. A better api where the error can
be queried might be nice, but this seems sufficient for current Weston use.
[Pekka Paalanen: removed one stray space.]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fail on trailing text after numbers, such as --width=100mm
Fail on any text after booleans, such as --flag=false
Also fixed reading of memory after the null terminator of a long
option with no = sign in it.
[Pekka Paalanen: some whitespace style fixes.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
weston_surface_update_transform() no longer exists, except in comments.
Fix that.
[Pekka Paalanen: don't lose the full comment in compositor-drm.c.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This reverts the parts of commit 81ff075bf4
that touch window.c.
This brings the toytoolkit window context menus back, until someone
implements the xdg-shell equivalent in the compositor.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82972
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Set the right position of maximized window. Up until now we ignored
output's "position" and were using only the working area
of output which is in output-relative coordinates. This led to
showing the maximized window always on the first output.
This, along with the previous patch, fixes
https://bugs.freedesktop.org/show_bug.cgi?id=82967
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
shsurf->output is the output that user expects the shell surface
is on. When maximizing, we don't have any explicit setting of the output
like in the case of fullscreening, so set the output to the one that
the surface is currently on. In the case that the surface is not mapped yet,
(if it ever happens) use the same heuristics as for fullscreening.
This fixes the size sent with configure event, when maximizing a window.
The size is now picked up by the correct output, but the maximized
window position is still wrong. [Pekka Paalanen]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82967
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If a cursor was set with wl_pointer.set_cursor but not in combination
with an action that has the side effect of damaging the region where the
cursor is positioned, it would not be drawn. This patch explicitly
schedules a repaint of the pointer sprite when it is set.
clickdot is updated to illustrate the bug; when moving the pointer over
clickdot, the pointer is hidden. When not having moved the pointer for
500 ms it is made visible using wl_pointer.set_pointer.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The destructor set on the wl_output resources needs the weston_output
to be allocated, because it removes the resource from its list.
So unset the destructor on all the resources when destroying an
output.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Extract these two new functions from main() to improve readability.
Refactoring only, no functioncal changes.
[Pekka Paalanen: commit message]
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
The move_signal in weston_output isn't used, and not even initialized,
so anything trying to listen to it will crash on wl_signal_add().
Instead of it, the 'output_moved_signal' in weston_compositor is
used, so remove it.
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fix recently introduced compiler warnings:
desktop-shell/shell.c: In function 'shell_configuration':
desktop-shell/shell.c:588:10: warning: ignoring return value of
'asprintf', declared with attribute warn_unused_result [-Wunused-result]
src/screenshooter.c: In function ‘screenshooter_binding’:
src/screenshooter.c:291:10: warning: ignoring return value of
‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
src/text-backend.c: In function ‘text_backend_configuration’:
src/text-backend.c:944:10: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When client is lauched in fullscreen, it is placed on the
first output, because it is not mapped and
shell_surface_set_output() therefore sets default output.
Since we have no better way how to position newly created windows,
(http://lists.freedesktop.org/archives/wayland-devel/2014-May/thread.html#14568)
set the output to the one that has currently focus. Priority has
the touch focus, then pointer and then keyboard focus.
This fixes bug
https://bugs.freedesktop.org/show_bug.cgi?id=69780
Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If a full screen program is fading out and a touch start happens, it
will result in a NULL pointer dereference when weston_touch_set_focus
tries to derefernce view->surface->resource.
Instead, this patch sets the focus to NULL, which should be the
same as if the program was destroyed during the touch anyway.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78706
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
We shouldn't do WM-y things on an O-R window, including setting input
focus to it.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=81273
Signed-off-by: Boyan Ding <stu_dby@126.com>
Tested-by: Ryo Munakata <ryomnktml@gmail.com>
Acked-by: Christopher Michael <cp.michael@samsung.com>
When zoom is activated in the pixman rendered the log is filled with warnings
and all rendering stops. With this patch the warning is generated once and
rendering continues without zooming.
Closes bug 80258
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80258
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
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>