wsMaximized BUG ?

Für Fehler in Lazarus, um diese von anderen verifizieren zu lassen.
Antworten
IB2012
Beiträge: 3
Registriert: Sa 1. Sep 2012, 10:42

wsMaximized BUG ?

Beitrag von IB2012 »

Lazarus Version 1.0 und 1.1
BS: Linux XFCE 4.8 (GTK2)
Wenn man eine Neue Anwendung erstellt und den WindowState den Wert wsMaximized zuweist wird das Fenster nach dem Compiler-lauf nur als schmaler Streifen dargestellt.

Kann Jemand den Fehler bestätigen? Und eventuell den Bug melden? Denn mein englisch ist grauenvoll.

Benutzeravatar
theo
Beiträge: 10497
Registriert: Mo 11. Sep 2006, 19:01

Re: wsMaximized BUG ?

Beitrag von theo »

Kann ich unter openSUSE 12.1 KDE nicht bestätigen. XFCE Problem?

Heinrich Wolf
Beiträge: 323
Registriert: Di 12. Apr 2011, 13:21
OS, Lazarus, FPC: WinXP + VMWare Player mit Fedora14, L 1.1, FPC 2.7.1
CPU-Target: 1core 1,8GHz 32Bit
Wohnort: Fürth
Kontaktdaten:

Re: wsMaximized BUG ?

Beitrag von Heinrich Wolf »

Mit Lazarus 1.1 auf Fedora 14 Linux mit Gnome bei mir kein Fehler.

Vielleicht kannst Du in die LCL hinein debuggen. Eine heiße Spur könnte in lazarus\lcl\include\customform.inc sein.

Code: Alles auswählen

procedure TCustomForm.AfterConstruction;
var
  NewWidth, NewHeight: Integer;
  OldWindowState: TWindowState;
 
  procedure ChangeFormDimensions(AIsBeforeOnCreate: Boolean);
  begin
    if (WindowState = wsMaximized) and (FormStyle <> fsMDIChild) then
    begin
      {$IFDEF DEBUG_SM_LCLMAXIMIZED}
      DebugLn('TCustomForm.AfterConstruction: SM_CYCAPTION ',
        dbgs(GetSystemMetrics(SM_CYCAPTION)),
      ' SM_CYSIZEFRAME ',dbgs(GetSystemMetrics(SM_CYSIZEFRAME)),
      ' SM_CXMAXIMIZED ',dbgs(GetSystemMetrics(SM_CXMAXIMIZED)),
      ' SM_CYMAXIMIZED ',dbgs(GetSystemMetrics(SM_CYMAXIMIZED)),
      ' SM_LCLMAXIMIZEDHEIGHT ',dbgs(GetSystemMetrics(SM_LCLMAXIMIZEDHEIGHT)),
      ' SM_LCLMAXIMIZEDWIDTH ',dbgs(GetSystemMetrics(SM_LCLMAXIMIZEDWIDTH)),
      ' AIsBeforeOnCreate ',dbgs(AIsBeforeOnCreate));
      {$ENDIF}
 
      if (BorderStyle <> bsNone) and (FormStyle <> fsSplash) then
      begin
        NewHeight := GetSystemMetrics(SM_LCLMAXIMIZEDHEIGHT);
        NewWidth := GetSystemMetrics(SM_LCLMAXIMIZEDWIDTH);
        // if some ws does not implement this then provide normal metrics.
        if NewHeight <= 0 then
          NewHeight := GetSystemMetrics(SM_CYMAXIMIZED);
        if NewWidth <= 0 then
          NewHeight := GetSystemMetrics(SM_CXMAXIMIZED);
      end else
      begin
        NewHeight := GetSystemMetrics(SM_CYMAXIMIZED);
        NewWidth := GetSystemMetrics(SM_CXMAXIMIZED);
      end;
 
      if Constraints.MaxWidth > 0 then
        NewWidth := Min(Constraints.MaxWidth, NewWidth);
      if Constraints.MaxHeight > 0 then
        NewHeight := Min(Constraints.MaxHeight, NewHeight);
 
      // for unknown reasons on some systems SM_*MAXIMIZED* system metrics
      // (tested xubuntu,64bits) return 0 or negative values, in this case
      // a maximized window is expected to have at least WorkArea width/height.
      // In the event WorkArea is also 0 width/height, at least
      // design sizes should be respected, see bug #21634
      if NewWidth<=0 then
        NewWidth := Screen.WorkAreaWidth;
      if NewHeight<=0 then
        NewHeight := Screen.WorkAreaHeight;
 
      if NewWidth>0 then
        Width := NewWidth;
      if NewHeight>0 then
        Height := NewHeight;
    end;
 
    if (WindowState = wsFullScreen) and (FormStyle <> fsMDIChild) then
    begin
      NewWidth := LCLIntf.GetSystemMetrics(SM_CXFULLSCREEN);
      NewHeight := LCLIntf.GetSystemMetrics(SM_CYFULLSCREEN);
      if Constraints.MaxWidth > 0 then
        NewWidth := Min(Constraints.MaxWidth, NewWidth);
      if Constraints.MaxHeight > 0 then
        NewHeight := Min(Constraints.MaxHeight, NewHeight);
      Width := NewWidth;
      Height := NewHeight;
    end;
  end;
begin
  // issue #21119, prepare maximized or fullscreen form to accurate dimensions.
  // we avoid flickering also in this case.
  if not (csDesigning in ComponentState) then
    ChangeFormDimensions(True);


Welche Werte erhalten NewHeight und NewWidth und wo kommen die her?

Heiner

Heinrich Wolf
Beiträge: 323
Registriert: Di 12. Apr 2011, 13:21
OS, Lazarus, FPC: WinXP + VMWare Player mit Fedora14, L 1.1, FPC 2.7.1
CPU-Target: 1core 1,8GHz 32Bit
Wohnort: Fürth
Kontaktdaten:

Re: wsMaximized BUG ?

Beitrag von Heinrich Wolf »

Ich hab mir zum Test XFCE installiert. Es ist Version 4.6 geworden. Auch mit XFCE zeigt sich Dein Fehler nicht auf meinem Lazarus 1.1, Fedora 14. Allerdings zeigen meine Lazarus Projekteinstellungen-Vererbt noch auf /opt/gnome/lib. Der LCLWidgetType ist auch bei mir gtk2.

IB2012
Beiträge: 3
Registriert: Sa 1. Sep 2012, 10:42

Re: wsMaximized BUG ?

Beitrag von IB2012 »

Heinrich Wolf hat geschrieben:Mit Lazarus 1.1 auf Fedora 14 Linux mit Gnome bei mir kein Fehler.

Vielleicht kannst Du in die LCL hinein debuggen. Eine heiße Spur könnte in lazarus\lcl\include\customform.inc sein.


Danke für den Hinweis.

Habe die Procedure nun wie folgt abgeändert und wsMaximized läüft nun bei mir.


Code: Alles auswählen

procedure TCustomForm.AfterConstruction;
var
  NewWidth, NewHeight: Integer;
  OldWindowState: TWindowState;
 
....
 
      // for unknown reasons on some systems SM_*MAXIMIZED* system metrics
      // (tested xubuntu,64bits) return 0 or negative values, in this case
      // a maximized window is expected to have at least WorkArea width/height.
      // In the event WorkArea is also 0 width/height, at least
      // design sizes should be respected, see bug #21634
 
      // Änderrung wenn einer der beiden Werte nur 0 zeigt auch den zweiten Wert patchen
      if (NewWidth<=0) or (NewHeight<=0) then
      begin
        NewWidth := Screen.WorkAreaWidth;
        NewHeight := Screen.WorkAreaHeight;
      end;
 
      if NewWidth>0 then
        Width := NewWidth;
      if NewHeight>0 then
        Height := NewHeight;
    end;
 
    if (WindowState = wsFullScreen) and (FormStyle <> fsMDIChild) then
....
;

Antworten