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

Commits:

1 changed file:

Changes:

  • gajim/chat_control_base.py
    ... ... @@ -31,6 +31,7 @@ from gi.repository import Gtk
    31 31
     from gi.repository import Gdk
    
    32 32
     from gi.repository import GLib
    
    33 33
     from gi.repository import Gio
    
    34
    +from gi.repository import GObject
    
    34 35
     
    
    35 36
     from gajim.common import events
    
    36 37
     from gajim.common import app
    
    ... ... @@ -57,7 +58,6 @@ from gajim.gtk import util
    57 58
     from gajim.gtk.util import at_the_end
    
    58 59
     from gajim.gtk.util import get_show_in_roster
    
    59 60
     from gajim.gtk.util import get_show_in_systray
    
    60
    -from gajim.gtk.util import get_primary_accel_mod
    
    61 61
     from gajim.gtk.util import get_hardware_key_codes
    
    62 62
     from gajim.gtk.emoji_chooser import emoji_chooser
    
    63 63
     
    
    ... ... @@ -254,9 +254,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
    254 254
             self.conv_textview = ConversationTextview(self.account)
    
    255 255
             id_ = self.conv_textview.connect('quote', self.on_quote)
    
    256 256
             self.handlers[id_] = self.conv_textview.tv
    
    257
    -        id_ = self.conv_textview.tv.connect(
    
    258
    -            'key_press_event', self._conv_textview_key_press_event)
    
    259
    -        self.handlers[id_] = self.conv_textview.tv
    
    260 257
     
    
    261 258
             # FIXME: DND on non editable TextView, find a better way
    
    262 259
             self.drag_entered = False
    
    ... ... @@ -273,6 +270,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
    273 270
                 Gdk.DragAction.COPY)
    
    274 271
             self.conv_textview.tv.drag_dest_set_target_list(dst_targets)
    
    275 272
     
    
    273
    +        id_ = self.conv_textview.tv.connect('grab-focus',
    
    274
    +                                            self._on_html_textview_grab_focus)
    
    275
    +        self.handlers[id_] = self.conv_textview.tv
    
    276
    +
    
    276 277
             self.conv_scrolledwindow = self.xml.get_object(
    
    277 278
                 'conversation_scrolledwindow')
    
    278 279
             self.conv_scrolledwindow.add(self.conv_textview.tv)
    
    ... ... @@ -516,6 +517,13 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
    516 517
             app.config.set_per(per_type, self.contact.jid,
    
    517 518
                                'speller_language', gspell_lang.get_code())
    
    518 519
     
    
    520
    +    def _on_html_textview_grab_focus(self, textview):
    
    521
    +        # Abort signal so the textview does not get focused
    
    522
    +        # Focus the MessageTextView instead
    
    523
    +        GObject.signal_stop_emission_by_name(textview, 'grab-focus')
    
    524
    +        self.msg_textview.grab_focus()
    
    525
    +        return Gdk.EVENT_STOP
    
    526
    +
    
    519 527
         def on_banner_label_populate_popup(self, label, menu):
    
    520 528
             """
    
    521 529
             Override the default context menu and add our own menuitems
    
    ... ... @@ -596,19 +604,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
    596 604
             if event.button == 3:  # right click
    
    597 605
                 self.parent_win.popup_menu(event)
    
    598 606
     
    
    599
    -    def _conv_textview_key_press_event(self, _widget, event):
    
    600
    -        if (event.get_state() & get_primary_accel_mod() and
    
    601
    -                event.hardware_keycode in self.keycodes_c):
    
    602
    -            return Gdk.EVENT_PROPAGATE
    
    603
    -
    
    604
    -        if (event.get_state() & Gdk.ModifierType.SHIFT_MASK and
    
    605
    -                event.keyval in (Gdk.KEY_Page_Down, Gdk.KEY_Page_Up)):
    
    606
    -            self._on_scroll(None, event.keyval)
    
    607
    -            return Gdk.EVENT_PROPAGATE
    
    608
    -
    
    609
    -        self.parent_win.notebook.event(event)
    
    610
    -        return Gdk.EVENT_STOP
    
    611
    -
    
    612 607
         def _on_message_textview_paste_event(self, texview):
    
    613 608
             clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
    
    614 609
             image = clipboard.wait_for_image()