Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h desktops.c ewins.c
Log Message:
Attempt do useful window repositioning on screen size change.
===================================================================
RCS file: /cvs/e/e16/e/src/E.h,v
retrieving revision 1.539
retrieving revision 1.540
diff -u -3 -r1.539 -r1.540
--- E.h 29 Mar 2006 19:13:16 -0000 1.539
+++ E.h 29 Mar 2006 23:45:32 -0000 1.540
@@ -508,6 +508,11 @@
} place;
struct
{
+ int w_old;
+ int h_old;
+ } screen;
+ struct
+ {
unsigned int extensions;
} server;
struct
===================================================================
RCS file: /cvs/e/e16/e/src/desktops.c,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -3 -r1.228 -r1.229
--- desktops.c 1 Mar 2006 21:57:50 -0000 1.228
+++ desktops.c 29 Mar 2006 23:45:32 -0000 1.229
@@ -836,10 +836,10 @@
BackgroundsInvalidate(0);
+ ModulesSignal(ESIGNAL_DESK_RESIZE, NULL);
+
for (i = 0; i < Conf.desks.num; i++)
DeskResize(i, w, h);
-
- ModulesSignal(ESIGNAL_DESK_RESIZE, NULL);
}
static void
@@ -1909,6 +1909,8 @@
if (w != ww || h != hh)
return;
+ Mode.screen.w_old = VRoot.w;
+ Mode.screen.h_old = VRoot.h;
VRoot.w = w;
VRoot.h = h;
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- ewins.c 22 Mar 2006 18:43:13 -0000 1.147
+++ ewins.c 29 Mar 2006 23:45:32 -0000 1.148
@@ -1732,6 +1732,61 @@
}
}
+static void
+EwinsReposition(void)
+{
+ int wdo, hdo, wdn, hdn;
+ int i, num;
+ EWin *const *lst, *ewin;
+ int x, y, w, h, ax, ay, xn, yn;
+
+ lst = EwinListGetAll(&num);
+
+ wdo = Mode.screen.w_old;
+ hdo = Mode.screen.h_old;
+ wdn = VRoot.w;
+ hdn = VRoot.h;
+
+ for (i = num - 1; i >= 0; i--)
+ {
+ ewin = lst[i];
+ x = EoGetX(ewin);
+ y = EoGetY(ewin);
+ w = EoGetW(ewin);
+ h = EoGetH(ewin);
+
+ /* Get relative area */
+ ax = (x >= 0) ? (x + w / 2) / wdo : (x + w / 2 + 1) / wdo - 1;
+ ay = (y >= 0) ? (y + h / 2) / hdo : (y + h / 2 + 1) / hdo - 1;
+
+ x -= ax * wdo;
+ y -= ay * hdo;
+
+ /* Reposition to same distance from nearest screen edge */
+ /* Fall back to left/top if this causes left/top to go offscreen */
+ if (abs(x) <= abs(x + w - wdo))
+ xn = x;
+ else
+ xn = x + (wdn - wdo);
+ if (x > 0 && xn < 0)
+ xn = x;
+ xn += ax * wdn;
+
+ if (abs(y) <= abs(y + h - hdo))
+ yn = y;
+ else
+ yn = y + (hdn - hdo);
+ if (y > 0 && yn < 0)
+ yn = y;
+ yn += ay * hdn;
+
+ if (xn == EoGetX(ewin) && yn == EoGetY(ewin))
+ continue;
+
+ EwinMove(ewin, xn, yn);
+ }
+}
+
void
EwinsMoveStickyToDesk(Desk * dsk)
{
@@ -2061,7 +2116,7 @@
break;
#endif
case ESIGNAL_DESK_RESIZE:
- EwinsTouch(NULL);
+ EwinsReposition();
break;
case ESIGNAL_THEME_TRANS_CHANGE:
EwinsTouch(DesksGetCurrent());
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs