They broke the CSS custom color settings in 3.20

2016-11-12 Thread Stefan Salewski
You may know the Nim editor from

https://github.com/ngtk3/NEd

Getting tooltips with white background for a dark gtksourceview color
scheme was already one of the harder task for GTK 3.18 -- but somehow I
managed it. Recently I got GTK 3.20 and had to notice that setting
background for tooltip does not work any more. Setting the colors was
done this way for GTK 3.18:

const
  str0 = ".tooltip {background-color: rgba($1, $2, $3, 0.9); color: rgba($4, 
$5, $6, 1.0); \n}"

proc setTTColor(fg, bg: cstring) =
  var rgba_bg: gdk3.RGBAObj
  var rgba_fg: gdk3.RGBAObj
  if not rgbaParse(rgba_fg, bg): return
  if not rgbaParse(rgba_bg, fg): return
  let str: string = str0 % map([rgba_bg.red, rgba_bg.green, rgba_bg.blue, 
rgba_fg.red, rgba_fg.green, rgba_fg.blue], proc(x: cdouble): string = 
$system.int(x*255))
  var gerror: GError
  let provider: CssProvider = newCssProvider()
  let display: Display = displayGetDefault()
  let screen: gdk3.Screen = getDefaultScreen(display)
  styleContextAddProviderForScreen(screen, styleProvider(provider), 
STYLE_PROVIDER_PRIORITY_APPLICATION.cuint)
  discard loadFromData(provider, str, GSize(-1), gerror)
  objectUnref(provider)

Even for a simple test application setting of background color seems
not to work any more:

https://github.com/ngtk3/nim-gtk3/blob/master/test/colors.nim

I have the feeling that fixing this basically simple problem will take
much time again. Have already done some (Google) investigations
yesterday, but found no good hints. GtkInstector seems to be not really
helpful for tooltips unfortunately. I think I can remember some
questions about CSS problems on this list in recent months, some maybe
with replies of Mr Bassi. Have to dig :-)
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Porting Gtk2 styles to Gtk3

2016-11-12 Thread zahlenmeer
I am struggling how to translate operators of the form
color = &style->light[GTK_STATE_PRELIGHT];
into proper Gtk3. The documentation says:
"One notable difference is the reduction from fg/bg/text/base colors to
only foreground/background, in exchange the widget is able to render its
various elements with different CSS classes, which can be themed
independently."
First question would be: What do the different colors stand for anyway?
What does light and dark mean when it comes to rendering? For example, I
am using the Arc Theme which does not provide .light or .dark classes
for different widgets. But I also don't want to provide an
application-specific CSS file because the application should follow the
system theme.
The second question would be how style properties fit into this as well.
Some colors are set explicitly via style properties, but those are also
deprecated. What would be the way to replace those?
I am looking for the recommended way/best practise of styling widgets,
not some hacks and workarounds. Can anybody help me?

Thanks and kind regards
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list