forked from e16/e16
1
0
Fork 0

Initial showing desktop support.

SVN revision: 11668
This commit is contained in:
Kim Woelders 2004-09-19 09:27:38 +00:00
parent 082924725c
commit 1300a3e887
5 changed files with 121 additions and 40 deletions

View File

@ -32,9 +32,8 @@ Root Window Properties (and Related Messages)
[+] _NET_SUPPORTING_WM_CHECK
[+] _NET_VIRTUAL_ROOTS
[ ] _NET_DESKTOP_LAYOUT
[/] _NET_SHOWING_DESKTOP
The client message does nothing but set the root window property.
[+] _NET_SHOWING_DESKTOP
Other Root Window Messages
~~~~~~~~~~~~~~~~~~~~~~~~~~
[+] _NET_CLOSE_WINDOW

11
src/E.h
View File

@ -838,12 +838,6 @@ struct _ewin
char floating;
char shapedone;
char fixedpos;
#if 0 /* ENABLE_GNOME - Not actually used */
int expanded_x;
int expanded_y;
int expanded_width;
int expanded_height;
#endif
char ignorearrange;
char skiptask;
char skip_ext_pager;
@ -873,6 +867,7 @@ struct _ewin
} strut;
struct
{
unsigned donthide:1; /* Don't hide on show desktop */
unsigned vroot:1; /* Virtual root window */
unsigned int opacity;
} props;
@ -881,6 +876,7 @@ struct _ewin
unsigned maximized_horz:1;
unsigned maximized_vert:1;
unsigned fullscreen:1;
unsigned showingdesk:1; /* Iconified by show desktop */
} st;
struct
{
@ -1718,6 +1714,8 @@ const char *EwinGetIconName(const EWin * ewin);
int EwinIsOnScreen(EWin * ewin);
int BorderWinpartIndex(EWin * ewin, Window win);
void EwinRememberPositionSet(EWin * ewin);
void EwinRememberPositionGet(EWin * ewin, int *px, int *py);
void EwinPropagateShapes(EWin * ewin);
void EwinChange(EWin * ewin, unsigned int flag);
void EwinChangesStart(EWin * ewin);
@ -1725,6 +1723,7 @@ void EwinChangesProcess(EWin * ewin);
void EwinsEventsConfigure(int mode);
void EwinsSetFree(void);
void EwinsShowDesktop(int on);
int BordersEventExpose(XEvent * ev);
int BordersEventMouseDown(XEvent * ev);

View File

@ -365,7 +365,10 @@ AddToFamily(Window win)
/* if is an afterstep/windowmaker dock app - dock it */
if (Conf.dockapp_support && ewin->docked)
DockIt(ewin);
{
DockIt(ewin);
ewin->props.donthide = 1;
}
/* if set for borderless then dont slide it in */
if ((!ewin->client.mwm_decor_title) && (!ewin->client.mwm_decor_border))
@ -3261,6 +3264,47 @@ BorderWinpartIndex(EWin * ewin, Window win)
return -1; /* Not found */
}
/*
* Save current position in absolute viewport coordinates
*/
void
EwinRememberPositionSet(EWin * ewin)
{
int ax, ay;
ewin->req_x = ewin->x;
ewin->req_y = ewin->y;
if (!ewin->sticky)
{
ax = desks.desk[ewin->desktop].current_area_x;
ay = desks.desk[ewin->desktop].current_area_y;
ewin->req_x += ax * VRoot.w;
ewin->req_y += ay * VRoot.h;
}
}
/*
* Get saved position in relative viewport coordinates
*/
void
EwinRememberPositionGet(EWin * ewin, int *px, int *py)
{
int x, y, ax, ay;
x = ewin->req_x;
y = ewin->req_y;
if (!ewin->sticky)
{
ax = desks.desk[ewin->desktop].current_area_x;
ay = desks.desk[ewin->desktop].current_area_y;
x -= ax * VRoot.w;
y -= ay * VRoot.h;
}
*px = x;
*py = y;
}
void
EwinPropagateShapes(EWin * ewin)
{
@ -3407,6 +3451,38 @@ EwinsSetFree(void)
}
}
void
EwinsShowDesktop(int on)
{
EWin *const *lst, *ewin;
int i, num;
lst = EwinListGetForDesktop(desks.current, &num);
for (i = 0; i < num; i++)
{
ewin = lst[i];
if (on)
{
if (ewin->internal || ewin->iconified || ewin->props.donthide ||
ewin->client.transient)
continue;
ewin->st.showingdesk = 1;
IconifyEwin(ewin);
}
else
{
if (!ewin->st.showingdesk)
continue;
DeIconifyEwin(ewin);
}
}
EWMH_SetShowingDesktop(on);
}
/*
* Border event handlers
*/

View File

@ -694,6 +694,7 @@ EWMH_GetWindowType(EWin * ewin)
ewin->skipfocus = 1;
ewin->fixedpos = 1;
EwinSetBorderByName(ewin, "BORDERLESS", 0);
ewin->props.donthide = 1;
}
else if (atom == _NET_WM_WINDOW_TYPE_DOCK)
{
@ -702,6 +703,7 @@ EWMH_GetWindowType(EWin * ewin)
ewin->skipfocus = 1;
ewin->sticky = 1;
ewin->never_use_area = 1;
ewin->props.donthide = 1;
}
else if (atom == _NET_WM_WINDOW_TYPE_UTILITY)
{
@ -710,6 +712,7 @@ EWMH_GetWindowType(EWin * ewin)
ewin->skipwinlist = 1;
ewin->skipfocus = 1;
ewin->never_use_area = 1;
ewin->props.donthide = 1;
}
#if 0 /* Not used by E (yet?) */
else if (atom == _NET_WM_WINDOW_TYPE_TOOLBAR)
@ -864,9 +867,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
}
else if (event->message_type == _NET_SHOWING_DESKTOP)
{
Eprintf("EWMH_ProcessClientMessage: _NET_SHOWING_DESKTOP: %ld\n",
event->data.l[0]);
EWMH_SetShowingDesktop(event->data.l[0]);
EwinsShowDesktop(event->data.l[0]);
goto done;
}

View File

@ -227,16 +227,16 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
if (ib)
{
if (ib->animate)
if (ib->animate && !ewin->st.showingdesk)
IB_Animate(1, ewin, ib->ewin);
UpdateAppIcon(ewin, ib->icon_mode);
IconboxAddEwin(ib, ewin);
}
HideEwin(ewin);
/* Save position at which the window was iconified in req_x/y */
ewin->req_x = ewin->x;
ewin->req_y = ewin->y;
/* Save position at which the window was iconified */
EwinRememberPositionSet(ewin);
if (was_shaded != ewin->shaded)
EwinInstantShade(ewin, 0);
@ -253,8 +253,7 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
HideEwin(e);
e->iconified = 4;
e->req_x = e->x;
e->req_y = e->y;
EwinRememberPositionSet(e);
}
if (lst)
Efree(lst);
@ -282,7 +281,7 @@ DeIconifyEwin(EWin * ewin)
EWin **lst, *e;
int i, num;
Iconbox *ib;
int x, y, dx, dy;
int x, y, ox, oy, dx, dy;
EDBUG(6, "DeIconifyEwin");
@ -295,27 +294,31 @@ DeIconifyEwin(EWin * ewin)
RemoveMiniIcon(ewin);
x = ewin->req_x;
y = ewin->req_y;
EwinRememberPositionGet(ewin, &ox, &oy);
x = ox;
y = oy;
/* If we iconified an offscreen window, get it back on screen */
if (x + ewin->w <= 4 || x > VRoot.w - 4 ||
y + ewin->h <= 4 || y > VRoot.h - 4)
if (!ewin->st.showingdesk)
{
dx = ewin->w / 2;
dy = ewin->h / 2;
x = (ewin->x + dx) % VRoot.w;
if (x < 0)
x += VRoot.w;
x -= dx;
y = (ewin->y + dy) % VRoot.h;
if (y < 0)
y += VRoot.h;
y -= dy;
/* If we iconified an offscreen window, get it back on screen */
if (x + ewin->w <= 4 || x > VRoot.w - 4 ||
y + ewin->h <= 4 || y > VRoot.h - 4)
{
dx = ewin->w / 2;
dy = ewin->h / 2;
x = (ewin->x + dx) % VRoot.w;
if (x < 0)
x += VRoot.w;
x -= dx;
y = (ewin->y + dy) % VRoot.h;
if (y < 0)
y += VRoot.h;
y -= dy;
}
}
dx = x - ewin->req_x;
dy = y - ewin->req_y;
dx = x - ox;
dy = y - oy;
if (ewin->sticky)
MoveEwin(ewin, x, y);
@ -326,9 +329,11 @@ DeIconifyEwin(EWin * ewin)
ewin->iconified = 0;
ib = SelectIconboxForEwin(ewin);
if (ib && ib->animate)
if (ib && ib->animate && !ewin->st.showingdesk)
IB_Animate(0, ewin, ib->ewin);
ewin->st.showingdesk = 0;
RaiseEwin(ewin);
ShowEwin(ewin);
ICCCM_DeIconify(ewin);
@ -340,10 +345,11 @@ DeIconifyEwin(EWin * ewin)
if (e->iconified != 4)
continue;
EwinRememberPositionGet(e, &ox, &oy);
if (e->sticky)
MoveEwin(e, e->req_x + dx, e->req_y + dy);
MoveEwin(e, ox + dx, oy + dy);
else
MoveEwinToDesktopAt(e, desks.current, e->req_x + dx, e->req_y + dy);
MoveEwinToDesktopAt(e, desks.current, ox + dx, oy + dy);
RaiseEwin(e);
ShowEwin(e);