Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Unmaintained
KDE Workspace
Commits
7cd45390
Commit
7cd45390
authored
Nov 23, 2012
by
Thomas Lübking
Browse files
special tab/backtab handling to align kglobalaccel
BUG: 310476 FIXED-IN: 4.10 REVIEW: 107441
parent
0619c1d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
kwin/tabbox/tabbox.cpp
View file @
7cd45390
...
@@ -1340,12 +1340,29 @@ void TabBox::keyPress(int keyQt)
...
@@ -1340,12 +1340,29 @@ void TabBox::keyPress(int keyQt)
}
}
forward
=
forwardShortcut
.
contains
(
keyQt
);
forward
=
forwardShortcut
.
contains
(
keyQt
);
backward
=
backwardShortcut
.
contains
(
keyQt
);
backward
=
backwardShortcut
.
contains
(
keyQt
);
if
(
!
forward
&&
!
backward
)
{
if
(
(
keyQt
&
Qt
::
ShiftModifier
)
&&
!
(
forward
||
backward
)
)
{
// if the shortcuts do not match, try matching again after filtering the shift key from keyQt
// if the shortcuts do not match, try matching again after filtering the shift key from keyQt
// it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt
// it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt
keyQt
&=
~
Qt
::
ShiftModifier
;
keyQt
&=
~
Qt
::
ShiftModifier
;
forward
=
forwardShortcut
.
contains
(
keyQt
);
forward
=
forwardShortcut
.
contains
(
keyQt
);
backward
=
backwardShortcut
.
contains
(
keyQt
);
backward
=
backwardShortcut
.
contains
(
keyQt
);
if
(
!
(
forward
||
backward
))
{
// the tabkey is however overly special and withdrawing the shift state will not turn backtab into tab
// yet kglobalaccel fires for both. since we ensure this is in a Shift condition, try the other key
// TODO: Check requirement regarding Qt5
// NOTICE: it is very important to restore the Shift modifier, since otherwise we can't distiguish
// between the regular alt+tab / alt+shift+tab anymore!!
if
((
keyQt
&
Qt
::
Key_Backtab
)
==
Qt
::
Key_Backtab
)
{
// regular case
keyQt
&=
~
Qt
::
Key_Backtab
;
keyQt
|=
(
Qt
::
Key_Tab
|
Qt
::
ShiftModifier
);
}
else
if
((
keyQt
&
Qt
::
Key_Tab
)
==
Qt
::
Key_Tab
)
{
// just to be very sure ... :-(
keyQt
&=
~
Qt
::
Key_Tab
;
keyQt
|=
(
Qt
::
Key_Backtab
|
Qt
::
ShiftModifier
);
}
forward
=
forwardShortcut
.
contains
(
keyQt
);
backward
=
backwardShortcut
.
contains
(
keyQt
);
}
}
}
if
(
forward
||
backward
)
{
if
(
forward
||
backward
)
{
kDebug
(
125
)
<<
"== "
<<
forwardShortcut
.
toString
()
kDebug
(
125
)
<<
"== "
<<
forwardShortcut
.
toString
()
...
@@ -1357,6 +1374,34 @@ void TabBox::keyPress(int keyQt)
...
@@ -1357,6 +1374,34 @@ void TabBox::keyPress(int keyQt)
m_cutWalkThroughDesktopList
.
contains
(
keyQt
);
m_cutWalkThroughDesktopList
.
contains
(
keyQt
);
backward
=
m_cutWalkThroughDesktopsReverse
.
contains
(
keyQt
)
||
backward
=
m_cutWalkThroughDesktopsReverse
.
contains
(
keyQt
)
||
m_cutWalkThroughDesktopListReverse
.
contains
(
keyQt
);
m_cutWalkThroughDesktopListReverse
.
contains
(
keyQt
);
if
((
keyQt
&
Qt
::
ShiftModifier
)
&&
!
(
forward
||
backward
))
{
// if the shortcuts do not match, try matching again after filtering the shift key from keyQt
// it is needed to handle correctly the ALT+~ shorcut for example as it is coded as ALT+SHIFT+~ in keyQt
keyQt
&=
~
Qt
::
ShiftModifier
;
forward
=
m_cutWalkThroughDesktops
.
contains
(
keyQt
)
||
m_cutWalkThroughDesktopList
.
contains
(
keyQt
);
backward
=
m_cutWalkThroughDesktopsReverse
.
contains
(
keyQt
)
||
m_cutWalkThroughDesktopListReverse
.
contains
(
keyQt
);
if
(
!
(
forward
||
backward
))
{
// the tabkey is however overly special and withdrawing the shift state will not turn backtab into tab
// yet kglobalaccel fires for both. since we ensure this is in a Shift condition, try the other key
// TODO: Check requirement regarding Qt5
// NOTICE: it is very important to restore the Shift modifier, since otherwise we can't distiguish
// between the regular alt+tab / alt+shift+tab anymore!!
if
((
keyQt
&
Qt
::
Key_Backtab
)
==
Qt
::
Key_Backtab
)
{
// regular case
keyQt
&=
~
Qt
::
Key_Backtab
;
keyQt
|=
(
Qt
::
Key_Tab
|
Qt
::
ShiftModifier
);
}
else
if
((
keyQt
&
Qt
::
Key_Tab
)
==
Qt
::
Key_Tab
)
{
// just to be very sure ... :-(
keyQt
&=
~
Qt
::
Key_Tab
;
keyQt
|=
(
Qt
::
Key_Backtab
|
Qt
::
ShiftModifier
);
}
forward
=
m_cutWalkThroughDesktops
.
contains
(
keyQt
)
||
m_cutWalkThroughDesktopList
.
contains
(
keyQt
);
backward
=
m_cutWalkThroughDesktopsReverse
.
contains
(
keyQt
)
||
m_cutWalkThroughDesktopListReverse
.
contains
(
keyQt
);
}
}
if
(
forward
||
backward
)
if
(
forward
||
backward
)
walkThroughDesktops
(
forward
);
walkThroughDesktops
(
forward
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment