Add options to ignore struts when maximising/fullscreening.

Whether or not to ignore struts can now be configured independently
for maximising, fullscreening, and general window placement.

Patch by Daniel Manjarres.
Also suggested by José Romildo Malaquias.

SVN revision: 57536
This commit is contained in:
Kim Woelders 2011-03-06 08:26:47 +00:00
parent 75e509203c
commit a2968d89f2
11 changed files with 45 additions and 14 deletions

View File

@ -277,5 +277,8 @@ Olivier <eliovir@nospam.gmail.com>
Aron Xu <aronmalache@163.com>
Chinese translation
Daniel Manjarres <manjarrs@illinois.edu>
Improved strut handling options, other patches and suggestions.
And others whose names we probably forgot to add (email us and we'll put you
in here)

View File

@ -232,6 +232,8 @@ typedef struct {
char manual_mouse_pointer;
char center_if_desk_full;
char ignore_struts;
char ignore_struts_fullscreen;
char ignore_struts_maximize;
char raise_fullscreen;
char slidein;
char cleanupslide;

View File

@ -316,7 +316,8 @@ ArrangeRects(const RectBox * fixed, int fixed_count, RectBox * floating,
{
int xx1, yy1, xx2, yy2;
ScreenGetAvailableAreaByPointer(&xx1, &yy1, &xx2, &yy2);
ScreenGetAvailableAreaByPointer(&xx1, &yy1, &xx2, &yy2,
Conf.place.ignore_struts);
xx2 += xx1;
yy2 += yy1;
if (tx1 < xx1)
@ -890,7 +891,7 @@ ArrangeEwinCenteredXY(EWin * ewin, int *px, int *py)
{
int x, y, w, h;
ScreenGetAvailableAreaByPointer(&x, &y, &w, &h);
ScreenGetAvailableAreaByPointer(&x, &y, &w, &h, Conf.place.ignore_struts);
*px = (w - EoGetW(ewin)) / 2 + x;
*py = (h - EoGetH(ewin)) / 2 + y;
}

View File

@ -1315,7 +1315,8 @@ EwinOpFullscreen(EWin * ewin, int source __UNUSED__, int on)
{
EventsUpdateXY(&x, &y);
}
ScreenGetAvailableArea(x, y, &x, &y, &w, &h);
ScreenGetAvailableArea(x, y, &x, &y, &w, &h,
Conf.place.ignore_struts_fullscreen);
ewin->state.fullscreen = 1;

View File

@ -630,7 +630,7 @@ EwinKeepOnScreen(const EWin * ewin, int wn, int hn, int *px, int *py)
w = EoGetW(ewin);
h = EoGetH(ewin);
ScreenGetAvailableArea(x, y, &sx, &sy, &sw, &sh);
ScreenGetAvailableArea(x, y, &sx, &sy, &sw, &sh, Conf.place.ignore_struts);
/* Quit if not on-screen to begin with */
if (x < sx || x + w > sx + sw || y < sy || y + h > sy + sh)
@ -913,7 +913,8 @@ AddToFamily(EWin * ewin, Window xwin, int startup)
DeskGoto(dsk);
EventsUpdateXY(&cx, &cy);
ScreenGetAvailableArea(cx, cy, &sx, &sy, &sw, &sh);
ScreenGetAvailableArea(cx, cy, &sx, &sy, &sw, &sh,
Conf.place.ignore_struts);
/* try to center the window on the mouse pointer */
x = cx - EoGetW(ewin) / 2;

View File

@ -170,6 +170,8 @@ static const CfgItem MiscCfgItems[] = {
CFG_ITEM_BOOL(Conf, place.manual_mouse_pointer, 0),
CFG_ITEM_BOOL(Conf, place.center_if_desk_full, 0),
CFG_ITEM_BOOL(Conf, place.ignore_struts, 0),
CFG_ITEM_BOOL(Conf, place.ignore_struts_fullscreen, 0),
CFG_ITEM_BOOL(Conf, place.ignore_struts_maximize, 0),
CFG_ITEM_BOOL(Conf, place.raise_fullscreen, 0),
CFG_ITEM_BOOL(Conf, place.slidein, 0),
CFG_ITEM_BOOL(Conf, place.cleanupslide, 1),

View File

@ -281,13 +281,14 @@ VRootGetAvailableArea(int *px, int *py, int *pw, int *ph)
}
int
ScreenGetAvailableArea(int xi, int yi, int *px, int *py, int *pw, int *ph)
ScreenGetAvailableArea(int xi, int yi, int *px, int *py, int *pw, int *ph,
int ignore_struts)
{
int x1, y1, w1, h1, x2, y2, w2, h2, head;
head = ScreenGetGeometry(xi, yi, &x1, &y1, &w1, &h1);
if (!Conf.place.ignore_struts)
if (!ignore_struts)
{
VRootGetAvailableArea(&x2, &y2, &w2, &h2);
if (x1 < x2)
@ -319,11 +320,13 @@ ScreenGetGeometryByPointer(int *px, int *py, int *pw, int *ph)
}
int
ScreenGetAvailableAreaByPointer(int *px, int *py, int *pw, int *ph)
ScreenGetAvailableAreaByPointer(int *px, int *py, int *pw, int *ph,
int ignore_struts)
{
int pointer_x, pointer_y;
EQueryPointer(NULL, &pointer_x, &pointer_y, NULL, NULL);
return ScreenGetAvailableArea(pointer_x, pointer_y, px, py, pw, ph);
return ScreenGetAvailableArea(pointer_x, pointer_y, px, py, pw, ph,
ignore_struts);
}

View File

@ -35,10 +35,11 @@ int ScreenGetGeometry(int x, int y, int *px, int *py,
void ScreenGetGeometryByHead(int head, int *px, int *py,
int *pw, int *ph);
int ScreenGetAvailableArea(int x, int y, int *px, int *py,
int *pw, int *ph);
int *pw, int *ph, int ignore_struts);
int ScreenGetGeometryByPointer(int *px, int *py,
int *pw, int *ph);
int ScreenGetAvailableAreaByPointer(int *px, int *py,
int *pw, int *ph);
int *pw, int *ph,
int ignore_struts);
#endif /* _SCREEN_H_ */

View File

@ -255,6 +255,8 @@ typedef struct {
char animate_shading;
int shade_speed;
char place_ignore_struts;
char place_ignore_struts_fullscreen;
char place_ignore_struts_maximize;
char raise_fullscreen;
#ifdef USE_XINERAMA_no /* Not implemented */
char extra_head;
@ -286,6 +288,8 @@ CB_ConfigurePlacement(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
Conf.shading.speed = dd->shade_speed;
Conf.place.ignore_struts = dd->place_ignore_struts;
Conf.place.ignore_struts_fullscreen = dd->place_ignore_struts_fullscreen;
Conf.place.ignore_struts_maximize = dd->place_ignore_struts_maximize;
Conf.place.raise_fullscreen = dd->raise_fullscreen;
#ifdef USE_XINERAMA_no /* Not implemented */
if (Mode.display.xinerama_active)
@ -322,6 +326,8 @@ _DlgFillPlacement(Dialog * d __UNUSED__, DItem * table, void *data __UNUSED__)
dd->shade_speed = Conf.shading.speed;
dd->place_ignore_struts = Conf.place.ignore_struts;
dd->place_ignore_struts_fullscreen = Conf.place.ignore_struts_fullscreen;
dd->place_ignore_struts_maximize = Conf.place.ignore_struts_maximize;
dd->raise_fullscreen = Conf.place.raise_fullscreen;
#ifdef USE_XINERAMA_no /* Not implemented */
@ -446,9 +452,19 @@ _DlgFillPlacement(Dialog * d __UNUSED__, DItem * table, void *data __UNUSED__)
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Ignore struts"));
DialogItemSetText(di, _("Ignore struts/panels for placing normal windows"));
DialogItemCheckButtonSetPtr(di, &dd->place_ignore_struts);
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Ignore struts/panels when windows are fullscreen"));
DialogItemCheckButtonSetPtr(di, &dd->place_ignore_struts_fullscreen);
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Ignore struts/panels when maximizing windows"));
DialogItemCheckButtonSetPtr(di, &dd->place_ignore_struts_maximize);
di = DialogAddItem(table, DITEM_CHECKBUTTON);
DialogItemSetColSpan(di, 2);
DialogItemSetText(di, _("Raise fullscreen windows"));

View File

@ -98,7 +98,8 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int hor, int ver)
case MAX_ABSOLUTE:
case MAX_AVAILABLE:
case MAX_CONSERVATIVE:
ScreenGetAvailableArea(x + w / 2, y + h / 2, &x1, &y1, &x2, &y2);
ScreenGetAvailableArea(x + w / 2, y + h / 2, &x1, &y1, &x2, &y2,
Conf.place.ignore_struts_maximize);
x2 += x1;
y2 += y1;

View File

@ -194,7 +194,7 @@ WarpFocusWinShow(WarpFocusWin * fw)
/* Reset shape */
EShapeSetMask(EoGetWin(fw), 0, 0, None);
ScreenGetAvailableAreaByPointer(&x, &y, &ww, &hh);
ScreenGetAvailableAreaByPointer(&x, &y, &ww, &hh, Conf.place.ignore_struts);
x += (ww - w) / 2;
y += (hh - h * warplist_num) / 2;
EoMoveResize(fw, x, y, w, h * warplist_num);