Lazarus

Programming => LCL => Topic started by: jamie on June 15, 2021, 12:19:33 am

Title: [fixed]WM_WindowPosChanged gives null pointer to WindowPos record randomly
Post by: jamie on June 15, 2021, 12:19:33 am
as stated.

 The WndpowPos record in the Message of TLMWindowPosChanged gives a nil pointer in the message at times.

I don't understand this because there isn't anything else in the record to use so what's the sense of sending a WM_WindowPosChanged message with a nil WindowPos record ?

 I tested this in Trunk and older lazes and I have also referenced the net and didn't find any documents where this is so?

 To test, just put a message handler for the LM_WindowPOSChanged and in the receiving method test the Message.WindowPos for a Nil pointer.

 This appears the be random from what I can see.
Title: Re: WM_WindowPosChanged gives null pointer to WindowPos record randomly
Post by: jamie on June 15, 2021, 02:14:01 am
I found the reason but I still can't give an answer to why?

in the WinControl.inc Procedure  TWinControl.SendMoveSizeMessages(….)

 They do a
      Perform(LM_WindowposChanged, 0, 0);

 as you can see, there is no pointer value in the Lparam parameter. ?
   
   This whole procedure does nothing but simulate a LM_MOVE and LM_SIZE instead of using the handlers from the OS.

 Although this is fine, why the need to send a fake blank message that can cause issues?

  What this means now is that code needs to test for a NIL windowPos record before attempting to reference it, more lard.

  From what I can see, the actual information is sent in a valid message and then this fake one is sent afterwards only if the values of either size or position changes, more lard.

 So in turn, you get twice the message traffic for the same message except maybe if a Z order did a change, lots more lard.

 Does this really make sense ?


EDIT:

  I filed a Bug report on this.
  we need all the speed and smoothness we can get with the GUI..
  Plus I also deal with custom messages passing through the class and don't need extra bloat..  %)

   I would be interested if anyone here is willing to rebuild their WinControl.inc file with that line commented out using Linux which handles these things a little differently. Or even a MAC.
Title: Re: WM_WindowPosChanged gives null pointer to WindowPos record randomly
Post by: jamie on June 18, 2021, 01:30:41 am
Fixed in Truck thanks to Michl
TinyPortal © 2005-2018