Recent

Author Topic: Lazarus 1.4.2 Release  (Read 49824 times)

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #15 on: July 18, 2015, 10:33:19 pm »
The mentioned patch was supposed to reduce background drawing in case of ownerdrawn listbox style. But this example demonstrates that standard background drawing is broken now.

I reopened the old bugreport http://bugs.freepascal.org/view.php?id=28146
« Last Edit: July 18, 2015, 11:01:14 pm by wp »

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Lazarus 1.4.2 Release
« Reply #16 on: July 19, 2015, 01:10:58 am »
The mentioned patch was supposed to reduce background drawing in case of ownerdrawn listbox style. But this example demonstrates that standard background drawing is broken now.

I reopened the old bugreport http://bugs.freepascal.org/view.php?id=28146
I have to (un-)clarify things a little,
The screenshot came from a x86_64 (win64) compile, i tried to reproduce it (Form with single listview filled with lots of Random text (short and long)),
but i was not able to reproduce the error jet, only two programs (both font-related, both Win64-x64) show this strange behavior.
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #17 on: July 19, 2015, 09:42:16 am »
I can reproduce it with the fontenum example. It is important to scroll the list down until the next page is visible which has not yet been painted. Standard background painting probably is not executed after scrolling.

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Lazarus 1.4.2 Release
« Reply #18 on: July 19, 2015, 01:02:42 pm »
I can reproduce it with the fontenum example. It is important to scroll the list down until the next page is visible which has not yet been painted. Standard background painting probably is not executed after scrolling.
I found out, why on some progs it works, and on other why not.
I stripped the font-enum-example down to it's bare minimum -> Error still there,
and compared it to the running example.
Difference was the XP-Manifest.
... and voila ...
Without: listbox with error
With XPMan : listbox OK
[Edit:]
To get the error, I don't have to scroll down a whole page, Scrolling down 1 line with the side-scrollbar is enough, (Background turns black)

PS.: Is it a good thing having the discussion about this error in this thread, or should there be a new one ?
PPS: If you like I can post or pm you my test-project.
« Last Edit: July 19, 2015, 01:12:18 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

legroumf

  • Newbie
  • Posts: 6
Re: Lazarus 1.4.2 Release
« Reply #19 on: July 20, 2015, 06:48:11 am »
Please post a screenshot. Does the "overexposure" occur with standard listbox drawing or only with ownerdraw styles?
Does it look like this, then I got the same problem.
(Program: Example/Fontenumeration )

yes, this is exactly here !

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #20 on: July 20, 2015, 12:51:42 pm »
I uploaded a new patch to bugtracker which hopefully will soon be applied and back-ported to Laz 1.4.4

legroumf

  • Newbie
  • Posts: 6
Re: Lazarus 1.4.2 Release
« Reply #21 on: July 20, 2015, 01:15:53 pm »
I uploaded a new patch to bugtracker which hopefully will soon be applied and back-ported to Laz 1.4.4

Thanx to you :)

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Lazarus 1.4.2 Release
« Reply #22 on: July 20, 2015, 10:27:39 pm »
I uploaded a new patch to bugtracker which hopefully will soon be applied and back-ported to Laz 1.4.4
Thanks,
I think the patch for 1.4.2 should look like:
Code: [Select]
Index: win32wsstdctrls.pp
===================================================================
--- win32wsstdctrls.pp    (revision 49524)
+++ win32wsstdctrls.pp    (working copy)
@@ -613,7 +613,8 @@
         Exit(DeliverMessage(WindowInfo^.WinControl, LMessage));
       end;
     WM_ERASEBKGND:
      // Avoid unnecessary background paints to avoid flickering of the listbox
+      if (WindowsVersion <= wvXP) or not ThemeServices.ThemesEnabled then
+        // Standardbehavior for XP, or no themes
+        Result := CallDefaultWindowProc(Window, Msg, WParam, LParam)
+      else
      begin
        WindowInfo := GetWin32WindowInfo(Window);
Is that correct ?
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #23 on: July 20, 2015, 10:58:02 pm »
Yes, patches are always relative to trunk. After being applied I'll request backporting to Laz 1.4fixes (http://wiki.lazarus.freepascal.org/Lazarus_1.4_fixes_branch), which eventually will turn into Laz 1.4.4. The current version 1.4.2 will not be touched any more.

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Lazarus 1.4.2 Release
« Reply #24 on: July 21, 2015, 12:04:10 am »
Yes, patches are always relative to trunk. After being applied I'll request backporting to Laz 1.4fixes (http://wiki.lazarus.freepascal.org/Lazarus_1.4_fixes_branch), which eventually will turn into Laz 1.4.4. The current version 1.4.2 will not be touched any more.
Definitely.
It was not meant to be something to change the release. It was only meant as a quick-fix for those who want to apply your change(s) to get the bug in their 1.4.2 version fixed, knowing that they change release sources, and not working with 1.4.2 anymore but with an experimental thing. Which is, btw looking relative good, thanks to you.
I think the
Code: [Select]
@@ -613,7 +613,8 @@
is wrong.
is
Code: [Select]
@@ -613,6 +613,10 @@ better ?
About the comment, was the comment omitted in the trunk ?
Is it better after the else-statement , or also omitted ?
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #25 on: July 21, 2015, 12:47:06 am »
Since many people are not familiar with patching I am posting here step-by-step instructions to quick-fix the non-themed listbox background painting issue of Laz 1.4.2 for those who cannot wait for Laz 1.4.4:
  • Open file "win32wsstdctrls.pp", you find it in the folder "lcl\interfaces\win32" of the Lazarus installation.
  • Seek the function "ListboxWindowProc" (it begins in line 580) and replace it by this one:
Code: [Select]
function ListBoxWindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
    LParam: Windows.LParam): LResult; stdcall;
var
  WindowInfo: PWin32WindowInfo;
  NCCreateParams: PNCCreateParams;
  LMessage: TLMessage;
  Count: LResult;
  Top: Integer;
  ARect: TRect;
begin
  case Msg of
    WM_NCCREATE:
      begin
        NCCreateParams := PCREATESTRUCT(lParam)^.lpCreateParams;
        if Assigned(NCCreateParams) then
        begin
          WindowInfo := AllocWindowInfo(Window);
          WindowInfo^.WinControl := NCCreateParams^.WinControl;
          WindowInfo^.WinControl.Handle := Window;
          WindowInfo^.DefWndProc := NCCreateParams^.DefWndProc;
          // listbox is not a transparent control -> no need for parentpainting
          WindowInfo^.needParentPaint := False;
          SetWindowLong(Window, GWL_ID, PtrInt(NCCreateParams^.WinControl));
          NCCreateParams^.Handled := True;
        end;
      end;
    WM_MEASUREITEM:
      begin
        WindowInfo := GetWin32WindowInfo(Window);
        LMessage.Msg := LM_MEASUREITEM;
        LMessage.LParam := LParam;
        LMessage.WParam := WParam;
        LMessage.Result := 0;
        Exit(DeliverMessage(WindowInfo^.WinControl, LMessage));
      end;
    WM_ERASEBKGND:
      if (WindowsVersion <= wvXP) or not ThemeServices.ThemesEnabled then
        // Standardbehavior for XP, or no themes
        Result := CallDefaultWindowProc(Window, Msg, WParam, LParam)
      else
      begin
        // Avoid unnecessary background paints to avoid flickering of the listbox
        WindowInfo := GetWin32WindowInfo(Window);
        Count := SendMessage(Window, LB_GETCOUNT, 0, 0);
        if Assigned(WindowInfo^.WinControl) and
          (TCustomListBox(WindowInfo^.WinControl).Columns < 2) and
          (Count <> LB_ERR) and (SendMessage(Window, LB_GETITEMRECT, Count - 1, Windows.LParam(@ARect)) <> LB_ERR) then
        begin
          Top := ARect.Bottom;
          Windows.GetClientRect(Window, ARect);
          ARect.Top := Top;
          if not IsRectEmpty(ARect) then
            Windows.FillRect(HDC(WParam), ARect, WindowInfo^.WinControl.Brush.Reference.Handle);
          Result := 1;
        end
        else
          Result := CallDefaultWindowProc(Window, Msg, WParam, LParam);
        Exit;
      end;
  end;
  // normal processing
  Result := WindowProc(Window, Msg, WParam, LParam);
end;

I just installed 1.4.2 and followed this procedure - it is working.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 405
Re: Lazarus 1.4.2 Release
« Reply #26 on: July 21, 2015, 02:45:36 pm »
Apparently unlike 1.4.0, 1.4.2 can be built using latest fpc trunk. This is a good thing.

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Lazarus 1.4.2 Release
« Reply #27 on: July 22, 2015, 11:23:00 am »
I uploaded a new patch to bugtracker which hopefully will soon be applied and back-ported to Laz 1.4.4
The patch now has been applied by Juha to trunk and it will make it into Laz 1.4.4

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Lazarus 1.4.2 Release
« Reply #28 on: July 22, 2015, 06:22:09 pm »
(Y) Yeah !
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

 

TinyPortal © 2005-2018