Skip to content

MessageWindow: Fix window resizing in one window mode

When using one window mode, we get the allocated size of our message control notebook and save it before closing. On starting, Gajim used to add the paned's handle-size (5px by default) and the roster_hpaned_position to the saved width value.

The allocated width of our notebook (saved before closing) does not include the background-size property of the paned's separator, which is 1px in my case. The separator adds 1px to the whole window's allocated size. This can easily be tested in GtkInspector by adding a CSS rule to the separator's background-size. Manipulating this value will result in an equally resized window on next start.

This lead to a size off by +4px (-1px because we didn't take the separator into account, +5 by adding the handle-size). Note: handle-size is deprecated (see https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Paned.html#style-properties).

I circumvented this by calculating the message contol notebook's width (or the substitute width, so to say) by subtracting roster_hpaned_position from allocated width of Gajim's whole window. This removes handle-size and the separator's background-size from the equasion. This also works for roster positioned on the right instead of left.

Fixes #9190 (closed)

Merge request reports