We forgot to show the titlebar again when a window is turned
from decorated to undecorated and back again. Also, we were drawing
the titlebar background even when the window is undecorated.
We now allow buttons at the left and right side, they can be specified
like this: menu,close:minimize,maximize.
Also, change the default button layout back to have just a close
button on the right.
This separates titlebar layout from the GtkWindow code, and gets
the title properly centered. It also paves the way for allowing
ttle buttons on the left.
This has been developed as GdHeaderBar in libgd. The copy here has
been renamed and changed to use GTK+ internals. It also properly
takes the label size into account.
For now, nothing changes, we're using their sum everywhere.
In the future, we will make the inner border the visible window
frame, and the outer border the shadow/resize border.
Hide the close button if the window is not deletable, hide the
maximize button if the window is not resizable, and hide all
buttons if the window is a dialog.
gtk_window_get_preferred_width/height were retrieving the border and title
height and then saving that into the private structure of the window. This was
then used inside the _gtk_window_set_allocation and gtk_window_draw methods.
If a subclass did not chain up for get_preferred_height / get_preferred_width
(like Nautilus) then these values would not be saved and the allocation and
drawing would not work correctly.
This resolves this by spinning out the retrieval of that information into a
separate function and using that every time the data is required.
Client side decorations can be enabled on non-Wayland platforms by setting the
GTK_CSD="1" environment variable.
We must ensure we have a GdkVisual that has an alpha channel since the
decorations rely on transparency. If we cannot get a visual with an alpha
channel then we do not enable client side decorations.
Otherwise we'll potentially get some background sticking through our rounded
corners in our decorations. The actual background will get drawn as part of
the decoration drawing.
This change comprises four main parts:
* the creation of the widgets that form the decorations,
* implementation of get_preferred_height/width, and the for_width/for_height
variants,
* taking the decorations into account when allocating,
* and drawing the decorations themselves.
Kristian did the bulk of the original work on this but any bugs are almost
certainly mine through the many refactorings and rebasings.
Update the documentation and users of this function to handle
the future case that that we have some internal decorations to the window and
useable allocation is thus smaller.
By having a separate out parameter there is no need to have an in/out function
and allows for greater robustness.
The current implementation simply returns the allocation provided.
2013-02-26 19:33:04 +00:00
8 changed files with 2711 additions and 44 deletions
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.