mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 08:21:28 +00:00
Fix borders with floating windows
This commit is contained in:
parent
6fa6c27f3d
commit
0af55539a8
|
@ -349,13 +349,13 @@ static void handle_view_geometry_request(wlc_handle handle, const struct wlc_geo
|
|||
view->desired_width = geometry->size.w;
|
||||
view->desired_height = geometry->size.h;
|
||||
|
||||
/* if (view->is_floating) { */
|
||||
/* view->width = view->desired_width; */
|
||||
/* view->height = view->desired_height; */
|
||||
/* view->x = geometry->origin.x; */
|
||||
/* view->y = geometry->origin.y; */
|
||||
/* /1* arrange_windows(view->parent, -1, -1); *1/ */
|
||||
/* } */
|
||||
if (view->is_floating) {
|
||||
view->width = view->desired_width;
|
||||
view->height = view->desired_height;
|
||||
view->x = geometry->origin.x;
|
||||
view->y = geometry->origin.y;
|
||||
arrange_windows(view->parent, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -374,6 +374,46 @@ void move_workspace_to(swayc_t* workspace, swayc_t* destination) {
|
|||
update_visibility(src_op);
|
||||
}
|
||||
|
||||
static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geometry) {
|
||||
struct wlc_geometry g = *geometry;
|
||||
c->actual_geometry = g;
|
||||
|
||||
switch (c->border_type) {
|
||||
case B_NONE:
|
||||
break;
|
||||
case B_PIXEL:
|
||||
g.origin.x -= c->border_thickness;
|
||||
g.origin.y -= c->border_thickness;
|
||||
g.size.w += (c->border_thickness * 2);
|
||||
g.size.h += (c->border_thickness * 2);
|
||||
break;
|
||||
case B_NORMAL:
|
||||
g.origin.x -= c->border_thickness;
|
||||
uint32_t title_bar_height = config->font_height + 4; // borders + padding
|
||||
g.origin.y -= title_bar_height;
|
||||
g.size.w += (c->border_thickness * 2);
|
||||
g.size.h += (c->border_thickness + title_bar_height);
|
||||
|
||||
struct wlc_geometry title_bar = {
|
||||
.origin = {
|
||||
.x = g.origin.x,
|
||||
.y = g.origin.y
|
||||
},
|
||||
.size = {
|
||||
.w = g.size.w,
|
||||
.h = title_bar_height
|
||||
}
|
||||
};
|
||||
c->title_bar_geometry = title_bar;
|
||||
break;
|
||||
}
|
||||
|
||||
c->border_geometry = g;
|
||||
*geometry = c->actual_geometry;
|
||||
|
||||
update_view_border(c);
|
||||
}
|
||||
|
||||
void update_geometry(swayc_t *container) {
|
||||
if (container->type != C_VIEW) {
|
||||
return;
|
||||
|
@ -431,8 +471,9 @@ void update_geometry(swayc_t *container) {
|
|||
if (swayc_is_fullscreen(container)) {
|
||||
container->border_geometry = (const struct wlc_geometry){0};
|
||||
container->title_bar_geometry = (const struct wlc_geometry){0};
|
||||
} else {
|
||||
// make room for border
|
||||
} else if (container->is_floating) { // allocate border for floating window
|
||||
update_border_geometry_floating(container, &geometry);
|
||||
} else if (!container->is_floating) { // allocate border for titled window
|
||||
container->border_geometry = geometry;
|
||||
|
||||
int border_top = container->border_thickness;
|
||||
|
|
Loading…
Reference in a new issue