Philipp Hörist pushed to branch master at gajim / gajim
Commits: 96274696 by lovetox at 2022-01-29T00:17:21+01:00 PlainWidget: Allow Focus and remove selection when focus is lost Without focus keybindings like CTRL + C do not work anymore Remove the selection on losing foucs so users know that they lost focus - - - - - 1 changed file: - gajim/gtk/conversation/plain_widget.py Changes: ===================================== gajim/gtk/conversation/plain_widget.py ===================================== @@ -12,6 +12,8 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <http://www.gnu.org/licenses/>. +from __future__ import annotations + from typing import Any import logging @@ -80,7 +82,6 @@ def __init__(self, account: str, selectable: bool) -> None: self.set_xalign(0) self.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) self.set_track_visited_links(False) - self.set_can_focus(False) self._account = account @@ -88,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-out-event', self._on_focus_out) def _on_populate_popup(self, label: Gtk.Label, menu: Gtk.Menu) -> None: selected, start, end = label.get_selection_bounds() @@ -124,6 +126,11 @@ 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) + class MessageTextview(Gtk.TextView): def __init__(self, account: str) -> None: View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9627469656960af5858031333fbd309314b7a803 -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9627469656960af5858031333fbd309314b7a803 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
