Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
492a7580 by wurstsalat at 2022-02-25T13:55:28+01:00
PlainWidget: Make selection transparent if there is no focus
When focusing out it is expected to clear text selection.
Clearing text selection itself clears middle mouse button's clipboard layer.
To work around this, we apply transparency to the selection for as long as we
don't have focus.
- - - - -
2 changed files:
- gajim/data/style/gajim.css
- gajim/gtk/conversation/plain_widget.py
Changes:
=====================================
gajim/data/style/gajim.css
=====================================
@@ -32,6 +32,11 @@ .message-input-focus {
border-radius: 4px;
}
+.transparent-selection > selection {
+ background-color: transparent;
+ color: @theme_fg_color;
+}
+
row:backdrop { transition: none; }
.conversation-row:hover button {
=====================================
gajim/gtk/conversation/plain_widget.py
=====================================
@@ -89,6 +89,7 @@ def __init__(self, account: str, selectable: bool) -> None:
self.connect('populate-popup', self._on_populate_popup)
self.connect('activate-link', self._on_activate_link)
+ self.connect('focus-in-event', self._on_focus_in)
self.connect('focus-out-event', self._on_focus_out)
def _on_populate_popup(self, label: Gtk.Label, menu: Gtk.Menu) -> None:
@@ -126,10 +127,17 @@ def _on_activate_link(self, _label: Gtk.Label, uri: str)
-> int:
open_uri(uri, self._account)
return Gdk.EVENT_STOP
- def _on_focus_out(self,
- widget: MessageLabel,
- event: Gdk.EventFocus) -> None:
- self.select_region(0, 0)
+ @staticmethod
+ def _on_focus_in(widget: MessageLabel,
+ _event: Gdk.EventFocus
+ ) -> None:
+ widget.get_style_context().remove_class('transparent-selection')
+
+ @staticmethod
+ def _on_focus_out(widget: MessageLabel,
+ _event: Gdk.EventFocus
+ ) -> None:
+ widget.get_style_context().add_class('transparent-selection')
class MessageTextview(Gtk.TextView):
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/492a75802fffa6b64fb8b51bbcd6b7a5ce1ebed2
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/492a75802fffa6b64fb8b51bbcd6b7a5ce1ebed2
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits