diff options
-rw-r--r-- | sway/ipc-json.c | 18 | ||||
-rw-r--r-- | swaymsg/main.c | 11 |
2 files changed, 26 insertions, 3 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 7d3091dd..dc3fbc2f 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -85,6 +85,19 @@ static const char *ipc_json_output_transform_description(enum wl_output_transfor | |||
85 | return NULL; | 85 | return NULL; |
86 | } | 86 | } |
87 | 87 | ||
88 | static const char *ipc_json_output_adaptive_sync_status_description( | ||
89 | enum wlr_output_adaptive_sync_status status) { | ||
90 | switch (status) { | ||
91 | case WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED: | ||
92 | return "disabled"; | ||
93 | case WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED: | ||
94 | return "enabled"; | ||
95 | case WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN: | ||
96 | return "unknown"; | ||
97 | } | ||
98 | return NULL; | ||
99 | } | ||
100 | |||
88 | #if HAVE_XWAYLAND | 101 | #if HAVE_XWAYLAND |
89 | static const char *ipc_json_xwindow_type_description(struct sway_view *view) { | 102 | static const char *ipc_json_xwindow_type_description(struct sway_view *view) { |
90 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; | 103 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; |
@@ -219,6 +232,11 @@ static void ipc_json_describe_output(struct sway_output *output, | |||
219 | json_object_object_add(object, "transform", | 232 | json_object_object_add(object, "transform", |
220 | json_object_new_string( | 233 | json_object_new_string( |
221 | ipc_json_output_transform_description(wlr_output->transform))); | 234 | ipc_json_output_transform_description(wlr_output->transform))); |
235 | const char *adaptive_sync_status = | ||
236 | ipc_json_output_adaptive_sync_status_description( | ||
237 | wlr_output->adaptive_sync_status); | ||
238 | json_object_object_add(object, "adaptive_sync_status", | ||
239 | json_object_new_string(adaptive_sync_status)); | ||
222 | 240 | ||
223 | struct sway_workspace *ws = output_get_active_workspace(output); | 241 | struct sway_workspace *ws = output_get_active_workspace(output); |
224 | if (!sway_assert(ws, "Expected output to have a workspace")) { | 242 | if (!sway_assert(ws, "Expected output to have a workspace")) { |
diff --git a/swaymsg/main.c b/swaymsg/main.c index b9a8189c..f9d3515a 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -190,7 +190,7 @@ static void pretty_print_output(json_object *o) { | |||
190 | json_object_object_get_ex(o, "active", &active); | 190 | json_object_object_get_ex(o, "active", &active); |
191 | json_object_object_get_ex(o, "current_workspace", &ws); | 191 | json_object_object_get_ex(o, "current_workspace", &ws); |
192 | json_object *make, *model, *serial, *scale, *scale_filter, *subpixel, | 192 | json_object *make, *model, *serial, *scale, *scale_filter, *subpixel, |
193 | *transform, *max_render_time; | 193 | *transform, *max_render_time, *adaptive_sync_status; |
194 | json_object_object_get_ex(o, "make", &make); | 194 | json_object_object_get_ex(o, "make", &make); |
195 | json_object_object_get_ex(o, "model", &model); | 195 | json_object_object_get_ex(o, "model", &model); |
196 | json_object_object_get_ex(o, "serial", &serial); | 196 | json_object_object_get_ex(o, "serial", &serial); |
@@ -199,6 +199,7 @@ static void pretty_print_output(json_object *o) { | |||
199 | json_object_object_get_ex(o, "subpixel_hinting", &subpixel); | 199 | json_object_object_get_ex(o, "subpixel_hinting", &subpixel); |
200 | json_object_object_get_ex(o, "transform", &transform); | 200 | json_object_object_get_ex(o, "transform", &transform); |
201 | json_object_object_get_ex(o, "max_render_time", &max_render_time); | 201 | json_object_object_get_ex(o, "max_render_time", &max_render_time); |
202 | json_object_object_get_ex(o, "adaptive_sync_status", &adaptive_sync_status); | ||
202 | json_object *x, *y; | 203 | json_object *x, *y; |
203 | json_object_object_get_ex(rect, "x", &x); | 204 | json_object_object_get_ex(rect, "x", &x); |
204 | json_object_object_get_ex(rect, "y", &y); | 205 | json_object_object_get_ex(rect, "y", &y); |
@@ -219,8 +220,7 @@ static void pretty_print_output(json_object *o) { | |||
219 | " Scale filter: %s\n" | 220 | " Scale filter: %s\n" |
220 | " Subpixel hinting: %s\n" | 221 | " Subpixel hinting: %s\n" |
221 | " Transform: %s\n" | 222 | " Transform: %s\n" |
222 | " Workspace: %s\n" | 223 | " Workspace: %s\n", |
223 | " Max render time: ", | ||
224 | json_object_get_string(name), | 224 | json_object_get_string(name), |
225 | json_object_get_string(make), | 225 | json_object_get_string(make), |
226 | json_object_get_string(model), | 226 | json_object_get_string(model), |
@@ -236,8 +236,13 @@ static void pretty_print_output(json_object *o) { | |||
236 | json_object_get_string(transform), | 236 | json_object_get_string(transform), |
237 | json_object_get_string(ws) | 237 | json_object_get_string(ws) |
238 | ); | 238 | ); |
239 | |||
239 | int max_render_time_int = json_object_get_int(max_render_time); | 240 | int max_render_time_int = json_object_get_int(max_render_time); |
241 | printf(" Max render time: "); | ||
240 | printf(max_render_time_int == 0 ? "off\n" : "%d ms\n", max_render_time_int); | 242 | printf(max_render_time_int == 0 ? "off\n" : "%d ms\n", max_render_time_int); |
243 | |||
244 | printf(" Adaptive sync: %s\n", | ||
245 | json_object_get_string(adaptive_sync_status)); | ||
241 | } else { | 246 | } else { |
242 | printf( | 247 | printf( |
243 | "Output %s '%s %s %s' (inactive)\n", | 248 | "Output %s '%s %s %s' (inactive)\n", |