GNOME Bugzilla – Bug 516822
gtk_window_fullscreen does not resize correctly if removing widgets
Last modified: 2011-11-10 18:13:48 UTC
Please describe the problem: I have an application, which makes its menu bar and tool bar invisible, when in fullscreen mode. This works on linux, but in win32, the size of the window is not fullscreen, and the taskbar remains visible. Steps to reproduce: 1. gtk_window_fullscreen(window); 2. gtk_widget_hide(toolbar); or hiding first then fullscreen, the same happens. Actual results: not fullscreened correctly; window does not have title bar, and is maximized horizontally, but only 98% size vertically and taskbar visible. Expected results: fullscreen app. Does this happen every time? yes Other information: can be worked around the following way: gboolean fs_func(gpointer data) { gtk_window_fullscreen(window); return FALSE; } ... gtk_widget_hide(toolbar); g_idle_add_full(G_PRIORITY_LOW, fs_func, NULL, NULL); so maybe some gtk-internal configure/windowstate event should handle if the content of the window changes. my app does not connect to either of these or similar events.
Could you please provide a minimal but complete sample program as an attachment (just a single C file), thanks!
Created attachment 107344 [details] testcase
Created attachment 107345 [details] fullscreened app, still start menu visible
The same happens for gtk_window_maximize on win32.
I am getting this too. winxp, pygtk 2.12.1, gtk 2.14.4 Note that the same thing happens whether you hide the widget when calling fullscreen(), or if you hide the widget inside a window_state_change callback. The workaround the reporter has indeed works in my case too. i.e.: self.menubar.hide() gobject.idle_add(self.fullscreen) #hack to workaround bug #516822 <mytwocents> In win32 (not gtk specifically), setting a maximized window's size, even to the same as the existing size, can do funny things like what i'm seeing. Maybe this is what gtk is doing when it reallocates after hiding a widget. (Hope that helps somebody, but it probably won't.) </mytwocents>
I've found that the idle_add workaround isn't very good, as it simply avoids doing a hide/show/add/pack/etc. while fullscreened. My app needs to do these while fullscreened. After looking at this again I have found a much more robust workaround. This code works on win32 with gtk 2.16.0 (I have not tried this on other platforms or older gtk versions): def toggle_fullscreen(self): if self.window.get_state() & gtk.gdk.WINDOW_STATE_FULLSCREEN: self.menubar.show() self.unfullscreen() self.set_decorated(True) else: self.menubar.hide() self.set_decorated(False) self.fullscreen() #or you can menubar.hide here. The order of set_decorated and fullscreen, as well as set_decorated and unfullscreen appears to be critical. However one can safely hide the menubar after fullscreening without breaking the fullscreen as described in the report.
hi with same code and pygtk 2.22 same thing happen on win32, ok on linux screencast attached thanks
(In reply to comment #7) > hi > > with same code and pygtk 2.22 same thing happen on win32, ok on linux > > screencast attached > > thanks sorry... screencast here: http://www.penguincape.org/downloads/smo/fullscreen_problem_win32.ogv you can see that set_decorated true/false do not work normally thanks !
Fixed in gtk-2-24 branch, will be in 2.24.8 release.