Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h borders.c evhandlers.c icccm.c session.c snaps.c
Log Message:
Get the window placement right, I hope.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.289
retrieving revision 1.290
diff -u -3 -r1.289 -r1.290
--- E.h 27 Jun 2004 10:42:52 -0000 1.289
+++ E.h 27 Jun 2004 15:59:32 -0000 1.290
@@ -1737,6 +1737,7 @@
#define EWIN_CHANGE_DESKTOP (1<<3)
#define EWIN_CHANGE_LAYER (1<<4)
+void EwinGetPosition(EWin * ewin, int *px, int *py);
void EwinRefresh(EWin * ewin);
void EwinUpdateAfterMoveResize(EWin * ewin, int resize);
void EwinFixPosition(EWin * ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -3 -r1.197 -r1.198
--- borders.c 26 Jun 2004 18:24:39 -0000 1.197
+++ borders.c 27 Jun 2004 15:59:32 -0000 1.198
@@ -485,8 +485,8 @@
}
/* if it hasn't been placed yet.... find a spot for it */
- x = 0;
- y = 0;
+ x = ewin->x;
+ y = ewin->y;
if ((!ewin->client.already_placed) && (!manplace))
{
@@ -536,53 +536,6 @@
ArrangeEwinXY(ewin, &x, &y);
} /* (Conf.manual_placement_mouse_pointer) */
} /* ((!ewin->client.already_placed) && (!manplace)) */
- else
- {
- x = ewin->x;
- y = ewin->y;
- switch (ewin->client.grav)
- {
- case NorthWestGravity:
- x += (ewin->client.bw * 2);
- y += (ewin->client.bw * 2);
- break;
- case NorthGravity:
- y += (ewin->client.bw * 2);
- break;
- case NorthEastGravity:
- y += (ewin->client.bw * 2);
- if (ewin->border)
- x -= ewin->border->border.left + (ewin->client.bw * 2);
- break;
- case EastGravity:
- if (ewin->border)
- x -= ewin->border->border.left + (ewin->client.bw * 2);
- break;
- case SouthEastGravity:
- if (ewin->border)
- {
- x -= ewin->border->border.left + (ewin->client.bw * 2);
- y -= ewin->border->border.top + (ewin->client.bw * 2);
- }
- break;
- case SouthGravity:
- if (ewin->border)
- y -= ewin->border->border.top + (ewin->client.bw * 2);
- break;
- case SouthWestGravity:
- x += (ewin->client.bw * 2);
- if (ewin->border)
- y -= ewin->border->border.top + (ewin->client.bw * 2);
- break;
- case WestGravity:
- x += (ewin->client.bw * 2);
- break;
- case CenterGravity:
- break;
- default:
- break;
- }
- }
/* if the window asked to be iconified at the start */
if (ewin->client.start_iconified)
@@ -1149,11 +1102,82 @@
EDBUG_RETURN_;
}
+/*
+ * Derive frame window position from client window and border properties
+ */
+void
+EwinGetPosition(EWin * ewin, int *px, int *py)
+{
+ int x, y, bw, frame_lr, frame_tb;
+
+ x = ewin->client.x;
+ y = ewin->client.y;
+ bw = ewin->client.bw;
+ frame_lr = ewin->border->border.left + ewin->border->border.right;
+ frame_tb = ewin->border->border.top + ewin->border->border.bottom;
+
+ switch (ewin->client.grav)
+ {
+ case NorthWestGravity:
+ case SouthWestGravity:
+ case WestGravity:
+ x -= bw;
+ break;
+ case NorthEastGravity:
+ case EastGravity:
+ case SouthEastGravity:
+ x -= frame_lr / 2;
+ break;
+ case NorthGravity:
+ case CenterGravity:
+ case SouthGravity:
+ x -= frame_lr - bw;
+ break;
+ default:
+ break;
+ }
+
+ switch (ewin->client.grav)
+ {
+ case NorthWestGravity:
+ case NorthGravity:
+ case NorthEastGravity:
+ y -= bw;
+ break;
+ case WestGravity:
+ case CenterGravity:
+ case EastGravity:
+ y -= frame_tb / 2;
+ break;
+ case SouthWestGravity:
+ case SouthGravity:
+ case SouthEastGravity:
+ y -= frame_tb - bw;
+ break;
+ default:
+ break;
+ }
+
+ *px = x;
+ *py = y;
+}
+
+/*
+ * Derive frame window geometry from client window properties
+ */
static void
EwinGetGeometry(EWin * ewin)
{
- ewin->shape_x = ewin->x = ewin->client.x - ewin->border->border.left;
- ewin->shape_y = ewin->y = ewin->client.y - ewin->border->border.top;
+ int x, y;
+
+ EwinGetPosition(ewin, &x, &y);
+
+ ewin->client.x = x + ewin->border->border.left;
+ ewin->client.y = y + ewin->border->border.top;
+
+ ewin->shape_x = ewin->x = x;
+ ewin->shape_y = ewin->y = y;
+
ewin->w = ewin->client.w +
ewin->border->border.left + ewin->border->border.right;
ewin->h = ewin->client.h +
@@ -3432,8 +3456,7 @@
/* This makes E determine the client window stacking at exit */
EReparentWindow(disp, ewin->client.win, VRoot.win,
- ewin->x + ewin->border->border.left,
- ewin->y + ewin->border->border.top);
+ ewin->client.x, ewin->client.y);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -3 -r1.166 -r1.167
--- evhandlers.c 19 May 2004 21:41:03 -0000 1.166
+++ evhandlers.c 27 Jun 2004 15:59:32 -0000 1.167
@@ -779,8 +779,8 @@
ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
if (ewin)
{
- x = ewin->x + ewin->border->border.left;
- y = ewin->y + ewin->border->border.top;
+ x = ewin->x;
+ y = ewin->y;
w = ewin->client.w;
h = ewin->client.h;
winrel = 0;
@@ -831,9 +831,16 @@
if (h > ewin->client.height.max)
ewin->client.height.max = h;
+ if (ev->xconfigurerequest.value_mask & (CWX | CWY))
+ {
+ /* Correct position taking gravity into account */
+ ewin->client.x = x;
+ ewin->client.y = y;
+ EwinGetPosition(ewin, &x, &y);
+ }
+
Mode.move.check = 0; /* Don't restrict client requests */
- MoveResizeEwin(ewin, x - ewin->border->border.left,
- y - ewin->border->border.top, w, h);
+ MoveResizeEwin(ewin, x, y, w, h);
Mode.move.check = 1;
if (Mode.mode == MODE_MOVE_PENDING || Mode.mode == MODE_MOVE)
ICCCM_Configure(ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -3 -r1.69 -r1.70
--- icccm.c 18 Jun 2004 20:12:09 -0000 1.69
+++ icccm.c 27 Jun 2004 15:59:32 -0000 1.70
@@ -390,7 +390,10 @@
EDBUG(6, "ICCCM_Adopt");
if (!ewin->internal)
- XSetWindowBorderWidth(disp, win, 0);
+ {
+ XSetWindowBorderWidth(disp, win, 0);
+ ewin->client.bw = 0;
+ }
EReparentWindow(disp, win, ewin->win_container, 0, 0);
c[0] = (ewin->client.start_iconified) ? IconicState : NormalState;
XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace,
@@ -1067,8 +1070,8 @@
aa = XInternAtom(disp, "ENL_INTERNAL_DATA_BORDER", False);
c[0] = ewin->desktop;
c[1] = ewin->sticky;
- c[2] = ewin->client.x;
- c[3] = ewin->client.y;
+ c[2] = ewin->x;
+ c[3] = ewin->y;
c[4] = ewin->iconified;
if (ewin->iconified)
ICCCM_DeIconify(ewin);
@@ -1179,6 +1182,7 @@
ewin->sticky = c[1];
ewin->client.x = c[2];
ewin->client.y = c[3];
+ ewin->client.grav = NorthWestGravity;
ewin->iconified = c[4];
ewin->shaded = c[5];
if (ewin->sticky)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- session.c 19 Jun 2004 21:31:40 -0000 1.73
+++ session.c 27 Jun 2004 15:59:32 -0000 1.74
@@ -236,7 +236,7 @@
y = desks.desk[ewin->desktop].current_area_y * VRoot.h;
}
fprintf(f, "[CLIENT] %i %i %i %i %i %i %i %i %i\n",
- ewin->client.x + x, ewin->client.y + y, ewin->client.w,
+ ewin->x + x, ewin->y + y, ewin->client.w,
ewin->client.h, ewin->desktop, ewin->iconified,
ewin->shaded, ewin->sticky, ewin->layer);
if (ewin->session_id)
@@ -412,6 +412,7 @@
(desks.desk[ewin->desktop].current_area_x * VRoot.w);
ewin->client.y = matches[i].y -
(desks.desk[ewin->desktop].current_area_y * VRoot.h);
+ ewin->client.grav = NorthWestGravity;
ewin->client.w = matches[i].w;
ewin->client.h = matches[i].h;
EMoveResizeWindow(disp, ewin->client.win, ewin->client.x,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/snaps.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -3 -r1.69 -r1.70
--- snaps.c 18 Jun 2004 20:12:10 -0000 1.69
+++ snaps.c 27 Jun 2004 15:59:32 -0000 1.70
@@ -629,8 +629,8 @@
if (!sn)
return;
sn->use_xy = 1;
- sn->x = ewin->client.x;
- sn->y = ewin->client.y;
+ sn->x = ewin->x;
+ sn->y = ewin->y;
sn->area_x = ewin->area_x;
sn->area_y = ewin->area_y;
if (!ewin->sticky)
@@ -1173,6 +1173,7 @@
ewin->client.already_placed = 1;
ewin->client.x = sn->x;
ewin->client.y = sn->y;
+ ewin->client.grav = NorthWestGravity;
ewin->area_x = sn->area_x;
ewin->area_y = sn->area_y;
if (!ewin->sticky)
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs