Bug 229300 - On logout, my kmix "Volume Up" shortcut is cleared
Summary: On logout, my kmix "Volume Up" shortcut is cleared
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: shortcuts (show other bugs)
Version: 4.4
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 262088 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-03 21:08 UTC by Christopher Neufeld
Modified: 2011-01-12 02:18 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Neufeld 2010-03-03 21:08:42 UTC
Version:            (using Devel)
Compiler:          gcc-4.2.4 
OS:                Linux
Installed from:    Compiled sources

I have mapped some multimedia keys to high function keys.  In one particular case, I have a volume knob that I've set up to deliver an F22 when rotated clockwise, and F21 when rotated counter-clockwise.

In the system settings, Global Keyboard Shortcuts, for kmix, I have set "Increase Volume" to F22, and "Decrease Volume" to F21.  This works until I log out, after which time the "Increase Volume" setting is cleared.  It's always the increase volume.  The decrease volume and mute settings persist.

Looking at kglobalshortcutsrc, while I'm logged in it has a line that looks like this:
increase_volume=F20,Volume Up,Increase Volume

After I log out, it looks like this:
increase_volume=Volume Up,Volume Up,Increase Volume

Those are the only differences inserted into this file during the logout process.

This is annoying, as I have to reset the volume-up behaviour by hand every time I log in.
Comment 1 Christopher Neufeld 2010-03-03 22:14:45 UTC
More details, and a minor correction.  I drew those kglobalshortcutsrc lines from a different computer, one which had F20 for the volume-up button.  On the computer which uses F22 for increase volume, the line naturally shows "F22".

I'm using revision 1098335.  This is relatively recent breakage, I first noticed it when I recompiled about three weeks ago.
Comment 2 Christopher Neufeld 2010-03-27 15:18:49 UTC
Let's look at the function.  In kdemultimedia/kmix/kmix.cpp

void KMixWindow::initActionsLate()
{
  if ( m_autouseMultimediaKeys ) {
    KAction* globalAction = actionCollection()->addAction("increase_volume");
    globalAction->setText(i18n("Increase Volume"));
    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp), ( KAction::ShortcutTypes)( KAction::ActiveShortcut |  KAction::DefaultShortcut),  KAction::NoAutoloading);
    connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotIncreaseVolume()));

    globalAction = actionCollection()->addAction("decrease_volume");
    globalAction->setText(i18n("Decrease Volume"));
    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeDown));
    connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotDecreaseVolume()));

    globalAction = actionCollection()->addAction("mute");
    globalAction->setText(i18n("Mute"));
    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeMute));
    connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotMute()));
  }
}

Why is the setGlobalShortcut() code for "increase_volume" different from that for "decrease_volume" and "mute"?  The latter two work correctly, but the first is broken for me.
Comment 3 Christopher Neufeld 2010-04-08 20:04:44 UTC
This patch fixes the behaviour for me:


Index: kmix.cpp
===================================================================
--- kmix.cpp    (revision 1111731)
+++ kmix.cpp    (working copy)
@@ -144,7 +144,8 @@
   if ( m_autouseMultimediaKeys ) {
     KAction* globalAction = actionCollection()->addAction("increase_volume");
     globalAction->setText(i18n("Increase Volume"));
-    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp), ( KAction::ShortcutTypes)( KAction::ActiveShortcut |  KAction::DefaultShortcut),  KAction::NoAutoloading);
+//    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp), ( KAction::ShortcutTypes)( KAction::ActiveShortcut |  KAction::DefaultShortcut),  KAction::NoAutoloading);
+    globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp));
     connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotIncreaseVolume()));
 
     globalAction = actionCollection()->addAction("decrease_volume");
Comment 4 Sascha Peilicke 2010-05-14 11:20:37 UTC
I can confirm that the volume up shortcut is messed up every time I log into KDE (also using SVN trunk version through openSUSE packages). I've set Meta+Up as a shortcut but after login, 'Volume Up' special key is set instead, which my keyboard is lacking :-) Other KMix shortcuts are unaffected.

This happened only recently. Haven't had the time to test the patch though..
Comment 5 Sascha Peilicke 2010-06-02 16:49:02 UTC
SVN commit 1133816 by saschpe:

Fix volume up / mute shortcut issue, which overwrites custom shortcuts with system defaults.

BUG: 229300


 M  +1 -1      kmix.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1133816
Comment 6 Christopher Neufeld 2010-06-10 04:42:20 UTC
I'm the original reporter, and I'm marking it as verified.  The change is the same as the non-comment part of my patch, which did fix the problem.
Comment 7 Christopher Neufeld 2010-10-31 18:52:32 UTC
Somehow this bug has been reintroduced, and is present in revision 1191299.  The suspicious code in comment #2 is back again.  The .cpp file has been moved to kdemultimedia/kmix/apps/.
Comment 8 Jakob Kummerow 2010-12-13 22:29:37 UTC
I can confirm that this bug is present again in both 4.5.80 and 4.5.85. The change described in #3 still fixes it. 

Please fix this again. 
(Btw, the bug was reintroduced in Revision 1170713 by esken on Sep 1 21:37:18 2010 UTC.)
Comment 9 Sascha Peilicke 2010-12-14 08:59:30 UTC
Can also confirm it. Can someone either revert the commit or re-apply my patch? I'm currently unable to do for myself.
Comment 10 Sergei Kasaurov 2011-01-07 20:32:56 UTC
I can confirm this bug since 4.5.80. Unfortunately it's not fixed in RC2. I hope relese will do fine with that.
Comment 11 Jakob Kummerow 2011-01-10 20:27:04 UTC
I just committed Sascha's fix again. Unfortunately automatic updating of this bug failed since I don't have required permissions to mark it closed. Here're the links:

trunk:
WebSVN link: http://websvn.kde.org/?view=rev&revision=1213537

4.6 branch:
WebSVN link: http://websvn.kde.org/?view=rev&revision=1213541
Comment 12 Christoph Feck 2011-01-10 21:20:43 UTC
*** Bug 262088 has been marked as a duplicate of this bug. ***
Comment 13 Christoph Feck 2011-01-10 21:21:51 UTC
Fixed, according to comment #11
Comment 14 Nikos Chantziaras 2011-01-12 02:08:37 UTC
I just found the same bug with another shortcut.  The "KDE Deamon -> Sleep" shortcut gets reset too.

Should I open a new bug about this?
Comment 15 Nikos Chantziaras 2011-01-12 02:18:26 UTC
Never mind, I opened bug 262908 for this.