@@ -1123,9 +1123,7 @@ static DBusHandlerResult cdbus_process_introspect(DBusMessage *reply) {
1123
1123
}
1124
1124
///@}
1125
1125
1126
- /**
1127
- * Process an D-Bus Introspect request, for /windows.
1128
- */
1126
+ /// Process an D-Bus Introspect request, for /windows.
1129
1127
static DBusHandlerResult
1130
1128
cdbus_process_windows_root_introspect (session_t * ps , DBusMessage * reply ) {
1131
1129
static const char * str_introspect =
@@ -1207,6 +1205,11 @@ static bool cdbus_process_window_introspect(DBusMessage *reply) {
1207
1205
" <property type='b' name='Mapped' access='read'/>\n"
1208
1206
" <property type='s' name='Name' access='read'/>\n"
1209
1207
" <property type='as' name='Type' access='read'/>\n"
1208
+ " <method name='BlockUnblockAnimation'>\n"
1209
+ " <arg type='s' name='trigger' direction='in'/>\n"
1210
+ " <arg type='b' name='block' direction='in'/>\n"
1211
+ " <arg type='u' name='count' direction='out'/>\n"
1212
+ " </method>\n"
1210
1213
" </interface>\n"
1211
1214
"</node>\n" ;
1212
1215
// clang-format on
@@ -1422,6 +1425,39 @@ cdbus_process_windows(DBusConnection *conn, DBusMessage *msg, void *ud) {
1422
1425
"Unexpected member \"%s\" of dbus properties interface." , member );
1423
1426
dbus_set_error_const (& err , DBUS_ERROR_UNKNOWN_METHOD , NULL );
1424
1427
}
1428
+ } else if (strcmp (interface , PICOM_WINDOW_INTERFACE ) == 0 &&
1429
+ strcmp (member , "BlockUnblockAnimation" ) == 0 ) {
1430
+ bool block = false;
1431
+ const char * trigger_str = NULL ;
1432
+ if (!cdbus_msg_get_arg (msg , 0 , DBUS_TYPE_STRING , & trigger_str ) ||
1433
+ !cdbus_msg_get_arg (msg , 1 , DBUS_TYPE_BOOLEAN , & block )) {
1434
+ dbus_set_error_const (& err , DBUS_ERROR_INVALID_ARGS , NULL );
1435
+ goto finished ;
1436
+ }
1437
+ auto trigger = parse_animation_trigger (trigger_str );
1438
+ if (trigger == ANIMATION_TRIGGER_INVALID ) {
1439
+ dbus_set_error (& err , CDBUS_ERROR_BADTGT , CDBUS_ERROR_BADTGT_S ,
1440
+ trigger_str );
1441
+ goto finished ;
1442
+ }
1443
+ auto cursor = wm_find (ps -> wm , wid );
1444
+ if (cursor == NULL ) {
1445
+ dbus_set_error (& err , CDBUS_ERROR_BADWIN , CDBUS_ERROR_BADWIN_S , wid );
1446
+ goto finished ;
1447
+ }
1448
+ auto w = wm_ref_deref (cursor );
1449
+ unsigned count = 0 ;
1450
+ if (w != NULL ) {
1451
+ if (block ) {
1452
+ w -> animation_block [trigger ] += 1 ;
1453
+ } else if (w -> animation_block [trigger ] > 0 ) {
1454
+ w -> animation_block [trigger ] -= 1 ;
1455
+ }
1456
+ count = w -> animation_block [trigger ];
1457
+ }
1458
+ if (reply != NULL && !cdbus_append_uint32 (reply , count )) {
1459
+ ret = DBUS_HANDLER_RESULT_NEED_MEMORY ;
1460
+ }
1425
1461
} else {
1426
1462
log_debug ("Illegal message of type \"%s\", path \"%s\" "
1427
1463
"interface \"%s\", member \"%s\"" ,
0 commit comments