cocoa: set window level on creation, disable hides on deactivate. Based on patch and finding of accSone, issue #25340

git-svn-id: trunk@43475 -
This commit is contained in:
paul 2013-11-23 10:32:17 +00:00
parent 6f8d2278a7
commit 4cb8725f1f

View File

@ -155,6 +155,16 @@ implementation
uses
CocoaInt;
const
FormStyleToWindowLevel: array[TFormStyle] of NSInteger = (
{ fsNormal } 0, // NSNormalWindowLevel,
{ fsMDIChild } 0, // NSNormalWindowLevel,
{ fsMDIForm } 0, // NSNormalWindowLevel,
{ fsStayOnTop } 3, // NSFloatingWindowLevel,
{ fsSplash } 3, // NSFloatingWindowLevel,
{ fsSystemStayOnTop } 8 // NSModalPanelWindowLevel or maybe NSStatusWindowLevel?
);
function GetDesigningBorderStyle(const AForm: TCustomForm): TFormBorderStyle;
begin
if csDesigning in AForm.ComponentState then
@ -318,7 +328,9 @@ begin
R := CreateParamsToNSRect(AParams);
win := TCocoaPanel(win.initWithContentRect_styleMask_backing_defer(R, GetStyleMaskFor(GetDesigningBorderStyle(Form), Form.BorderIcons), NSBackingStoreBuffered, False));
win.setHidesOnDeactivate(False);
UpdateWindowIcons(win, GetDesigningBorderStyle(Form), Form.BorderIcons);
win.setLevel(FormStyleToWindowLevel[Form.FormStyle]);
win.enableCursorRects;
TCocoaPanel(win).callback := TLCLWindowCallback.Create(win, AWinControl);
win.setDelegate(win);
@ -408,15 +420,6 @@ end;
class procedure TCocoaWSCustomForm.SetFormStyle(const AForm: TCustomform;
const AFormStyle, AOldFormStyle: TFormStyle);
const
FormStyleToWindowLevel: array[TFormStyle] of NSInteger = (
{ fsNormal } 0, // NSNormalWindowLevel,
{ fsMDIChild } 0, // NSNormalWindowLevel,
{ fsMDIForm } 0, // NSNormalWindowLevel,
{ fsStayOnTop } 3, // NSFloatingWindowLevel,
{ fsSplash } 3, // NSFloatingWindowLevel,
{ fsSystemStayOnTop } 8 // NSModalPanelWindowLevel or maybe NSStatusWindowLevel?
);
begin
if AForm.HandleAllocated then
NSWindow(AForm.Handle).setLevel(FormStyleToWindowLevel[AFormStyle]);