Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h actions.c areas.c borders.c desktops.c focus.c
Log Message:
Fix problem with windows going off in all directions after restart.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -3 -r1.200 -r1.201
--- E.h 8 Feb 2004 17:02:26 -0000 1.200
+++ E.h 8 Feb 2004 22:51:50 -0000 1.201
@@ -1716,7 +1716,11 @@
void *ptr);
EWin *CreateEwin(void);
void FreeEwin(EWin * ewin);
+void EwinSetArea(EWin * ewin, int ax, int ay);
+void MoveEwinToArea(EWin * ewin, int ax, int ay);
+void SetEwinToCurrentArea(EWin * ewin);
int EwinGetDesk(EWin * ewin);
+int EwinIsOnScreen(EWin * ewin);
int EwinWinpartIndex(EWin * ewin, Window win);
int BordersEventMouseDown(XEvent * ev);
@@ -1740,7 +1744,6 @@
/* borders.c functions */
void KillEwin(EWin * ewin, int nogroup);
void ResizeEwin(EWin * ewin, int w, int h);
-void DetermineEwinArea(EWin * ewin);
void MoveEwin(EWin * ewin, int x, int y);
void MoveResizeEwin(EWin * ewin, int x, int y, int w, int h);
void FloatEwin(EWin * ewin);
@@ -1928,6 +1931,7 @@
void DesktopAddEwinToTop(EWin * ewin);
void DesktopRemoveEwin(EWin * ewin);
void MoveEwinToDesktopAt(EWin * ewin, int num, int x, int y);
+void GotoDesktopByEwin(EWin * ewin);
void FloatEwinAboveDesktops(EWin * ewin);
void DesktopAccounting(void);
@@ -2270,14 +2274,14 @@
void ShowDeskMenu(void);
void ShowGroupMenu(void);
+/* areas.c */
+void AreaFix(int *ax, int *ay);
void SetNewAreaSize(int ax, int ay);
void GetCurrentArea(int *ax, int *ay);
void SetAreaSize(int aw, int ah);
void GetAreaSize(int *aw, int *ah);
void InitCurrentArea(int ax, int ay);
void SetCurrentArea(int ax, int ay);
-void MoveEwinToArea(EWin * ewin, int ax, int ay);
-void SetEwinToCurrentArea(EWin * ewin);
void MoveCurrentAreaBy(int ax, int ay);
void SetCurrentLinearArea(int a);
int GetCurrentLinearArea(void);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -3 -r1.137 -r1.138
--- actions.c 6 Feb 2004 19:56:26 -0000 1.137
+++ actions.c 8 Feb 2004 22:51:50 -0000 1.138
@@ -2534,11 +2534,8 @@
{
EDBUG(6, "doFocusSet");
- if (!ewin->sticky)
- {
- GotoDesktop(ewin->desktop);
- SetCurrentArea(ewin->area_x, ewin->area_y);
- }
+ GotoDesktopByEwin(ewin);
+
if (ewin->iconified)
DeIconifyEwin(ewin);
if (ewin->shaded)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- areas.c 6 Feb 2004 19:56:26 -0000 1.60
+++ areas.c 8 Feb 2004 22:51:50 -0000 1.61
@@ -26,34 +26,56 @@
static int area_w = 3;
static int area_h = 3;
-#define AREA_FIX(ax, ay) \
-if (ax < 0) \
-{ \
-if (conf.areas.wraparound) \
-ax = area_w - 1; \
-else \
-ax = 0; \
-} \
-else if (ax >= area_w) \
-{ \
-if (conf.areas.wraparound) \
-ax = 0; \
-else \
-ax = area_w - 1; \
-} \
-if (ay < 0) \
-{ \
-if (conf.areas.wraparound) \
-ay = area_h - 1; \
-else \
-ay = 0; \
-} \
-else if (ay >= area_h) \
-{ \
-if (conf.areas.wraparound) \
-ay = 0; \
-else \
-ay = area_h - 1; \
+void
+AreaFix(int *ax, int *ay)
+{
+ if (*ax < 0)
+ {
+ if (conf.areas.wraparound)
+ *ax = area_w - 1;
+ else
+ *ax = 0;
+ }
+ else if (*ax >= area_w)
+ {
+ if (conf.areas.wraparound)
+ *ax = 0;
+ else
+ *ax = area_w - 1;
+ }
+
+ if (*ay < 0)
+ {
+ if (conf.areas.wraparound)
+ *ay = area_h - 1;
+ else
+ *ay = 0;
+ }
+ else if (*ay >= area_h)
+ {
+ if (conf.areas.wraparound)
+ *ay = 0;
+ else
+ *ay = area_h - 1;
+ }
+}
+
+static int
+AreaXYToLinear(int ax, int ay)
+{
+ AreaFix(&ax, &ay);
+ return (ay * area_w) + ax;
+}
+
+static void
+AreaLinearToXY(int a, int *ax, int *ay)
+{
+ if (a < 0)
+ a = 0;
+ else if (a >= (area_w * area_h))
+ a = (area_w * area_h) - 1;
+ *ay = a / area_w;
+ *ax = a - (*ay * area_w);
}
void
@@ -71,7 +93,9 @@
GetAreaSize(&a, &b);
if ((a == ax) && (b == ay))
return;
+
SetAreaSize(ax, ay);
+
lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
if (lst)
{
@@ -87,6 +111,7 @@
}
Efree(lst);
}
+
GetCurrentArea(&a, &b);
if (a >= ax)
{
@@ -134,7 +159,7 @@
InitCurrentArea(int ax, int ay)
{
EDBUG(4, "InitCurrentArea");
- AREA_FIX(ax, ay);
+ AreaFix(&ax, &ay);
desks.desk[desks.current].current_area_x = ax;
desks.desk[desks.current].current_area_y = ay;
EDBUG_RETURN_;
@@ -143,18 +168,17 @@
void
SetCurrentLinearArea(int a)
{
- if (a < 0)
- a = 0;
- else if (a >= (area_w * area_h))
- a = (area_w * area_h) - 1;
- SetCurrentArea(a - ((a / area_w) * area_w), (a / area_w));
+ int ax, ay;
+
+ AreaLinearToXY(a, &ax, &ay);
+ SetCurrentArea(ax, ay);
}
int
GetCurrentLinearArea(void)
{
- return ((desks.desk[desks.current].current_area_y * area_w) +
- desks.desk[desks.current].current_area_x);
+ return AreaXYToLinear(desks.desk[desks.current].current_area_x,
+ desks.desk[desks.current].current_area_y);
}
void
@@ -164,27 +188,6 @@
}
void
-MoveEwinToLinearArea(EWin * ewin, int a)
-{
- if (a < 0)
- a = 0;
- else if (a >= (area_w * area_h))
- a = (area_w * area_h) - 1;
- MoveEwinToArea(ewin, a - ((a / area_w) * area_w), (a / area_w));
-}
-
-void
-MoveEwinLinearAreaBy(EWin * ewin, int a)
-{
- a += (ewin->area_y * area_w) + (ewin->area_x);
- if (a < 0)
- a = 0;
- else if (a >= (area_w * area_h))
- a = (area_w * area_h) - 1;
- MoveEwinToArea(ewin, a - ((a / area_w) * area_w), (a / area_w));
-}
-
-void
SlideWindowsBy(Window * win, int num, int dx, int dy, int speed)
{
int i, k, spd, x, y, min;
@@ -249,7 +252,7 @@
|| (mode.mode == MODE_RESIZE_V))
EDBUG_RETURN_;
- AREA_FIX(ax, ay);
+ AreaFix(&ax, &ay);
if ((ax == desks.desk[desks.current].current_area_x)
&& (ay == desks.desk[desks.current].current_area_y))
EDBUG_RETURN_;
@@ -446,34 +449,26 @@
}
void
-MoveEwinToArea(EWin * ewin, int ax, int ay)
+MoveCurrentAreaBy(int ax, int ay)
{
- EDBUG(4, "MoveEwinToArea");
- AREA_FIX(ax, ay);
- MoveEwin(ewin, ewin->x + (root.w * (ax - ewin->area_x)),
- ewin->y + (root.h * (ay - ewin->area_y)));
- ewin->area_x = ax;
- ewin->area_y = ay;
- HintsSetWindowArea(ewin);
+ EDBUG(4, "MoveCurrentAreaBy");
+
+ SetCurrentArea(desks.desk[desks.current].current_area_x + ax,
+ desks.desk[desks.current].current_area_y + ay);
EDBUG_RETURN_;
}
void
-SetEwinToCurrentArea(EWin * ewin)
+MoveEwinToLinearArea(EWin * ewin, int a)
{
- EDBUG(4, "SetEwinToCurrentArea");
- ewin->area_x = desks.desk[ewin->desktop].current_area_x;
- ewin->area_y = desks.desk[ewin->desktop].current_area_y;
- HintsSetWindowArea(ewin);
- EDBUG_RETURN_;
+ int ax, ay;
+
+ AreaLinearToXY(a, &ax, &ay);
+ MoveEwinToArea(ewin, ax, ay);
}
void
-MoveCurrentAreaBy(int ax, int ay)
+MoveEwinLinearAreaBy(EWin * ewin, int a)
{
- EDBUG(4, "MoveCurrentAreaBy");
-
- SetCurrentArea(desks.desk[desks.current].current_area_x + ax,
- desks.desk[desks.current].current_area_y + ay);
- EDBUG_RETURN_;
+ MoveEwinToLinearArea(ewin, AreaXYToLinear(ewin->area_x, ewin->area_y) + a);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -3 -r1.131 -r1.132
--- borders.c 6 Feb 2004 19:56:26 -0000 1.131
+++ borders.c 8 Feb 2004 22:51:50 -0000 1.132
@@ -25,6 +25,7 @@
static void EwinSetBorderInit(EWin * ewin);
static void EwinSetBorderTo(EWin * ewin, Border * b);
+static void DetermineEwinArea(EWin * ewin);
#if 0
#define DELETE_EWIN_REFERENCE(ew, ew_ref) \
@@ -400,73 +401,46 @@
DetermineEwinArea(ewin);
ResizeEwin(ewin, ewin->client.w, ewin->client.h);
- /* tag the parent window if this is a transient */
if (ewin->client.transient)
{
- ewin2 =
- FindItem(NULL, ewin->client.transient_for, LIST_FINDBY_ID,
- LIST_TYPE_EWIN);
+ /* tag the parent window if this is a transient */
+ ewin2 = FindItem(NULL, ewin->client.transient_for, LIST_FINDBY_ID,
+ LIST_TYPE_EWIN);
if (ewin2)
ewin2->has_transients++;
- }
- if ((conf.focus.transientsfollowleader) && (ewin->client.transient))
- {
- ewin2 =
- FindItem(NULL, ewin->client.transient_for, LIST_FINDBY_ID,
- LIST_TYPE_EWIN);
- if (ewin2)
- {
- ewin->desktop = ewin2->desktop;
- if ((conf.focus.switchfortransientmap)
- && (ewin->desktop != desks.current) && (!ewin->iconified))
- {
- GotoDesktop(ewin->desktop);
- SetCurrentArea(ewin2->area_x, ewin2->area_y);
- }
- }
- else
+
+ if (conf.focus.transientsfollowleader)
{
- ewin2 =
- FindItem(NULL, ewin->client.group, LIST_FINDBY_ID,
- LIST_TYPE_EWIN);
- if (ewin2)
+ if (!ewin2)
+ ewin2 = FindItem(NULL, ewin->client.group, LIST_FINDBY_ID,
+ LIST_TYPE_EWIN);
+
+ if (!ewin2)
{
- ewin->desktop = ewin2->desktop;
- if ((conf.focus.switchfortransientmap)
- && (ewin->desktop != desks.current) && (!ewin->iconified))
+ lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
+ for (i = 0; i < num; i++)
{
- GotoDesktop(ewin->desktop);
- SetCurrentArea(ewin2->area_x, ewin2->area_y);
+ if ((lst[i]->iconified) ||
+ (ewin->client.group != lst[i]->client.group))
+ continue;
+
+ ewin2 = lst[i];
+ break;
}
+ if (lst)
+ Efree(lst);
}
- else
+
+ if (ewin2)
{
- lst = (EWin **) ListItemType(&num, LIST_TYPE_EWIN);
- if ((lst) && (num > 0))
- {
- for (i = 0; i < num; i++)
- {
- if ((!lst[i]->iconified)
- && (ewin->client.group == lst[i]->client.group))
- {
- ewin->desktop = lst[i]->desktop;
- if ((conf.focus.switchfortransientmap)
- && (ewin->desktop != desks.current)
- && (!ewin->iconified))
- {
- GotoDesktop(ewin->desktop);
- SetCurrentArea(lst[i]->area_x,
- lst[i]->area_y);
- }
- i = num;
- }
- }
- Efree(lst);
- }
+ ewin->desktop = ewin2->desktop;
+ if ((conf.focus.switchfortransientmap) && (!ewin->iconified))
+ GotoDesktopByEwin(ewin2);
}
}
}
- /* if it hasnt been planed on a desktop - assing it the current desktop */
+
+ /* if it hasn't been planted on a desktop - assign it the current desktop */
if (ewin->desktop < 0)
{
ewin->desktop = desks.current;
@@ -591,6 +565,7 @@
break;
}
}
+
/* add it to our list of managed clients */
AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
DesktopAddEwinToTop(ewin);
@@ -611,6 +586,7 @@
IconifyEwin(ewin);
EDBUG_RETURN_;
}
+
/* if we should slide it in and are not currently in the middle of a slide */
if ((manplace) && (!ewin->client.already_placed))
{
@@ -1697,28 +1673,6 @@
}
void
-DetermineEwinArea(EWin * ewin)
-{
- int pax, pay;
-
- EDBUG(4, "DetermineEwinArea");
-
- pax = ewin->area_x;
- pay = ewin->area_y;
- ewin->area_x =
- (ewin->x + (ewin->w / 2) +
- (desks.desk[ewin->desktop].current_area_x * root.w)) / root.w;
- ewin->area_y =
- (ewin->y + (ewin->h / 2) +
- (desks.desk[ewin->desktop].current_area_y * root.h)) / root.h;
- if ((pax != ewin->area_x) || (pay != ewin->area_y))
- {
- HintsSetWindowArea(ewin);
- }
- EDBUG_RETURN_;
-}
-
-void
MoveEwin(EWin * ewin, int x, int y)
{
int dx, dy;
@@ -1726,12 +1680,10 @@
static int call_depth = 0;
EDBUG(3, "MoveEwin");
- call_depth++;
if (call_depth > 256)
- {
- call_depth--;
- EDBUG_RETURN_;
- }
+ EDBUG_RETURN_;
+ call_depth++;
+
dx = x - ewin->x;
dy = y - ewin->y;
if ((dx != 0) || (dy != 0))
@@ -1741,9 +1693,12 @@
ewin->reqx = x;
ewin->reqy = y;
EMoveWindow(disp, ewin->win, ewin->x, ewin->y);
+
if (mode.mode != MODE_MOVE_PENDING && mode.mode != MODE_MOVE)
ICCCM_Configure(ewin);
+
DetermineEwinArea(ewin);
+
if (ewin->has_transients)
{
EWin **lst;
@@ -1766,6 +1721,7 @@
Efree(lst);
}
}
+
if ((mode.mode == MODE_NONE) && (move))
{
if (ewin->dialog)
@@ -1776,6 +1732,7 @@
PagerEwinOutsideAreaUpdate(ewin);
ForceUpdatePagersForDesktop(ewin->desktop);
}
+
call_depth--;
EDBUG_RETURN_;
}
@@ -1788,12 +1745,10 @@
static int call_depth = 0;
EDBUG(3, "MoveResizeEwin");
- call_depth++;
if (call_depth > 256)
- {
- call_depth--;
- EDBUG_RETURN_;
- }
+ EDBUG_RETURN_;
+ call_depth++;
+
dx = x - ewin->x;
dy = y - ewin->y;
if ((dx != 0) || (dy != 0) || (w != ewin->w) || (h != ewin->h))
@@ -1805,6 +1760,7 @@
ewin->client.w = w;
ewin->client.h = h;
ICCCM_MatchSize(ewin);
+
if (!ewin->shaded)
{
ewin->w =
@@ -1814,11 +1770,15 @@
ewin->client.h + ewin->border->border.top +
ewin->border->border.bottom;
}
+
EMoveResizeWindow(disp, ewin->win, ewin->x, ewin->y, ewin->w, ewin->h);
+
DetermineEwinArea(ewin);
+
if ((mode.mode != MODE_MOVE_PENDING && mode.mode != MODE_MOVE)
|| (mode.have_place_grab))
ICCCM_Configure(ewin);
+
CalcEwinSizes(ewin);
if (ewin->has_transients)
{
@@ -2999,6 +2959,54 @@
EDBUG_RETURN_;
}
+void
+EwinSetArea(EWin * ewin, int ax, int ay)
+{
+ if (ax == ewin->area_x && ay == ewin->area_y)
+ return;
+
+ ewin->area_x = ax;
+ ewin->area_y = ay;
+
+ HintsSetWindowArea(ewin);
+}
+
+static void
+DetermineEwinArea(EWin * ewin)
+{
+ int ax, ay;
+
+ EDBUG(4, "DetermineEwinArea");
+
+ ax = (ewin->x + (ewin->w / 2) +
+ (desks.desk[ewin->desktop].current_area_x * root.w)) / root.w;
+ ay = (ewin->y + (ewin->h / 2) +
+ (desks.desk[ewin->desktop].current_area_y * root.h)) / root.h;
+
+ AreaFix(&ax, &ay);
+ EwinSetArea(ewin, ax, ay);
+
+ EDBUG_RETURN_;
+}
+
+void
+MoveEwinToArea(EWin * ewin, int ax, int ay)
+{
+ EDBUG(4, "MoveEwinToArea");
+ AreaFix(&ax, &ay);
+ MoveEwin(ewin, ewin->x + (root.w * (ax - ewin->area_x)),
+ ewin->y + (root.h * (ay - ewin->area_y)));
+ EwinSetArea(ewin, ax, ay);
+ EDBUG_RETURN_;
+}
+
+void
+SetEwinToCurrentArea(EWin * ewin)
+{
+ EwinSetArea(ewin, desks.desk[ewin->desktop].current_area_x,
+ desks.desk[ewin->desktop].current_area_y);
+}
+
int
EwinGetDesk(EWin * ewin)
{
@@ -3006,6 +3014,20 @@
}
int
+EwinIsOnScreen(EWin * ewin)
+{
+ int desk;
+
+ desk = EwinGetDesk(ewin);
+ if (desk != desks.current)
+ return 0;
+ if (ewin->area_x != desks.desk[desk].current_area_x ||
+ ewin->area_y != desks.desk[desk].current_area_y)
+ return 0;
+ return 1;
+}
+
+int
EwinWinpartIndex(EWin * ewin, Window win)
{
int i;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- desktops.c 8 Feb 2004 22:00:33 -0000 1.60
+++ desktops.c 8 Feb 2004 22:51:50 -0000 1.61
@@ -1885,6 +1885,16 @@
EDBUG_RETURN_;
}
+void
+GotoDesktopByEwin(EWin * ewin)
+{
+ if (!ewin->sticky)
+ {
+ GotoDesktop(ewin->desktop);
+ SetCurrentArea(ewin->area_x, ewin->area_y);
+ }
+}
+
#if 0 /* Unused */
void
FloatEwinAboveDesktops(EWin * ewin)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- focus.c 7 Feb 2004 00:30:23 -0000 1.46
+++ focus.c 8 Feb 2004 22:51:50 -0000 1.47
@@ -71,7 +71,6 @@
for (i = 0; i < num0; i++)
{
ewin = lst0[i];
- DetermineEwinArea(ewin);
if (((ewin->sticky) || (ewin->desktop == desks.current)) &&
((ewin->area_x == ax) && (ewin->area_y == ay)) &&
(!ewin->skipfocus) && (!ewin->neverfocus) &&
@@ -157,8 +156,7 @@
void
FocusToEWin(EWin * ewin, int why)
{
- int ax, ay;
- int do_set = 0;
+ int do_follow = 0;
EDBUG(4, "FocusToEWin");
#if 0
@@ -186,12 +184,12 @@
if (conf.focus.all_new_windows_get_focus)
{
- do_set = 2;
+ do_follow = 2;
}
else if (conf.focus.new_transients_get_focus)
{
if (ewin->client.transient)
- do_set = 2;
+ do_follow = 2;
}
else if (conf.focus.new_transients_get_focus_if_group_focused)
{
@@ -200,14 +198,14 @@
ewin2 = FindItem(NULL, ewin->client.transient_for,
LIST_FINDBY_ID, LIST_TYPE_EWIN);
if ((ewin2) && (mode.focuswin == ewin2))
- do_set = 2;
+ do_follow = 2;
}
else if (mode.place)
{
- do_set = 1;
+ do_follow = 1;
}
- if (!do_set)
+ if (!do_follow)
EDBUG_RETURN_;
break;
@@ -234,6 +232,12 @@
if (ewin->menu)
EDBUG_RETURN_;
+ if (do_follow && !mode.startup)
+ GotoDesktopByEwin(ewin);
+
+ if (!EwinIsOnScreen(ewin))
+ EDBUG_RETURN_;
+
if (conf.autoraise.enable)
{
RemoveTimerEvent("AUTORAISE_TIMEOUT");
@@ -243,22 +247,6 @@
ewin->client.win, NULL);
}
- if (EwinGetDesk(ewin) != desks.current)
- {
- GotoDesktop(ewin->desktop);
- }
-
- if ((!ewin->fixedpos) && (!ewin->sticky))
- {
- GetCurrentArea(&ax, &ay);
- if ((ax != ewin->area_x) || (ay != ewin->area_y))
- {
- if ((ewin->x >= root.w) || (ewin->y >= root.h)
- || ((ewin->x + ewin->w) < 0) || ((ewin->y + ewin->h) < 0))
- SetCurrentArea(ewin->area_x, ewin->area_y);
- }
- }
-
if ((conf.focus.raise_on_next_focus && (why == FOCUS_NEXT)) ||
(conf.focus.raise_after_next_focus && (why == FOCUS_WARP_DONE)))
RaiseEwin(ewin);
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs