Fix regression of being unable to select text
This commit is contained in:
parent
2d6f580c87
commit
092edaf9fd
|
@ -42,20 +42,12 @@ public class MergedMessageItem : Grid {
|
|||
name_label.label = Util.get_message_display_name(stream_interactor, message, conversation.account);
|
||||
|
||||
update_display_style();
|
||||
message_text_view.style_updated.connect(style_changed);
|
||||
}
|
||||
|
||||
private void style_changed() {
|
||||
lock(message_text_view) {
|
||||
message_text_view.style_updated.disconnect(style_changed);
|
||||
update_display_style();
|
||||
message_text_view.style_updated.connect(style_changed);
|
||||
}
|
||||
Util.force_base_background(message_text_view, "textview, text:not(:selected)");
|
||||
message_text_view.style_updated.connect(update_display_style);
|
||||
}
|
||||
|
||||
private void update_display_style() {
|
||||
TextView tmp = new TextView();
|
||||
RGBA bg = tmp.get_style_context().get_background_color(StateFlags.NORMAL);
|
||||
RGBA bg = get_style_context().get_background_color(StateFlags.NORMAL);
|
||||
bool dark_theme = (bg.red < 0.5 && bg.green < 0.5 && bg.blue < 0.5);
|
||||
|
||||
string display_name = Util.get_message_display_name(stream_interactor, messages[0], conversation.account);
|
||||
|
@ -64,8 +56,6 @@ public class MergedMessageItem : Grid {
|
|||
LinkButton lnk = new LinkButton("http://example.com");
|
||||
RGBA link_color = lnk.get_style_context().get_color(StateFlags.LINK);
|
||||
link_tag.foreground_rgba = link_color;
|
||||
|
||||
message_text_view.override_background_color(0, {0,0,0,0});
|
||||
}
|
||||
|
||||
public void update() {
|
||||
|
|
|
@ -50,22 +50,7 @@ public class View : Box {
|
|||
return true;
|
||||
});
|
||||
|
||||
update_background_color();
|
||||
this.style_updated.connect(style_changed);
|
||||
}
|
||||
|
||||
private void update_background_color() {
|
||||
TextView tmp = new TextView();
|
||||
this.override_background_color(0, tmp.get_style_context().get_background_color(0));
|
||||
main.override_background_color(0, tmp.get_style_context().get_background_color(0));
|
||||
}
|
||||
|
||||
private void style_changed() {
|
||||
lock (main) {
|
||||
this.style_updated.disconnect(style_changed);
|
||||
update_background_color();
|
||||
this.style_updated.connect(style_changed);
|
||||
}
|
||||
Util.force_base_background(this);
|
||||
}
|
||||
|
||||
public void initialize_for_conversation(Conversation? conversation) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue