dragmfact: Tweaks for fixed horizontal split

This commit is contained in:
bakkeby 2020-06-29 11:03:25 +02:00
parent c14a51524b
commit 347e6ace91

View File

@ -4,7 +4,7 @@ dragmfact(const Arg *arg)
unsigned int n;
int py, px; // pointer coordinates
int ax, ay, aw, ah; // area position, width and height
int center = 0, horizontal = 0, mirror = 0; // layout configuration
int center = 0, horizontal = 0, mirror = 0, fixed = 0; // layout configuration
double fact;
Monitor *m;
XEvent ev;
@ -25,9 +25,54 @@ dragmfact(const Arg *arg)
ah = m->wh;
aw = m->ww;
#if FLEXTILE_DELUXE_LAYOUT
if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
if (layout < 0) {
mirror = 1;
layout *= -1;
}
if (layout > FLOATING_MASTER) {
layout -= FLOATING_MASTER;
fixed = 1;
}
if (layout == SPLIT_HORIZONTAL || layout == SPLIT_HORIZONTAL_DUAL_STACK)
horizontal = 1;
else if (layout == SPLIT_CENTERED_VERTICAL && (fixed || n - m->nmaster > 1))
center = 1;
else if (layout == FLOATING_MASTER) {
center = 1;
if (aw < ah)
horizontal = 1;
}
else if (layout == SPLIT_CENTERED_HORIZONTAL) {
if (fixed || n - m->nmaster > 1)
center = 1;
horizontal = 1;
}
}
#endif // FLEXTILE_DELUXE_LAYOUT
#if CENTEREDMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredmaster && (fixed || n - m->nmaster > 1))
center = 1;
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
#endif // CENTEREDFLOATINGMASTER_LAYOUT
#if BSTACK_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstack)
horizontal = 1;
#endif // BSTACK_LAYOUT
#if BSTACKHORIZ_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstackhoriz)
horizontal = 1;
#endif // BSTACKHORIZ_LAYOUT
/* do not allow mfact to be modified under certain conditions */
if (!m->lt[m->sellt]->arrange // floating
|| (m->nmaster && n <= m->nmaster) // no master
if (!m->lt[m->sellt]->arrange // floating layout
|| (!n || (!fixed && m->nmaster && n <= m->nmaster)) // no master
#if MONOCLE_LAYOUT
|| m->lt[m->sellt]->arrange == &monocle
#endif // MONOCLE_LAYOUT
@ -49,48 +94,6 @@ dragmfact(const Arg *arg)
)
return;
#if FLEXTILE_DELUXE_LAYOUT
if (m->lt[m->sellt]->arrange == &flextile) {
int layout = m->ltaxis[LAYOUT];
if (layout < 0) {
mirror = 1;
layout *= -1;
}
if (layout > FLOATING_MASTER)
layout -= FLOATING_MASTER;
if (layout == SPLIT_HORIZONTAL || layout == SPLIT_HORIZONTAL_DUAL_STACK)
horizontal = 1;
else if (layout == SPLIT_CENTERED_VERTICAL && (n - m->nmaster) > 1)
center = 1;
else if (layout == FLOATING_MASTER) {
center = 1;
if (aw < ah)
horizontal = 1;
}
else if (layout == SPLIT_CENTERED_HORIZONTAL) {
horizontal = 1;
center = 1;
}
}
#endif // FLEXTILE_DELUXE_LAYOUT
#if CENTEREDMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredmaster && (n - m->nmaster) > 1)
center = 1;
#endif // CENTEREDMASTER_LAYOUT
#if CENTEREDFLOATINGMASTER_LAYOUT
else if (m->lt[m->sellt]->arrange == &centeredfloatingmaster)
center = 1;
#endif // CENTEREDFLOATINGMASTER_LAYOUT
#if BSTACK_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstack)
horizontal = 1;
#endif // BSTACK_LAYOUT
#if BSTACKHORIZ_LAYOUT
else if (m->lt[m->sellt]->arrange == &bstackhoriz)
horizontal = 1;
#endif // BSTACKHORIZ_LAYOUT
#if VANITYGAPS_PATCH
ay += oh;
ax += ov;