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

Kostas Michalopoulos badsectoracula at gmail.com
Thu May 18 01:43:10 CEST 2017


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.


On Thu, May 18, 2017 at 12:20 AM, Kostas Michalopoulos <
badsectoracula at gmail.com> wrote:

> Hi all,
>
> So i finally figured out why this happens and the reason is the
> ShowWindow(Handle, SW_SHOWNORMAL) call made when selecting components (this
> is done to activate the designer form).
>
> Under Gtk2 this call always calls gtk_window_unmaximize (among others) but
> Gtk2 seems to have a bug that always tries to unmaximize the window
> regardless of its status - with some window managers (like Window Maker)
> this can cause the window to be resized. The bug is most likely with Gtk2
> not ignoring the call for unmaximized windows, but since Gtk2's development
> has practically stopped (most recent changes are documentation and build
> fixes) and since Lazarus needs to work with 10+ year old versions of Gtk2,
> this needs to be addressed on the LCL side.
>
> Fortunately LCL already tracks the window state in the WindowState
> property, so at least for TCustomForm descendants (which would be almost
> all cases this is needed - 100% of the cases in design time where the bug
> is mostly visible) we can workaround this by not calling
> gtk_window_unmaximize for forms that aren't maximized.
>
> The description and patch can be found in Mantis here, as well as a video
> that shows the issue:
>
> https://bugs.freepascal.org/view.php?id=31832
>
> The patch was made against SVN but should apply with 1.8RC1 since i
> originally wrote it there.
>
> Kostas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170518/1d9a7f3f/attachment.html>


More information about the Lazarus mailing list