added fibonacci smart master size diff file

This commit is contained in:
Alexander Bocken 2020-08-24 09:33:59 +02:00
parent 36cbf6658f
commit 7602bce929
3 changed files with 28 additions and 1 deletions

View File

@ -26,6 +26,7 @@ Patches
- warp mouse to center of focussed window - warp mouse to center of focussed window
- scratchpads - scratchpads
- zoom swap - zoom swap
- don't create empty space if master windows are smaller than alloted space (personal) -> This is multiple patches, depending on the layout (fibonacci, tile & deck are seperately listed in patches folder)
Requirements Requirements

View File

@ -46,7 +46,7 @@ fibonacci(Monitor *mon, int s) {
if(i == 0) if(i == 0)
{ {
unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */ unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
if( n==1 ){ if(n == 1){
//if window has min aspect ratio (aka not infinitely adjustable to screen), center that window //if window has min aspect ratio (aka not infinitely adjustable to screen), center that window
if ( c->mina > 0 && altw < c->mon->mw ){ if ( c->mina > 0 && altw < c->mon->mw ){
nx = c->mon->mx + (c->mon->mw - altw ) / 2; nx = c->mon->mx + (c->mon->mw - altw ) / 2;

View File

@ -0,0 +1,26 @@
This patch automatically centers if only one window is open in fibonacci (and that window can't make use of the whole screen)
If there are multiple windows and the master window does not take up all it's alloted space, everything will be adjusted so no empty space is created.
--- fibonacci.c 2020-08-24 09:22:31.596464187 +0200
+++ fibonacci.c 2020-08-24 09:22:16.013131432 +0200
@@ -43,9 +45,18 @@
}
if(i == 0)
{
- if(n != 1)
- nw = mon->ww * mon->mfact;
- ny = mon->wy;
+ unsigned int altw = WIDTH(c) * mon->wh / HEIGHT(c); /*use max window height but preserve aspect ratio */
+ if(n == 1){
+ //if window has min aspect ratio (aka not infinitely adjustable to screen), center that window
+ if ( c->mina > 0 && altw < c->mon->mw ){
+ nx = c->mon->mx + (c->mon->mw - altw ) / 2;
+ }
+ }
+ else{
+ nw = mon->ww *mon->mfact;
+ nw = c->mina > 0 && altw < nw ? altw : nw;
+ ny = mon->wy;
+ }
}
else if(i == 1)
nw = mon->ww - nw;