]> git.mdlowis.com Git - proto/labwc.git/commitdiff
HiDPI: fix osd placement and maximized scale
authorARDiDo <90479315+ARDiDo@users.noreply.github.com>
Wed, 24 Nov 2021 16:11:48 +0000 (11:11 -0500)
committerARDiDo <90479315+ARDiDo@users.noreply.github.com>
Wed, 24 Nov 2021 22:33:10 +0000 (17:33 -0500)
src/output.c
src/view.c

index 73b1549799aed6940e573dc0edbf2eeee38e47d3..d215ff8a05ed1cb4eb2bb1ea0537244ca6155635 100644 (file)
@@ -522,14 +522,20 @@ render_osd(struct output *output, pixman_region32_t *damage,
 
        /* show on screen display (osd) on all outputs */
        struct output *o;
+       struct wlr_output_layout *layout = server->output_layout;
+       struct wlr_output_layout_output *ol_output;
        wl_list_for_each(o, &server->outputs, link) {
-               struct wlr_box usable = output_usable_area_in_layout_coords(o);
+               ol_output = wlr_output_layout_get(layout, o->wlr_output);
                struct wlr_box box = {
-                       .x = usable.x + (usable.width - server->osd->width) / 2,
-                       .y = usable.y + (usable.height - server->osd->height) / 2,
+                       .x = ol_output->x + o->wlr_output->width
+                               / o->wlr_output->scale / 2,
+                       .y = ol_output->y + o->wlr_output->height
+                               / o->wlr_output->scale / 2,
                        .width = server->osd->width,
                        .height = server->osd->height,
                };
+               box.x -= server->osd->width / 2;
+               box.y -= server->osd->height / 2;
                render_texture_helper(output, damage, &box, server->osd);
        }
 }
index 5d55cb5db677f54656ce0bb65788aa0d8e9e2c81..1654c5698e3afd1cef296af847d568284831d022 100644 (file)
@@ -139,6 +139,12 @@ view_maximize(struct view *view, bool maximize)
 
                struct output *output = view_output(view);
                struct wlr_box box = output_usable_area_in_layout_coords(output);
+               if (box.height == output->wlr_output->height && output->wlr_output->scale != 1) {
+                       box.height /= output->wlr_output->scale;
+               }
+               if (box.width == output->wlr_output->width && output->wlr_output->scale != 1) {
+                       box.width /= output->wlr_output->scale;
+               }
 
                if (view->ssd.enabled) {
                        struct border border = ssd_thickness(view);