Recent

Author Topic: 'Minimize all on minimize main' disabled  (Read 15451 times)

dunderhead

  • Guest
'Minimize all on minimize main' disabled
« on: October 01, 2005, 06:07:34 am »
Hello,

I am running lazarus 0.9.9 on Fedora Core 4 and would like all windows of the lazarus IDE (main, object inspector, messages etc.) minimized when I minimize the main window.

There is a checkbox on the  Environment | Environment options | Windows  tabsheet that reads 'Minimize all on minimize main' - but this checkbox is permanently disabled on my system.

Does anybody know how to enable the above option, as having to click the minimize icon on every ide window is driving me nuts !

Thanking you in advance.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
'Minimize all on minimize main' disabled
« Reply #1 on: October 03, 2005, 12:17:13 pm »
This is not yet possible on GTK/X.
Contrary to win32, this is a windowmanager issue and ont of the app itself. AFAIK, it is possible to give the WM hints for this, but it is not implemented yet.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #2 on: October 12, 2005, 02:28:17 pm »
But on my system it can hide and restore all windows if "hide IDE Windows on run" is checked.
So I don't think this is really a WM Problem.
Could anybody shed some light on this? It's really annoying.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
'Minimize all on minimize main' disabled
« Reply #3 on: October 12, 2005, 06:11:03 pm »
Minimize <> hide
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #4 on: October 12, 2005, 07:25:04 pm »
You're right, but it would be enough for me if it did the same as it does "on run" when minimzing the main window.
But anyway what's the problem with minimizing child windows? This works for me.
Form2.WindowState:=wsMinimized;
What's wrong with it?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
'Minimize all on minimize main' disabled
« Reply #5 on: October 13, 2005, 12:20:19 pm »
is this on linux ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #6 on: October 13, 2005, 02:05:53 pm »
Yes

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
'Minimize all on minimize main' disabled
« Reply #7 on: October 13, 2005, 03:39:45 pm »
OK, then I seen no reason why it isn't implemented (except time)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
'Minimize all on minimize main' disabled
« Reply #8 on: October 14, 2005, 08:12:21 am »
Time (or lack of contributors) is the main problem for this feature.

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #9 on: October 15, 2005, 01:37:14 pm »
It' seems that Application.Minimize works, i.e. minimizes child windows too.
The problem is that there is no event in the LCL to indicate whether the main window is minimizing etc.
Like: Application.OnMinimize, Application.OnRestore, or Form.OnWindowStateChange or sth.
And even worse: TForm.Windowstate does not reflect the correct state when the window was minimized/max. by the
WM directly.
Des anybody know better what the problems are? (on GTK/Linux that is)
To me this seems like a high-priority problem, even for the IDE itself.

Drewski

  • Jr. Member
  • **
  • Posts: 55
'Minimize all on minimize main' disabled
« Reply #10 on: October 15, 2005, 03:54:45 pm »
There is a bug that is related to your question: http://www.lazarus.freepascal.org/mantis/view.php?id=1058

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #11 on: October 17, 2005, 04:48:37 am »
Yipiee! I've got a Lazarus (GTK/Linux) which minimizes and restores all children.
Previous state ("was minimized") ist taken care of and Z-Order is prevented.
It's a hack, because it uses a Timer to find out Main Window State. (Because of missing event)
Window States are adjusted by
XInternAtom(Display, 'WM_STATE', true); and so on.
Nothing serious but: My Linux-Lazarus minimizes all of it!

Anonymous

  • Guest
'Minimize all on minimize main' disabled
« Reply #12 on: October 17, 2005, 05:09:27 am »
If somebody cares: here's the code
"GetState" is from xutils http://www.tempest-sw.com/freeware/freeware.cgi?kylix


Code: [Select]
procedure TMainIDE.OnMinTimer(Sender: TObject);
var i: Integer;
  AForm: TCustomForm;
  Winfo: TWinInfo;
begin
  if Screen = nil then exit;

  AdjustWinStateInfo(MainIDEBar);
  if MainIDEBar.WindowState = WsMinimized then begin
    if not fStateMinimized then
    begin
      fWinList.clear;

      for i := 0 to Screen.CustomFormCount - 1 do begin
        AForm := Screen.CustomForms[i];
        if (AForm.Parent = nil) and AForm.HandleAllocated then
        begin
          AdjustWinStateInfo(TForm(AForm));

          if AForm.WindowState <> wsminimized then
          begin
            fWinList.add(AForm);
            ShowWindow(AForm.Handle, SW_MINIMIZE);
          end;
        end;
      end;
    end;
    fStateMinimized := true;
  end else begin
    if fStateMinimized then
    begin
      for i := fWinList.Count - 1 downto 0 do begin
        AForm := TForm(fWinList[i]);
        if (AForm.Parent = nil) and AForm.HandleAllocated then begin
          if AForm.Visible then ShowWindow(AForm.Handle, SW_SHOWNORMAL);
        end;
      end; //scr
    end; //statemin
    fStateMinimized := false;
    MainIDEBar.SetFocus;
    MainIDEBar.Refresh;
  end;
end;

function TMainIDE.GetMinimized(FHandle: HWND): Boolean;
var
  XDisplay: PDisplay;
  XScreen: PScreen;
  XWindow: x.TWindow;
begin
  XDisplay := GDK_WINDOW_XDISPLAY(PGdkWindowPrivate(PGtkWidget(FHandle)^.window));
  XScreen := XDefaultScreenOfDisplay(XDisplay);
  XWindow := GDK_WINDOW_XWINDOW(PGdkWindowPrivate(PGtkWidget(FHandle)^.window));
  Result := GetState(XDisplay, XWindow) = IconicState;
end;

procedure TMainIDE.AdjustWinStateInfo(Window: TForm);
begin
  if GetMinimized(Window.Handle) then
  begin
    if Window.WindowState <> wsMinimized then Window.WindowState := wsMinimized;
  end else
  begin
    if Window.WindowState <> wsNormal then Window.WindowState := wsNormal;
  end;
end;                        

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
'Minimize all on minimize main' disabled
« Reply #13 on: October 17, 2005, 11:20:06 am »
Thanks.
I don't think we will go throught the timer solution, but it gives an idea in what direction to look for a solution.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker