mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 07:56:31 +01:00
Add adaptive_sync_status to output IPC reply
This commit is contained in:
parent
5d692b0581
commit
a2d49099e1
2 changed files with 26 additions and 3 deletions
|
@ -85,6 +85,19 @@ static const char *ipc_json_output_transform_description(enum wl_output_transfor
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *ipc_json_output_adaptive_sync_status_description(
|
||||||
|
enum wlr_output_adaptive_sync_status status) {
|
||||||
|
switch (status) {
|
||||||
|
case WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED:
|
||||||
|
return "disabled";
|
||||||
|
case WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED:
|
||||||
|
return "enabled";
|
||||||
|
case WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
static const char *ipc_json_xwindow_type_description(struct sway_view *view) {
|
static const char *ipc_json_xwindow_type_description(struct sway_view *view) {
|
||||||
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
|
||||||
|
@ -219,6 +232,11 @@ static void ipc_json_describe_output(struct sway_output *output,
|
||||||
json_object_object_add(object, "transform",
|
json_object_object_add(object, "transform",
|
||||||
json_object_new_string(
|
json_object_new_string(
|
||||||
ipc_json_output_transform_description(wlr_output->transform)));
|
ipc_json_output_transform_description(wlr_output->transform)));
|
||||||
|
const char *adaptive_sync_status =
|
||||||
|
ipc_json_output_adaptive_sync_status_description(
|
||||||
|
wlr_output->adaptive_sync_status);
|
||||||
|
json_object_object_add(object, "adaptive_sync_status",
|
||||||
|
json_object_new_string(adaptive_sync_status));
|
||||||
|
|
||||||
struct sway_workspace *ws = output_get_active_workspace(output);
|
struct sway_workspace *ws = output_get_active_workspace(output);
|
||||||
if (!sway_assert(ws, "Expected output to have a workspace")) {
|
if (!sway_assert(ws, "Expected output to have a workspace")) {
|
||||||
|
|
|
@ -190,7 +190,7 @@ static void pretty_print_output(json_object *o) {
|
||||||
json_object_object_get_ex(o, "active", &active);
|
json_object_object_get_ex(o, "active", &active);
|
||||||
json_object_object_get_ex(o, "current_workspace", &ws);
|
json_object_object_get_ex(o, "current_workspace", &ws);
|
||||||
json_object *make, *model, *serial, *scale, *scale_filter, *subpixel,
|
json_object *make, *model, *serial, *scale, *scale_filter, *subpixel,
|
||||||
*transform, *max_render_time;
|
*transform, *max_render_time, *adaptive_sync_status;
|
||||||
json_object_object_get_ex(o, "make", &make);
|
json_object_object_get_ex(o, "make", &make);
|
||||||
json_object_object_get_ex(o, "model", &model);
|
json_object_object_get_ex(o, "model", &model);
|
||||||
json_object_object_get_ex(o, "serial", &serial);
|
json_object_object_get_ex(o, "serial", &serial);
|
||||||
|
@ -199,6 +199,7 @@ static void pretty_print_output(json_object *o) {
|
||||||
json_object_object_get_ex(o, "subpixel_hinting", &subpixel);
|
json_object_object_get_ex(o, "subpixel_hinting", &subpixel);
|
||||||
json_object_object_get_ex(o, "transform", &transform);
|
json_object_object_get_ex(o, "transform", &transform);
|
||||||
json_object_object_get_ex(o, "max_render_time", &max_render_time);
|
json_object_object_get_ex(o, "max_render_time", &max_render_time);
|
||||||
|
json_object_object_get_ex(o, "adaptive_sync_status", &adaptive_sync_status);
|
||||||
json_object *x, *y;
|
json_object *x, *y;
|
||||||
json_object_object_get_ex(rect, "x", &x);
|
json_object_object_get_ex(rect, "x", &x);
|
||||||
json_object_object_get_ex(rect, "y", &y);
|
json_object_object_get_ex(rect, "y", &y);
|
||||||
|
@ -219,8 +220,7 @@ static void pretty_print_output(json_object *o) {
|
||||||
" Scale filter: %s\n"
|
" Scale filter: %s\n"
|
||||||
" Subpixel hinting: %s\n"
|
" Subpixel hinting: %s\n"
|
||||||
" Transform: %s\n"
|
" Transform: %s\n"
|
||||||
" Workspace: %s\n"
|
" Workspace: %s\n",
|
||||||
" Max render time: ",
|
|
||||||
json_object_get_string(name),
|
json_object_get_string(name),
|
||||||
json_object_get_string(make),
|
json_object_get_string(make),
|
||||||
json_object_get_string(model),
|
json_object_get_string(model),
|
||||||
|
@ -236,8 +236,13 @@ static void pretty_print_output(json_object *o) {
|
||||||
json_object_get_string(transform),
|
json_object_get_string(transform),
|
||||||
json_object_get_string(ws)
|
json_object_get_string(ws)
|
||||||
);
|
);
|
||||||
|
|
||||||
int max_render_time_int = json_object_get_int(max_render_time);
|
int max_render_time_int = json_object_get_int(max_render_time);
|
||||||
|
printf(" Max render time: ");
|
||||||
printf(max_render_time_int == 0 ? "off\n" : "%d ms\n", max_render_time_int);
|
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));
|
||||||
} else {
|
} else {
|
||||||
printf(
|
printf(
|
||||||
"Output %s '%s %s %s' (inactive)\n",
|
"Output %s '%s %s %s' (inactive)\n",
|
||||||
|
|
Loading…
Reference in a new issue