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

Kostas Michalopoulos badsectoracula at gmail.com
Wed May 17 23:20:51 CEST 2017


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/39510e85/attachment.html>


More information about the Lazarus mailing list