diff options
author | Marvin W <git@larma.de> | 2017-03-13 22:53:36 +0100 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-03-13 22:54:52 +0100 |
commit | 092edaf9fd05067c34d87ad4193d3485bdb5245d (patch) | |
tree | b6635a06552d0bef8d3297a7d11735fc807a25c8 /main/src/ui/util.vala | |
parent | 2d6f580c871df055ca79b8a8be53e53e62aa155c (diff) | |
download | dino-092edaf9fd05067c34d87ad4193d3485bdb5245d.tar.gz dino-092edaf9fd05067c34d87ad4193d3485bdb5245d.zip |
Fix regression of being unable to select text
Diffstat (limited to 'main/src/ui/util.vala')
-rw-r--r-- | main/src/ui/util.vala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/main/src/ui/util.vala b/main/src/ui/util.vala index aad0817d..ec09609a 100644 --- a/main/src/ui/util.vala +++ b/main/src/ui/util.vala @@ -74,6 +74,22 @@ public class Util : Object { if (scale == 0) scale = image.get_scale_factor(); image.set_from_surface(Gdk.cairo_surface_create_from_pixbuf(pixbuf, scale, image.get_window())); } + + private const string force_background_css = "%s { background-color: %s; }"; + + public static void force_background(Gtk.Widget widget, string color, string selector = "*") { + var p = new Gtk.CssProvider(); + try { + p.load_from_data(force_background_css.printf(selector, color)); + widget.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + } catch (GLib.Error err) { + // handle err + } + } + + public static void force_base_background(Gtk.Widget widget, string selector = "*") { + force_background(widget, "@theme_base_color", selector); + } } }
\ No newline at end of file |