summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tkMacOSXWindowEvent.c9
-rw-r--r--macosx/tkMacOSXWm.c25
2 files changed, 23 insertions, 11 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index fd401ab..a07ef15 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -31,7 +31,7 @@
*/
static int GenerateUpdates(HIShapeRef updateRgn,
- CGRect *updateBounds, TkWindow *winPtr);
+ CGRect *updateBounds, TkWindow *winPtr);
static int GenerateActivateEvents(TkWindow *winPtr,
int activeFlag);
static void DoWindowActivate(ClientData clientData);
@@ -75,10 +75,12 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
if (winPtr) {
WmInfo *wmPtr = winPtr->wmInfoPtr;
NSRect bounds = [w frame];
+ NSRect screenRect = [[w screen] frame];
int x, y, width = -1, height = -1, flags = 0;
int minY = 1 + [[NSApp mainMenu] menuBarHeight];
+
x = bounds.origin.x;
- y = tkMacOSXZeroScreenHeight - (bounds.origin.y + bounds.size.height);
+ y = screenRect.size.height - (bounds.origin.y + bounds.size.height);
if (winPtr->changes.x != x || winPtr->changes.y != y) {
flags |= TK_LOCATION_CHANGED;
} else {
@@ -679,7 +681,7 @@ TkGenWMConfigureEvent(
if (flags & TK_LOCATION_CHANGED) {
wmPtr->x = x;
wmPtr->y = y;
- wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
+ //wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
}
if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) &&
((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) {
@@ -722,6 +724,7 @@ TkGenWMConfigureEvent(
}
}
+
/*
* Now set up the changes structure. Under X we wait for the
* ConfigureNotify to set these values. On the Mac we know imediatly that
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index f36ef1d..8ef322b 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1951,8 +1951,9 @@ WmGeometryCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char xSign, ySign;
- int width, height;
+ NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
+ char xSign = '+', ySign = '+';
+ int width, height, x = wmPtr->x, y= wmPtr->y;
char *argv3;
if ((objc != 3) && (objc != 4)) {
@@ -1960,8 +1961,6 @@ WmGeometryCmd(
return TCL_ERROR;
}
if (objc == 3) {
- xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+';
- ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+';
if (wmPtr->gridWin != NULL) {
width = wmPtr->reqGridWidth + (winPtr->changes.width
- winPtr->reqWidth)/wmPtr->widthInc;
@@ -1971,8 +1970,20 @@ WmGeometryCmd(
width = winPtr->changes.width;
height = winPtr->changes.height;
}
+ if (win) {
+ if (wmPtr->flags & WM_NEGATIVE_X) {
+ xSign = '-';
+ x = wmPtr->vRootWidth - wmPtr->x
+ - (width + (wmPtr->parentWidth - winPtr->changes.width));
+ }
+ if (wmPtr->flags & WM_NEGATIVE_Y) {
+ ySign = '-';
+ y = wmPtr->vRootHeight - wmPtr->y
+ - (height + (wmPtr->parentHeight - winPtr->changes.height));
+ }
+ }
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d%c%d%c%d",
- width, height, xSign, wmPtr->x, ySign, wmPtr->y));
+ width, height, xSign, x, ySign, y));
return TCL_OK;
}
argv3 = Tcl_GetString(objv[3]);
@@ -3874,7 +3885,6 @@ UpdateGeometryInfo(
return;
}
-
/*
* Compute the new size for the top-level window. See the user
* documentation for details on this, but the size requested depends on
@@ -4216,7 +4226,6 @@ ParseGeometry(
flags |= WM_MOVE_PENDING;
}
wmPtr->flags = flags;
-
if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr);
wmPtr->flags |= WM_UPDATE_PENDING;
@@ -4677,7 +4686,7 @@ Tk_MoveToplevelWindow(
wmPtr->x = x;
wmPtr->y = y;
wmPtr->flags |= WM_MOVE_PENDING;
- wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
+ // wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y);
if (!(wmPtr->sizeHintsFlags & (USPosition|PPosition))) {
wmPtr->sizeHintsFlags |= USPosition;
wmPtr->flags |= WM_UPDATE_SIZE_HINTS;