summaryrefslogtreecommitdiff
path: root/src/logind-util.c
AgeCommit message (Collapse)AuthorFilesLines
2015-07-17logind-util: Use %u for unsigned int in snprintfBryce Harrington1-1/+1
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-06-15src: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington1-16/+19
2015-05-15launcher-util: Force all weston_launcher_open()s to use O_CLOEXECDerek Foreman1-18/+2
Really, there's pretty much no time we'd ever want O_CLOEXEC unset, as it will likely result in leaking fds to processes that aren't interested in them or shouldn't have them. This also removes the (now unused) code from weston_logind_open() that could drop O_CLOEXEC. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-01-16logind: fix PropertiesChanged parserDavid Herrmann1-28/+28
The current parser directly reads a BOOLEAN on the PropertiesChanged signal for 'Active' properties. However, all property-values are packed in a VARIANT, otherwise, we wouldn't know the type. Fix the parser to recurse into the variant before reading the boolean. To avoid such bugs in the future, we extract the 'Active' parser into a helper function parse_active(), which is then shared between the PropertiesChanged and Get handlers. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
2015-01-16logind: forward Active=true changes for non-DRM backendsDavid Herrmann1-5/+11
Logind sends us a notification whenever the Active attribute of our session changes. However, due to the way compositor-drm.c relies on the master DRM device to be synced with the session, we used to delay Active=true handling until the DRM device was up, too. See: commit aedc7732ebd9bc7b4f51ee247ea857ffec6260a7 Author: David Herrmann <dh.herrmann@gmail.com> Date: Sat Nov 30 11:25:45 2013 +0100 logind: delay wakeup until DRM-device is resumed However, the other compositor backends do not use DRM, so logind-util will never get notified about any DRM device. Therefore, we have to forward the Active=true change immediately. This commit fixes logind-util to take sync_drm as argument. If it is true, we do DRM-device synchronisation, otherwise we don't. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86889 Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
2015-01-16logind: use SIGRTMIN to not conflict with xwaylandDavid Herrmann1-10/+18
xwayland uses SIGUSR1 as startup notification. Make sure to use SIGRTMIN and SIGRTMIN+1 for VT handling. A bonus is SIGRT* signals can be queued multiple times, so we will be able to correctly track them and will no longer lose signals (which wouldn't really matter, but is confusing in logs). Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Tested-by: nerdopolis <bluescreen_avenger@verizon.net>
2014-11-28Use zalloc instead of calloc(1, ...)Bryce Harrington1-2/+2
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com> Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-01-31compositor: Fix a couple of #includes to use "" instead of <>Kristian Høgsberg1-1/+0
2013-12-03logind: delay wakeup until DRM-device is resumedDavid Herrmann1-21/+37
The logind API was designed to allow any kind of devices and any number of devices. It has no idea of "main DRM device" or similar. However, the weston DRM backend was designed with a single DRM device as master. Therefore, we wake it up unconditionally on session-wakeup. But this may fail with logind as a session may be awake, but not all devices have been resumed, yet. Therefore, we change the weston-logind backend to deal with this case correctly. Instead of waking up the compositor on session-wakeup, we wait for the main DRM device to wake up. Once we get the event, we notify the compositor. For sleep, we reverse this logic. On *any* of the following events we tell the compositor to go to sleep: - Session gets inactive - DRM device gets inactive - DRM device is removed This guarantees, that weston is only active if *both*, the session and the main DRM device are awake/active. Note that we could actually rely solely on the DRM-device Pause/Resume events from logind and drop all the Active-Prop-Changed handling. logind guarantees proper ordering of both. However, in case we ever change weston to support multiple GPUs, we need the per-device notification. Thus, keep the code. This also makes weston more fail-safe in case logind fails to send the PauseDevice event (for whatever reason..).
2013-11-21logind: change to -1+errnoDavid Herrmann1-6/+10
Set errno and return -1 in public API calls like all other weston code does. Most systemd+dbus calls return negative error-codes instead of -1 and setting errno. Thus, we need to explicitly set errno before returning. Also note that we must set errno _after_ the cleanup path. Calling functions like close() in the cleanup path might overwrite errno (which is not what we want). So protect errno until the final return -1;
2013-11-21logind: Use dbus_bool_t for bool types in dbus callsKristian Høgsberg1-2/+3
The gcc built-in 'bool' type is not the same size as dbus_bool_t, which is an uint32_t. Passing a pointer to bool where dbus expects a uint32_t * doesn't work. Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
2013-10-30logind: Return proper error value when tty or seat doesn't matchKristian Høgsberg1-1/+7
If the seat or tty doesn't match we return with r == 0, which looks like success to weston_launcher_connect(), which then fails to fall back to the legacy path. https://bugs.freedesktop.org/show_bug.cgi?id=70876
2013-10-21launcher: add logind backendDavid Herrmann1-0/+913
Instead of connecting to weston-launch from launcher-util, we now try to connect to logind first. If logind provides session-devices, we use them. If not, we fall back to the old weston-launch facility.