diff options
author | Drew DeVault <ddevault@linode.com> | 2016-07-18 16:21:45 -0400 |
---|---|---|
committer | Drew DeVault <ddevault@linode.com> | 2016-07-28 14:36:49 -0400 |
commit | 11e7ca044c61f0bcce95a90b50814f780f769f21 (patch) | |
tree | 70a4b6d6e476471a7f290f8c1278b01b275358be /sway | |
parent | Initial pass on HiDPI support (diff) | |
download | sway-11e7ca044c61f0bcce95a90b50814f780f769f21.tar.gz sway-11e7ca044c61f0bcce95a90b50814f780f769f21.tar.zst sway-11e7ca044c61f0bcce95a90b50814f780f769f21.zip |
Update hidpi support to latest wlc API
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 6 | ||||
-rw-r--r-- | sway/config.c | 10 | ||||
-rw-r--r-- | sway/container.c | 2 | ||||
-rw-r--r-- | sway/handlers.c | 2 | ||||
-rw-r--r-- | sway/layout.c | 6 | ||||
-rw-r--r-- | sway/output.c | 7 |
6 files changed, 20 insertions, 13 deletions
diff --git a/sway/commands.c b/sway/commands.c index 89d4337c..053b5792 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -1706,10 +1706,10 @@ static struct cmd_results *cmd_output(int argc, char **argv) { | |||
1706 | list_add(config->output_configs, output); | 1706 | list_add(config->output_configs, output); |
1707 | } | 1707 | } |
1708 | 1708 | ||
1709 | sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d) (bg %s %s)", | 1709 | sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d scale %d) (bg %s %s)", |
1710 | output->name, output->enabled, output->width, | 1710 | output->name, output->enabled, output->width, |
1711 | output->height, output->x, output->y, output->background, | 1711 | output->height, output->x, output->y, output->scale, |
1712 | output->background_option); | 1712 | output->background, output->background_option); |
1713 | 1713 | ||
1714 | if (output->name) { | 1714 | if (output->name) { |
1715 | // Try to find the output container and apply configuration now. If | 1715 | // Try to find the output container and apply configuration now. If |
diff --git a/sway/config.c b/sway/config.c index 83129524..25566213 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -863,12 +863,12 @@ void apply_output_config(struct output_config *oc, swayc_t *output) { | |||
863 | output->width = oc->width; | 863 | output->width = oc->width; |
864 | output->height = oc->height; | 864 | output->height = oc->height; |
865 | 865 | ||
866 | sway_log(L_DEBUG, "Set %s size to %ix%i", oc->name, oc->width, oc->height); | 866 | sway_log(L_DEBUG, "Set %s size to %ix%i (%d)", oc->name, oc->width, oc->height, oc->scale); |
867 | struct wlc_size new_size = { .w = oc->width, .h = oc->height }; | 867 | struct wlc_size new_size = { .w = oc->width, .h = oc->height }; |
868 | wlc_output_set_resolution(output->handle, &new_size); | 868 | wlc_output_set_resolution(output->handle, &new_size, (uint32_t)oc->scale); |
869 | } | 869 | } else if (oc && oc->scale != 1) { |
870 | if (oc && oc->scale != 1) { | 870 | const struct wlc_size *new_size = wlc_output_get_resolution(output->handle); |
871 | wlc_output_set_scale(output->handle, (int32_t)oc->scale); | 871 | wlc_output_set_resolution(output->handle, new_size, (uint32_t)oc->scale); |
872 | } | 872 | } |
873 | 873 | ||
874 | // Find position for it | 874 | // Find position for it |
diff --git a/sway/container.c b/sway/container.c index df9ce724..c922bac3 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -103,7 +103,7 @@ static void update_root_geometry() { | |||
103 | 103 | ||
104 | swayc_t *new_output(wlc_handle handle) { | 104 | swayc_t *new_output(wlc_handle handle) { |
105 | struct wlc_size size; | 105 | struct wlc_size size; |
106 | wlc_output_get_scaled_size(handle, &size); | 106 | output_get_scaled_size(handle, &size); |
107 | const char *name = wlc_output_get_name(handle); | 107 | const char *name = wlc_output_get_name(handle); |
108 | // Find current outputs to see if this already exists | 108 | // Find current outputs to see if this already exists |
109 | { | 109 | { |
diff --git a/sway/handlers.c b/sway/handlers.c index ad035e38..7e958c72 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -57,7 +57,7 @@ static struct background_config *if_background_find_config(struct wl_client *cli | |||
57 | 57 | ||
58 | static struct wlc_geometry compute_panel_geometry(struct panel_config *config) { | 58 | static struct wlc_geometry compute_panel_geometry(struct panel_config *config) { |
59 | struct wlc_size resolution; | 59 | struct wlc_size resolution; |
60 | wlc_output_get_scaled_size(config->output, &resolution); | 60 | output_get_scaled_size(config->output, &resolution); |
61 | const struct wlc_geometry *old = wlc_view_get_geometry(config->handle); | 61 | const struct wlc_geometry *old = wlc_view_get_geometry(config->handle); |
62 | struct wlc_geometry new; | 62 | struct wlc_geometry new; |
63 | 63 | ||
diff --git a/sway/layout.c b/sway/layout.c index 2037955e..db9787f3 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -407,7 +407,7 @@ static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geo | |||
407 | 407 | ||
408 | swayc_t *output = swayc_parent_by_type(c, C_OUTPUT); | 408 | swayc_t *output = swayc_parent_by_type(c, C_OUTPUT); |
409 | struct wlc_size res; | 409 | struct wlc_size res; |
410 | wlc_output_get_scaled_size(output->handle, &res); | 410 | output_get_scaled_size(output->handle, &res); |
411 | 411 | ||
412 | switch (c->border_type) { | 412 | switch (c->border_type) { |
413 | case B_NONE: | 413 | case B_NONE: |
@@ -548,7 +548,7 @@ void update_geometry(swayc_t *container) { | |||
548 | 548 | ||
549 | swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); | 549 | swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); |
550 | struct wlc_size size; | 550 | struct wlc_size size; |
551 | wlc_output_get_scaled_size(output->handle, &size); | 551 | output_get_scaled_size(output->handle, &size); |
552 | 552 | ||
553 | if (swayc_is_fullscreen(container)) { | 553 | if (swayc_is_fullscreen(container)) { |
554 | geometry.origin.x = 0; | 554 | geometry.origin.x = 0; |
@@ -729,7 +729,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
729 | case C_OUTPUT: | 729 | case C_OUTPUT: |
730 | { | 730 | { |
731 | struct wlc_size resolution; | 731 | struct wlc_size resolution; |
732 | wlc_output_get_scaled_size(container->handle, &resolution); | 732 | output_get_scaled_size(container->handle, &resolution); |
733 | width = resolution.w; height = resolution.h; | 733 | width = resolution.w; height = resolution.h; |
734 | // output must have correct size due to e.g. seamless mouse, | 734 | // output must have correct size due to e.g. seamless mouse, |
735 | // but a workspace might be smaller depending on panels. | 735 | // but a workspace might be smaller depending on panels. |
diff --git a/sway/output.c b/sway/output.c index d56a2f30..97b8a4a6 100644 --- a/sway/output.c +++ b/sway/output.c | |||
@@ -5,6 +5,13 @@ | |||
5 | #include "log.h" | 5 | #include "log.h" |
6 | #include "list.h" | 6 | #include "list.h" |
7 | 7 | ||
8 | void output_get_scaled_size(wlc_handle handle, struct wlc_size *size) { | ||
9 | *size = *wlc_output_get_resolution(handle); | ||
10 | uint32_t scale = wlc_output_get_scale(handle); | ||
11 | size->w /= scale; | ||
12 | size->h /= scale; | ||
13 | } | ||
14 | |||
8 | swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos) { | 15 | swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos) { |
9 | if (strcasecmp(name, "left") == 0) { | 16 | if (strcasecmp(name, "left") == 0) { |
10 | return swayc_adjacent_output(NULL, MOVE_LEFT, abs_pos, true); | 17 | return swayc_adjacent_output(NULL, MOVE_LEFT, abs_pos, true); |