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); int ActionsEnd(EWin * ewin);
/* size.c */ /* size.c */
void MaxSize(EWin * ewin, const char *resize_type); void MaxSizeHV(EWin * ewin, const char *resize_type,
void MaxWidth(EWin * ewin, const char *resize_type); int hor, int ver);
void MaxHeight(EWin * ewin, const char *resize_type);
/* stacking.c */ /* stacking.c */
EWin *const *EwinListStackGet(int *num); 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 || else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT ||
atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
{ {
void (*func) (EWin *, const char *); int maxh, maxv;
unsigned int maxh, maxv;
maxh = ewin->state.maximized_horz; maxh = ewin->state.maximized_horz;
maxv = ewin->state.maximized_vert; maxv = ewin->state.maximized_vert;
@ -945,25 +944,22 @@ EWMH_ProcessClientClientMessage(EWin * ewin, XClientMessageEvent * ev)
atom2 == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) atom2 == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
{ {
/* (ok - ok) */ /* (ok - ok) */
func = MaxSize;
maxh = do_set(maxh, action); maxh = do_set(maxh, action);
maxv = do_set(maxv, action); maxv = do_set(maxv, action);
} }
else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT) else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
{ {
func = MaxHeight;
maxv = do_set(maxv, action); maxv = do_set(maxv, action);
} }
else else
{ {
func = MaxWidth;
maxh = do_set(maxh, action); maxh = do_set(maxh, action);
} }
if ((ewin->state.maximized_horz != maxh) || if ((ewin->state.maximized_horz != maxh) ||
(ewin->state.maximized_vert != maxv)) (ewin->state.maximized_vert != maxv))
{ {
func(ewin, "available"); MaxSizeHV(ewin, "available", maxh, maxv);
EWMH_SetWindowState(ewin); EWMH_SetWindowState(ewin);
} }
} }

View File

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

View File

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