mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-22 00:50:00 +01:00
Qt,Gtk2: added minimize/restore ability to get consistent behaviour on all platforms. Patch by Flavio Etrusco modified by me for qt. fixes #13919
git-svn-id: trunk@25407 -
This commit is contained in:
parent
dda71573f7
commit
2773d06487
@ -4,7 +4,6 @@ inherited MessagesView: TMessagesView
|
|||||||
Top = 640
|
Top = 640
|
||||||
Width = 722
|
Width = 722
|
||||||
ActiveControl = MessageTreeView
|
ActiveControl = MessageTreeView
|
||||||
BorderStyle = bsSizeToolWin
|
|
||||||
Caption = 'MessagesView'
|
Caption = 'MessagesView'
|
||||||
ClientHeight = 79
|
ClientHeight = 79
|
||||||
ClientWidth = 722
|
ClientWidth = 722
|
||||||
|
|||||||
@ -629,6 +629,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
if OldState <> FWindowState then
|
if OldState <> FWindowState then
|
||||||
begin
|
begin
|
||||||
|
if (OldState = wsMinimized) and (Application.MainForm = Self)
|
||||||
|
and (WidgetSet.GetLCLCapability(lcNeedMininimizeAppWithMainForm) <> LCL_CAPABILITY_NO) then
|
||||||
|
begin
|
||||||
|
Application.Restore;
|
||||||
|
end;
|
||||||
if Assigned(OnWindowStateChange) then
|
if Assigned(OnWindowStateChange) then
|
||||||
OnWindowStateChange(Self);
|
OnWindowStateChange(Self);
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -64,6 +64,8 @@ type
|
|||||||
function LCLPlatform: TLCLPlatform; override;
|
function LCLPlatform: TLCLPlatform; override;
|
||||||
|
|
||||||
procedure AppInit(var ScreenInfo: TScreenInfo); override;
|
procedure AppInit(var ScreenInfo: TScreenInfo); override;
|
||||||
|
procedure AppMinimize; override;
|
||||||
|
procedure AppRestore; override;
|
||||||
function AppHandle: THandle; override;
|
function AppHandle: THandle; override;
|
||||||
|
|
||||||
procedure SetCallbackEx(const AMsg: LongInt; const AGTKObject: PGTKObject; const ALCLObject: TObject; Direct: Boolean);override;
|
procedure SetCallbackEx(const AMsg: LongInt; const AGTKObject: PGTKObject; const ALCLObject: TObject; Direct: Boolean);override;
|
||||||
|
|||||||
@ -598,6 +598,38 @@ begin
|
|||||||
{$ifend}
|
{$ifend}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGtk2WidgetSet.AppMinimize;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
begin
|
||||||
|
if Screen=nil then exit;
|
||||||
|
for i:= 0 to Screen.CustomFormZOrderCount-1 do
|
||||||
|
begin
|
||||||
|
AForm := Screen.CustomFormsZOrdered[i];
|
||||||
|
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||||
|
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||||
|
not (AForm.BorderStyle in [bsNone]) then
|
||||||
|
gtk_window_iconify(PGtkWindow(AForm.Handle));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGtk2WidgetSet.AppRestore;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
begin
|
||||||
|
if Screen=nil then exit;
|
||||||
|
for i:= Screen.CustomFormZOrderCount-1 downto 0 do
|
||||||
|
begin
|
||||||
|
AForm:=Screen.CustomFormsZOrdered[i];
|
||||||
|
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||||
|
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||||
|
not (AForm.BorderStyle in [bsNone]) then
|
||||||
|
gtk_window_deiconify(PGtkWindow(AForm.Handle));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGtk2WidgetSet.AppHandle: Thandle;
|
function TGtk2WidgetSet.AppHandle: Thandle;
|
||||||
begin
|
begin
|
||||||
{$ifdef windows}
|
{$ifdef windows}
|
||||||
|
|||||||
@ -216,15 +216,54 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtWidgetSet.AppMinimize;
|
procedure TQtWidgetSet.AppMinimize;
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
||||||
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
for i := 0 to Screen.CustomFormZOrderCount-1 do
|
||||||
|
begin
|
||||||
|
AForm := Screen.CustomFormsZOrdered[i];
|
||||||
|
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||||
|
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||||
|
not (AForm.BorderStyle in [bsNone])
|
||||||
|
then
|
||||||
|
TQtMainWindow(AForm.Handle).ShowMinimized;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
TQtMainWindow(Application.MainForm.Handle).ShowMinimized;
|
TQtMainWindow(Application.MainForm.Handle).ShowMinimized;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtWidgetSet.AppRestore;
|
procedure TQtWidgetSet.AppRestore;
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
if (Application.MainForm <> nil) and (Application.MainForm.HandleAllocated) then
|
||||||
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
if Screen = nil then exit;
|
||||||
|
for i := Screen.CustomFormZOrderCount-1 downto 0 do
|
||||||
|
begin
|
||||||
|
AForm := Screen.CustomFormsZOrdered[i];
|
||||||
|
if (AForm.Parent=nil) and AForm.HandleAllocated and AForm.Visible and
|
||||||
|
not (AForm.FormStyle in [fsMDIChild, fsSplash]) and
|
||||||
|
not (AForm.BorderStyle in [bsNone])
|
||||||
|
then
|
||||||
|
TQtMainWindow(AForm.Handle).ShowNormal;
|
||||||
|
end;
|
||||||
|
{$ELSE}
|
||||||
TQtMainWindow(Application.MainForm.Handle).ShowNormal;
|
TQtMainWindow(Application.MainForm.Handle).ShowNormal;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtWidgetSet.AppBringToFront;
|
procedure TQtWidgetSet.AppBringToFront;
|
||||||
@ -367,6 +406,8 @@ begin
|
|||||||
lcCanDrawOutsideOnPaint: Result := LCL_CAPABILITY_NO;
|
lcCanDrawOutsideOnPaint: Result := LCL_CAPABILITY_NO;
|
||||||
lcDragDockStartOnTitleClick: Result :=
|
lcDragDockStartOnTitleClick: Result :=
|
||||||
{$ifdef MSWINDOWS} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
{$ifdef MSWINDOWS} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
||||||
|
lcNeedMininimizeAppWithMainForm: Result :=
|
||||||
|
{$ifdef LINUX} LCL_CAPABILITY_YES {$else} LCL_CAPABILITY_NO {$endif};
|
||||||
else
|
else
|
||||||
Result := inherited GetLCLCapability(ACapability);
|
Result := inherited GetLCLCapability(ACapability);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user