Use the '_k_session' shortcuts feature for the per-window shortcuts,

as those are definitely not to be handled by kdedglobalaccel besides
delivering the event, only KWin can keep track of those. Also add
a kconf_update script to dump all the possibly previously created
shortcuts that'd block actually using them.


svn path=/branches/KDE/4.1/kdebase/workspace/; revision=880850
This commit is contained in:
Luboš Luňák 2008-11-06 17:11:47 +00:00
parent b17896174f
commit fe84baef03
5 changed files with 21 additions and 5 deletions

View file

@ -28,6 +28,6 @@ install(TARGETS kwin_update_default_rules DESTINATION ${LIB_INSTALL_DIR}/kconf_u
install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules ) install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules )
install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} ) install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} )
install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh kwin_window_shortcuts.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )

View file

@ -0,0 +1,10 @@
#! /bin/sh
# remove <number>=<shortcuts> lines for per-window shortcuts that are not supposed to be saved
while read line; do
if echo "$line" | grep '^[0-9]\+=' >/dev/null 2>/dev/null; then
key=`echo "$line" | sed 's/^\([0-9]\+\)=.*$/\1/'`
echo '# DELETE [kwin]'$key
else
echo "$line"
fi
done

View file

@ -0,0 +1,5 @@
Id=kde414
File=kglobalshortcutsrc
Group=kwin
Options=overwrite
Script=kwin_window_shortcuts.sh,sh

View file

@ -410,7 +410,7 @@ void Workspace::setupWindowShortcutDone( bool ok )
void Workspace::clientShortcutUpdated( Client* c ) void Workspace::clientShortcutUpdated( Client* c )
{ {
QString key = QString::number( c->window()); QString key = QString( "_k_session:%1" ).arg(c->window());
QAction* action = client_keys->action( key.toLatin1().constData() ); QAction* action = client_keys->action( key.toLatin1().constData() );
if( !c->shortcut().isEmpty()) if( !c->shortcut().isEmpty())
{ {
@ -426,10 +426,8 @@ void Workspace::clientShortcutUpdated( Client* c )
action->setEnabled( true ); action->setEnabled( true );
} }
else else
{
delete action; delete action;
} }
}
void Workspace::clientPopupActivated( QAction *action ) void Workspace::clientPopupActivated( QAction *action )
{ {

View file

@ -579,7 +579,10 @@ void Workspace::removeClient( Client* c, allowed_t )
if( client_keys_client == c ) if( client_keys_client == c )
setupWindowShortcutDone( false ); setupWindowShortcutDone( false );
if( !c->shortcut().isEmpty()) if( !c->shortcut().isEmpty())
{
c->setShortcut( QString() ); // remove from client_keys c->setShortcut( QString() ); // remove from client_keys
clientShortcutUpdated( c ); // needed, since this is otherwise delayed by setShortcut() and wouldn't run
}
if( c->isDialog()) if( c->isDialog())
Notify::raise( Notify::TransDelete ); Notify::raise( Notify::TransDelete );