Trivial code shuffle (sticky.c into borders.c) and namespace cleanup.

SVN revision: 10439
This commit is contained in:
Kim Woelders 2004-06-04 19:23:47 +00:00
parent f28483e5af
commit b43495e0d5
11 changed files with 95 additions and 130 deletions

15
src/E.h
View File

@ -1738,11 +1738,12 @@ void AddBorderPart(Border * b, ImageClass * iclass,
int typ, int tya, int borigin, int bxp,
int bxa, int byp, int bya,
char keep_for_shade);
void MinShadeSize(EWin * ewin, int *mw, int *mh);
void InstantShadeEwin(EWin * ewin, int force);
void InstantUnShadeEwin(EWin * ewin);
void ShadeEwin(EWin * ewin);
void UnShadeEwin(EWin * ewin);
void EwinStick(EWin * ewin);
void EwinUnStick(EWin * ewin);
void EwinInstantShade(EWin * ewin, int force);
void EwinInstantUnShade(EWin * ewin);
void EwinShade(EWin * ewin);
void EwinUnShade(EWin * ewin);
void EwinSetFullscreen(EWin * ewin, int on);
void EwinSetBorder(EWin * ewin, Border * b, int apply);
void EwinSetBorderByName(EWin * ewin, const char *name,
@ -2634,10 +2635,6 @@ int EwinListFocusRaise(EWin * ewin);
void AddE(void);
void CreateStartupDisplay(char start);
/* sticky.c */
void MakeWindowSticky(EWin * ewin);
void MakeWindowUnSticky(EWin * ewin);
/* tclass.c */
TextClass *CreateTclass(void);
void FreeTextState(TextState * ts);

View File

@ -73,7 +73,6 @@ enlightenment_SOURCES = \
sound.c \
stacking.c \
startup.c \
sticky.c \
tclass.c \
text.c \
theme.c \

View File

@ -1594,13 +1594,13 @@ DoStick(EWin * ewin, const void *params, int nogroup)
&& ((curr_group && !curr_group->cfg.mirror) || sticky))
{
SoundPlay("SOUND_WINDOW_UNSTICK");
MakeWindowUnSticky(gwins[i]);
EwinUnStick(gwins[i]);
}
else if (!gwins[i]->sticky
&& ((curr_group && !curr_group->cfg.mirror) || !sticky))
{
SoundPlay("SOUND_WINDOW_STICK");
MakeWindowSticky(gwins[i]);
EwinStick(gwins[i]);
}
RememberImportantInfoForEwin(gwins[i]);
}
@ -2434,13 +2434,13 @@ DoShade(EWin * ewin, const void *params, int nogroup)
&& ((curr_group && !curr_group->cfg.mirror) || shaded))
{
SoundPlay("SOUND_UNSHADE");
UnShadeEwin(gwins[i]);
EwinUnShade(gwins[i]);
}
else if (!gwins[i]->shaded
&& ((curr_group && !curr_group->cfg.mirror) || !shaded))
{
SoundPlay("SOUND_SHADE");
ShadeEwin(gwins[i]);
EwinShade(gwins[i]);
}
RememberImportantInfoForEwin(gwins[i]);
}
@ -2627,7 +2627,7 @@ doFocusSet(EWin * ewin, const void *params)
if (ewin->iconified)
DeIconifyEwin(ewin);
if (ewin->shaded)
UnShadeEwin(ewin);
EwinUnShade(ewin);
FocusToEWin(ewin, FOCUS_SET);
EDBUG_RETURN(0);
@ -2852,11 +2852,11 @@ DoSetWinBorder(EWin * ewin, const void *params, int nogroup)
if (gwins[i]->shaded)
{
shadechange = 1;
InstantUnShadeEwin(gwins[i]);
EwinInstantUnShade(gwins[i]);
}
EwinSetBorder(gwins[i], b, 1);
if (shadechange)
InstantShadeEwin(gwins[i], 0);
EwinInstantShade(gwins[i], 0);
}
RememberImportantInfoForEwin(gwins[i]);
}

View File

@ -1142,7 +1142,7 @@ Adopt(Window win)
UngrabX();
if (ewin->shaded)
InstantShadeEwin(ewin, 1);
EwinInstantShade(ewin, 1);
HintsSetWindowState(ewin);
HintsSetClientList();
@ -1204,7 +1204,7 @@ AdoptInternal(Window win, Border * border, int type)
UngrabX();
if (ewin->shaded)
InstantShadeEwin(ewin, 1);
EwinInstantShade(ewin, 1);
HintsSetWindowState(ewin);
HintsSetClientList();
@ -2253,6 +2253,51 @@ AddBorderPart(Border * b, ImageClass * iclass, ActionClass * aclass,
}
void
EwinUnStick(EWin * ewin)
{
EDBUG(4, "EwinUnStick");
if (!ewin)
EDBUG_RETURN_;
ewin->sticky = 0;
MoveEwinToDesktopAt(ewin, desks.current, ewin->x, ewin->y);
EwinBorderDraw(ewin, 0, 0);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
void
EwinStick(EWin * ewin)
{
int x, y, dx, dy;
EDBUG(4, "EwinStick");
if (!ewin)
EDBUG_RETURN_;
/* Avoid "losing" windows made sticky while not in the current viewport */
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;
MoveEwinToDesktopAt(ewin, desks.current, x, y);
ewin->sticky = 1;
EwinBorderDraw(ewin, 0, 0);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
static void
MinShadeSize(EWin * ewin, int *mw, int *mh)
{
int i, pw, ph, w, h, min_w, min_h;
@ -2351,13 +2396,13 @@ MinShadeSize(EWin * ewin, int *mw, int *mh)
}
void
InstantShadeEwin(EWin * ewin, int force)
EwinInstantShade(EWin * ewin, int force)
{
XSetWindowAttributes att;
int b, d;
char pq;
EDBUG(4, "InstantShadeEwin");
EDBUG(4, "EwinInstantShade");
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0)
&& (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
@ -2436,13 +2481,13 @@ InstantShadeEwin(EWin * ewin, int force)
}
void
InstantUnShadeEwin(EWin * ewin)
EwinInstantUnShade(EWin * ewin)
{
XSetWindowAttributes att;
int b, d;
char pq;
EDBUG(4, "InstantUnShadeEwin");
EDBUG(4, "EwinInstantUnShade");
if (GetZoomEWin() == ewin)
EDBUG_RETURN_;
if (!ewin->shaded)
@ -2512,7 +2557,7 @@ InstantUnShadeEwin(EWin * ewin)
}
void
ShadeEwin(EWin * ewin)
EwinShade(EWin * ewin)
{
XSetWindowAttributes att;
int i, j, speed, a, b, c, d, ww, hh;
@ -2522,7 +2567,7 @@ ShadeEwin(EWin * ewin)
double tm;
char pq;
EDBUG(4, "ShadeEwin");
EDBUG(4, "EwinShade");
if ((ewin->border->border.left == 0) && (ewin->border->border.right == 0)
&& (ewin->border->border.top == 0) && (ewin->border->border.bottom == 0))
@ -2771,7 +2816,7 @@ ShadeEwin(EWin * ewin)
}
void
UnShadeEwin(EWin * ewin)
EwinUnShade(EWin * ewin)
{
XSetWindowAttributes att;
int i, j, speed, a, b, c, d;
@ -2781,7 +2826,7 @@ UnShadeEwin(EWin * ewin)
double tm;
char pq;
EDBUG(4, "UnShadeEwin");
EDBUG(4, "EwinUnShade");
if (GetZoomEWin() == ewin)
EDBUG_RETURN_;
if (!ewin->shaded)

View File

@ -781,7 +781,7 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
DeIconifyEwin(ewin);
RaiseEwin(ewin);
if (ewin->shaded)
UnShadeEwin(ewin);
EwinUnShade(ewin);
FocusToEWin(ewin, FOCUS_SET);
}
else if (event->message_type == _NET_CLOSE_WINDOW)
@ -793,12 +793,12 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
if ((unsigned)event->data.l[0] == 0xFFFFFFFF)
{
if (!ewin->sticky)
MakeWindowSticky(ewin);
EwinStick(ewin);
}
else
{
if (ewin->sticky)
MakeWindowUnSticky(ewin);
EwinUnStick(ewin);
else
MoveEwinToDesktop(ewin, event->data.l[0]);
}
@ -819,18 +819,18 @@ EWMH_ProcessClientMessage(XClientMessageEvent * event)
{
action = do_set(ewin->sticky, action);
if (action)
MakeWindowSticky(ewin);
EwinStick(ewin);
else
MakeWindowUnSticky(ewin);
EwinUnStick(ewin);
ewin->sticky = action;
}
else if (atom == _NET_WM_STATE_SHADED)
{
action = do_set(ewin->shaded, action);
if (action)
ShadeEwin(ewin);
EwinShade(ewin);
else
UnShadeEwin(ewin);
EwinUnShade(ewin);
ewin->shaded = action;
}
else if (atom == _NET_WM_STATE_SKIP_TASKBAR)

View File

@ -846,28 +846,20 @@ GNOME_ProcessClientMessage(XClientMessageEvent * event)
if (event->data.l[1] & WIN_STATE_STICKY)
{
if (!(ewin->sticky))
{
ewin->sticky = 1;
RaiseEwin(ewin);
EwinBorderDraw(ewin, 0, 0);
}
EwinStick(ewin);
}
else
{
if (ewin->sticky)
{
ewin->sticky = 0;
RaiseEwin(ewin);
EwinBorderDraw(ewin, 0, 0);
}
EwinUnStick(ewin);
}
}
if (event->data.l[0] & WIN_STATE_SHADED)
{
if (event->data.l[1] & WIN_STATE_SHADED)
ShadeEwin(ewin);
EwinShade(ewin);
else
UnShadeEwin(ewin);
EwinUnShade(ewin);
}
HintsSetWindowState(ewin);
EDBUG_RETURN_;

View File

@ -234,7 +234,7 @@ IconboxIconifyEwin(Iconbox * ib, EWin * ewin)
HideEwin(ewin);
if (was_shaded != ewin->shaded)
InstantShadeEwin(ewin, 0);
EwinInstantShade(ewin, 0);
ewin->iconified = 3;
ICCCM_Iconify(ewin);
@ -618,7 +618,7 @@ IconboxShow(Iconbox * ib)
}
else
{
MakeWindowSticky(ewin);
EwinStick(ewin);
MoveResizeEwin(ewin, VRoot.w - 160, VRoot.h - h, 160, h);
}
@ -1261,7 +1261,7 @@ UpdateAppIcon(EWin * ewin, int imode)
if (!ewin->icon_pmm.pmap)
{
if (ewin->shaded)
InstantUnShadeEwin(ewin);
EwinInstantUnShade(ewin);
RaiseEwin(ewin);
IB_SnapEWin(ewin);
}
@ -1279,7 +1279,7 @@ UpdateAppIcon(EWin * ewin, int imode)
if (!ewin->icon_pmm.pmap)
{
if (ewin->shaded)
InstantUnShadeEwin(ewin);
EwinInstantUnShade(ewin);
RaiseEwin(ewin);
IB_SnapEWin(ewin);
}
@ -1291,7 +1291,7 @@ UpdateAppIcon(EWin * ewin, int imode)
if (!ewin->icon_pmm.pmap)
{
if (ewin->shaded)
InstantUnShadeEwin(ewin);
EwinInstantUnShade(ewin);
RaiseEwin(ewin);
IB_SnapEWin(ewin);
}
@ -2012,7 +2012,7 @@ IconboxRedraw(Iconbox * ib)
if (ib->ewin->shaded)
{
was_shaded = 1;
UnShadeEwin(ib->ewin);
EwinUnShade(ib->ewin);
}
IB_CalcMax(ib);
@ -2078,7 +2078,7 @@ IconboxRedraw(Iconbox * ib)
}
if (was_shaded)
ShadeEwin(ib->ewin);
EwinShade(ib->ewin);
pq = Mode.queue_up;
Mode.queue_up = 0;

View File

@ -3167,9 +3167,9 @@ IPC_WinOps(const char *params, Client * c)
&ewin->shaded, param1, 0))
{
if (ewin->shaded)
UnShadeEwin(ewin);
EwinUnShade(ewin);
else
ShadeEwin(ewin);
EwinShade(ewin);
}
}
else if (!strncmp(operation, "stick", 2))
@ -3178,9 +3178,9 @@ IPC_WinOps(const char *params, Client * c)
&ewin->sticky, param1, 0))
{
if (ewin->sticky)
MakeWindowUnSticky(ewin);
EwinUnStick(ewin);
else
MakeWindowSticky(ewin);
EwinStick(ewin);
}
}
else if (!strcmp(operation, "fixedpos"))

View File

@ -353,14 +353,14 @@ MenuShow(Menu * m, char noshow)
ewin->head = head_num;
if (Conf.menuslide)
InstantShadeEwin(ewin, 0);
EwinInstantShade(ewin, 0);
ICCCM_Cmap(NULL);
MoveEwin(ewin, ewin->x, ewin->y);
if (!noshow)
{
ShowEwin(ewin);
if (Conf.menuslide)
UnShadeEwin(ewin);
EwinUnShade(ewin);
}
}
@ -2491,7 +2491,7 @@ MenusEventMouseDown(XEvent * ev)
RaiseEwin(ewin2);
ShowEwin(ewin2);
if (Conf.menuslide)
UnShadeEwin(ewin2);
EwinUnShade(ewin2);
Mode.cur_menu[Mode.cur_menu_depth++] = mi->child;
}
#else
@ -2623,7 +2623,7 @@ SubmenuShowTimeout(int val, void *dat)
ShowEwin(ewin2);
if (Conf.menuslide)
UnShadeEwin(ewin2);
EwinUnShade(ewin2);
if (Mode.cur_menu[Mode.cur_menu_depth - 1] != mi->child)
Mode.cur_menu[Mode.cur_menu_depth++] = mi->child;

View File

@ -383,7 +383,7 @@ PagerShow(Pager * p)
/* show the pager ewin */
ShowEwin(ewin);
if (((sn) && (sn->use_sticky) && (sn->sticky)) || (!sn))
MakeWindowSticky(ewin);
EwinStick(ewin);
RememberImportantInfoForEwin(ewin);
if (Conf.pagers.snap)
{

View File

@ -1,68 +0,0 @@
/*
* Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
void
MakeWindowUnSticky(EWin * ewin)
{
EDBUG(5, "MakeWindowUnSticky");
if (!ewin)
EDBUG_RETURN_;
ewin->sticky = 0;
MoveEwinToDesktopAt(ewin, desks.current, ewin->x, ewin->y);
EwinBorderDraw(ewin, 0, 0);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}
void
MakeWindowSticky(EWin * ewin)
{
int x, y, dx, dy;
EDBUG(5, "MakeWindowSticky");
if (!ewin)
EDBUG_RETURN_;
/* Avoid "losing" windows made sticky while not in the current viewport */
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;
MoveEwinToDesktopAt(ewin, desks.current, x, y);
ewin->sticky = 1;
EwinBorderDraw(ewin, 0, 0);
HintsSetWindowState(ewin);
EDBUG_RETURN_;
}