mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 14:04:11 +01:00
Update hidpi support to latest wlc API
This commit is contained in:
parent
6ea02f3064
commit
11e7ca044c
@ -19,4 +19,6 @@ void get_absolute_center_position(swayc_t *container, struct wlc_point *point);
|
|||||||
// stable sort workspaces on this output
|
// stable sort workspaces on this output
|
||||||
void sort_workspaces(swayc_t *output);
|
void sort_workspaces(swayc_t *output);
|
||||||
|
|
||||||
|
void output_get_scaled_size(wlc_handle handle, struct wlc_size *size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1706,10 +1706,10 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
|
|||||||
list_add(config->output_configs, output);
|
list_add(config->output_configs, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d) (bg %s %s)",
|
sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d scale %d) (bg %s %s)",
|
||||||
output->name, output->enabled, output->width,
|
output->name, output->enabled, output->width,
|
||||||
output->height, output->x, output->y, output->background,
|
output->height, output->x, output->y, output->scale,
|
||||||
output->background_option);
|
output->background, output->background_option);
|
||||||
|
|
||||||
if (output->name) {
|
if (output->name) {
|
||||||
// Try to find the output container and apply configuration now. If
|
// Try to find the output container and apply configuration now. If
|
||||||
|
@ -863,12 +863,12 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
|
|||||||
output->width = oc->width;
|
output->width = oc->width;
|
||||||
output->height = oc->height;
|
output->height = oc->height;
|
||||||
|
|
||||||
sway_log(L_DEBUG, "Set %s size to %ix%i", oc->name, oc->width, oc->height);
|
sway_log(L_DEBUG, "Set %s size to %ix%i (%d)", oc->name, oc->width, oc->height, oc->scale);
|
||||||
struct wlc_size new_size = { .w = oc->width, .h = oc->height };
|
struct wlc_size new_size = { .w = oc->width, .h = oc->height };
|
||||||
wlc_output_set_resolution(output->handle, &new_size);
|
wlc_output_set_resolution(output->handle, &new_size, (uint32_t)oc->scale);
|
||||||
}
|
} else if (oc && oc->scale != 1) {
|
||||||
if (oc && oc->scale != 1) {
|
const struct wlc_size *new_size = wlc_output_get_resolution(output->handle);
|
||||||
wlc_output_set_scale(output->handle, (int32_t)oc->scale);
|
wlc_output_set_resolution(output->handle, new_size, (uint32_t)oc->scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find position for it
|
// Find position for it
|
||||||
|
@ -103,7 +103,7 @@ static void update_root_geometry() {
|
|||||||
|
|
||||||
swayc_t *new_output(wlc_handle handle) {
|
swayc_t *new_output(wlc_handle handle) {
|
||||||
struct wlc_size size;
|
struct wlc_size size;
|
||||||
wlc_output_get_scaled_size(handle, &size);
|
output_get_scaled_size(handle, &size);
|
||||||
const char *name = wlc_output_get_name(handle);
|
const char *name = wlc_output_get_name(handle);
|
||||||
// Find current outputs to see if this already exists
|
// Find current outputs to see if this already exists
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ static struct background_config *if_background_find_config(struct wl_client *cli
|
|||||||
|
|
||||||
static struct wlc_geometry compute_panel_geometry(struct panel_config *config) {
|
static struct wlc_geometry compute_panel_geometry(struct panel_config *config) {
|
||||||
struct wlc_size resolution;
|
struct wlc_size resolution;
|
||||||
wlc_output_get_scaled_size(config->output, &resolution);
|
output_get_scaled_size(config->output, &resolution);
|
||||||
const struct wlc_geometry *old = wlc_view_get_geometry(config->handle);
|
const struct wlc_geometry *old = wlc_view_get_geometry(config->handle);
|
||||||
struct wlc_geometry new;
|
struct wlc_geometry new;
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geo
|
|||||||
|
|
||||||
swayc_t *output = swayc_parent_by_type(c, C_OUTPUT);
|
swayc_t *output = swayc_parent_by_type(c, C_OUTPUT);
|
||||||
struct wlc_size res;
|
struct wlc_size res;
|
||||||
wlc_output_get_scaled_size(output->handle, &res);
|
output_get_scaled_size(output->handle, &res);
|
||||||
|
|
||||||
switch (c->border_type) {
|
switch (c->border_type) {
|
||||||
case B_NONE:
|
case B_NONE:
|
||||||
@ -548,7 +548,7 @@ void update_geometry(swayc_t *container) {
|
|||||||
|
|
||||||
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
|
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
|
||||||
struct wlc_size size;
|
struct wlc_size size;
|
||||||
wlc_output_get_scaled_size(output->handle, &size);
|
output_get_scaled_size(output->handle, &size);
|
||||||
|
|
||||||
if (swayc_is_fullscreen(container)) {
|
if (swayc_is_fullscreen(container)) {
|
||||||
geometry.origin.x = 0;
|
geometry.origin.x = 0;
|
||||||
@ -729,7 +729,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
|
|||||||
case C_OUTPUT:
|
case C_OUTPUT:
|
||||||
{
|
{
|
||||||
struct wlc_size resolution;
|
struct wlc_size resolution;
|
||||||
wlc_output_get_scaled_size(container->handle, &resolution);
|
output_get_scaled_size(container->handle, &resolution);
|
||||||
width = resolution.w; height = resolution.h;
|
width = resolution.w; height = resolution.h;
|
||||||
// output must have correct size due to e.g. seamless mouse,
|
// output must have correct size due to e.g. seamless mouse,
|
||||||
// but a workspace might be smaller depending on panels.
|
// but a workspace might be smaller depending on panels.
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
void output_get_scaled_size(wlc_handle handle, struct wlc_size *size) {
|
||||||
|
*size = *wlc_output_get_resolution(handle);
|
||||||
|
uint32_t scale = wlc_output_get_scale(handle);
|
||||||
|
size->w /= scale;
|
||||||
|
size->h /= scale;
|
||||||
|
}
|
||||||
|
|
||||||
swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos) {
|
swayc_t *output_by_name(const char* name, const struct wlc_point *abs_pos) {
|
||||||
if (strcasecmp(name, "left") == 0) {
|
if (strcasecmp(name, "left") == 0) {
|
||||||
return swayc_adjacent_output(NULL, MOVE_LEFT, abs_pos, true);
|
return swayc_adjacent_output(NULL, MOVE_LEFT, abs_pos, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user