According to POSIX standard "upon successful completion, putenv() shall
return 0; otherwise, it shall return a non-zero value." Unlike in
setenv() we should not be checking only for negative values.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
When the output can't be completely created in the backend (for example
lack of memory), weston_compositor_add_output() is never run. In such
a case output->link is not initialized. Letter, when
weston_output_destroy() is called, application crashes on
wl_list_remove(&output->link).
This problem happens when drm, fbdev, rdp, rpi or wayland backend is
used.
v2: Initialize output->link in weston_output_init() as suggested by
Derek Foreman.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Previously, we blindly created a mode for the output based on surface size
and completely ignoring the output transform. This caused modesets to fail
on outputs that were transformed by 90 or 270 degrees. We should be
swapping the width and the height in this case.
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>
If we destroy all the devices before trying to remove keyboard focus
we'll segfault because we destroyed the keyboard.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
When we get a focus in event from an X window which is not the one
we last set as the active window, reset the focus.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
We already do this math in compositor.c so let's not duplicate it here.
Additionally, the copy here has broken zoom, so this also fixes zooming.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Valgrind has shown that in at least one place (default_grab_pointer_focus)
we're testing uninitialized values coming out of weston_compositor_pick_view.
This is happening when default_grab_pointer_focus is called when there is
nothing on the view list, and during the first repaint when only the black
surface with no input region exists.
This patch adds a function to clear pointer focus and also set the sx,sy
co-ordinates to a sentinel value we shouldn't compute with.
Assertions are added to make sure any time pointer focus is set to NULL
these values are used.
weston_compositor_pick_view() now returns these values too.
Now the values are always initialized, even when no view exists, and
they're initialized in such a way that actually doing computation
with them should fail in an obvious way, but we can compare them
safely for equality.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This seems like a good idea for consistency that the protocol header
is included for any protocols used by the code. This also means the
code will compile with headers generated by wayland-scanner -c.
Fixed to use angle brackets.
Reviewed-by: Daniel Stone <daniels@collabora.com>
This makes it consistent with the pointer grab, which also gets
global coordinates and not surface relative ones, and allows to
easily filter out gestures based on compositor global hotspots.
Reviewed-by: Daniel Stone <daniels@collabora.com>
In weston_compositor_create, we initialize output_list.
After that we call weston_compositor_schedule_repaint which just calls
weston_output_schedule_repaint on all elements of output_list.
This call does nothing obviously. So we remove it.
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Guilio Camuffo <guiliocamuffo@gmail.com>
An earlier patch made surface_resize() and surface_move() take pointers
instead of seats, this updates the weston_shell_interface resize and move to
match.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
When something goes wrong during weston initialization,
weston_compositor_destroy() is executed. It destroys the backend and
then frees compositor memory. Unfortunately RDP backend is not correctly
destroyed. It frees compositor instead of a backend memory. This causes
later a double free error. The easiest way to reproduce a problem is to
run weston with an invalid option.
Additionally some other objects of rdp_backend structure are not
destroyed/freed. The patch fixes both issues.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91457
v3: comply with Weston coding style, this time for real
v2: comply with Weston coding style
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we
should really be testing keyboard_device_count and pointer_device_count
in most cases, not the actual pointers. Otherwise we end up with
different behaviour after removing a device than we had before it was
inserted.
This commit makes screen-share.c compile once again after changes in
commit 1281a36e3b.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This prevents a use after free when the surfaces are automatically cleaned
up later, as shell_client's freed node was still in the surface list.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
There's no need to check if a pointer exists before passing it to free().
free() can handle NULL pointers.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-By: David FORT <contact@hardening-consulting.com>
For better readability of `weston --help' output, backends are now sorted
in alphabetical order.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Keyboards and pointers aren't freed when devices are removed, so we should
really be testing keyboard_device_count and pointer_device_count in most
cases, not the actual pointers. Otherwise we end up with different
behaviour after removing a device than we had before it was inserted.
This commit renames the touch/keyboard/pointer pointers and adds helper
functions to get them that hide this complexity and return NULL when
*_device_count is 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We should be testing device counts, not pointers. The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after the last release.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We should be testing device counts, not pointers. The pointers are
persistent state that never gets freed, and are an inaccurate indicator
of device presence after a release.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
seat->keyboard_focus_listener.link isn't a head, it's just sometimes a
member of the focus signal list. Calling wl_list_init() on it puts
a loop in the list.
Instead, we remove the item then init it. That way we can call remove on
it again later even if it hasn't been re-added to a list.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
We shouldn't be using seat->pointer|keyboard|touch here, we should be
testing *_device_count to see if a device is currently present.
Testing the pointers directly will result in incorrectly advertising
capabilities after all devices of a type have been removed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Hi,
after running configure with "Enable developer documentation" set to
"yes" git status warns about two new untracked files:
doc/doxygen/tooldev.doxygen
doc/doxygen/tools.doxygen
Below is a small patch.
HTH,
Dawid
`--env-socket' option is of type WESTON_OPTION_BOOLEAN, not
WESTON_OPTION_STRING. Socket should be defined in RDP_FD environment variable.
Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Track the seat that initiated a seat instead of picking the first one.
Previously, if there are multiple seats then any seat can adjust the zoom
level but the zoom tracks the first seat's pointer.
Now the zoom will follow the pointer of the seat that initiated the zoom.
Additionally, if there's no pointer in the first seat, starting a zoom
with the second seat will no longer crash weston.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.
Add an assert() to make sure update_zoom is never called without an
active zoom.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
It doesn't do anything with a pointer, and zoom can be initiated by the
keyboard, so the name was a little confusing.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The initialization of the freerdp_peer was done too early.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=91390.
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
backend_init now returns an int not a pointer.
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
In parallel out-of-tree builds it is possible for e.g. ivi-shell/weston.ini to
be written before ivi-shell/ exists. Solve this by creating the target
directory first.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Allows to force loading an identity gamma table if
option icc_profile= is given in weston.ini for
an output, ie., icc_profile= is specified to an
empty assignment.
Some special display output devices, e.g., for
neuro-science applications, and special display
testing hardware need a guaranteed perfect pixel
passthrough from framebuffer to output. This is
an easy way to set this up for cms-static.
v2: Remove confusing/redundant weston_log debug output.
v3: Don't use the "identity" keyword to trigger this, but
instead assignment of an empty string will trigger
loading of an identity LUT. Suggested by Derek Foreman.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
cms-colord used the weston_compositor destroy signal to
trigger its final colord_module_destroy cleanup, and the
wl_output destroy signal to trigger per output cleanup.
The problem is that the compositor destroy signal gets
emitted before the output destroy signals at compositor
shutdown, colord_module_destroy would free all its
shared data structures and then later on the output
destroy callback would try to access those shared
data structures when handling output destruction
-> Use after free -> Crash, usually with VT switching
dead and thereby an unuseable system requiring a reboot.
Solve this by moving the output destruction handling into
the colord_cms_output_destroy() cleanup function for
colord-cms own hash dictionary of all active outputs.
The output destroy callback just removes the corresponding
output from the dictionary and triggers proper cleanup if
an output is unplugged during runtime. During compositor
shutdown, the dictionary as a whole is released before
releasing all other shared data structures, thereby
triggering cleanup of all remaining outputs.
Tested to fix crashes on x11 and drm backends.
v2: Formatting: Wrap lines to < 80 characters, as suggested
by Derek. Thanks.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Removing the screensaver had the accidental side effect of disabling
DPMS display shut down.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
We were loading modules out of the system dirs unconditionally, so
tests that loaded modules would use the system ones, or fail if
they weren't installed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-By: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Moving the destroy listener setup allows the animation completion handler
to be called before we free any structures it needs.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Break device_removed() out into its own function like device_added().
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.
Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
This fixes the case where an output isn't at y = 0, where the panel height
isn't correct for constraints.
It also kills a bug - moving a window with a mod-drag off the top of the
screen clamped earlier than it should.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
The panel size calculation needs to take the output position into account
or it's only correct when the output is at 0, 0.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
get_output_work_area() now returns the absolute work area including the
output's offset.
This will make math a little simpler later when we use it to constrain
window moves.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Addresses this warning found by Denis Denisov:
[src/logind-util.c:702]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>