FS#85 - Can't resize window
Attached to Project:
Uzbl
Opened by Anonymous Submitter - 2009-08-07 11:22:07 AM
Last edited by Dieter Plaetinck (Dieter_be) - 2009-11-08 11:17:17 AM
Opened by Anonymous Submitter - 2009-08-07 11:22:07 AM
Last edited by Dieter Plaetinck (Dieter_be) - 2009-11-08 11:17:17 AM
|
DetailsWhen running uzbl on xfce, the window will not resize. Tried with mouse, tried with keyboard shortcuts - nothing. It won't budge.
What makes this bug even worse, is that when uzbl loads a page the window automatically resizes to the full size of that page, which is usually much larger than my screen. This makes uzbl unusable for me. |
This task depends upon
It also takes care of scroll_[vert|horz|begin|end] but someone who actually KNOWS gtk or c coding for that matter should probably fix it, compiles fine without warnings and seems to work the way it was intended (but I have never used uzbl with an older webkit, so I had to guess)
is this good stuff?
gtk_widget_set_size_request(GTK_WIDGET(uzbl.gui.main_window),1,1);
The committed fix is probably the more robust solution.
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
to...
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
There are 4 different patches here but I can test none.
diff per patch:
Bill: 1 line
Sean: 1 line (I'm not sure just changing the policy is a good idea. I think we even changed it in the past, the 'never' is probably there for a reason)
Israel: 4 lines
Thomas: many lines
Discuss with each other what is the best solution (the simpler the better) and when done, let me know which i should merge.
If we are already collecting all the fixes, than I started out based on this suggestion:
http://www.uzbl.org/bugs/index.php?do=details&task_id=99
It's only two lines, but it produces compilation warnings, so I checked some GTK sample code and saw the more conventional way of doing it. Warning free.
I have to admit that Sean's patch is the only one that makes sense to me (which means I can sort of understand why it works without knowing much about GTK). Does anyone care to explain why setting the window's minimal size (which is what Bill and me are doing) solves our problem?
With the overly-large gtk_vbox contained in a scrolled window, a smaller window size just means that not everything will be displayed at once. That's why setting the minimum size to the smallest allowable works---it overrides the huge size request of webkit, and because everything is scrolled, it doesn't have side-effects. Furthermore, with the minimum size changed instead of the scroll policy, the scroll bars should never appear. Changing the policy seems to open the door for scroll bars appearing.
As for which of the set-minimum-size patches to use, I suggest placing my line in his location. Using the geometry hints would make sense if they were dynamic or if there were a maximum size we were aiming for, but it looks like Israel's patch and mine come to the same thing in this case. Placing the size request in his location (at the end of create_window, c. 2394) seems to have the benefit of both simplicity and being less frequently called than my original placement (chosen to really hammer the point home that I wanted to resize it).
"gdk_window_set_geometry_hints() expects the hints to be fully valid already and simply passes them to the window manager; in contrast, gtk_window_set_geometry_hints() performs some interpretation. For example, GtkWindow will apply the hints to the geometry widget instead of the toplevel window, if you set a geometry widget. Also, the min_width/min_height/max_width/max_height fields may be set to -1, and GtkWindow will substitute the size request of the window or geometry widget. If the minimum size hint is not provided, GtkWindow will use its requisition as the minimum size. If the minimum size is provided and a geometry widget is set, GtkWindow will take the minimum size as the minimum size of the geometry widget rather than the entire window. The base size is treated similarly. "
Shouldn't we set the max size too? I wrote a patch (https://dl.getdropbox.com/u/1720529/inclmaxsize-ubzl.patch) for that that includes the fix from http://www.uzbl.org/bugs/index.php?do=details&task_id=99
Trying your suggestion, I discovered that the set-size request does not solve the problem when placed at the end of create_window. I guess that it has to be in retrieve_geometry so it will be called every time a page loads and tries to change the window size, and that setting the geometry hints does that automatically.
I am still not completely clear on why setting a minimum size overrides webkit's size request. We are telling the window to be AT LEAST 1x1, right? That means anything above that value, including the huge size webkit is requesting, is legit. Does the mere fact that there is a size request makes the window ignore webkit's request?
Based on this assumption I managed to slim my version down quite a bit. It's now a single line just before the end of create_window as follows:
gtk_window_set_geometry_hints(GTK_WINDOW (window), NULL, NULL, GDK_HINT_MIN_SIZE);
Note that I am not setting any minimal size, just passing null. And it works.
Committing this to my fork, for your gitting pleasure.
I'm using DWM, and setting resizehints to False in config.h made it go away.
Ignoring webkit's min-size hint sounds like a good thing in general. Should I ask Dieter to merge?
I was told that the webkitgtk+ behavior is different in 1.1.14 and this issue should be totally gone if compiled against webkitgtk+ 1.1.14.
can you guys confirm this?
1. Open uzbl.c
2. Find in function - retrieve_geometry() strings:
gtk_window_get_size(GTK_WINDOW(uzbl.gui.main_window), &w, &h);
gtk_window_get_position(GTK_WINDOW(uzbl.gui.main_window), &x, &y);
3. Replace:
gtk_window_set_size(GTK_WINDOW(uzbl.gui.main_window), &w, &h);
gtk_window_set_position(GTK_WINDOW(uzbl.gui.main_window), &x, &y);
> maybe:
...
> gtk_window_set_position(GTK_WINDOW(uzbl.gui.main_window), &x, &y);
But Window random resize, i don't know why.
This issue was consistently happening when browsing around the uzbl site before. However, all of the pages no longer stretch the window / disable resizing with the new build. :)
Uzbl version: Commit: 01ce2a70bddb831c77a5f6eabd35a85b0549095f
Also, it took me some time to figure out how to build webkitgtk, as the build-webkit script doesn't tell you about missing dependencies. (And the build 'guide' on their website doesn't even mention linux)
You can just use ./autogen.sh and have a familiar build-process that tells you what's going wrong.
- geometry behavior is now improved (in both master and experimental). see http://github.com/Dieterbe/uzbl/commit/1461ac760f79b8f153c8317c4534cb047a48331a
if this problem continues to exist with a recent uzbl + libwebkit 1.1.15, feel free to reopen this ticket