]> git.mdlowis.com Git - proto/labwc.git/commitdiff
src/xwayland.c: make size_hints globally accessible
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 17 Aug 2023 17:00:56 +0000 (19:00 +0200)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 19 Aug 2023 16:37:16 +0000 (18:37 +0200)
include/view.h
src/xwayland.c

index 5ba62a5b7bd4903391d662ae16d7b1d56351b468..01468745a15df83954956aebe345d9081fc6f48b 100644 (file)
@@ -57,6 +57,7 @@ struct view_impl {
        void (*move_to_back)(struct view *view);
        struct view *(*get_root)(struct view *self);
        void (*append_children)(struct view *self, struct wl_array *children);
+       void (*fill_size_hints)(struct view *self, struct wlr_box *box);
 };
 
 struct view {
index 2a67f0b634c9b0a3d85d06a91f6a905d5b00f7e1..4f9a84bd5e7808a51718d88e5a6738fb2b0db86e 100644 (file)
@@ -50,6 +50,21 @@ xwayland_apply_size_hints(struct view *view, int *w, int *h)
        return false;
 }
 
+static void
+xwayland_view_fill_size_hints(struct view *view, struct wlr_box *box)
+{
+       if (view->type == LAB_XWAYLAND_VIEW) {
+               xcb_size_hints_t *hints = xwayland_surface_from_view(view)->size_hints;
+               if (hints) {
+                       box->width = hints->width_inc;
+                       box->height = hints->height_inc;
+                       return;
+               }
+       }
+       box->width = 0;
+       box->height = 0;
+}
+
 static struct wlr_xwayland_surface *
 top_parent_of(struct view *view)
 {
@@ -639,6 +654,7 @@ static const struct view_impl xwayland_view_impl = {
        .move_to_back = xwayland_view_move_to_back,
        .get_root = xwayland_view_get_root,
        .append_children = xwayland_view_append_children,
+       .fill_size_hints = xwayland_view_fill_size_hints,
 };
 
 void