mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 10:39:18 +02:00
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:
parent
6f8d2278a7
commit
4cb8725f1f
@ -155,6 +155,16 @@ implementation
|
|||||||
uses
|
uses
|
||||||
CocoaInt;
|
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;
|
function GetDesigningBorderStyle(const AForm: TCustomForm): TFormBorderStyle;
|
||||||
begin
|
begin
|
||||||
if csDesigning in AForm.ComponentState then
|
if csDesigning in AForm.ComponentState then
|
||||||
@ -318,7 +328,9 @@ begin
|
|||||||
|
|
||||||
R := CreateParamsToNSRect(AParams);
|
R := CreateParamsToNSRect(AParams);
|
||||||
win := TCocoaPanel(win.initWithContentRect_styleMask_backing_defer(R, GetStyleMaskFor(GetDesigningBorderStyle(Form), Form.BorderIcons), NSBackingStoreBuffered, False));
|
win := TCocoaPanel(win.initWithContentRect_styleMask_backing_defer(R, GetStyleMaskFor(GetDesigningBorderStyle(Form), Form.BorderIcons), NSBackingStoreBuffered, False));
|
||||||
|
win.setHidesOnDeactivate(False);
|
||||||
UpdateWindowIcons(win, GetDesigningBorderStyle(Form), Form.BorderIcons);
|
UpdateWindowIcons(win, GetDesigningBorderStyle(Form), Form.BorderIcons);
|
||||||
|
win.setLevel(FormStyleToWindowLevel[Form.FormStyle]);
|
||||||
win.enableCursorRects;
|
win.enableCursorRects;
|
||||||
TCocoaPanel(win).callback := TLCLWindowCallback.Create(win, AWinControl);
|
TCocoaPanel(win).callback := TLCLWindowCallback.Create(win, AWinControl);
|
||||||
win.setDelegate(win);
|
win.setDelegate(win);
|
||||||
@ -408,15 +420,6 @@ end;
|
|||||||
|
|
||||||
class procedure TCocoaWSCustomForm.SetFormStyle(const AForm: TCustomform;
|
class procedure TCocoaWSCustomForm.SetFormStyle(const AForm: TCustomform;
|
||||||
const AFormStyle, AOldFormStyle: TFormStyle);
|
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
|
begin
|
||||||
if AForm.HandleAllocated then
|
if AForm.HandleAllocated then
|
||||||
NSWindow(AForm.Handle).setLevel(FormStyleToWindowLevel[AFormStyle]);
|
NSWindow(AForm.Handle).setLevel(FormStyleToWindowLevel[AFormStyle]);
|
||||||
|
Loading…
Reference in New Issue
Block a user