[polari] chatView: Highlight links on hover
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] chatView: Highlight links on hover
- Date: Tue, 22 Dec 2015 18:19:31 +0000 (UTC)
commit cd69f6cecef05b01bb7f54a4c71e1f17056a446b
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Dec 20 01:50:41 2015 +0100
chatView: Highlight links on hover
GTK+ started doing this for links in labels, so follow suite. It's
a nice touch anyway - while the underline and cursor change are
well established indications for clickable links, the highlight
still helps in the case of multiple links in succession.
src/chatView.js | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 0354571..d475c9b 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -325,8 +325,11 @@ const ChatView = new Lang.Class({
context.save();
context.set_state(Gtk.StateFlags.LINK);
- let linkColor = context.get_color(context.get_state());
+ this._linkColor = context.get_color(context.get_state());
this._activeNickColor = context.get_color(context.get_state());
+
+ context.set_state(Gtk.StateFlags.LINK | Gtk.StateFlags.PRELIGHT);
+ this._hoveredLinkColor = context.get_color(context.get_state());
context.restore();
let desaturatedNickColor = (this._activeNickColor.red +
@@ -349,7 +352,7 @@ const ChatView = new Lang.Class({
{ name: 'action',
foreground_rgba: dimColor },
{ name: 'url',
- foreground_rgba: linkColor }
+ foreground_rgba: this._linkColor }
];
tags.forEach(function(tagProps) {
let tag = tagTable.lookup(tagProps.name);
@@ -1141,6 +1144,13 @@ const ChatView = new Lang.Class({
url = 'http://' + url;
let tag = new ButtonTag();
+ tag.connect('notify::hover', Lang.bind(this,
+ function() {
+ if (tag.hover)
+ tag.foreground_rgba = this._hoveredLinkColor;
+ else
+ tag.foreground_rgba = this._linkColor;
+ }));
tag.connect('clicked',
function() {
Utils.openURL(url, Gtk.get_current_event_time());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]