Make the message control text entry grab focus when new controls are created and each time the tabs
are switched. Fixes #4227
This commit is contained in:
parent
e8bd2d3f66
commit
55c1868d92
3 changed files with 9 additions and 4 deletions
|
@ -304,6 +304,7 @@ class ChatControlBase(MessageControl):
|
||||||
self.user_nick = None
|
self.user_nick = None
|
||||||
|
|
||||||
self.smooth = True
|
self.smooth = True
|
||||||
|
self.msg_textview.grab_focus()
|
||||||
|
|
||||||
def on_msg_textview_populate_popup(self, textview, menu):
|
def on_msg_textview_populate_popup(self, textview, menu):
|
||||||
'''we override the default context menu and we prepend an option to switch languages'''
|
'''we override the default context menu and we prepend an option to switch languages'''
|
||||||
|
@ -1155,6 +1156,7 @@ class ChatControl(ChatControlBase):
|
||||||
self.update_ui()
|
self.update_ui()
|
||||||
# restore previous conversation
|
# restore previous conversation
|
||||||
self.restore_conversation()
|
self.restore_conversation()
|
||||||
|
self.msg_textview.grab_focus()
|
||||||
|
|
||||||
def update_toolbar(self):
|
def update_toolbar(self):
|
||||||
# Add to roster
|
# Add to roster
|
||||||
|
|
|
@ -890,6 +890,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
if self.parent_win:
|
if self.parent_win:
|
||||||
self.parent_win.redraw_tab(self)
|
self.parent_win.redraw_tab(self)
|
||||||
|
|
||||||
|
self.msg_textview.grab_focus()
|
||||||
|
|
||||||
def got_disconnected(self):
|
def got_disconnected(self):
|
||||||
self.list_treeview.get_model().clear()
|
self.list_treeview.get_model().clear()
|
||||||
nick_list = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
nick_list = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
||||||
|
|
|
@ -730,6 +730,10 @@ class MessageWindow(object):
|
||||||
new_ctrl.set_control_active(True)
|
new_ctrl.set_control_active(True)
|
||||||
self.show_title(control = new_ctrl)
|
self.show_title(control = new_ctrl)
|
||||||
|
|
||||||
|
control = self.get_active_control()
|
||||||
|
if isinstance(control, ChatControlBase):
|
||||||
|
control.msg_textview.grab_focus()
|
||||||
|
|
||||||
def _on_notebook_key_press(self, widget, event):
|
def _on_notebook_key_press(self, widget, event):
|
||||||
# Ctrl+PageUP / DOWN has to be handled by notebook
|
# Ctrl+PageUP / DOWN has to be handled by notebook
|
||||||
if (event.state & gtk.gdk.CONTROL_MASK and
|
if (event.state & gtk.gdk.CONTROL_MASK and
|
||||||
|
@ -986,9 +990,6 @@ class MessageWindowMgr(gobject.GObject):
|
||||||
if not self.one_window_opened(contact, acct, type):
|
if not self.one_window_opened(contact, acct, type):
|
||||||
self._resize_window(win, acct, type)
|
self._resize_window(win, acct, type)
|
||||||
self._position_window(win, acct, type)
|
self._position_window(win, acct, type)
|
||||||
#FIXME: make sure when first chat tab is shown textview grabs focus
|
|
||||||
#this wont work but something close to that should be fine:
|
|
||||||
# win.window.grab_focus()
|
|
||||||
|
|
||||||
self._windows[win_key] = win
|
self._windows[win_key] = win
|
||||||
return win
|
return win
|
||||||
|
|
Loading…
Add table
Reference in a new issue