lanoxx / tilda

A Gtk based drop down terminal for Linux and Unix
GNU General Public License v2.0
1.28k stars 161 forks source link

Tilda does not resize properly after fullscreen mode #306

Closed madeindjs closed 6 years ago

madeindjs commented 7 years ago

I have theses settings for windows size

This is actually 100% / 50%.

When enter in fullscreen mode F11, hide Tilda F1 and then I unhide Tilda F1 my configuration change.

Windows size is now 1920px / 529px.

I had to change my configuration mannyally after theses steps.

My OS: Linux Mint 18.2 Sonya / Tilda 1.3.1.

lanoxx commented 6 years ago

Could you check if the patch in the branch wip/fullscreen (e.g. commit 84fe390b4e808de90f5eb8d3924c920eabc1c4b1) fixes the issue?

webmatze commented 6 years ago

I just tried the branch wip/fullscreen on Ubuntu 17.10.

I did the following steps:

  1. enter fullscreen mode F11
  2. hide Tilda F1
  3. unhide F1
  4. then leave fullcreen mode F11

Now Tilda is still nearly full screen. But after I hide Tilda again F1 and then show it F1 it is at its old size but not at the right position. If I press F1 two times more it is back at its configured position (centered vertically and horizontally)

So there is still a problem here.

voidplayer commented 6 years ago

I just tested this on last 1.4.1-1 and still happens :(

Does the patch still need testing?

lanoxx commented 6 years ago

@voidplayer First, if the patch in wip/fullscreen does not cause and negative side effects I can merge it into master and also backport to the 1.4.x series.

Regarding the issue reported by @webmatze. I can confirm that there is still a problem, however I cannot see that there is any code in Tilda that would be causing this behavior. My best guess is that either GTK+ or the Window Manager has a bug that causes this behavior. There is already code in place when returning from fullscreen mode to restore the original window size:

https://github.com/lanoxx/tilda/blob/master/src/tilda_window.c#L177

For some reason that seems to have no effect in certain situations.

voidplayer commented 6 years ago

Are you able to reproduce it? I mean, thats the most important thing to find the real cause :)

I just tried the patch and it doesnt fix it for me :(

After f11->hidding->showing, it never gets to the original size unless I do two things:

Not sure if this is what you are able to reproduce or different. I dont know much about gtk, but tell me if I can be of any more help :)

voidplayer commented 6 years ago

Btw, I just want to add a workaround in case somebody else find it useful :)

I have an 'extra' tilda config with a different key for full screen where tilda takes up all the screen

I try to spawn the processes that will eventually need more room on this tilda instead of the regular ones. Ex. Programming consoles, diffs, big debugging outputs

Not perfect or as confy as using your regular tildas because you have to think ahead but it works pretty well

lanoxx commented 6 years ago

Yes I can reproduce the problem, but I do not know how to fix it. To me it seems like a problem in GTK+.

voidplayer commented 6 years ago

Thanks for your time

Whats the exact api call that is not behaving as expected?

I will open a bug in gtk

lanoxx commented 6 years ago

@voidplayer I you look at the code for returning from fullscreen you see the following functions get called:

gtk_window_unfullscreen (GTK_WINDOW (tw->window));
// This appears to be necssary on (at least) xfwm4 if you tabbed out
// while fullscreened.
gtk_window_set_default_size (GTK_WINDOW(tw->window), config_getint ("max_width"), config_getint ("max_height"));
gtk_window_resize (GTK_WINDOW(tw->window), config_getint ("max_width"), config_getint ("max_height"));

gtk_window_move(GTK_WINDOW(tw->window), config_getint ("x_pos"), config_getint ("y_pos"));

The first calls GTK to disable fullscreen mode, the next three calls ensure that the window restores its proper size and position. In an ideal scenario I would assume that the window size and position is cached somewhere (e.g. in the X11 window object, GTK, etc.) and that this information is used to restore the size after returning from fullscreen. The fact that returning from fullscreen works most of the time shows that something is being cached somewhere. It seems that hiding tilda and restoring it, while it is in fullscreen mode somehow clears or changes this cached information and thus prevents the window from returning to its original size.

For example, even if I remove the last three lines and toggle fullscreen mode the window size and position is correctly restored after returning from fullscreen (as long as I do not hide the window in between). If I do hide and show the tilda window with fullscreen enabled and while those last three lines are commented out, then not only does the tilda size change, but its now also located at the center of the screen.

In summary, to find the source of this bug I believe that gtk_window_unfullscreen would be a good starting point to find this bug. However, the GTK documentation also clearly states that the behavior of this function is window manager dependent. Therefore it may also be the case that this bug is not actually a GTK bug, but that the problem lies even further down the stack, possibly in the window manager.

While writing this a took a look if metacity prints anything while this bug occurs and I noticed the following output:

Window manager warning: Treating resize request of legacy application 0x1600007 (tilda) as a fullscreen request

lanoxx commented 6 years ago

I think I can propose a workaround for this bug. If we temporarily unfullscreen the tilda window before hiding it, then it seems that the bug does not occur.

lanoxx commented 6 years ago

Please reopen if this does not fix the problem.

voidplayer commented 6 years ago

Well, this workaround indeed fixed the issue for me

Thank you so much!

Gerrit-K commented 6 years ago

Is there any way to code this 'workaround' into the application? (or fix the bug of course ...) Edit: nevermind, didn't see the linked commit

lanoxx commented 6 years ago

This workaround is already part of tilda, but is currently not available in any of tilda's released versions. You can try to compile tilda from the master branch or wait until a new tilda release is available.

Gerrit-K commented 6 years ago

Wow, kudos for the quick reply. Thanks, looking forward to the next update. Loving Tilda so far!

makemegit commented 6 years ago

I have the same issue on Ubuntu Mate 18.04 fresh install. The only workaround i have found is to right click and select "Toggle Fullscreen" two times. This is very strange. It seems like F11 and "Toggle Fullscreen" options are not the same things. I hope someone resolve that issue.

falsechicken commented 5 years ago

@makemegit Thanks! I have been having this issue for like a year! (Ubuntu 18.04.1)

Gratouille commented 5 years ago

It seems I've always this problem under Ubuntu 18.04.2. The @makemegit's workaround indeed works but it's like a no-solution for me, I would like to not use my mouse to solve something made for the keyboard :(

I've seen the @lanoxx reply, is a new version fixing this is going out anyday ?

Thx a lot, loving Tilda over any other terms for now, that's the only pb I've with :(

voidplayer commented 5 years ago

Theres no new version with this fix afaik

I have compiled the latest version with this fix and is the one i use :)

Thats the only way to get it until a new release is done at the discretion of lanoxx