Commit graph

4826 commits

Author SHA1 Message Date
Derek Foreman e42d754843 desktop-shell: drop shell_client from the head of the surface list on destroy
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>
2015-08-06 16:04:15 +01:00
Dawid Gajownik f965db5fc1 compositor-rdp: free() can handle NULL pointers
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>
2015-08-02 03:08:45 -07:00
Dawid Gajownik 71f5704879 main: print backends in help message in alphabetical order
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>
2015-07-31 16:15:06 -07:00
Dawid Gajownik 2d7ded80f5 .gitignore: ignore doxygen generated files v2
Fixes incorrect commit d956379058

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
2015-07-31 15:46:18 -07:00
Derek Foreman 1281a36e3b input: Don't test keyboard/pointer/touch pointers
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>
2015-07-31 15:16:09 -07:00
Derek Foreman b41b59e2fa fullscreen-shell: Test for device presence properly
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>
2015-07-31 15:16:06 -07:00
Derek Foreman 006cf67c77 desktop-shell: Check for device presence properly
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>
2015-07-31 15:16:03 -07:00
Derek Foreman 60d97311be desktop-shell: Don't call wl_list_init() in the middle of a list
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>
2015-07-31 15:15:59 -07:00
Derek Foreman 30ce607682 input: Check device counts in bind_seat()
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>
2015-07-31 15:15:46 -07:00
Dawid Gajownik d956379058 Update .gitignore
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
2015-07-31 12:52:19 -07:00
Dawid Gajownik d99a050195 main: update RDP backend help message
`--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>
2015-07-31 12:49:35 -07:00
Bryce Harrington d88f1942df gitignore: Ignore some dist generated files 2015-07-30 18:17:29 -07:00
Derek Foreman 22276a596a zoom: Store the seat that initiated a zoom
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>
2015-07-29 19:54:17 -07:00
Derek Foreman 25bd8a71fc zoom: Call weston_output_activate_zoom() appropriately
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>
2015-07-29 19:47:31 -07:00
Derek Foreman 859b52b62e zoom: Rename zoom_area_center_from_pointer to zoom_area_center_from_point
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>
2015-07-29 19:46:05 -07:00
Derek Foreman a36eb50973 zoom: Change zoom->active to a bool
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-29 19:44:02 -07:00
FORT David b3463a9e9c Fix crash when using RDP4 security
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>
2015-07-23 18:32:23 -07:00
FORT David c2635c6599 remove a warning during compilation
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>
2015-07-23 18:32:01 -07:00
Ross Burton 2eff22b8e6 build: mkdir target weston.ini directories before writing
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>
2015-07-23 18:01:24 -07:00
Mario Kleiner 7e07db9207 cms-helper/static: Add "identity" builtin cms profile (v3)
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>
2015-07-23 12:29:49 -07:00
Mario Kleiner 2611ebd316 cms-colord: Fix crash at compositor shutdown. (v2)
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>
2015-07-23 12:28:50 -07:00
Derek Foreman 004b4a1dc1 desktop-shell: Put monitor to sleep when idle timer expires
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>
2015-07-23 10:54:47 -07:00
Derek Foreman 3f86e50be0 compositor: Respect WESTON_BUILD_DIR env var in weston_load_module
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>
2015-07-17 19:19:46 -07:00
Derek Foreman d8156e22f6 exposay: Fix use after free when a view is destroyed during animation
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>
2015-07-17 19:02:28 -07:00
Derek Foreman daf846e4ea exposay: Fix logic inversion when ending keyboard grabs
I flipped a ! in cee82d6286
and the exposay keyboard grab became permanent.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 18:59:35 -07:00
Derek Foreman 6b557a7047 input: make a function for device removal
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>
2015-07-17 17:51:00 -07:00
Derek Foreman 118a429504 window: Use wl_cursor_frame_and_duration() for mouse cursor updates
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>
2015-07-17 17:48:45 -07:00
Derek Foreman 6feb0f9f55 desktop-shell: use work area instead of panel size to constrain moves
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>
2015-07-17 17:46:58 -07:00
Derek Foreman 612341f1a6 desktop-shell: use output position in get_output_panel_size()
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>
2015-07-17 17:46:54 -07:00
Derek Foreman f814c5dc9d desktop-shell: add output co-ordinates to get_output_work_area()
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>
2015-07-17 17:46:49 -07:00
Bryce Harrington c68362329e logind-util: Use %u for unsigned int in snprintf
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>
2015-07-17 14:35:50 -07:00
Ryo Munakata 27135af4d4 compositor: destroy modifier_binding_list
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 13:49:34 -07:00
Jon A. Cruz 179c186e19 Adding doxygen setup and info for the testing framework.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-17 13:28:02 +03:00
Jon A. Cruz a67c541e27 Converted the config parser test to the new framework.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-17 13:27:56 +03:00
Jon A. Cruz 646aef543e Enables output in the JUnit XML format.
Adds basic support for optionally outputting in the XML format
commonly used by JUnit compatible tools.

This format is supported by default by many tools, including
the Jenkins build system. It also is more detailed and
captures more information than the more simplistic TAP
format.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-17 13:27:39 +03:00
Ross Burton 315476fa7b build: don't duplicate rule for weston.desktop
dist_wayland_session_DATA will distribute and install src/weston.desktop, so the
definition of wayland_session_DATA which also installs src/weston.desktop will
result in the file being installed twice and (rarely) cause install to fail.

Spotted and fix by Roy Li <rongqing.li@windriver.com>.
Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:45:16 -07:00
Derek Foreman 2217f3f738 shell: Switch middle and right mouse bindings
Currently rotate is on the right mouse button and resize is on the middle.

As fantastic as rotating windows is, it's probably nicer to have resize on
the right button, especially for anyone with only 2 buttons.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-16 19:35:19 -07:00
Derek Foreman 6bc33d63cf log: Open log file CLOEXEC so child processes don't get the fd
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:28:36 -07:00
Bryce Harrington 4a8a3a1c71 input: Also pass appropriate pointer type when libva unavailable 2015-07-16 19:12:26 -07:00
Derek Foreman 99a6a2db4c bindings: Make run binding functions take apropriate device instead of a seat
Going from seat to input device requires that we test the device
before relying on the pointer.  In all of these binding functions
we can trust exactly one input device type directly.  If we pass
that in instead of a seat it's more obvious that we can trust
the one pointer we have.

When a seat is required, we can access through the device we have
and use that to get to other device types for the seat, provided
we validate them appropriately.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:40 -07:00
Derek Foreman b591a30ac2 bindings: make install_binding_grab take a keyboard instead of a seat
It doesn't need the seat pointer, and the caller should already have
tested that the keyboard pointer is valid.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:32 -07:00
Derek Foreman f7b2f8b0a6 desktop-shell: Use the grabbed pointer in popup_grab_button
This should be identical to the pointer in shset->seat.

A later patch prevents direct access to seat->pointer, using the
known valid pointer in the grab will be nicer than using the
getter functions that patch introduces.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:19 -07:00
Derek Foreman 8fbebbd985 desktop-shell: Make surface_resize take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:17 -07:00
Derek Foreman 74de4693b7 desktop-shell: Make surface_rotate take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:07 -07:00
Derek Foreman 794fa0e031 desktop-shell: Make surface_move take a pointer instead of a seat
It doesn't actually need the seat and we have to validate that the seat
has a pointer before making the call, so it's safer just to pass
the validated pointer.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:04:04 -07:00
Derek Foreman b7674ae4dc desktop-shell: Make surface_touch_move take a touch instead of a seat
It never actually needs the seat, and we always verify the touch pointer
before calling it, so let's just pass a touch pointer instead of having
an assumption that the seat's touch pointer has been verified.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:56 -07:00
Derek Foreman 8ae2db5b0c input: Pass the appropriate pointer type to bindings instead of a seat
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:43 -07:00
Derek Foreman 0720ea36c8 compositor-drm: Simplify logic in setup_output_seat_constraint
Use early return for a slight simplification.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:42 -07:00
Derek Foreman 2e6485c8aa bindings: Stop exporting internal functions
These functions should never be called outside of the core.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:36 -07:00
Derek Foreman cee82d6286 exposay: Test keyboard presence before using keyboard pointer
We shouldn't actually use the keyboard pointer unless we check that
a keyboard is present.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:32 -07:00