Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
28bc5031
Commit
28bc5031
authored
16 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
better keypress handling
parent
d8c9aa0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/chat_control.py
+5
-10
5 additions, 10 deletions
src/chat_control.py
src/message_window.py
+27
-15
27 additions, 15 deletions
src/message_window.py
with
32 additions
and
25 deletions
src/chat_control.py
+
5
−
10
View file @
28bc5031
...
@@ -429,9 +429,12 @@ class ChatControlBase(MessageControl):
...
@@ -429,9 +429,12 @@ class ChatControlBase(MessageControl):
def
_conv_textview_key_press_event
(
self
,
widget
,
event
):
def
_conv_textview_key_press_event
(
self
,
widget
,
event
):
if
gtk
.
gtk_version
<
(
2
,
12
,
0
):
if
gtk
.
gtk_version
<
(
2
,
12
,
0
):
return
return
if
event
.
state
&
(
gtk
.
gdk
.
SHIFT_MASK
|
gtk
.
gdk
.
CONTROL_MASK
):
if
event
.
state
&
gtk
.
gdk
.
CONTROL_MASK
and
event
.
keyval
==
gtk
.
keysyms
.
c
\
or
event
.
state
&
gtk
.
gdk
.
SHIFT_MASK
and
event
.
keyval
in
(
gtk
.
keysyms
.
Page_Down
,
gtk
.
keysyms
.
Page_Up
):
return
False
return
False
self
.
parent_win
.
notebook
.
emit
(
'
key_press_event
'
,
event
)
self
.
parent_win
.
notebook
.
emit
(
'
key_press_event
'
,
event
)
return
True
def
show_emoticons_menu
(
self
):
def
show_emoticons_menu
(
self
):
if
not
gajim
.
config
.
get
(
'
emoticons_theme
'
):
if
not
gajim
.
config
.
get
(
'
emoticons_theme
'
):
...
@@ -467,6 +470,7 @@ class ChatControlBase(MessageControl):
...
@@ -467,6 +470,7 @@ class ChatControlBase(MessageControl):
set_emoticons_menu_position
,
1
,
0
)
set_emoticons_menu_position
,
1
,
0
)
def
_on_message_textview_key_press_event
(
self
,
widget
,
event
):
def
_on_message_textview_key_press_event
(
self
,
widget
,
event
):
# Ctrl [+ Shift] + Tab are not forwarded to notebook. We handle it here
if
self
.
widget_name
==
'
muc_child_vbox
'
:
if
self
.
widget_name
==
'
muc_child_vbox
'
:
if
event
.
keyval
not
in
(
gtk
.
keysyms
.
ISO_Left_Tab
,
gtk
.
keysyms
.
Tab
):
if
event
.
keyval
not
in
(
gtk
.
keysyms
.
ISO_Left_Tab
,
gtk
.
keysyms
.
Tab
):
self
.
last_key_tabs
=
False
self
.
last_key_tabs
=
False
...
@@ -485,15 +489,6 @@ class ChatControlBase(MessageControl):
...
@@ -485,15 +489,6 @@ class ChatControlBase(MessageControl):
if
event
.
keyval
==
gtk
.
keysyms
.
Tab
:
# CTRL + TAB
if
event
.
keyval
==
gtk
.
keysyms
.
Tab
:
# CTRL + TAB
self
.
parent_win
.
move_to_next_unread_tab
(
True
)
self
.
parent_win
.
move_to_next_unread_tab
(
True
)
return
True
return
True
# CTRL + PAGE_[UP|DOWN]: send to parent notebook
elif
event
.
keyval
==
gtk
.
keysyms
.
Page_Down
or
\
event
.
keyval
==
gtk
.
keysyms
.
Page_Up
:
self
.
parent_win
.
notebook
.
emit
(
'
key_press_event
'
,
event
)
return
True
# we pressed a control key or ctrl+sth: we don't block
# the event in order to let ctrl+c (copy text) and
# others do their default work
self
.
conv_textview
.
tv
.
emit
(
'
key_press_event
'
,
event
)
return
False
return
False
def
_on_message_textview_mykeypress_event
(
self
,
widget
,
event_keyval
,
def
_on_message_textview_mykeypress_event
(
self
,
widget
,
event_keyval
,
...
...
This diff is collapsed.
Click to expand it.
src/message_window.py
+
27
−
15
View file @
28bc5031
...
@@ -99,7 +99,7 @@ class MessageWindow(object):
...
@@ -99,7 +99,7 @@ class MessageWindow(object):
self
.
handlers
[
id_
]
=
self
.
window
self
.
handlers
[
id_
]
=
self
.
window
keys
=
[
'
<Control>f
'
,
'
<Control>g
'
,
'
<Control>h
'
,
'
<Control>i
'
,
keys
=
[
'
<Control>f
'
,
'
<Control>g
'
,
'
<Control>h
'
,
'
<Control>i
'
,
'
<Control>l
'
,
'
<Control>L
'
,
'
<Control>n
'
,
'
<Control>u
'
,
'
<Control>v
'
,
'
<Control>l
'
,
'
<Control>L
'
,
'
<Control>n
'
,
'
<Control>u
'
,
'
<Control>b
'
,
'
<Control><Shift>Tab
'
,
'
<Control>Tab
'
,
'
<Control>F4
'
,
'
<Control>b
'
,
'
<Control><Shift>Tab
'
,
'
<Control>Tab
'
,
'
<Control>F4
'
,
'
<Control>w
'
,
'
<Control>Page_Up
'
,
'
<Control>Page_Down
'
,
'
<Alt>Right
'
,
'
<Control>w
'
,
'
<Control>Page_Up
'
,
'
<Control>Page_Down
'
,
'
<Alt>Right
'
,
'
<Alt>Left
'
,
'
<Alt>a
'
,
'
<Alt>c
'
,
'
<Alt>m
'
,
'
<Alt>t
'
,
'
Escape
'
]
+
\
'
<Alt>Left
'
,
'
<Alt>a
'
,
'
<Alt>c
'
,
'
<Alt>m
'
,
'
<Alt>t
'
,
'
Escape
'
]
+
\
...
@@ -333,16 +333,6 @@ class MessageWindow(object):
...
@@ -333,16 +333,6 @@ class MessageWindow(object):
control
.
_on_change_nick_menuitem_activate
(
None
)
control
.
_on_change_nick_menuitem_activate
(
None
)
elif
keyval
==
gtk
.
keysyms
.
u
:
# CTRL + u: emacs style clear line
elif
keyval
==
gtk
.
keysyms
.
u
:
# CTRL + u: emacs style clear line
control
.
clear
(
control
.
msg_textview
)
control
.
clear
(
control
.
msg_textview
)
elif
keyval
==
gtk
.
keysyms
.
v
:
# CTRL + v: Paste into msg_textview
if
not
control
.
msg_textview
.
is_focus
():
control
.
msg_textview
.
grab_focus
()
# Paste into the msg textview
event
=
gtk
.
gdk
.
Event
(
gtk
.
gdk
.
KEY_PRESS
)
event
.
window
=
self
.
window
.
window
event
.
time
=
int
(
time
.
time
())
event
.
state
=
gtk
.
gdk
.
CONTROL_MASK
event
.
keyval
=
gtk
.
keysyms
.
v
control
.
msg_textview
.
emit
(
'
key_press_event
'
,
event
)
elif
control
.
type_id
==
message_control
.
TYPE_GC
and
\
elif
control
.
type_id
==
message_control
.
TYPE_GC
and
\
keyval
==
gtk
.
keysyms
.
b
:
# CTRL + b
keyval
==
gtk
.
keysyms
.
b
:
# CTRL + b
control
.
_on_bookmark_room_menuitem_activate
(
None
)
control
.
_on_bookmark_room_menuitem_activate
(
None
)
...
@@ -397,6 +387,7 @@ class MessageWindow(object):
...
@@ -397,6 +387,7 @@ class MessageWindow(object):
elif
keyval
==
gtk
.
keysyms
.
Escape
and
\
elif
keyval
==
gtk
.
keysyms
.
Escape
and
\
gajim
.
config
.
get
(
'
escape_key_closes
'
):
# Escape
gajim
.
config
.
get
(
'
escape_key_closes
'
):
# Escape
self
.
remove_tab
(
control
,
self
.
CLOSE_ESC
)
self
.
remove_tab
(
control
,
self
.
CLOSE_ESC
)
return
True
def
_on_close_button_clicked
(
self
,
button
,
control
):
def
_on_close_button_clicked
(
self
,
button
,
control
):
'''
When close button is pressed: close a tab
'''
'''
When close button is pressed: close a tab
'''
...
@@ -734,15 +725,36 @@ class MessageWindow(object):
...
@@ -734,15 +725,36 @@ class MessageWindow(object):
control
.
msg_textview
.
grab_focus
()
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
if
(
event
.
state
&
gtk
.
gdk
.
CONTROL_MASK
and
event
.
keyval
in
(
gtk
.
keysyms
.
Page_Down
,
gtk
.
keysyms
.
Page_Up
)):
return
False
# when tab itself is selected, make sure <- and -> are allowed for navigating between tabs
# when tab itself is selected, make sure <- and -> are allowed for navigating between tabs
if
event
.
keyval
in
(
gtk
.
keysyms
.
Left
,
gtk
.
keysyms
.
Right
):
if
event
.
keyval
in
(
gtk
.
keysyms
.
Left
,
gtk
.
keysyms
.
Right
):
return
False
return
False
control
=
self
.
get_active_control
()
control
=
self
.
get_active_control
()
if
event
.
state
&
gtk
.
gdk
.
SHIFT_MASK
:
# CTRL + SHIFT + TAB
if
event
.
state
&
gtk
.
gdk
.
CONTROL_MASK
and
\
event
.
keyval
==
gtk
.
keysyms
.
ISO_Left_Tab
:
self
.
move_to_next_unread_tab
(
False
)
return
True
# SHIFT + PAGE_[UP|DOWN]: send to conv_textview
elif
event
.
keyval
in
(
gtk
.
keysyms
.
Page_Down
,
gtk
.
keysyms
.
Page_Up
):
control
.
conv_textview
.
tv
.
emit
(
'
key_press_event
'
,
event
)
return
True
elif
event
.
state
&
gtk
.
gdk
.
CONTROL_MASK
:
if
event
.
keyval
==
gtk
.
keysyms
.
Tab
:
# CTRL + TAB
self
.
move_to_next_unread_tab
(
True
)
return
True
# Ctrl+PageUP / DOWN has to be handled by notebook
elif
event
.
keyval
==
gtk
.
keysyms
.
Page_Down
:
self
.
move_to_next_unread_tab
(
True
)
return
True
elif
event
.
keyval
==
gtk
.
keysyms
.
Page_Up
:
self
.
move_to_next_unread_tab
(
False
)
return
True
elif
event
.
keyval
==
gtk
.
keysyms
.
Control_L
:
return
True
if
isinstance
(
control
,
ChatControlBase
):
if
isinstance
(
control
,
ChatControlBase
):
# we forwarded it to message textview
# we forwarded it to message textview
control
.
msg_textview
.
emit
(
'
key_press_event
'
,
event
)
control
.
msg_textview
.
emit
(
'
key_press_event
'
,
event
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment