This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Kate: alt now sends keyboard focus to the menubar

Tags: None
(comma "," separated)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I'm using KDE 4 via Arch Linux. kate recently updated to 14.12.1-4, using kf5. However, this has made kate essentially unusable for me.

In the new kate/kf5, if I tap alt and release, keystroke focus moves to the menubar. (In addition, there is no indication that the menubar now has keyboard focus.) Thus, if I then tap "f", the file menu opens. Alternatively, if I tap alt, then enter, the first menu drop-down will also open. This has made it impossible to use kate with my setup.

I suffered from RSI, and thus use an ergonomic keyboard. This works well, but has a very poorly placed alt key. Hence, I must use at-home-modifier. If I hold down the enter key and press another key simultaneously, it acts as an alt modifier. If I tap the enter key briefly, it sends an enter keystroke. However, it first sends a brief alt, before releasing it to send the enter keystroke. This worked fine in the past with almost all applications (with the exception of Firefox's context menu, where the alt would close the menu before I could select an item with enter).

Hence, with the new kate, every time I try to print a newline, my enter key quickly sends an alt first, sending focus to the menu. The enter keystroke then opens the first menu, and the main pane loses focus.

Is there a way to prevent this "feature"?

Arch Linux, kf5, kate 14.12.1-4

Last edited by sparhawk on Thu Jan 29, 2015 3:12 am, edited 1 time in total.
luebking
Karma
0
Try to set the GUI style to "fusion" - it seems the SH_MenuBar_AltKeyNavigation behavior changed. This may be a Qt bug.
Please report whether using the fusion style (application looks slightly different) prevents this behavior.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
luebking wrote:Try to set the GUI style to "fusion"


I'm not sure how to do this. I looked in System Settings and Kate's settings, but couldn't see that option anywhere.

I should also mention that I'm still running KDE 4, and not the full Plasma 5.
luebking
Karma
0
run kate from konsole or the Alt+F2 runner.

Code: Select all
kate --style fusion
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
That had no effect. Previously when I upgraded, the default look had already changed, although I'm not sure if it is "fusion". FWIW this is what Kate looks like. In comparison, Dolphin looks like this.
luebking
Karma
0
That's the fusion style - and I was wrong (my test somehow failed)
Luckily the gtk+ style returns false to that hint, so as a workaround, you should be able to

Code: Select all
kate --style gtk+


I'm pretty sure that this is what you described (once pressing Alt+F or similar, the menubar gets the focus and it's not leaving until you explicitly move it somewhere else) and also have informed the author of the breeze style.

As for the fusion style, I cannot say whether that's intended - but returning false to that hint now behaves as returning true did in Qt4.

I'll push a patch to the virtuality style in a few minutes (in case that should help you ;-)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Thanks for that. I can confirm that `kate --style gtk+` works perfectly. It looks horrific (very spindly font), but it's definitely usable now.

Thanks also for the fixes and informing the relevant author.

I also tried to get a uniform look by installing Oxygen 5 from the Arch repositories. When I ran `kate --style oxygen`, the alt key had the expected behaviour. (FWIW KF5 Oxygen looks horrible too, but I expect this will improve later. I might just have to trial Virtuality instead!)
luebking
Karma
0
The gtk+ style follows the gtk+ theme.
You can use some 3rd party kcm or eg. gtk-chtheme to alter it and download the style of you preference from eg. here:
http://xfce-look.org/index.php?xcontentmode=100

For virtuality you'll require commit 40928cd23fb1bc24a00eb976c7bd38690305fdbe and be warned that it's a rather radical approach ;-)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Grrr… Since oxygen-gtk is now obsolete, I've started investigating other GTK themes that have KDE-theme counterparts, in order to have a unified look for my system. I haven't found many options. One reasonable one is Clearlooks/Cleanlooks. This works quite well as a GTK2/GTK3 theme, but I've come across the problem described in the original post in LyX, when I enable the Cleanlooks KDE theme.

I guess I should report a KDE bug, but I'm not sure what category to file it in. Also, kate is still suffering from the same problem. luebking, you mentioned that you informed the author of the breeze style, but I was wondering if I should post a public bug as well?
luebking
Karma
0
The different interpretation of the stylehint may or maynot be a bug in Qt (not KDE) - I just informed Hugo about that behavioral change and ensured to fix it mayself in virtuality.
Behavior w/ any other style (cleanlooks) is obviously not affected by changes in those styles to prevent unwanted behavior due to this style hint.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
I'm not sure that I understand 100%. Are you saying that the bug is either in the interpretation of this stylehint (i.e. in Qt) or in the style itself (i.e. Cleanlooks)? If it's the latter, then should that be filed in the KDE bugtracker?
luebking
Karma
0
Cleanlooks is a Qt style.

I cannot say where the bug is, all I know is that the interpretation of the stylehint (by QMenuBar) changed between Qt4 and Qt5
That may be either due to a bug or a fix.

The styles are not "buggy" if they set this hint by purpose (that's why such hint exists ;-)
The opinion of the style authors may of course change due to the behavioral change in Qt.
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
Thanks again. I'll file a bug with Qt and post here with a link when I'm done. In the meantime, I've found that Dolphin is now behaving the same way. That is, when I press "Enter" to open a directory or file, it opens the menu instead. This has essentially broken Dolphin for me. I fear that all the KDE applications will soon follow suit. I'd love to find a uniform theme with KDE/Qt and GTK2/3 apps, so I had a look at hacking the code of Cleanlooks myself, similar to your virtuality commit 40928cd23fb1bc24a00eb976c7bd38690305fdbe. However, I couldn't see a similar file or code. Would you know how to hack this theme?

Also, I tried to test other styles in the System Settings, but nothing seems to stick in Dolphin. That is, I can select an alternative style in Application Appearance > Style > Applications > Widget Style, then click Apply, and this will immediately change how Dolphin looks. However, when I quit and restart Dolphin, it will always revert to a previous style.

I'm not sure if it's related, but doing the above changes the System Settings appearance itself, but surprisingly, if I change the GTK2 theme, this also immediately changes the System Settings appearance. This seems strange that both control its appearance.
luebking
Karma
0
Qt5 style selction is a matter of its own. It basically is not possible - unless it is ;-)

export QT_STYLE_OVERRIDE=cleanlooks

Qt5 doesn't ship cleanlooks anymore, so I'd first need to know which sources you fetched.
The default/only stock style is "fusion", file qtbase/src/widgets/styles/qfusionstyle.cpp

You're looking for the "::styleHint" function and either it handles SH_MenuBar_AltKeyNavigation, or you'll have to add that symbol and return false (returns "1" in stock code)
User avatar
sparhawk
Registered Member
Posts
433
Karma
0
OS
luebking wrote:Qt5 style selction is a matter of its own. It basically is not possible - unless it is ;-)

export QT_STYLE_OVERRIDE=cleanlooks

I'm not sure what you mean by this. I tried setting that variable, but I wasn't sure if it was working. I tried a few other more obvious styles, like "CDE" or "cde", but it failed for me.
luebking wrote:Qt5 doesn't ship cleanlooks anymore, so I'd first need to know which sources you fetched.
The default/only stock style is "fusion", file qtbase/src/widgets/styles/qfusionstyle.cpp

You're looking for the "::styleHint" function and either it handles SH_MenuBar_AltKeyNavigation, or you'll have to add that symbol and return false (returns "1" in stock code)

I'm running Arch, and it appears to be in the qt4 package. The following file, which I assume contains the cleanlooks style, was tracked to the qt4 package.
Code: Select all
$ pacman -Qo /usr/include/qt4/Qt/qcleanlooksstyle.h
/usr/include/qt4/Qt/qcleanlooksstyle.h is owned by qt4 4.8.6-5

I downloaded the qt4 source, and patched the code.
Code: Select all
diff -aur qt-everywhere-opensource-src-4.8.6.orig/src/gui/styles/qcleanlooksstyle.cpp qt-everywhere-opensource-src-4.8.6/src/gui/styles/qcleanlooksstyle.cpp
--- qt-everywhere-opensource-src-4.8.6.orig/src/gui/styles/qcleanlooksstyle.cpp   2014-04-11 04:37:12.000000000 +1000
+++ qt-everywhere-opensource-src-4.8.6/src/gui/styles/qcleanlooksstyle.cpp   2015-04-18 14:57:22.658221840 +1000
@@ -4294,6 +4294,9 @@
 {
     int ret = 0;
     switch (hint) {
+    case SH_MenuBar_AltKeyNavigation:
+        ret = false;
+        break;
     case SH_ScrollBar_MiddleClickAbsolutePosition:
         ret = true;
         break;

I then installed it, then restarted. Fortunately, even though Dolphin is stuck in in a particular style, it's cleanlooks, and it works fine. Unfortunately, kate is still broken. I assume that kate is using Qt5, and hence the following file is relevant.
Code: Select all
$ pacman -Qo /usr/include/qt/QtWidgets/5.4.1/QtWidgets/private/qfusionstyle_p.h
/usr/include/qt/QtWidgets/5.4.1/QtWidgets/private/qfusionstyle_p.h is owned by qt5-base 5.4.1-3

I suppose I could patch then build qt5 from source too if necessary…


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]