diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2025-07-05 13:25:51 +0200 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2025-07-05 13:25:51 +0200 |
| commit | e696b964d22e1c760d66a2e1b96b49db22807c22 (patch) | |
| tree | dea0dd9202de9d68c701ea5d32be442e2dfbd987 | |
| parent | 2347bbd94cf76a81fbf4cc921b4fd0181e395da5 (diff) | |
ipc-json, swaymsg: indicate when adaptive sync is unsupported
| -rw-r--r-- | sway/ipc-json.c | 6 | ||||
| -rw-r--r-- | swaymsg/main.c | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index d3adedd4..6a0d462f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -318,6 +318,12 @@ static void ipc_json_describe_wlr_output(struct wlr_output *wlr_output, json_obj json_object_array_add(modes_array, mode_object); } json_object_object_add(object, "modes", modes_array); + + json_object *features_object = json_object_new_object(); + json_object_object_add(features_object, "adaptive_sync", + json_object_new_boolean(wlr_output->adaptive_sync_supported || + wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED)); + json_object_object_add(object, "features", features_object); } static void ipc_json_describe_output(struct sway_output *output, diff --git a/swaymsg/main.c b/swaymsg/main.c index 6a9eb198..9152b794 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c @@ -210,6 +210,9 @@ static void pretty_print_output(json_object *o) { json_object_object_get_ex(current_mode, "width", &width); json_object_object_get_ex(current_mode, "height", &height); json_object_object_get_ex(current_mode, "refresh", &refresh); + json_object *features, *features_adaptive_sync; + json_object_object_get_ex(o, "features", &features); + json_object_object_get_ex(features, "adaptive_sync", &features_adaptive_sync); if (json_object_get_boolean(non_desktop)) { printf( @@ -252,7 +255,9 @@ static void pretty_print_output(json_object *o) { printf(max_render_time_int == 0 ? "off\n" : "%d ms\n", max_render_time_int); printf(" Adaptive sync: %s\n", - json_object_get_string(adaptive_sync_status)); + json_object_get_boolean(features_adaptive_sync) ? + json_object_get_string(adaptive_sync_status) : + "unsupported"); printf(" Allow tearing: %s\n", json_object_get_boolean(allow_tearing) ? "yes" : "no"); |
