This commit is contained in:
lenemter 2023-09-26 09:36:31 +09:00
parent d346a55a71
commit 58c80f14c0
3 changed files with 29 additions and 33 deletions

View File

@ -318,22 +318,21 @@ namespace Gala {
return (int) (Math.round ((float)value * scale_factor));
}
// private static Gtk.StyleContext selection_style_context = null;
private static Gtk.StyleContext selection_style_context = null;
public static Gdk.RGBA get_theme_accent_color () {
// if (selection_style_context == null) {
// 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, "selection");
if (selection_style_context == null) {
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, "selection");
// // selection_style_context = new Gtk.StyleContext ();
// // selection_style_context.set_path (label_widget_path);
// }
selection_style_context = new Gtk.StyleContext ();
selection_style_context.set_path (label_widget_path);
}
// return (Gdk.RGBA) selection_style_context.get_property (
// Gtk.STYLE_PROPERTY_BACKGROUND_COLOR,
// Gtk.StateFlags.NORMAL
// );
return { 0, 0, 255 };
return (Gdk.RGBA) selection_style_context.get_property (
Gtk.STYLE_PROPERTY_BACKGROUND_COLOR,
Gtk.StateFlags.NORMAL
);
}
/**

View File

@ -10,7 +10,7 @@
public class Gala.Tooltip : Clutter.Actor {
private static Clutter.Color text_color;
private static Gtk.Border padding;
// private static Gtk.StyleContext style_context;
private static Gtk.StyleContext style_context;
/**
* Canvas to draw the Tooltip background.
@ -52,23 +52,20 @@ public class Gala.Tooltip : Clutter.Actor {
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.set_path (tooltip_widget_path);
style_context = new Gtk.StyleContext ();
style_context.set_path (tooltip_widget_path);
// padding = style_context.get_padding (Gtk.StateFlags.NORMAL);
padding = style_context.get_padding (Gtk.StateFlags.NORMAL);
// tooltip_widget_path.append_type (typeof (Gtk.Label));
tooltip_widget_path.append_type (typeof (Gtk.Label));
// Gtk.StyleContext label_style_context = null;
// var label_style_context = new Gtk.StyleContext ();
// label_style_context.set_path (tooltip_widget_path);
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
// );
Gdk.RGBA text_rgba = { 0, 0, 0, 0};
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,
@ -136,8 +133,8 @@ public class Gala.Tooltip : Clutter.Actor {
ctx.save ();
// style_context.render_background (ctx, 0, 0, width, height);
// style_context.render_frame (ctx, 0, 0, width, height);
style_context.render_background (ctx, 0, 0, width, height);
style_context.render_frame (ctx, 0, 0, width, height);
ctx.restore ();

View File

@ -880,10 +880,10 @@ public class Gala.WindowClone : Clutter.Actor {
var label_widget_path = new Gtk.WidgetPath ();
label_widget_path.append_type (typeof (Gtk.Label));
// var style_context = new Gtk.StyleContext ();
// style_context.add_class (Granite.STYLE_CLASS_CARD);
// style_context.add_class (Granite.STYLE_CLASS_ROUNDED);
// style_context.set_path (label_widget_path);
var style_context = new Gtk.StyleContext ();
style_context.add_class (Granite.STYLE_CLASS_CARD);
style_context.add_class (Granite.STYLE_CLASS_ROUNDED);
style_context.set_path (label_widget_path);
border_radius = style_context.get_property (
Gtk.STYLE_PROPERTY_BORDER_RADIUS,