attempt to fix zooming behavior when the user height matches the zoomed height
svn: r6681
This commit is contained in:
parent
05ea93da4c
commit
c9554c4946
|
@ -49,6 +49,7 @@ static OSStatus window_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
||||||
extern char *scheme_mac_spec_to_path(FSSpec *spec);
|
extern char *scheme_mac_spec_to_path(FSSpec *spec);
|
||||||
|
|
||||||
static int os_x_post_tiger;
|
static int os_x_post_tiger;
|
||||||
|
static int zoom_window_hack = 0;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Public constructors
|
// Public constructors
|
||||||
|
@ -317,7 +318,7 @@ static OSStatus window_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
||||||
/* DragWindow is somehow confused by MrEd. It seems to confuse the struct
|
/* DragWindow is somehow confused by MrEd. It seems to confuse the struct
|
||||||
and content regions, causing current bounds's height to become
|
and content regions, causing current bounds's height to become
|
||||||
different from the original bound's height. To compensate,
|
different from the original bound's height. To compensate,
|
||||||
10.3 seems to ignore the hieght, but 10.4 doesn't. So we
|
10.3 seems to ignore the height, but 10.4 doesn't. So we
|
||||||
explicitly request the old size. */
|
explicitly request the old size. */
|
||||||
Rect o, n;
|
Rect o, n;
|
||||||
GetEventParameter(inEvent, kEventParamPreviousBounds, typeQDRectangle,
|
GetEventParameter(inEvent, kEventParamPreviousBounds, typeQDRectangle,
|
||||||
|
@ -328,7 +329,7 @@ static OSStatus window_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
||||||
n.right = n.left + (o.right - o.left);
|
n.right = n.left + (o.right - o.left);
|
||||||
SetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
SetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
||||||
sizeof(Rect), &n);
|
sizeof(Rect), &n);
|
||||||
} else if (!(a & (kWindowBoundsChangeUserResize | kWindowBoundsChangeZoom))) {
|
} else if (!(a & (kWindowBoundsChangeUserResize | (zoom_window_hack ? 0 : kWindowBoundsChangeZoom)))) {
|
||||||
Rect n, s, c;
|
Rect n, s, c;
|
||||||
WindowRef w;
|
WindowRef w;
|
||||||
|
|
||||||
|
@ -345,8 +346,17 @@ static OSStatus window_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
||||||
between the real content and structure regions. */
|
between the real content and structure regions. */
|
||||||
int h, w, hdelta, wdelta;
|
int h, w, hdelta, wdelta;
|
||||||
|
|
||||||
w = f->Width();
|
GetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
||||||
h = f->Height();
|
NULL, sizeof(Rect), NULL, &n);
|
||||||
|
|
||||||
|
if (a & kWindowBoundsChangeZoom) {
|
||||||
|
h = n.bottom - n.top;
|
||||||
|
w = n.right - n.left;
|
||||||
|
} else {
|
||||||
|
w = f->Width();
|
||||||
|
h = f->Height();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
wxArea *parea;
|
wxArea *parea;
|
||||||
wxMargin pam;
|
wxMargin pam;
|
||||||
|
@ -356,8 +366,6 @@ static OSStatus window_evt_handler(EventHandlerCallRef inHandlerCallRef,
|
||||||
hdelta = pam.Offset(wxVertical);
|
hdelta = pam.Offset(wxVertical);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
|
||||||
NULL, sizeof(Rect), NULL, &n);
|
|
||||||
n.bottom = n.top + h - hdelta;
|
n.bottom = n.top + h - hdelta;
|
||||||
n.right = n.left + w - wdelta;
|
n.right = n.left + w - wdelta;
|
||||||
SetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
SetEventParameter(inEvent, kEventParamCurrentBounds, typeQDRectangle,
|
||||||
|
@ -612,6 +620,7 @@ void wxFrame::Maximize(Bool maximize)
|
||||||
int oldWindowY = cWindowY;
|
int oldWindowY = cWindowY;
|
||||||
int oldWindowWidth = cWindowWidth;
|
int oldWindowWidth = cWindowWidth;
|
||||||
int oldWindowHeight = cWindowHeight;
|
int oldWindowHeight = cWindowHeight;
|
||||||
|
int pam_dh, pam_dv;
|
||||||
CGrafPtr theMacGrafPort;
|
CGrafPtr theMacGrafPort;
|
||||||
WindowPtr theMacWindow;
|
WindowPtr theMacWindow;
|
||||||
Point size;
|
Point size;
|
||||||
|
@ -619,11 +628,33 @@ void wxFrame::Maximize(Bool maximize)
|
||||||
theMacGrafPort = cMacDC->macGrafPort();
|
theMacGrafPort = cMacDC->macGrafPort();
|
||||||
theMacWindow = GetWindowFromPort(theMacGrafPort);
|
theMacWindow = GetWindowFromPort(theMacGrafPort);
|
||||||
|
|
||||||
|
{
|
||||||
|
wxArea *parea;
|
||||||
|
wxMargin pam;
|
||||||
|
|
||||||
|
parea = PlatformArea();
|
||||||
|
pam = parea->Margin();
|
||||||
|
|
||||||
|
pam_dh = pam.Offset(wxHorizontal);
|
||||||
|
pam_dv = pam.Offset(wxVertical);
|
||||||
|
}
|
||||||
|
|
||||||
if (maximize) {
|
if (maximize) {
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
||||||
IsWindowInStandardState(theMacWindow, NULL, &rect);
|
IsWindowInStandardState(theMacWindow, NULL, &rect);
|
||||||
size.h = (rect.right - rect.left);
|
size.h = (rect.right - rect.left);
|
||||||
size.v = (rect.bottom - rect.top);
|
size.v = (rect.bottom - rect.top);
|
||||||
|
|
||||||
|
if (size.v + pam_dv == cWindowHeight) {
|
||||||
|
zoom_window_hack = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Rect r;
|
||||||
|
GetWindowIdealUserState(theMacWindow, &r);
|
||||||
|
if ((r.bottom - r.top + pam_dv) == cWindowHeight) {
|
||||||
|
zoom_window_hack = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::ZoomWindowIdeal(theMacWindow, maximize ? inZoomOut : inZoomIn, &size);
|
::ZoomWindowIdeal(theMacWindow, maximize ? inZoomOut : inZoomIn, &size);
|
||||||
|
@ -632,16 +663,14 @@ void wxFrame::Maximize(Bool maximize)
|
||||||
/* MrEd somehow confuses Carbon about structure region versus content region.
|
/* MrEd somehow confuses Carbon about structure region versus content region.
|
||||||
Subtract out the difference. */
|
Subtract out the difference. */
|
||||||
Rect r;
|
Rect r;
|
||||||
wxArea *parea;
|
|
||||||
wxMargin pam;
|
|
||||||
parea = PlatformArea();
|
|
||||||
pam = parea->Margin();
|
|
||||||
GetWindowIdealUserState(theMacWindow, &r);
|
GetWindowIdealUserState(theMacWindow, &r);
|
||||||
r.right -= pam.Offset(wxHorizontal);
|
r.right -= pam_dh;
|
||||||
r.bottom -= pam.Offset(wxVertical);
|
r.bottom -= pam_dv;
|
||||||
SetWindowIdealUserState(theMacWindow, &r);
|
SetWindowIdealUserState(theMacWindow, &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zoom_window_hack = 0;
|
||||||
|
|
||||||
wxMacRecalcNewSize();
|
wxMacRecalcNewSize();
|
||||||
|
|
||||||
if (cStatusPanel) {
|
if (cStatusPanel) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user