Initial pass on HiDPI support

This commit is contained in:
Drew DeVault 2016-07-16 10:04:18 -04:00
parent a5af3bce98
commit 6ea02f3064
6 changed files with 34 additions and 14 deletions

View file

@ -406,20 +406,21 @@ static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geo
c->actual_geometry = g;
swayc_t *output = swayc_parent_by_type(c, C_OUTPUT);
const struct wlc_size *res = wlc_output_get_resolution(output->handle);
struct wlc_size res;
wlc_output_get_scaled_size(output->handle, &res);
switch (c->border_type) {
case B_NONE:
break;
case B_PIXEL:
adjust_border_geometry(c, &g, res, c->border_thickness,
adjust_border_geometry(c, &g, &res, c->border_thickness,
c->border_thickness, c->border_thickness, c->border_thickness);
break;
case B_NORMAL:
{
int title_bar_height = config->font_height + 4; // borders + padding
adjust_border_geometry(c, &g, res, c->border_thickness,
adjust_border_geometry(c, &g, &res, c->border_thickness,
c->border_thickness, title_bar_height, c->border_thickness);
struct wlc_geometry title_bar = {
@ -545,13 +546,15 @@ void update_geometry(swayc_t *container) {
gap = update_gap_geometry(container, &geometry);
}
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
struct wlc_size size;
wlc_output_get_scaled_size(output->handle, &size);
if (swayc_is_fullscreen(container)) {
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
const struct wlc_size *size = wlc_output_get_resolution(output->handle);
geometry.origin.x = 0;
geometry.origin.y = 0;
geometry.size.w = size->w;
geometry.size.h = size->h;
geometry.size.w = size.w;
geometry.size.h = size.h;
if (op->focused == workspace) {
wlc_view_bring_to_front(container->handle);
}
@ -576,7 +579,9 @@ void update_geometry(swayc_t *container) {
border_left = 0;
}
if (geometry.origin.x + geometry.size.w == workspace->x + workspace->width) {
if (geometry.origin.x + geometry.size.w == size.w ||
geometry.size.w == container->x + container->width) {
// should work for swaybar at right
border_right = 0;
}
}
@ -586,7 +591,9 @@ void update_geometry(swayc_t *container) {
border_top = 0;
}
if (geometry.origin.y + geometry.size.h == workspace->y + workspace->height) {
if (geometry.origin.y + geometry.size.h == size.h ||
geometry.size.h == container->y + container->height) {
// this works for swaybar at bottom
border_bottom = 0;
}
}
@ -721,7 +728,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
return;
case C_OUTPUT:
{
struct wlc_size resolution = *wlc_output_get_resolution(container->handle);
struct wlc_size resolution;
wlc_output_get_scaled_size(container->handle, &resolution);
width = resolution.w; height = resolution.h;
// output must have correct size due to e.g. seamless mouse,
// but a workspace might be smaller depending on panels.