Philipp Hörist pushed to branch master at gajim / gajim


Commits:
dc25497c by Philipp Hörist at 2019-08-15T06:56:51Z
ChatControlBase: Focus message input on textview click

- - - - -
af312830 by Philipp Hörist at 2019-08-15T06:56:51Z
Remove ConversationTextView key-press-event handler

The underlying HtmlTextView is not selectable anymore, so we dont need
to send events to the notebook

- - - - -


1 changed file:

- gajim/chat_control_base.py


Changes:

=====================================
gajim/chat_control_base.py
=====================================
@@ -31,6 +31,7 @@ from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import GLib
 from gi.repository import Gio
+from gi.repository import GObject
 
 from gajim.common import events
 from gajim.common import app
@@ -57,7 +58,6 @@ from gajim.gtk import util
 from gajim.gtk.util import at_the_end
 from gajim.gtk.util import get_show_in_roster
 from gajim.gtk.util import get_show_in_systray
-from gajim.gtk.util import get_primary_accel_mod
 from gajim.gtk.util import get_hardware_key_codes
 from gajim.gtk.emoji_chooser import emoji_chooser
 
@@ -254,9 +254,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, 
CommandTools):
         self.conv_textview = ConversationTextview(self.account)
         id_ = self.conv_textview.connect('quote', self.on_quote)
         self.handlers[id_] = self.conv_textview.tv
-        id_ = self.conv_textview.tv.connect(
-            'key_press_event', self._conv_textview_key_press_event)
-        self.handlers[id_] = self.conv_textview.tv
 
         # FIXME: DND on non editable TextView, find a better way
         self.drag_entered = False
@@ -273,6 +270,10 @@ class ChatControlBase(MessageControl, 
ChatCommandProcessor, CommandTools):
             Gdk.DragAction.COPY)
         self.conv_textview.tv.drag_dest_set_target_list(dst_targets)
 
+        id_ = self.conv_textview.tv.connect('grab-focus',
+                                            self._on_html_textview_grab_focus)
+        self.handlers[id_] = self.conv_textview.tv
+
         self.conv_scrolledwindow = self.xml.get_object(
             'conversation_scrolledwindow')
         self.conv_scrolledwindow.add(self.conv_textview.tv)
@@ -516,6 +517,13 @@ class ChatControlBase(MessageControl, 
ChatCommandProcessor, CommandTools):
         app.config.set_per(per_type, self.contact.jid,
                            'speller_language', gspell_lang.get_code())
 
+    def _on_html_textview_grab_focus(self, textview):
+        # Abort signal so the textview does not get focused
+        # Focus the MessageTextView instead
+        GObject.signal_stop_emission_by_name(textview, 'grab-focus')
+        self.msg_textview.grab_focus()
+        return Gdk.EVENT_STOP
+
     def on_banner_label_populate_popup(self, label, menu):
         """
         Override the default context menu and add our own menuitems
@@ -596,19 +604,6 @@ class ChatControlBase(MessageControl, 
ChatCommandProcessor, CommandTools):
         if event.button == 3:  # right click
             self.parent_win.popup_menu(event)
 
-    def _conv_textview_key_press_event(self, _widget, event):
-        if (event.get_state() & get_primary_accel_mod() and
-                event.hardware_keycode in self.keycodes_c):
-            return Gdk.EVENT_PROPAGATE
-
-        if (event.get_state() & Gdk.ModifierType.SHIFT_MASK and
-                event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up)):
-            self._on_scroll(None, event.keyval)
-            return Gdk.EVENT_PROPAGATE
-
-        self.parent_win.notebook.event(event)
-        return Gdk.EVENT_STOP
-
     def _on_message_textview_paste_event(self, texview):
         clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
         image = clipboard.wait_for_image()



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/768c46c883688b3ac6e85c7cdac31ed0fc46716a...af312830ef42fdb712c2b3874f8d61e6a8b1636c

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/768c46c883688b3ac6e85c7cdac31ed0fc46716a...af312830ef42fdb712c2b3874f8d61e6a8b1636c
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

Reply via email to