Bug 257900 - XF86Calculator key doesn't work as trigger
Summary: XF86Calculator key doesn't work as trigger
Status: RESOLVED FIXED
Alias: None
Product: khotkeys
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.10.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Jansen
URL:
Keywords:
: 263109 283249 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-25 18:31 UTC by Stephen Baker
Modified: 2024-01-30 18:10 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.1
Sentry Crash Report:


Attachments
This patch fix the bug (521 bytes, patch)
2012-02-25 21:12 UTC, Leonardo
Details
qt-gui-4.8.2-calculator-key.patch (1.53 KB, patch)
2012-08-09 14:31 UTC, Matthew Schultz
Details
qt-gui-4.8.2-calculator-key.patch (839 bytes, patch)
2012-08-09 15:58 UTC, Matthew Schultz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Baker 2010-11-25 18:31:05 UTC
Version:           unspecified (using KDE 4.5.3) 
OS:                Linux

I have been trying to use the calculator key on my Microsoft Multimedia Pro keyboard to launch kcalc.  I tried setting it up as a global shortcut under custom actions, and through the edit menu dialog.

When I press the Calculator button it is registered in the trigger as Launch(1) but after clicking apply it doesn't have any effect.  Using another shortcut like Meta+c works as expected.

xev for that key shows the following:

KeyPress event, serial 34, synthetic NO, window 0x5000001,
    root 0x107, subw 0x0, time 13592514, (763,758), root:(766,781),
    state 0x0, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False



Reproducible: Always

Steps to Reproduce:
Right click K-menu and choose Menu Editor
Click on the KCalc entry
Click Advanced
Click the button beside Current Shortcut Key
Press the Calculator key (Launch(1) will show up on the button)
Click save settings
Press the calculator key

Actual Results:  
Nothing

Expected Results:  
KCalc should open
Comment 1 Philipp Woelfel 2011-01-01 09:31:28 UTC
I can confirm this on KDE 4.5.4., OpenSuSE 11.3 packages, with a Microsoft Natural Ergonomic Keyboard 4000.

A workaround as posted at http://forum.kde.org/viewtopic.php?f=17&t=89602 works for me: In khotkeysrc and kglobalshortcutsrc I replaced the occurrences of "Launch (1)" with "Calculator" (while not logged into KDE). After that the calculator key starts the program assigned to it.
Comment 2 Philipp Woelfel 2011-01-01 09:34:47 UTC
Bug 255329 is a duplicate of this one...
Comment 3 Andrew M 2011-05-26 09:45:16 UTC
I would like to confirm this problem in both KDE 4.5.5 on Ubuntu and 4.6.3 on Arch.

If you do the config file hack to force it manually, the menu editor correctly displays "Calculator" as the hot key. If you then try to set it by pressing the calculator key it sets it to Launch(1). Launch(1) is actually a generic hot key sometimes found as Fn+F2/F3 on laptops.

I have tried this on Microsoft Digital Media keyboard 1.0a and Wireless desktop 1000. Until someone says otherwise I think it's safe to assume that it effects all MS keyboards with the calculator key.
Comment 4 Andrew M 2011-09-26 09:42:47 UTC
Still effects KDE 4.7.1

Can this please be marked as confirmed? It should effect any user with a Microsoft keyboard.
Comment 5 Matteo Agostinelli 2011-10-03 14:56:28 UTC
*** Bug 283249 has been marked as a duplicate of this bug. ***
Comment 6 sendel 2011-12-15 06:07:30 UTC
in KDE 4.7.1 still, with Logitech Internet Keyboard
Comment 7 motosauro 2012-02-13 16:00:25 UTC
Absolutely confirmed
I'm on Gentoo, KDE 4.7.4
and the problem is still there:
khotkeys stubbornly thinks that the calculator key on all of my keyboards is the "Launch (1)" key
I used a Microsoft ComfortCurve2000, a Logitech k750 and a Logitech k710 all with the same result, so I'm pretty sure it's not hardware related
All other multimedia Keys work as expected

xev reports this:
KeyPress event, serial 35, synthetic NO, window 0x6e00001,
    root 0x15d, subw 0x6e00002, time 133413435, (63,62), root:(1801,93),
    state 0x10, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 35, synthetic NO, window 0x6e00001,
    root 0x15d, subw 0x6e00002, time 133413535, (63,62), root:(1801,93),
    state 0x10, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
Comment 8 motosauro 2012-02-13 16:11:30 UTC
(In reply to comment #7)
> Absolutely confirmed
> I'm on Gentoo, KDE 4.7.4
> and the problem is still there:
> khotkeys stubbornly thinks that the calculator key on all of my keyboards is
> the "Launch (1)" key
cut ...

Forgot to mention that for me too manually changing "Launch (1)" with "Calculator" in both .kde4/share/config/khotkeysrc and .kde4/share/config/kglobalshortcutsrc fixes the problem
Comment 9 Christoph Feck 2012-02-18 14:05:12 UTC
*** Bug 263109 has been marked as a duplicate of this bug. ***
Comment 10 Leonardo 2012-02-25 21:12:00 UTC
Created attachment 69094 [details]
This patch fix the bug

This patch fix the bug
Comment 11 Leonardo 2012-02-26 10:13:39 UTC
Comment on attachment 69094 [details]
This patch fix the bug

>--- kdelibs-4.8.0/kdeui/util/kkeyserver_x11.cpp	2012-02-25 18:53:49.480771132 -0200
>+++ kkeyserver_x11.cpp	2012-02-25 18:20:38.912403430 -0200
>@@ -355,7 +355,7 @@
>     { Qt::Key_MediaRecord, XF86XK_AudioRecord },
>     { Qt::Key_LaunchMail, XF86XK_Mail },
>     { Qt::Key_Launch0,    XF86XK_MyComputer },
>-    { Qt::Key_Calculator,    XF86XK_Calculator },
>+    { Qt::Key_Launch1,    XF86XK_Calculator },
>     { Qt::Key_Memo,    XF86XK_Memo },
>     { Qt::Key_ToDoList,    XF86XK_ToDoList },
>     { Qt::Key_Calendar,    XF86XK_Calendar },
Comment 12 Jesus 2012-08-07 10:32:27 UTC
KDE 4.9, the bug is still there. It's boring to patch every new version to get the calc key working.
Comment 13 David Faure 2012-08-09 11:12:33 UTC
This looks like a workaround to me. Does this mean Qt handles Qt::Key_Calculator badly?

I grepped qt4 src/gui and I see no difference between Key_Calculator and Key_Launch1, on X11. They are both in qkeymapper_x11.cpp and in qkeysequence.cpp

Ah, but qkeymapper_x11.cpp maps XF86XK_Calculator to both!

Isn't the right fix to remove the line 1066, which says
  XF86XK_Calculator,          Qt::Key_Launch1,
?
Comment 14 Matthew Schultz 2012-08-09 13:17:55 UTC
(In reply to comment #13)
> This looks like a workaround to me. Does this mean Qt handles
> Qt::Key_Calculator badly?
> 
> I grepped qt4 src/gui and I see no difference between Key_Calculator and
> Key_Launch1, on X11. They are both in qkeymapper_x11.cpp and in
> qkeysequence.cpp
> 
> Ah, but qkeymapper_x11.cpp maps XF86XK_Calculator to both!
> 
> Isn't the right fix to remove the line 1066, which says
>   XF86XK_Calculator,          Qt::Key_Launch1,
> ?

I looked at the source as well for qt-gui.  I saw the two mappings but did you also notice that the second one has calculator misspelled as calculater?  It might be better to shift a few lines around instead of deleting the properly spelled one so the properly spelled one is maintained and the misspelled one is deleted -- XF86XK_Calculator being the proper spelling and not XF86XK_Calculater.  I'll try testing it to see if that would work.
Comment 15 Matthew Schultz 2012-08-09 14:31:43 UTC
Created attachment 73062 [details]
qt-gui-4.8.2-calculator-key.patch

I just confirmed that patching qt-gui works without needing to patch kdelibs.  It seems like the qt guys even know that some of the key shortcuts are screwed up as well? (// ### Qt 5: remap properly)  I wonder if this calculator key bug has also been fixed in qt 5.
Comment 16 Matthew Schultz 2012-08-09 15:35:19 UTC
Although this qt patch fixes the problem, I wonder what the purpose of the misspelled calculator constant is for.  These constants in qt were pulled from XF86keysym.h from the x11proto package.  The misspelled "XF86XK_Calculater" constant which has a different hex value from "XF86XK_Calculator" originated in xfree86 XF86keysym.h revision 1.13 on 11/22/2002:  

522. Added support for special keys found on many ACPI control, Easy Access
      Keyboards, Internet keyboards, laptops, notebooks and PDA (via
      xkb/symbols/inet). Added new key symbols for these keyboards
      (Stanislav Brabec).

Before that commit, XF86XK_Calculator was the only one that existed.  

In revision 1.12, the keysym for XF86XK_Calculator was 0x1008FF1D.  This is the same symbol that my keyword uses (Microsoft Natural Keyboard 4000).  In revision 1.13 that keysym did not change while XF86XK_Calculater was added with a keysym of 0x1008FF54.  Strangely enough, the comments for XF86XK_Calculator note that the developer thinks they only apply to PDAs like Pocket PC and Palm while the other keysym 0x1008FF54 applies to "internet keyboards" which is what I guess my keyboard is.  I wonder if there are keyboards out there that register the calculator key as 0x1008FF54 instead of 0x1008FF1D as my keyboard does (you can test this with the xev program and looking at the keysym your calculator key emits).   In that case, my patch for qt-gui would not work for everyone.  I'm thinking that maybe Qt::Key_Calculator should be applied to both the misspelled constant and the correctly spelled one instead.
Comment 17 Matthew Schultz 2012-08-09 15:58:48 UTC
Created attachment 73065 [details]
qt-gui-4.8.2-calculator-key.patch

I just tested my theory and that appears to work.  This patch would work for both types of keyboards that register the calculator key as 0x1008FF1D or 0x1008FF54.
Comment 18 Matthew Schultz 2012-08-09 17:27:11 UTC
I just examined qt 5 alpha and unfortunately, it appears as though nothing as changed in qt 5 alpha in regards to this bug or any changes to the mapping of keys (file changed to qxcbkeyboard.cpp in qt 5) as indicated in that qt comment.  Perhaps this patch can be pushed to the qt developers so they can patch qt 4 and 5.
Comment 19 Matthew Schultz 2012-08-09 17:45:30 UTC
I created a ticket on the qt tracker as well if anyone is interested: https://bugreports.qt-project.org/browse/QTBUG-26812
Comment 20 David Faure 2012-08-10 10:34:41 UTC
Thanks for your work on this. Unfortunately, for legal reasons, *you* have to be the one to push the patch to Qt5, and then to Qt4, via gerrit (http://codereview.qt-project.org).
Well, ok it's a one-liner, I guess it could be considered trivial enough for anyone to apply it.
But since I can't even test it, I'd rather not do that myself :-)
In any case, the first step is to make a Qt5 patch (Qt contribution rules require a Qt5 fix before a Qt4 fix, so that no fix for 4 is forgotten in 5)
Comment 21 Matthew Schultz 2012-08-10 13:52:41 UTC
(In reply to comment #20)
> Thanks for your work on this. Unfortunately, for legal reasons, *you* have
> to be the one to push the patch to Qt5, and then to Qt4, via gerrit
> (http://codereview.qt-project.org).
> Well, ok it's a one-liner, I guess it could be considered trivial enough for
> anyone to apply it.
> But since I can't even test it, I'd rather not do that myself :-)
> In any case, the first step is to make a Qt5 patch (Qt contribution rules
> require a Qt5 fix before a Qt4 fix, so that no fix for 4 is forgotten in 5)

I don't mind submitting the patch myself but I'm not sure how to sign up for an account and post to https://codereview.qt-project.org
Comment 22 Matthew Schultz 2012-08-10 14:07:26 UTC
(In reply to comment #21)
> (In reply to comment #20)
> > Thanks for your work on this. Unfortunately, for legal reasons, *you* have
> > to be the one to push the patch to Qt5, and then to Qt4, via gerrit
> > (http://codereview.qt-project.org).
> > Well, ok it's a one-liner, I guess it could be considered trivial enough for
> > anyone to apply it.
> > But since I can't even test it, I'd rather not do that myself :-)
> > In any case, the first step is to make a Qt5 patch (Qt contribution rules
> > require a Qt5 fix before a Qt4 fix, so that no fix for 4 is forgotten in 5)
> 
> I don't mind submitting the patch myself but I'm not sure how to sign up for
> an account and post to https://codereview.qt-project.org

nm, I found the wiki on how to do it.
Comment 23 Leonardo 2012-08-12 11:51:41 UTC
Well, I think that patching the kdelibs is the most correct approach, because, according to http://qt-project.org/doc/qt-4.8/qt.html, Qt::Key_Calculator is not mapped on X11 and Qt::Key_Launch1 must be used instead. Anyway, even if the problem is with Qt, your path probably will not be accept, because, as stated in https://bugreports.qt-project.org/browse/QTBUG-25118 Qt5 is meant to have minimum source incompatibility. Therefore, I think this patch must be accept in kdelibs as soon as possible, because, as said before, is indeed annoying have to patch every new version to have the calculator key working.
Comment 24 Matthew Schultz 2012-08-13 12:40:16 UTC
Leonardo is right.  It would likely take a while for Qt to apply this patch, it's better to patch kdelibs now than to wait for the change to come through Qt assuming they agree to change it.
Comment 25 David Faure 2012-08-17 17:38:28 UTC
What a mess, between the typo in the X headers and the full documentation of these quirks in the Qt API docs -- I had no idea the use of Launch1 was fully documented in Qt :-)

OK then, I'll apply the kdelibs fix.

Thanks for all the investigations.
Comment 26 David Faure 2012-08-17 17:41:47 UTC
Git commit 1c7ae18ef5d1b7adbb271c1164d0d899eb6d4ed8 by David Faure.
Committed on 17/08/2012 at 19:41.
Pushed by dfaure into branch 'KDE/4.9'.

Fix handling of XF86Calculator, patch by "Leonardo".

Full investigation details in the bug report.
FIXED-IN: 4.9.1

M  +3    -1    kdeui/util/kkeyserver_x11.cpp

http://commits.kde.org/kdelibs/1c7ae18ef5d1b7adbb271c1164d0d899eb6d4ed8
Comment 27 Ian Turner 2012-10-07 23:49:49 UTC
I'm actually still seeing this issue in 4.9.2.
Comment 28 Jesus 2012-10-08 00:48:02 UTC
It's working for me since 4.9.1 Ian.
Comment 29 Ian Turner 2012-10-08 01:04:26 UTC
Looks like I did not have the shortcut key set. Following Stephen's steps in the bug description, I see that the calculator key now works.
Comment 30 Janek Bevendorff 2012-12-08 12:54:51 UTC
Bug still present in 4.9.90. Is this a regression?
I did not re-check in 4.9.1 since I already applied the workaround from the forums several versions ago.
From my perspective I would say this was never fixed, but if it actually was in 4.9.1, then it seems to be back in 4.10.

xev correctly outputs:

KeyRelease event, serial 36, synthetic NO, window 0x4000001,
    root 0x135, subw 0x0, time 10647210, (561,-616), root:(563,226),
    state 0x10, keycode 148 (keysym 0x1008ff1d, XF86Calculator), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

but when setting a shortcut I still get "Launch (1)" instead of "Calculator".
Comment 31 Ian Turner 2012-12-08 13:38:14 UTC
This WORKSFORME using KDE 4.9.2 on Ubuntu 12.04.1, however it requests root privileges for kcalc (I guess that's a different issue...)
Comment 32 Stephen Baker 2013-02-09 04:28:11 UTC
Still works for me in 4.9.5 and 4.10 on ArchLinux.  The shortcut trigger still says Launch(1), however the fix made pressing the calculator key work to trigger the event anyway.
Comment 33 Janek Bevendorff 2013-02-09 09:40:28 UTC
That's right, but it's still confusing that it says "Launch (1)". It should really display "Calculator". I wouldn't consider this issue fully fixed until then.
Comment 34 Leonardo 2013-02-09 13:27:43 UTC
No, "Launch (1)" is how Qt handle this key. If you check the link that I posted before you'll see that       Qt::Key_Calculator is not mapped in X11 and you must use Qt::Key_Launch1 instead. If you still want it to display "Calculator" please open a ticket on Qt tracker since I don't think that this is a job to KDE do.
Comment 35 David Edmundson 2014-10-24 11:08:12 UTC
Tested on Qt5. Things seem to work for me.