Merge pull request #778 from thejan2009/hide_edge_borders-fix

Hide edge borders fix
This commit is contained in:
Drew DeVault 2016-07-21 16:56:44 -04:00 committed by GitHub
commit 9fe1d3da38

View File

@ -522,8 +522,8 @@ void update_geometry(swayc_t *container) {
return; return;
} }
swayc_t *ws = swayc_parent_by_type(container, C_WORKSPACE); swayc_t *workspace = swayc_parent_by_type(container, C_WORKSPACE);
swayc_t *op = ws->parent; swayc_t *op = workspace->parent;
swayc_t *parent = container->parent; swayc_t *parent = container->parent;
struct wlc_geometry geometry = { struct wlc_geometry geometry = {
@ -552,7 +552,7 @@ void update_geometry(swayc_t *container) {
geometry.origin.y = 0; geometry.origin.y = 0;
geometry.size.w = size->w; geometry.size.w = size->w;
geometry.size.h = size->h; geometry.size.h = size->h;
if (op->focused == ws) { if (op->focused == workspace) {
wlc_view_bring_to_front(container->handle); wlc_view_bring_to_front(container->handle);
} }
@ -570,30 +570,23 @@ void update_geometry(swayc_t *container) {
int border_right = container->border_thickness; int border_right = container->border_thickness;
// handle hide_edge_borders // handle hide_edge_borders
if (config->hide_edge_borders != E_NONE && (gap <= 0 || (config->smart_gaps && ws->children->length == 1))) { if (config->hide_edge_borders != E_NONE && (gap <= 0 || (config->smart_gaps && workspace->children->length == 1))) {
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
const struct wlc_size *size = wlc_output_get_resolution(output->handle);
if (config->hide_edge_borders == E_HORIZONTAL || config->hide_edge_borders == E_BOTH) { if (config->hide_edge_borders == E_HORIZONTAL || config->hide_edge_borders == E_BOTH) {
if (geometry.origin.x == 0 || geometry.origin.x == container->x) { if (geometry.origin.x == workspace->x) {
// should work for swaybar at left
border_left = 0; border_left = 0;
} }
if (geometry.origin.x + geometry.size.w == size->w || geometry.size.w == container->width) { if (geometry.origin.x + geometry.size.w == workspace->width) {
// should work for swaybar at right
border_right = 0; border_right = 0;
} }
} }
if (config->hide_edge_borders == E_VERTICAL || config->hide_edge_borders == E_BOTH) { if (config->hide_edge_borders == E_VERTICAL || config->hide_edge_borders == E_BOTH) {
if (geometry.origin.y == 0 || geometry.origin.y == container->y) { if (geometry.origin.y == workspace->y) {
// this works for swaybar at top
border_top = 0; border_top = 0;
} }
if (geometry.origin.y + geometry.size.h == size->h || geometry.size.h == container->height) { if (geometry.origin.y + geometry.size.h == workspace->height) {
// this works for swaybar at bottom
border_bottom = 0; border_bottom = 0;
} }
} }