[Lazarus] Patch for fixing the window resizes when switching components

zeljko zeljko at holobit.net
Thu May 18 13:20:52 CEST 2017


On 18.05.2017 01:43, Kostas Michalopoulos via Lazarus wrote:
> I see the patch was added and Lazarus seems to work fine now, but the
> check was altered a little. The current check assumes that the Control
> will never be nil, but is this the case? I ask because i see in other
> places in the same source code file that there are checks for that -
> almost all calls to GetLCLObject either check for nil or use "if object
> is something then use object" (with the "is" operator returning false
> for nil, essentially making it an indirect test for nil).
>
> This might be just an instance defensive programming, but i think it is
> a good idea to bring this up.
>

Yes, this is clearly gtk2 bug, but maybe we can take another approach 
instead of getting LCL object and using "is". We should check if 
GdkWindow of widget is valid and then check it's state and in case it's 
= GDK_WINDOW_STATE_MAXIMIZED call gtk_window_unmaximize()


if GDK_IS_WINDOW(PGtkWindow(OurWidget)^.window) and 
(gdk_window_get_state(PGtkWindow(OurWidget)^.window) = 
GDK_WINDOW_STATE_MAXIMIZED) then
   gtk_window_unmaximize() ...
Same for unfullscreen and other "un" routines which we use inside that 
procedure.

What other devels think about this ? Should I correct that patch in this 
way and fix future problems with eg gtk_window_unfullscreen() which 
isn't covered by this patch atm ?

zeljko








More information about the Lazarus mailing list