mirror of
https://github.com/cage-kiosk/cage.git
synced 2025-10-29 05:40:19 -04:00
output: use the output's preferred mode
On outputs that have modes, we need to set one before we can use it. We pick the preferred mode, or if this is not advertised, the last listed mode. This mode is generally the mode with the highest resolution. Fixes #10
This commit is contained in:
parent
5af455a905
commit
b16fc7d780
1 changed files with 4 additions and 7 deletions
11
output.c
11
output.c
|
|
@ -347,14 +347,11 @@ handle_new_output(struct wl_listener *listener, void *data)
|
|||
{
|
||||
struct cg_server *server = wl_container_of(listener, server, new_output);
|
||||
struct wlr_output *wlr_output = data;
|
||||
struct wlr_output_mode *preferred_mode;
|
||||
|
||||
/* On outputs that have modes, we need to set one before we
|
||||
* can use it. Each monitor supports only a specific set of
|
||||
* modes. We just pick the last, in the future we could pick
|
||||
* the mode the display advertises as preferred. */
|
||||
if (!wl_list_empty(&wlr_output->modes)) {
|
||||
struct wlr_output_mode *mode = wl_container_of(wlr_output->modes.prev, mode, link);
|
||||
wlr_output_set_mode(wlr_output, mode);
|
||||
preferred_mode = wlr_output_preferred_mode(wlr_output);
|
||||
if (preferred_mode) {
|
||||
wlr_output_set_mode(wlr_output, preferred_mode);
|
||||
}
|
||||
|
||||
server->output = calloc(1, sizeof(struct cg_output));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue