forked from e16/e16
1
0
Fork 0

Initial fullscreen window state handling.

SVN revision: 10403
This commit is contained in:
Kim Woelders 2004-05-31 20:30:12 +00:00
parent a5e7d6d8ab
commit ee357f86a7
7 changed files with 113 additions and 43 deletions

View File

@ -67,7 +67,7 @@ Application Window Properties
[+] _NET_WM_STATE_SKIP_TASKBAR;
[+] _NET_WM_STATE_SKIP_PAGER;
[+] _NET_WM_STATE_HIDDEN;
[ ] _NET_WM_STATE_FULLSCREEN;
[+] _NET_WM_STATE_FULLSCREEN;
[+] _NET_WM_STATE_ABOVE;
[+] _NET_WM_STATE_BELOW;
[ ] _NET_WM_ALLOWED_ACTIONS

14
src/E.h
View File

@ -506,8 +506,9 @@ int Esnprintf(va_alist);
#define ACTION_NEVERFOCUS 101
#define ACTION_SKIPLISTS 102
#define ACTION_SWAPMOVE 103
#define ACTION_FULLSCREEN 104
/* false number excluding the above list */
#define ACTION_NUMBEROF 104
#define ACTION_NUMBEROF 105
#define MODE_NONE 0
#define MODE_MOVE_PENDING 1
@ -896,7 +897,7 @@ struct _ewin
int x, y, w, h;
int shape_x, shape_y;
int req_x, req_y;
int lx, ly, lw, lh;
int lx, ly, lw, lh, ll;
char type;
char state;
char internal;
@ -936,7 +937,6 @@ struct _ewin
char focusclick;
char neverfocus;
char no_actions;
int ewmh_flags;
Menu *menu;
Window shownmenu;
Dialog *dialog;
@ -953,6 +953,12 @@ struct _ewin
int icon_w, icon_h;
int head;
struct
{
unsigned maximized_horz:1;
unsigned maximized_vert:1;
unsigned fullscreen:1;
} st;
struct
{
char *wm_name;
char *wm_icon_name;
@ -1320,6 +1326,7 @@ typedef struct
int last_button;
Time last_time;
char queue_up;
char edge_flip_inhibit;
}
EMode;
@ -1723,6 +1730,7 @@ void InstantShadeEwin(EWin * ewin, int force);
void InstantUnShadeEwin(EWin * ewin);
void ShadeEwin(EWin * ewin);
void UnShadeEwin(EWin * ewin);
void EwinSetFullscreen(EWin * ewin, int on);
void EwinSetBorder(EWin * ewin, Border * b, int apply);
void EwinSetBorderByName(EWin * ewin, const char *name,
int apply);

View File

@ -926,6 +926,26 @@ doSwapMove(EWin * ewin, const void *params)
return ActionMoveStart(ewin, params, 0, 0);
}
static int
doFullscreen(EWin * ewin, const void *params)
{
int on;
on = 0;
if (!params)
on = !ewin->st.fullscreen;
else if (!strcmp(params, "on"))
on = 1;
EwinSetFullscreen(ewin, on);
/* Inhibit edge flip while in fullscreen mode */
/* FIXME: Breaks when multiple windows enter/leave fullscreen state */
Mode.edge_flip_inhibit = on;
ShowEdgeWindows();
return 0;
}
#if 0 /* Not used */
static int
doMoveConstrainedNoGroup(EWin * ewin, const void *params)
@ -3430,5 +3450,6 @@ static ActionFunction ActionFunctions[ACTION_NUMBEROF] = {
{1, 0, 0, 0, doSkipWinList}, /* ACTION_SKIPWINLIST */
{1, 0, 0, 0, doNeverFocus}, /* ACTION_NEVERFOCUS */
{1, 0, 0, 0, doSkipLists}, /* ACTION_SKIPLISTS */
{1, 0, 0, 1, doSwapMove} /* ACTION_SWAPMOVE */
{1, 0, 0, 1, doSwapMove}, /* ACTION_SWAPMOVE */
{1, 0, 0, 0, doFullscreen} /* ACTION_FULLSCREEN */
};

View File

@ -3047,6 +3047,45 @@ UnShadeEwin(EWin * ewin)
EDBUG_RETURN_;
}
void
EwinSetFullscreen(EWin * ewin, int on)
{
int x, y, w, h;
if (ewin->st.fullscreen == on)
return;
if (on)
{
ewin->lx = ewin->x;
ewin->ly = ewin->y;
ewin->lw = ewin->client.w;
ewin->lh = ewin->client.h;
ewin->ll = ewin->layer;
ScreenGetGeometry(ewin->x, ewin->y, &x, &y, &w, &h);
x -= ewin->border->border.left;
y -= ewin->border->border.top;
#if 0
ewin->layer = 10;
#endif
ewin->fixedpos = 1;
ewin->st.fullscreen = 1;
}
else
{
x = ewin->lx;
y = ewin->ly;
w = ewin->lw;
h = ewin->lh;
ewin->layer = ewin->ll;
ewin->fixedpos = 0; /* Yeah - well */
ewin->st.fullscreen = 0;
}
RaiseEwin(ewin);
MoveResizeEwin(ewin, x, y, w, h);
HintsSetWindowState(ewin);
}
void
EwinSetArea(EWin * ewin, int ax, int ay)
{

View File

@ -31,7 +31,7 @@ EdgeTimeout(int val, void *data)
{
int ax, ay, aw, ah, dx, dy, dax, day;
if (Mode.cur_menu_mode > 0)
if (Mode.edge_flip_inhibit || (Mode.cur_menu_mode > 0))
return;
if (!Conf.edge_flip_resistance)
return;
@ -93,11 +93,12 @@ ShowEdgeWindows(void)
{
int ax, ay, cx, cy;
if (Conf.edge_flip_resistance <= 0)
if (Mode.edge_flip_inhibit || (Conf.edge_flip_resistance <= 0))
{
HideEdgeWindows();
return;
}
if (!w1)
{
w1 = ECreateEventWindow(VRoot.win, 0, 0, 1, VRoot.h);

View File

@ -127,10 +127,6 @@ Atom _NET_WM_STATE_BELOW;
#define _NET_WM_STATE_ADD 1
#define _NET_WM_STATE_TOGGLE 2
/* EWMH flags (somewhat messy) */
#define NET_WM_FLAG_MAXIMIZED_VERT 0x01
#define NET_WM_FLAG_MAXIMIZED_HORZ 0x02
/*
* Set/clear Atom in list
*/
@ -219,9 +215,7 @@ EWMH_Init(Window win_wm_check)
_ATOM_INIT(_NET_WM_STATE_SKIP_TASKBAR);
_ATOM_INIT(_NET_WM_STATE_SKIP_PAGER);
_ATOM_INIT(_NET_WM_STATE_HIDDEN);
#if 0 /* Not implemented */
_ATOM_INIT(_NET_WM_STATE_FULLSCREEN);
#endif
_ATOM_INIT(_NET_WM_STATE_ABOVE);
_ATOM_INIT(_NET_WM_STATE_BELOW);
@ -489,9 +483,11 @@ EWMH_SetWindowState(const EWin * ewin)
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_HIDDEN,
ewin->iconified || ewin->shaded);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_VERT,
ewin->ewmh_flags & NET_WM_FLAG_MAXIMIZED_VERT);
ewin->st.maximized_vert);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_HORZ,
ewin->ewmh_flags & NET_WM_FLAG_MAXIMIZED_HORZ);
ewin->st.maximized_horz);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_FULLSCREEN,
ewin->st.fullscreen);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_SKIP_PAGER,
ewin->skip_ext_pager);
atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_ABOVE,
@ -590,8 +586,6 @@ EWMH_GetWindowState(EWin * ewin)
EDBUG(6, "EWMH_GetWindowState");
ewin->ewmh_flags = 0;
n_atoms = 0;
p_atoms = AtomGet(ewin->client.win, _NET_WM_STATE, XA_ATOM, &n_atoms);
n_atoms /= sizeof(Atom); /* Silly */
@ -601,7 +595,8 @@ EWMH_GetWindowState(EWin * ewin)
/* We must clear/set all according to not present/present */
ewin->sticky = ewin->shaded = 0;
ewin->skiptask = ewin->skip_ext_pager = 0;
ewin->ewmh_flags = 0;
ewin->st.maximized_horz = ewin->st.maximized_vert = 0;
ewin->st.fullscreen = 0;
/* ewin->layer = No ... TBD */
for (i = 0; i < n_atoms; i++)
@ -618,9 +613,11 @@ EWMH_GetWindowState(EWin * ewin)
else if (atom == _NET_WM_STATE_HIDDEN)
; /* ewin->iconified = 1; No - WM_STATE does this */
else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_VERT;
ewin->st.maximized_vert = 1;
else if (atom == _NET_WM_STATE_MAXIMIZED_HORZ)
ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_HORZ;
ewin->st.maximized_horz = 1;
else if (atom == _NET_WM_STATE_FULLSCREEN)
ewin->st.fullscreen = 1;
else if (atom == _NET_WM_STATE_ABOVE)
ewin->layer = 6;
else if (atom == _NET_WM_STATE_BELOW)
@ -852,51 +849,49 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
atom == _NET_WM_STATE_MAXIMIZED_HORZ)
{
void (*func) (EWin *, const char *);
int maskbits;
int maxh, maxv;
maxh = ewin->st.maximized_horz;
maxv = ewin->st.maximized_vert;
if (atom2 == _NET_WM_STATE_MAXIMIZED_VERT || atom2 == _NET_WM_STATE_MAXIMIZED_HORZ) /* (ok - ok) */
{
func = MaxSize;
maskbits = NET_WM_FLAG_MAXIMIZED_VERT |
NET_WM_FLAG_MAXIMIZED_HORZ;
maxh = do_set(maxh, action);
maxv = do_set(maxv, action);
}
else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
{
func = MaxHeight;
maskbits = NET_WM_FLAG_MAXIMIZED_VERT;
maxv = do_set(maxv, action);
}
else
{
func = MaxWidth;
maskbits = NET_WM_FLAG_MAXIMIZED_HORZ;
maxh = do_set(maxh, action);
}
if (ewin->ewmh_flags & maskbits)
{
if (action != _NET_WM_STATE_ADD)
{
ewin->ewmh_flags &= ~maskbits;
ewin->toggle = 1;
}
}
if ((ewin->st.maximized_horz == maxh) &&
(ewin->st.maximized_vert == maxv))
goto done;
if ((ewin->st.maximized_horz && !maxh) ||
(ewin->st.maximized_vert && !maxv))
ewin->toggle = 1;
else
{
if (action != _NET_WM_STATE_REMOVE)
{
ewin->ewmh_flags |= maskbits;
ewin->toggle = 0;
}
}
ewin->toggle = 0;
func(ewin, "available");
RememberImportantInfoForEwin(ewin);
EWMH_SetWindowState(ewin);
ewin->toggle = 0;
}
#if 0 /* Not yet implemented */
else if (atom == _NET_WM_STATE_FULLSCREEN)
{
action = do_set(ewin->st.fullscreen, action);
if (ewin->st.fullscreen == action)
goto done;
ActionsCall(ACTION_FULLSCREEN, ewin, (action) ? "on" : "off");
}
#endif
else if (atom == _NET_WM_STATE_ABOVE)
{
action = do_set(ewin->layer >= 6, action);

View File

@ -48,6 +48,8 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
ewin->ly = ewin->y;
ewin->lw = ewin->client.w;
ewin->lh = ewin->client.h;
ewin->st.maximized_horz = 0;
ewin->st.maximized_vert = 0;
ewin->toggle = 0;
goto done;
}
@ -128,6 +130,8 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
y = y1;
h = y2 - y1 - (ewin->border->border.top +
ewin->border->border.bottom);
ewin->st.maximized_vert = 1;
}
if (direction & MAX_HOR)
@ -153,6 +157,8 @@ MaxSizeHV(EWin * ewin, const char *resize_type, int direction)
x = x1;
w = x2 - x1 - (ewin->border->border.left +
ewin->border->border.right);
ewin->st.maximized_horz = 1;
}
break;