mirror of
https://github.com/swaywm/sway.git
synced 2025-10-08 13:16:05 +00:00
Merge 273c1224cf
into b4a9a1716f
This commit is contained in:
commit
4f2b4db9f0
5 changed files with 43 additions and 12 deletions
|
@ -681,7 +681,7 @@ struct seat_config *store_seat_config(struct seat_config *seat);
|
|||
int output_name_cmp(const void *item, const void *data);
|
||||
|
||||
void output_get_identifier(char *identifier, size_t len,
|
||||
struct sway_output *output);
|
||||
struct wlr_output *output);
|
||||
|
||||
const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filter);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
|||
output = new_output_config(sway_output->wlr_output->name);
|
||||
} else {
|
||||
char identifier[128];
|
||||
output_get_identifier(identifier, 128, sway_output);
|
||||
output_get_identifier(identifier, 128, sway_output->wlr_output);
|
||||
output = new_output_config(identifier);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#endif
|
||||
|
||||
void output_get_identifier(char *identifier, size_t len,
|
||||
struct sway_output *output) {
|
||||
struct wlr_output *wlr_output = output->wlr_output;
|
||||
struct wlr_output *wlr_output) {
|
||||
snprintf(identifier, len, "%s %s %s",
|
||||
wlr_output->make ? wlr_output->make : "Unknown",
|
||||
wlr_output->model ? wlr_output->model : "Unknown",
|
||||
|
@ -245,7 +244,7 @@ void store_output_config(struct output_config *oc) {
|
|||
|
||||
char id[128];
|
||||
if (output) {
|
||||
output_get_identifier(id, sizeof(id), output);
|
||||
output_get_identifier(id, sizeof(id), output->wlr_output);
|
||||
}
|
||||
|
||||
for (int i = 0; i < config->output_configs->length; i++) {
|
||||
|
@ -648,7 +647,7 @@ static struct output_config *find_output_config_from_list(
|
|||
}
|
||||
|
||||
char id[128];
|
||||
output_get_identifier(id, sizeof(id), sway_output);
|
||||
output_get_identifier(id, sizeof(id), sway_output->wlr_output);
|
||||
|
||||
// We take a new config and merge on top, in order, the wildcard config,
|
||||
// output config by name, and output config by identifier to form the final
|
||||
|
|
|
@ -47,7 +47,7 @@ bool output_match_name_or_id(struct sway_output *output,
|
|||
}
|
||||
|
||||
char identifier[128];
|
||||
output_get_identifier(identifier, sizeof(identifier), output);
|
||||
output_get_identifier(identifier, sizeof(identifier), output->wlr_output);
|
||||
return strcasecmp(identifier, name_or_id) == 0
|
||||
|| strcasecmp(output->wlr_output->name, name_or_id) == 0;
|
||||
}
|
||||
|
@ -522,6 +522,39 @@ static void handle_request_state(struct wl_listener *listener, void *data) {
|
|||
force_modeset();
|
||||
}
|
||||
|
||||
static void dump_output(struct wlr_output *output) {
|
||||
bool supports_bt2020 = output->supported_primaries &
|
||||
WLR_COLOR_NAMED_PRIMARIES_BT2020;
|
||||
bool supports_pq = output->supported_transfer_functions &
|
||||
WLR_COLOR_TRANSFER_FUNCTION_ST2084_PQ;
|
||||
bool supports_color_transform =
|
||||
server.renderer->features.output_color_transform;
|
||||
|
||||
const char *hdr_support = "yes";
|
||||
if (!supports_bt2020 && !supports_pq) {
|
||||
hdr_support = "no";
|
||||
} else if (supports_bt2020 && supports_pq && !supports_color_transform) {
|
||||
hdr_support = "no (missing renderer color transform support)";
|
||||
} else if (!supports_bt2020) {
|
||||
hdr_support = "no (missing BT2020 primaries)";
|
||||
} else if (!supports_pq) {
|
||||
hdr_support = "no (missing PQ transfer function)";
|
||||
}
|
||||
|
||||
char id[128];
|
||||
output_get_identifier(id, sizeof(id), output);
|
||||
|
||||
sway_log(SWAY_INFO, "New output: %s", output->name);
|
||||
sway_log(SWAY_INFO, " Identifier: %s", id);
|
||||
sway_log(SWAY_INFO, " Dimensions: %dmm x %dmm",
|
||||
output->phys_width, output->phys_height);
|
||||
sway_log(SWAY_INFO, " Non-desktop: %s",
|
||||
output->non_desktop ? "yes" : "no");
|
||||
sway_log(SWAY_INFO, " Adaptive sync support: %s",
|
||||
output->adaptive_sync_supported ? "yes" : "no");
|
||||
sway_log(SWAY_INFO, " HDR support: %s", hdr_support);
|
||||
}
|
||||
|
||||
static unsigned int last_headless_num = 0;
|
||||
|
||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||
|
@ -538,8 +571,7 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||
wlr_output_set_name(wlr_output, name);
|
||||
}
|
||||
|
||||
sway_log(SWAY_DEBUG, "New output %p: %s (non-desktop: %d)",
|
||||
wlr_output, wlr_output->name, wlr_output->non_desktop);
|
||||
dump_output(wlr_output);
|
||||
|
||||
if (wlr_output->non_desktop) {
|
||||
sway_log(SWAY_DEBUG, "Not configuring non-desktop output");
|
||||
|
|
|
@ -623,7 +623,7 @@ static int find_output(const void *id1, const void *id2) {
|
|||
static int workspace_output_get_priority(struct sway_workspace *ws,
|
||||
struct sway_output *output) {
|
||||
char identifier[128];
|
||||
output_get_identifier(identifier, sizeof(identifier), output);
|
||||
output_get_identifier(identifier, sizeof(identifier), output->wlr_output);
|
||||
int index_id = list_seq_find(ws->output_priority, find_output, identifier);
|
||||
int index_name = list_seq_find(ws->output_priority, find_output,
|
||||
output->wlr_output->name);
|
||||
|
@ -640,7 +640,7 @@ void workspace_output_raise_priority(struct sway_workspace *ws,
|
|||
int new_index = workspace_output_get_priority(ws, output);
|
||||
if (new_index < 0) {
|
||||
char identifier[128];
|
||||
output_get_identifier(identifier, sizeof(identifier), output);
|
||||
output_get_identifier(identifier, sizeof(identifier), output->wlr_output);
|
||||
list_insert(ws->output_priority, old_index, strdup(identifier));
|
||||
} else if (new_index > old_index) {
|
||||
char *name = ws->output_priority->items[new_index];
|
||||
|
@ -653,7 +653,7 @@ void workspace_output_add_priority(struct sway_workspace *workspace,
|
|||
struct sway_output *output) {
|
||||
if (workspace_output_get_priority(workspace, output) < 0) {
|
||||
char identifier[128];
|
||||
output_get_identifier(identifier, sizeof(identifier), output);
|
||||
output_get_identifier(identifier, sizeof(identifier), output->wlr_output);
|
||||
list_add(workspace->output_priority, strdup(identifier));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue