@@ -306,7 +306,7 @@ void print_cfg_commands(enum LogThreshold t, struct Cfg *cfg) {
306
306
}
307
307
}
308
308
309
- void print_head_current (enum LogThreshold t , enum InfoEvent event , struct Head * head ) {
309
+ void print_head_current (enum LogThreshold t , struct Head * head ) {
310
310
static const struct Output * output = NULL ;
311
311
312
312
if (!head )
@@ -324,11 +324,9 @@ void print_head_current(enum LogThreshold t, enum InfoEvent event, struct Head *
324
324
if (head -> current .transform ) {
325
325
log_ (t , " transform: %s" , transform_name (head -> current .transform ));
326
326
}
327
- }
328
327
329
- print_mode (t , head -> current .mode );
328
+ print_mode (t , head -> current .mode );
330
329
331
- if (head -> current .enabled ) {
332
330
log_ (t , " VRR: %s" , head -> current .adaptive_sync == ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED ? "on" : "off" );
333
331
} else {
334
332
log_ (t , " (disabled)" );
@@ -339,61 +337,45 @@ void print_head_current(enum LogThreshold t, enum InfoEvent event, struct Head *
339
337
}
340
338
}
341
339
342
- void print_head_deltas (enum LogThreshold t , struct Head * head ) {
340
+ void print_head_desired (enum LogThreshold t , struct Head * head ) {
343
341
if (!head )
344
342
return ;
345
343
346
- if (head -> current .enabled && !head -> desired .enabled ) {
347
- log_ (t , " (enabled) -> (disabled)" );
348
- return ;
349
- }
350
-
351
- if (!head -> current .enabled == head -> desired .enabled ) {
352
- log_ (t , " (disabled) -> (enabled)" );
353
- }
354
-
355
- // mode changes happen in their own operation
356
- if (head_current_mode_not_desired (head )) {
357
- if (head -> current .mode != head -> desired .mode ) {
358
- static char buf_current [2048 ];
359
- static char buf_desired [2048 ];
360
-
361
- info_mode_string (head -> current .mode , buf_current , sizeof (buf_current ));
362
- info_mode_string (head -> desired .mode , buf_desired , sizeof (buf_desired ));
363
-
364
- log_ (t , " mode: %s -> %s" , buf_current , buf_desired );
344
+ if (head -> desired .enabled ) {
345
+ if (head_current_mode_not_desired (head )) {
346
+ // mode changes happen in their own operation
347
+ if (!head -> current .enabled || head -> current .mode != head -> desired .mode ) {
348
+ print_mode (t , head -> desired .mode );
349
+ }
350
+ } else if (head_current_adaptive_sync_not_desired (head )) {
351
+ // adaptive sync changes happen in their own operation
352
+ log_ (t , " VRR: %s" , head -> desired .adaptive_sync == ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED ? "on" : "off" );
353
+ } else {
354
+ if (!head -> current .enabled || head -> current .scale != head -> desired .scale ) {
355
+ log_ (t , " scale: %.3f%s" ,
356
+ wl_fixed_to_double (head -> desired .scale ),
357
+ (!head -> width_mm || !head -> height_mm ) ? " (default, size not specified)" : ""
358
+ );
359
+ }
360
+ if (!head -> current .enabled || head -> current .x != head -> desired .x || head -> current .y != head -> desired .y ) {
361
+ log_ (t , " position: %d,%d" ,
362
+ head -> desired .x ,
363
+ head -> desired .y
364
+ );
365
+ }
366
+ if (!head -> current .enabled || head -> current .transform != head -> desired .transform ) {
367
+ if (head -> desired .transform ) {
368
+ log_ (t , " transform: %s" , transform_name (head -> desired .transform ));
369
+ } else {
370
+ log_ (t , " transform: none" );
371
+ }
372
+ }
365
373
}
366
- return ;
367
- }
368
-
369
- // adaptive sync changes happen in their own operation
370
- if (head_current_adaptive_sync_not_desired (head )) {
371
- log_ (t , " VRR: %s -> %s" ,
372
- head -> current .adaptive_sync == ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED ? "on" : "off" ,
373
- head -> desired .adaptive_sync == ZWLR_OUTPUT_HEAD_V1_ADAPTIVE_SYNC_STATE_ENABLED ? "on" : "off"
374
- );
375
- return ;
376
- }
377
-
378
- if (head -> current .scale != head -> desired .scale ) {
379
- log_ (t , " scale: %.3f -> %.3f" ,
380
- wl_fixed_to_double (head -> current .scale ),
381
- wl_fixed_to_double (head -> desired .scale )
382
- );
383
- }
384
-
385
- if (head -> current .x != head -> desired .x || head -> current .y != head -> desired .y ) {
386
- log_ (t , " position: %d,%d -> %d,%d" ,
387
- head -> current .x , head -> current .y ,
388
- head -> desired .x , head -> desired .y
389
- );
390
- }
391
-
392
- if (head -> current .transform != head -> desired .transform ) {
393
- log_ (t , " transform: %s -> %s" ,
394
- head -> current .transform ? transform_name (head -> current .transform ) : "none" ,
395
- head -> desired .transform ? transform_name (head -> desired .transform ) : "none"
396
- );
374
+ if (!head -> current .enabled ) {
375
+ log_ (t , " (enabled)" );
376
+ }
377
+ } else {
378
+ log_ (t , " (disabled)" );
397
379
}
398
380
}
399
381
@@ -431,7 +413,7 @@ void print_head(enum LogThreshold t, enum InfoEvent event, struct Head *head) {
431
413
print_modes_res_refresh (t , head );
432
414
print_modes_failed (t , head );
433
415
log_ (t , " current:" );
434
- print_head_current (t , event , head );
416
+ print_head_current (t , head );
435
417
break ;
436
418
case DEPARTED :
437
419
log_ (t , "\n%s Departed:" , head -> name );
@@ -443,7 +425,10 @@ void print_head(enum LogThreshold t, enum InfoEvent event, struct Head *head) {
443
425
case DELTA :
444
426
if (head_current_not_desired (head )) {
445
427
log_ (t , "\n%s Changing:" , head -> name );
446
- print_head_deltas (t , head );
428
+ log_ (t , " from:" );
429
+ print_head_current (t , head );
430
+ log_ (t , " to:" );
431
+ print_head_desired (t , head );
447
432
}
448
433
break ;
449
434
default :
0 commit comments