Only one maximisation function.

SVN revision: 34891
This commit is contained in:
Kim Woelders 2008-06-22 22:23:24 +00:00
parent 19230084fb
commit dda2eb8c84
4 changed files with 15 additions and 41 deletions

View File

@ -458,9 +458,8 @@ void ActionsHandleMotion(void);
int ActionsEnd(EWin * ewin);
/* size.c */
void MaxSize(EWin * ewin, const char *resize_type);
void MaxWidth(EWin * ewin, const char *resize_type);
void MaxHeight(EWin * ewin, const char *resize_type);
void MaxSizeHV(EWin * ewin, const char *resize_type,
int hor, int ver);
/* stacking.c */
EWin *const *EwinListStackGet(int *num);

View File

@ -936,8 +936,7 @@ EWMH_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * ev)
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT ||
atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
{
void (*func) (EWin *, const char *);
unsigned int maxh, maxv;
int maxh, maxv;
maxh = ewin->state.maximized_horz;
maxv = ewin->state.maximized_vert;
@ -945,25 +944,22 @@ EWMH_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * ev)
atom2 == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
{
/* (ok - ok) */
func = MaxSize;
maxh = do_set(maxh, action);
maxv = do_set(maxv, action);
}
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
{
func = MaxHeight;
maxv = do_set(maxv, action);
}
else
{
func = MaxWidth;
maxh = do_set(maxh, action);
}
if ((ewin->state.maximized_horz != maxh) ||
(ewin->state.maximized_vert != maxv))
{
func(ewin, "available");
MaxSizeHV(ewin, "available", maxh, maxv);
EWMH_SetWindowState(ewin);
}
}

View File

@ -632,15 +632,15 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm)
break;
case EWIN_OP_MAX_WIDTH:
MaxWidth(ewin, param1);
MaxSizeHV(ewin, param1, 1, 0);
break;
case EWIN_OP_MAX_HEIGHT:
MaxHeight(ewin, param1);
MaxSizeHV(ewin, param1, 0, 1);
break;
case EWIN_OP_MAX_SIZE:
MaxSize(ewin, param1);
MaxSizeHV(ewin, param1, 1, 1);
break;
case EWIN_OP_FULLSCREEN:

View File

@ -26,16 +26,13 @@
#include "hints.h"
#include "screen.h"
#define MAX_HOR 0x1
#define MAX_VER 0x2
#define MAX_ABSOLUTE 0 /* Fill screen */
#define MAX_AVAILABLE 1 /* Expand until don't cover */
#define MAX_CONSERVATIVE 2 /* Expand until something */
#define MAX_XINERAMA 3 /* Fill Xinerama screen */
static void
MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
void
MaxSizeHV(EWin * ewin, const char *resize_type, int hor, int ver)
{
int x, y, w, h, x1, x2, y1, y2, type, bl, br, bt, bb;
EWin *const *lst, *pe;
@ -44,9 +41,9 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
if (!ewin)
return;
if (ewin->state.inhibit_max_hor && (direction & MAX_HOR))
if (ewin->state.inhibit_max_hor && hor)
return;
if (ewin->state.inhibit_max_ver && (direction & MAX_VER))
if (ewin->state.inhibit_max_ver && ver)
return;
if (ewin->state.maximized_horz || ewin->state.maximized_vert)
@ -83,13 +80,13 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
switch (type)
{
case MAX_XINERAMA:
if (direction & MAX_HOR)
if (hor)
{
x = 0;
w = WinGetW(VROOT);
ewin->state.maximized_horz = 1;
}
if (direction & MAX_VER)
if (ver)
{
y = 0;
h = WinGetH(VROOT);
@ -116,7 +113,7 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
lst = EwinListGetAll(&num);
}
if (direction & MAX_VER)
if (ver)
{
for (i = 0; i < num; i++)
{
@ -142,7 +139,7 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
ewin->state.maximized_vert = 1;
}
if (direction & MAX_HOR)
if (hor)
{
for (i = 0; i < num; i++)
{
@ -190,21 +187,3 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
done:
HintsSetWindowState(ewin);
}
void
MaxWidth(EWin * ewin, const char *resize_type)
{
MaxSizeHV(ewin, resize_type, MAX_HOR);
}
void
MaxHeight(EWin * ewin, const char *resize_type)
{
MaxSizeHV(ewin, resize_type, MAX_VER);
}
void
MaxSize(EWin * ewin, const char *resize_type)
{
MaxSizeHV(ewin, resize_type, MAX_HOR | MAX_VER);
}