An unexpected journey

Since my last post quite some progress has been made in getting KWin working on top of a Wayland compositor. My main focus of work has been on the input stack. This is something I am not really familiar with as so far we did not have to care about it.

As some might know input handling in X11 is very insecure. Every application is able to listen to every key event. And in the KDE workspaces we obviously make use of these “features”. For example the global shortcut handling is implemented as a kded module listening to all key events and notifying the application via D-Bus that the shortcut got triggered. In a post-X11 world this will not work any more: applications are no longer able to listen to all key events.

One of the important tasks therefore is to not send all input events to the
X-Server but just to the window which should get it, or to handle the input events inside KWin and discard them without passing to the applications. My current branch already supports activating screen edges and using fullscreen effects like Present Windows completely without passing the input events through X. This means that some of the longstanding issues are automatically resolved. We no longer “steal” the screen edges from applications and starting the screen locker should be possible even if present windows is active (not tested and still needs some screen locker support in KWin).

But this also means that features like the global shortcut handling start to break. Mostly because kded is not listening on my virtual X but that’s just detail 😉 So I also had to start working on global shortcut support inside KWin – otherwise I would have had a hard time to use some of the important features like switching desktops or using Alt+Tab. At the moment the latest code only supports KWin’s internal shortcuts, but global support for kglobalacceld will have to follow. We had some ideas on how to improve global shortcut handling in general anyway.

When the infrastructure was in place I couldn’t resist the temptation to work on features which had been requested for a long time and were not really possible to do with X11 (or only with huge hacks): mouse shortcuts. Ctrl+Alt+left click activates desktop cube. But that’s not enough. While sitting in the Kubuntu Developer Summit I added also mouse wheel support which allows us to ctrl+alt+wheel to switch desktops and also to use the zoom effect. This work can be found in branch kwin/global-shortcuts on my personal workspace clone.

I hope that we will soon have a decision on the “what’s master” discussion and I can start merging the changes in. Once this is done I plan to switch focus to the Qt 5 port and concentrate on this for the next few weeks.

Nevertheless this should not be a reason to stop the work on the Wayland efforts. There are so many small things which can be done and lots of low hanging fruit. I will try to setup a trello board with a few tasks, so that interested developers could start picking up some easy tasks and get their hands dirty. Once something is in place I’ll write another post.

28 Replies to “An unexpected journey”

  1. So, if I understand that correct it would also be possible to use mouse shortcuts not just in a global scope, but also for applications?

    What I have in mind would be rocker-gestures one has e.g. in opera or firefox (with the right plugin) for dolphin like “hold right mouse button, click left mouse button” for back and other way around for forward.

    I am also a big fan of “real” mouse gestures, but I guess these one would be more complicated to identify, because one would need to track the pointer movement for some time (although this has to be done anyway for touch devices I guess?).

  2. Hi Martin,

    I can’t really figure it out from your post, but could you explain a bit more on the intention with global shortcuts?

    The way i understand it is that KWin is going to manage those, right?

    But then how would another application register a global shortcut? In which application would they be visible and adjustable? Right now there is the “shortcut manager” in system settings that allows one to manage those settings, but i’m guessing that won’t work anymore in a post X11 era.

    1. The only difference (besides the implementation, of course) is that kded won’t be handling this .. kwin will.

      There is still the question of environments where kwin is no running and the environment does not provide an implementation of global shortcut triggering that we can hook into .. and then kded will likely be relied on again.

  3. Will the transition to Wayland also affect the trackpoint-functionality of Thinkpads? Will its functionality (e.g. scrolling via middle button+trackpoint) be preserved or there even the chance that there will be a settings module for Trackpoints?

  4. Wonderfull! I’m thankfull for this good work!

    One question:
    I recently discovered bug in the gestures handling when using left handed mouse (with swapped keys). I’m wonder if i should report this (i was about to) or keyshortcuts handling is about to get overhauled anyway.

  5. Hi Martin,

    I’m really excited by your progress report. Global shortcut is one of my most favorite feature on KDE. I’m looking forward to seeing a better thing on KDE5. By the way, I hit on an idea about global shortcut. What do you think about having a switchable shortcut subset just like minor mode on Emacs? It will be handy when we switch device type using a single device, e.g. connecting a netbook to a larger display.

  6. It’s great that we are working on features like global shortcuts in 2013! We as a project must love rework.

    1. Fixing issues in the handling of global shortcuts present for 20+ years? Yes, I am glad that we can finally address those

  7. Hi Martin, I’m not sure if it’s related to input handling, but does it mean there is a chance for KDE supporting multi-touchpads (like switching desktops with a three finger slide gesture) some day? That would just be AWESOME!

  8. Does this change involve being able to use modifier keys on its own? Like hitting superkey to launch krunner (or any application launcher, like in windows or unity; i am using ksuperkey currently to get this behavior)
    Anyway, thanks for the awesome news 🙂

  9. This is the reason i do believe KDE should take an unexpected journey and support both Wayland and Mir/XMir right from the start:

    http://blogs.linux.ie/caolan/2013/07/19/gnome3-app-menu-integration/

    It will make KDE better on the long run and there will be stronger influence in both ways this way. I would comment this under appropriate blog post but comments are disabled there and i think this is good example how controversy back then proved wrong and now GNOME and Unity are generally speaking better and i don’t see how could KDE be worse if it would work on 2 different FOSS display servers/protocols that will try to challenge Xorg/X11 and hopefully improve things for the better.

    1. I hope you realize that this is totally offtopic to my blog post. I will not tolerate this on my blog post. In future I will just delete your comments. If you want Mir support in KDE than do it – the code is open. End of discussion

      1. Yes i would post it under another blog post but the comments there are disabled. You don’t have to do anything i agree but example given does speak for it self and some slack should be given to Canonical to try their thing.

        Supporting both efforts to replace Xorg/X11 does make sense and if Apple or Microsoft would make it easier for KDE to run on their platform i doubt this would not be done. And i think it’s not fair to compare Canonical to those two companies Canonical still is FOSS vendor and being actively involved could make KDE and Canonical better in the future instead of having some artificial barrier and acting like “non friends”.

        1. there’s a reason that all other blog posts are closed. I am seriously annoyed by the topic and don’t want to talk about it any more. I have been on the recieving side of hate mail enough for a life time. I do not want to have anything to do with Mir. So commenting on my blog about Mir means that my motivations to have anything to do with it goes even further down. If you want it: work on it, but don’t annoy me.

          1. Yes i agree Canonical mismanagement this badly and because of that a lot of “hate” was generated but i still do believe it was not done because Canonical is “evil” ATM but because probably they want to do too much too soon and in this heat the outcome was badly mismanagement concerning inviting in broader community. I think this will settle down when they make a dent in mobile market space and convergence strategy starts to take shape.

            I see it more like that foolish fights going on inside families that generally speaking love each other. It’s up to Canonical to fix this broken relationship i agree on that or at least to take honest and meaningful first steps.

            Said that i do believe on the long run because this family members still have to live together it makes sense to be pragmatic and on technical level to work together. I do see potential being actively involved in technical development of Wayland and Mir/XMir will make things better in the long run. Who knows when Wayland protocol matures Mir might gain support and Wayland protocol could mature faster in some areas influenced by Mir? Why not?

            Haters would get their mouth shut if Phoronix would post something like KDE fully committed to both Wayland and Mir/Xmir? What i am trying to say is it’s still FOSS and this “artificial hate” will go away by itself and be superseded by benefits FOSS brings to each interesting family members on the long run.

            1. Just stop it, please. Don’t annoy me, you make the situation worse, not better.

              1. Not true. On the long run you will see what i wrote made sense.

                Said that i agree this broken relationship will need time to heal and no need to push it hard ATM it’s probably best if involved parties take some time for themselves and then to find each other somewhere in the future on common path again. But in this time between there is no reason why on technical level things shouldn’t evolve just like they always had in FOSS ecosystem.

                1. If I tell you that I am so fed up about the complete situation that I don’t want to hear anything about Mir for at least half a year, than please respect it.

                  So yes it is true. If you continue to write about it and with this annoy me (yes anything about Mir is annoying to me given the hate I got – including Canonical employees) my motivation goes further down.

                  If you think Kubuntu needs Mir, then I give you some good advices:
                  1. leave me alone.
                  2. don’t post as “Mir server”
                  3. work on it.

                  1. Yes half a year is reasonable time frame…

                    About point 1 i don’t agree because on the long run it doesn’t make sense to exclude the most competent individuals out of the process. I am not speaking in behalf of Canonical but as individual FOSS user and yes i agree Canonical did mismanage this completely and will need to do this differently in the future.

                    About point 2 fair enough for let’s say half a year? 😉

                    About point 3 i guess Canonical should do that (not only on technical level) and until we see what they got maybe to give the some slack. It wouldn’t necessarily be a bad thing if they manage to pull it off? And if both sides can at least tolerate each other that might end up in having better Wayland, Mir/XMir, KDE… I don’t know to be honest how it will end up but this “artificial hate barrier” doesn’t benefit anybody in my opinion. Maybe (extreme) fanboys and haters but who really cares about them? I don’t.

Comments are closed.