Adding maximize patch
This commit is contained in:
@@ -52,6 +52,10 @@
|
||||
#include "holdbar.c"
|
||||
#endif
|
||||
|
||||
#if MAXIMIZE_PATCH
|
||||
#include "maximize.c"
|
||||
#endif
|
||||
|
||||
#if PERTAG_PATCH
|
||||
#include "pertag.c"
|
||||
#endif
|
||||
|
@@ -52,6 +52,10 @@
|
||||
#include "holdbar.h"
|
||||
#endif
|
||||
|
||||
#if MAXIMIZE_PATCH
|
||||
#include "maximize.h"
|
||||
#endif
|
||||
|
||||
#if PERTAG_PATCH
|
||||
#include "pertag.h"
|
||||
#endif
|
||||
|
45
patch/maximize.c
Normal file
45
patch/maximize.c
Normal file
@@ -0,0 +1,45 @@
|
||||
void
|
||||
maximize(int x, int y, int w, int h) {
|
||||
XEvent ev;
|
||||
|
||||
if(!selmon->sel || selmon->sel->isfixed)
|
||||
return;
|
||||
XRaiseWindow(dpy, selmon->sel->win);
|
||||
if(!selmon->sel->ismax) {
|
||||
if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
|
||||
selmon->sel->wasfloating = True;
|
||||
else {
|
||||
togglefloating(NULL);
|
||||
selmon->sel->wasfloating = False;
|
||||
}
|
||||
selmon->sel->oldx = selmon->sel->x;
|
||||
selmon->sel->oldy = selmon->sel->y;
|
||||
selmon->sel->oldw = selmon->sel->w;
|
||||
selmon->sel->oldh = selmon->sel->h;
|
||||
resize(selmon->sel, x, y, w, h, True);
|
||||
selmon->sel->ismax = True;
|
||||
}
|
||||
else {
|
||||
resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True);
|
||||
if(!selmon->sel->wasfloating)
|
||||
togglefloating(NULL);
|
||||
selmon->sel->ismax = False;
|
||||
}
|
||||
drawbar(selmon);
|
||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
}
|
||||
|
||||
void
|
||||
togglemaximize(const Arg *arg) {
|
||||
maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx);
|
||||
}
|
||||
|
||||
void
|
||||
toggleverticalmax(const Arg *arg) {
|
||||
maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx);
|
||||
}
|
||||
|
||||
void
|
||||
togglehorizontalmax(const Arg *arg) {
|
||||
maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h);
|
||||
}
|
4
patch/maximize.h
Normal file
4
patch/maximize.h
Normal file
@@ -0,0 +1,4 @@
|
||||
static void maximize(int x, int y, int w, int h);
|
||||
static void togglemaximize(const Arg *arg);
|
||||
static void toggleverticalmax(const Arg *arg);
|
||||
static void togglehorizontalmax(const Arg *arg);
|
Reference in New Issue
Block a user