After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688959 - Resize reverted on focus loss
Resize reverted on focus loss
Status: RESOLVED DUPLICATE of bug 685507
Product: gnome-terminal
Classification: Core
Component: general
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
: 694738 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-23 23:03 UTC by Egmont Koblinger
Modified: 2013-02-26 12:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proof of concept (456 bytes, patch)
2012-11-23 23:12 UTC, Egmont Koblinger
none Details | Review

Description Egmont Koblinger 2012-11-23 23:03:38 UTC
Open a gnome-terminal window, and open a second tab. Resize the window. Then switch to another window (or click on the desktop). When g-t loses the focus, it reverts back to its previous size.

Apparently the bug happens if the currently active tab is not the oldest one, and you do not switch (not even temporarily) to this oldest tab after resizing.

[Originally seen on http://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/1071295 , but apparently it's not Ubuntu specific.]

A little bit of debugging revealed the following. In terminal_window_set_size_force_grid() I print the values of screen (as pointer), grid_width and grid_height. What you see is, on every focus loss or similar event, this method is called once for every tab you have, in apparently reverse order of their creation. This happens via terminal_screen_style_updated() which calls terminal_screen_change_font() which in turn calls terminal_window_set_size().

This is combined with the fact that g-t does not resize all its terminal tabs on window resize, only the active one; it defers resizing each tab (each terminal) until they become the selected one. So all the tabs that were not made the selected one after the resize still carry the old logical size. When someone (it's not clear to me yet who and why) iterates through all the tabs (apparently in reverse order of their creation) and adjusts the window size to match them, so the window size eventually will match the terminal size of the oldest tab, which might not have been updated since the resize.

I'm really not sure if terminal_screen_style_updated() indeed needs to be called for every tab, but as a proof of concept inside this method I changed
  if (gtk_widget_get_realized (widget))
    terminal_screen_change_font (screen);
to
  if (gtk_widget_get_mapped (widget))
    terminal_screen_change_font (screen);
and this seems to solve the problem - I'm not sure about its side effects though (e.g. I never have tabs with different font sizes, I don't know what happens and what should happen in that case).

I hope that based on these findings it'll be quite easy for you developer guys to come up with a proper fix :)
Comment 1 Egmont Koblinger 2012-11-23 23:12:41 UTC
Created attachment 229745 [details] [review]
proof of concept
Comment 2 Jeremy Nickurak 2012-11-24 00:15:32 UTC

*** This bug has been marked as a duplicate of bug 685507 ***
Comment 3 Christian Persch 2013-02-26 12:15:54 UTC
*** Bug 694738 has been marked as a duplicate of this bug. ***