Bug 113124 - Global shortcuts no longer work or save properly
Summary: Global shortcuts no longer work or save properly
Status: RESOLVED FIXED
Alias: None
Product: kmix
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Esken
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-23 08:32 UTC by Paul Eggleton
Modified: 2006-09-18 12:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Change first mixer if no master channel is explitely defined (2.57 KB, patch)
2005-11-14 00:11 UTC, Stephan Binner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2005-09-23 08:32:39 UTC
Version:            (using KDE KDE 3.4.90)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 3.3.5-20050130 Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1
OS:                Linux

In KDE 3.4 I had XF86AudioRaiseVolume, XF86AudioRaiseVolume and XF86AudioMute set up as global shortcuts. Upon upgrading to KDE 3.5 beta 1 these no longer worked. Going into the global shortcut settings in KMix showed that the shortcuts had been cleared, so I set them up again; however the keys still didn't do anything. In fact assigning any shortcut key (eg. Shift+F12) gives the same result, so it's not just the special keys. Interestingly when I closed KMix (which seems to take a few seconds longer than I remember previously) and re-run it, the settings have again been cleared.

Initially I thought this might be the same as bug #74575, but I have KMilo disabled (actually it's not even installed - it was excluded by way of DO_NOT_COMPILE).
Comment 1 Paul Eggleton 2005-10-20 12:23:27 UTC
Just tested again with 3.5 beta 2, and the problem is still present. I did however find that if I use the "Select Master Channel" and then configure the global shortcut keys it works. However, if you close kmix and then re-run it, the shortcut keys are unassigned again.
Comment 2 Ork de Rooij 2005-11-09 22:32:53 UTC
I am having the exact same problems as you with with 3.5 beta 2, including the trick with "Select Master Channel". The asigned buttons then work until kmix is closed. In 3.4 there also was a popup screen giving me the current master volume for a second whenever I pressed one of the assigned up/down/mute buttons, but this also seems not to work in 3.5 beta 2.

As a sidenote, does artscontrol work for you? Mine currently does this: :(
$ artscontrol
*** glibc detected *** free(): invalid pointer: 0x08067d58 ***
Alarm clock
$   
.. that's including the Alarm clock message. No idea yet what to make from this...
Comment 3 Paul Eggleton 2005-11-10 08:28:28 UTC
artscontrol does seem to work here - well, I don't get an error when I run it anyway. I don't normally use it myself.

I have to say that it is a little worrying that we've heard no official comment about this bug considering it is a regression and how close we are to the 3.5 release. It can't be that hard to fix, surely.
Comment 4 Christian Esken 2005-11-12 21:39:20 UTC
Hello, "official statement" coming up. I have no problems with this setup:
SuSE10.0 clean freshly installed
KDE3.5 SVN branch of today freshly compiled and installed

There only seems to be an issue with the keys "XF86AudioRaiseVolume, XF86AudioRaiseVolume and XF86AudioMute". It is very important to check, whether kmilo is running.

I have 2 questions. Answers from both Paul and Ork would be appreciated.

1) KMilo check
There could be an old kmilo installation around. So please open the Control Center. Select KDE components => Services (literal translation, actual names might vary):
Is there a "Kmilo" entry?

2) Assign a "simple" key
a) Assign somehting like "CTRL-J" to "Headphones".
b) Quit KMix (CTRL-q)
c) Start KMix
d) Is the shortcut still assigned ?

Chris
Comment 5 Christian Esken 2005-11-12 21:43:33 UTC
Additional hint: There also seem to be issues with other keys, e.g. the Keypad keys get assigned, but are NOT GLOBAL Shortcuts. But this applies to ALL KDE applications, for example amarok has the same problem.
Comment 6 Christian Esken 2005-11-12 22:26:24 UTC
Additional hint: The page http://websvn.kde.org/branches/KDE/3.5/kdemultimedia/kmix/kmix.cpp?rev=457033&view=log points to the source of the problem: A "master volume shortcut" has been introduced, and it is very likely that this one overwrites the regular volume control shortcut.
It looks like the "master volume shortcut" patch must be reverted or fixed.
Comment 7 Ork de Rooij 2005-11-13 00:03:08 UTC
Individual channels are assignable here, e.g. Ctrl-J or XF86AudioMute assign and stay assigned after quitting and restarting kmix. It only happens with the Settings->Configure global shortcuts menu option, right clicking Master and then selecting 'Configure Global Shortcuts' does work. Furthermore I haven't got KMilo installed nor is it running. I hope this helps :)

In the mean time assigning shortcuts to the 'Master' channel instead of the global channel option in the menu solved my problem, thanks for the help!
Comment 8 Paul Eggleton 2005-11-13 00:44:06 UTC
1) Control Centre->KDE Components->Service Manager, no KMilo listed.
2) As mentioned, assigning a global shortcut key to an individual channel works fine.
Comment 9 Stephan Binner 2005-11-13 23:09:31 UTC
SVN commit 480242 by binner:

Save configured global shortcuts
CCBUG:113124


 M  +1 -0      kmix.cpp  


--- branches/KDE/3.5/kdemultimedia/kmix/kmix.cpp #480241:480242
@@ -572,6 +572,7 @@
 KMixWindow::configureGlobalShortcuts()
 {
 	KKeyDialog::configure( m_globalAccel, 0, false ) ;
+        m_globalAccel->writeSettings();
         m_globalAccel->updateConnections();
 }
 
Comment 10 Stephan Binner 2005-11-13 23:17:08 UTC
> set up as global shortcuts. Upon upgrading to KDE 3.5 beta 1 these no longer worked.

Dunno why that, I doubt that my patch is responsible for breaking any previously defined channel-specific global shortcut.

> Going into the global shortcut settings in KMix showed that the shortcuts had been cleared

You speak about "Settings/Configure Global Shortcuts..."? These are new shortcuts, they cannot be cleared compared to previous KDE versions.

> so I set them up again; however the keys still didn't do anything.

Maybe the "master channel" has to default to something sensible? Also nothing my patch breaks.

> Interestingly when I closed KMix (which seems to take a few seconds longer than I remember previously) and re-run it, the settings have again been cleared.

That's now fixed.
Comment 11 Stephan Binner 2005-11-14 00:11:14 UTC
Created attachment 13426 [details]
Change first mixer if no master channel is explitely defined

Christian, please comment on the correctness of this patch.
Comment 12 Christian Esken 2005-11-14 11:22:31 UTC
The two parts of the patch:

1) It is good that KMixWindow::configureGlobalShortcuts() uses its own config group. I understood that the control would be saved twice, which would lead to all kinds of serious trouble. So that part is good - I like it.

2) The implementation of KMixWindow::toggleMuted(), KMixWindow::increaseVolume() and KMixWindow::decreaseVolume() is wrong. It only wors with the first sound card. These methods should defintely reuse the functionality from the Mixer class. For example increaseVolume() works like this:

void KMixWindow::increaseVolume() {
Mixer* mixerMaster = Mixer::masterCard();
if ( mixerMaster != 0 ) {
  MixDevice* md = mixerMaster->masterDevice();
  if ( md != 0 ) {
    mixerMaster->increaseVolume(md->num());
  }
}
}

Comment 13 Stephan Binner 2005-11-14 14:21:19 UTC
2) With the patch part you posted the shortcuts don't work for me if you don't have selected a master channel before.
Comment 14 Christian Esken 2005-11-16 12:12:04 UTC
SVN commit 480731 by esken:

Global shortcuts are now saved (this is about the new shortcuts,
available from the KMix main menu). Also global shortcuts now behave
exactly like the DCOP methods by properly re-using the Mixer methods.
BUGS: 113124


 M  +18 -31    kmix.cpp  
 M  +7 -0      mixertoolbox.cpp  


--- branches/KDE/3.5/kdemultimedia/kmix/kmix.cpp #480730:480731
@@ -579,49 +579,36 @@
 void
 KMixWindow::toggleMuted()
 {
-   Mixer* mixerMasterCard = Mixer::masterCard();
-   MixDevice* mdMaster = Mixer::masterCardDevice();
-   if ( mixerMasterCard && mdMaster ) {
-     if ( mdMaster->hasMute() ) {
-       mdMaster->setMuted( !mdMaster->isMuted() );
-       mixerMasterCard->commitVolumeChange(mdMaster);
-     }
+   Mixer* mixerMaster = Mixer::masterCard();
+   if ( mixerMaster != 0 ) {
+      MixDevice* md = mixerMaster->masterDevice();
+      if ( md != 0 && md->hasMute() ) {
+         mixerMaster->toggleMute(md->num());
+      }
    }
 }
 
 void
 KMixWindow::increaseVolume()
 {
-   Mixer* mixerMasterCard = Mixer::masterCard();
-   MixDevice* mdMaster = Mixer::masterCardDevice();
-   if ( mixerMasterCard && mdMaster ) {
-	Volume vol = mdMaster->getVolume();
-	long inc = vol.maxVolume() / 20;
-	if ( inc == 0 )
-		inc = 1;
-	for ( int i = 0; i < vol.count(); i++ ) {
-		long newVal = (vol[i]) + inc;
-		mdMaster->setVolume( i, newVal < vol.maxVolume() ? newVal : vol.maxVolume() );
-	}
-	mixerMasterCard->commitVolumeChange(mdMaster);
+   Mixer* mixerMaster = Mixer::masterCard();
+   if ( mixerMaster != 0 ) {
+      MixDevice* md = mixerMaster->masterDevice();
+      if ( md != 0 ) {
+         mixerMaster->increaseVolume(md->num());
+      }
    }
 }
 
 void
 KMixWindow::decreaseVolume()
 {
-   Mixer* mixerMasterCard = Mixer::masterCard();
-   MixDevice* mdMaster = Mixer::masterCardDevice();
-   if ( mixerMasterCard && mdMaster ) {
-	Volume vol = mdMaster->getVolume();
-	long inc = vol.maxVolume() / 20;
-	if ( inc == 0 )
-		inc = 1;
-	for ( int i = 0; i < vol.count(); i++ ) {
-		long newVal = (vol[i]) - inc;
-		mdMaster->setVolume( i, newVal > 0 ? newVal : 0 );
-	}
-	mixerMasterCard->commitVolumeChange(mdMaster);
+   Mixer* mixerMaster = Mixer::masterCard();
+   if ( mixerMaster != 0 ) {
+      MixDevice* md = mixerMaster->masterDevice();
+      if ( md != 0 ) {
+         mixerMaster->decreaseVolume(md->num());
+      }
    }
 }
 
--- branches/KDE/3.5/kdemultimedia/kmix/mixertoolbox.cpp #480730:480731
@@ -129,6 +129,13 @@
 			primaryKeyOfMixer.replace("=","_");
 			
 			mixer->setID(primaryKeyOfMixer);
+                        if ( Mixer::masterCard() == 0 ) {
+                           // We have no master card yet. This actually only happens when there was
+                           // not one defined in the kmixrc.
+                           // So lets set this here as master card.
+                           Mixer::setMasterCard(primaryKeyOfMixer);
+                        }
+
 		} // valid
 		else
 		{
Comment 15 Elmar Stellnberger (AT/K) 2006-09-18 12:25:08 UTC
Kmix does not accept the special keys on my keyboard built for increasing, decreasing or switching off the volume. Other keys like return are accepted by the input mask.