@ -287,33 +287,18 @@ weston_logind_set_active(struct weston_logind *wl, bool active)
}
}
static void
static void
get_active_cb ( DBusPendingCall * pending , void * data )
parse_active ( struct weston_logind * wl , DBusMessage * m , DBusMessageIter * iter )
{
{
struct weston_logind * wl = data ;
DBusMessageIter sub ;
DBusMessage * m ;
DBusMessageIter iter , sub ;
int type ;
dbus_bool_t b ;
dbus_bool_t b ;
dbus_pending_call_unref ( wl - > pending_active ) ;
if ( dbus_message_iter_get_arg_type ( iter ) ! = DBUS_TYPE_VARIANT )
wl - > pending_active = NULL ;
m = dbus_pending_call_steal_reply ( pending ) ;
if ( ! m )
return ;
return ;
type = dbus_message_get_type ( m ) ;
dbus_message_iter_recurse ( iter , & sub ) ;
if ( type ! = DBUS_MESSAGE_TYPE_METHOD_RETURN )
goto err_unref ;
if ( ! dbus_message_iter_init ( m , & iter ) | |
dbus_message_iter_get_arg_type ( & iter ) ! = DBUS_TYPE_VARIANT )
goto err_unref ;
dbus_message_iter_recurse ( & iter , & sub ) ;
if ( dbus_message_iter_get_arg_type ( & sub ) ! = DBUS_TYPE_BOOLEAN )
if ( dbus_message_iter_get_arg_type ( & sub ) ! = DBUS_TYPE_BOOLEAN )
goto err_unref ;
return ;
dbus_message_iter_get_basic ( & sub , & b ) ;
dbus_message_iter_get_basic ( & sub , & b ) ;
@ -322,8 +307,28 @@ get_active_cb(DBusPendingCall *pending, void *data)
* other backends , we immediately forward the Active - change event . */
* other backends , we immediately forward the Active - change event . */
if ( ! wl - > sync_drm | | ! b )
if ( ! wl - > sync_drm | | ! b )
weston_logind_set_active ( wl , b ) ;
weston_logind_set_active ( wl , b ) ;
}
static void
get_active_cb ( DBusPendingCall * pending , void * data )
{
struct weston_logind * wl = data ;
DBusMessageIter iter ;
DBusMessage * m ;
int type ;
dbus_pending_call_unref ( wl - > pending_active ) ;
wl - > pending_active = NULL ;
m = dbus_pending_call_steal_reply ( pending ) ;
if ( ! m )
return ;
type = dbus_message_get_type ( m ) ;
if ( type = = DBUS_MESSAGE_TYPE_METHOD_RETURN & &
dbus_message_iter_init ( m , & iter ) )
parse_active ( wl , m , & iter ) ;
err_unref :
dbus_message_unref ( m ) ;
dbus_message_unref ( m ) ;
}
}
@ -408,7 +413,6 @@ property_changed(struct weston_logind *wl, DBusMessage *m)
{
{
DBusMessageIter iter , sub , entry ;
DBusMessageIter iter , sub , entry ;
const char * interface , * name ;
const char * interface , * name ;
dbus_bool_t b ;
if ( ! dbus_message_iter_init ( m , & iter ) | |
if ( ! dbus_message_iter_init ( m , & iter ) | |
dbus_message_iter_get_arg_type ( & iter ) ! = DBUS_TYPE_STRING )
dbus_message_iter_get_arg_type ( & iter ) ! = DBUS_TYPE_STRING )
@ -433,12 +437,8 @@ property_changed(struct weston_logind *wl, DBusMessage *m)
goto error ;
goto error ;
if ( ! strcmp ( name , " Active " ) ) {
if ( ! strcmp ( name , " Active " ) ) {
if ( dbus_message_iter_get_arg_type ( & entry ) = = DBUS_TYPE_BOOLEAN ) {
parse_active ( wl , m , & entry ) ;
dbus_message_iter_get_basic ( & entry , & b ) ;
return ;
if ( ! b )
weston_logind_set_active ( wl , false ) ;
return ;
}
}
}
dbus_message_iter_next ( & sub ) ;
dbus_message_iter_next ( & sub ) ;