mirror of
https://github.com/elementary/gala.git
synced 2024-11-26 11:25:47 +03:00
Tooltip: get text color from style context (#1295)
* Tooltip: get text color from style context * cache the math
This commit is contained in:
parent
fee8ce43a3
commit
869aa70cfe
@ -47,17 +47,33 @@ public class Gala.Tooltip : Clutter.Actor {
|
||||
public float max_width;
|
||||
|
||||
static construct {
|
||||
var label_widget_path = new Gtk.WidgetPath ();
|
||||
label_widget_path.append_type (GLib.Type.from_name ("label"));
|
||||
label_widget_path.iter_set_object_name (-1, "tooltip");
|
||||
var tooltip_widget_path = new Gtk.WidgetPath ();
|
||||
var pos = tooltip_widget_path.append_type (typeof (Gtk.Window));
|
||||
tooltip_widget_path.iter_set_object_name (pos, "tooltip");
|
||||
tooltip_widget_path.iter_add_class (pos, Gtk.STYLE_CLASS_CSD);
|
||||
tooltip_widget_path.iter_add_class (pos, Gtk.STYLE_CLASS_BACKGROUND);
|
||||
|
||||
style_context = new Gtk.StyleContext ();
|
||||
style_context.add_class (Gtk.STYLE_CLASS_BACKGROUND);
|
||||
style_context.set_path (label_widget_path);
|
||||
style_context.set_path (tooltip_widget_path);
|
||||
|
||||
padding = style_context.get_padding (Gtk.StateFlags.NORMAL);
|
||||
|
||||
text_color = Clutter.Color.from_string ("#ffffff");
|
||||
tooltip_widget_path.append_type (typeof (Gtk.Label));
|
||||
|
||||
var label_style_context = new Gtk.StyleContext ();
|
||||
label_style_context.set_path (tooltip_widget_path);
|
||||
|
||||
var text_rgba = (Gdk.RGBA) label_style_context.get_property (
|
||||
Gtk.STYLE_PROPERTY_COLOR,
|
||||
Gtk.StateFlags.NORMAL
|
||||
);
|
||||
|
||||
text_color = Clutter.Color () {
|
||||
red = (uint8) text_rgba.red * uint8.MAX,
|
||||
green = (uint8) text_rgba.green * uint8.MAX,
|
||||
blue = (uint8) text_rgba.blue * uint8.MAX,
|
||||
alpha = (uint8) text_rgba.alpha * uint8.MAX,
|
||||
};
|
||||
}
|
||||
|
||||
construct {
|
||||
|
Loading…
Reference in New Issue
Block a user