Re: GTK3 Frame Border - Bug #659926



Hi;

On 10 September 2015 at 15:06, richard boaz <ivor boaz gmail com> wrote:

After some google-reading, it seems that with GTK-3, control of frame decorations has been 100% given over to whatever WM is running whatever theme.

The WM is not involved in the least. The theme involved is the GTK+ one.

To be fair, the shadow style was always left to the theme, even in the GTK+ 2.x days. These days, mapping all possible border size, shadow, and color combinations to a simple flat enumeration is impossible without having a combinatorial explosion of values. We have a better way, with CSS, to express that.

My first question to the general list is to wonder if anyone has found a work-around for this.  Investigating the documentation turns up nothing obvious in possible alternatives.

You can add your own CSS styling to get the border you wish.
 
Barring some other way of achieving what's required for my app, I'm dying to know how this evolution of functionality is a good idea.  A bug was reported for this (https://bugzilla.gnome.org/show_bug.cgi?id=659926) where this has been marked as WONTFIX, since this seems to have been simply given over to the theme engine's own nefarious intent.

Please, let's not be overly melodramatic. No need to infer "nefarious" intents.

The theme is responsible for the styling of everything you see on the screen; it makes sense to have the theme in charge of the border of a frame.

Since it's part of the theme, it also means you can override it with a custom set of CSS rules, instead of having to patch GTK or your application.
 
But I don't entirely understand this: the above two plots are generated using the same WM on the same box, at exactly the same time, so something has obviously changed between GTK-2 and GTK-3, where program control of how an app's internal widgets must be displayed has simply vanished.

The whole theme system has changed between GTK 2.x and GTK 3.x, so, yes: you could say that something has changed.
 
So, how am I supposed to provide a GtkGrid of drawing areas where I'm actually able to distinguish to the user the borders between them?

Add a style class to your GtkFrame, using the gtk_style_context_add_class() API on the GtkStyleContext of your widget, or by by using the <style><class name=''/></style> stanza in the GtkBuilder XML, depending on what you use to build your UI.

When launching your application, create a GtkCssProvider and load a CSS snippet; something like:

.my-drawing-area-frame {
  border: 1px red;
  padding: 6px;
}

and use gtk_style_context_add_provider_for_screen() to associate the GtkCssProvider to the default screen. This will ensure that all widgets with a style class of 'my-drawing-area-frame' will have a red, 1 pixel border, and a padding of 6 pixels.

Ciao,
 Emmanuele.

--


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]