So today I sat down and went to work on panel autohiding. Short story: you can now hide your panels. Feel free to do a little dance, make a little love. You know the drill.
Longer story:
In KDE3 kicker had two really annoying attributes when it came to panel hiding: it polled for the mouse cursor and it actually moved the whole top level window around on screen. "So what?" you say.
Well, the polling meant that whenever a panel was autohidden, kicker would wake up 10 times a second and ask the window system, "Hey, where's the cursor now?" If it was along any edge or corner, it would emit a signal that hidden panels would be listening to. Not only was this mildly inefficient just due to the polling and what not, it meant that when kicker wasn't on your screen it was (ironically) waking up your CPU a lot. Not great for power consumption, but hey, at least it was all the way off the screen right?
Moving the actual window around was a problem because moving a window isn't exactly cheap. It's less expensive than resizing the window, though: that involves allocating a new buffer for the new size of the window, blitting the contents into that and then freeing the old buffer. So instead of resizing, kicker moved the window. Not perfect, but reasonably efficient enough that it works even on low end systems. All is great .. until you put more than one screen on your computer and a panel "in between" them. Then when the window moved off of one screen (pretending to hide) it would just move onto the other one. Whoops!
So I took a completely different approach with Plasma. Now we move the contents inside the panel window to animate hiding, which means it works even on multiscreen systems, and we use something called an "input only window" to trigger the unhide. An input only window doesn't paint anything to screen, but does let us get input events. When a panel hides, we create a teeny tiny little input only window and when we get an enter event, pop goes the panel. Voila, no more polling and therefore no more waking up the CPU ten times a second.
Now the bad news:
If you don't have a compositing window manager you don't get any animations. The panel just appears and disappears. This is because to do the move-the-contents trick and make it look convincing, the panel window background needs to be transparent and we have a policy in Plasma: no stupid tricks like fake transparency. If you want bling, you need to use the right tools.
I also haven't done the configuration UI for this feature yet, but it'll be there soon so those of you using KDE from trunk don't need to fiddle with your configuration files.
There's also a problem I've run into with some "interesting" optimizations that QAbstractScrollArea makes in painting that results in some white-blink. I may have to make some minor alterations to get it to work exactly the way I want.
I also haven't implemented "prevent hiding when a menu or something else like that is showing". So if you pop up, say, the kickoff menu the panel will hide when you go over it. It's not a big deal, and I'll fix this tomorrow along with some of the other rough edges.
Oh, I also implemented the windows-can-cover-the-panel option. Ta-da.
Friday, August 22, 2008
Subscribe to:
Post Comments (Atom)

19 comments:
Now what the hell am I supposed to complain about?
so, all the people that say BS about kde4 now can say that kde4 is perfect and aseigo can rest in peace, why??, because the panel size can be changed and autohide. Talk is so easy.
Good to se news about kde4.2 dev.
Great!!!
Thanks a lot Aaron for this.
Windows covering panels?
Autohide?
OMG! Thank you!!!
I just want to give you the following valuable input since nobody is taking me serious on kde-devel and i dont think you can do without:
* Plasma is vapourware
* ..at any rate its all about clocks.
* The panel cannot be resized.
* KDE should just have been ported to qt4 with no new features. clearly it will never be stable.
* KDE4 changes should be backported to qt3, kde4 dropped. i know this because i once had a pirated copy of borland VB.
* Everything is black and cannot be themed.
* Oxygen has to little contrast
* Why are there no desktop icons?!
* oh there is... why do they have those small icons around them?
* Those frames that you can display any random folder local or whatever based is lame because its... in a frame!!!
* I dont want to understand the concept of full screen containments.
* konquer was a great app but now its ruined and will never be functional again.
* Konquer is missing some special treeview thing or whatever, clearly this will *never* be implemented given only 20-odd features have been added the last two months.
* the panel cannot autohide.
* uhm...
* THE CASHEW! IT JUST SIT THERE AND STARE!!!! TOTALLY RUINS MY DAY!!!!
Sincerely,
A Troll.
Seriously. Remember back when all you had to do to troll was to bitch that plasma was all vapourware?
There should really be a brainstorm-for-trolls post on the dot so the trolls could get together and figure out new topics to be trollish about and talk about leaving for gnome. Panel autohiding seemed to be the last stand. Congratulations for all the amazing work.
thank you for "we have a policy in Plasma: no stupid tricks"
I just can't understand a thing with transparencies, Aaron. Why there are transparencies that actually work without composite? Look at plasmoids rounded borders, or QT4 demos in which widgets ARE transparents.
What's the difference?
@ anothersysadmin: this is because plasmoids are not windows. Windows can't have transparency (that would require compositing), but widgets within one app can. See how the runner dialog has these white borders, as does the clock popup - and neither have transparency.
Wow, coding gods at work.
Now only Xorg has to get some major work done ( Vsync, kernelmodesetting, multimonitor setup, Open Source 3D etc) and Linux will be perfect ;)
KDE already seems to be.
Thanks!
Great! Finally, I don't have to listen to "GIMME AN AUTOHYDE PANLE NAOW!".
Personally, I don't use auto-hide panels (too annoying), but those who do will love this.
"@ anothersysadmin: this is because plasmoids are not windows. Windows can't have transparency (that would require compositing), but widgets within one app can. See how the runner dialog has these white borders, as does the clock popup - and neither have transparency."
Does this mean that KWin with Compositing is required or just an OpenGL implementation running? I'm not too sure if my Radeon Mobility 9600 would be able to cope with composited KWin's demands. That said Gnome with Beryl/Compiz works wonderfully (I'm not Gnome's biggest fan but the effects and window management are very smooth) but then again KWin runs like a dog on my Geforce 4 but compiz runs a treat. Could it be time for an upgrade, its just the moths in my wallet don't like to be disturbed...
Keep up the excellent work.
KDE rocks.
@behavedave: only the animation requires a compositing window manager. you can use any compositer, actually, including kwin, compiz, metacity, xcompmgr, etc.
is this similar to yakuake appearance animation effect?
yakuake's implementation sucks when kwin compositing is enabled. you know all the details, so it would be easy for you to implement yakuake's appearance effect in opengl, right?
I've found out that my problem with KWin running slower/choppier than Beryl/Compiz is that it spanks the CPU pretty hard in kind of stays at 18% for a couple of seconds then goes to 87% and above for 10 seconds and repeats this over and over (figures are estimates - your mileage may vary). This part is the mystery though, when I turn on the snow effect CPU usage drops to 4% and less! How very random - it might be the Kubuntu packages from Riddell I am using.
@behavedave: Could you be running into this? http://labs.trolltech.com/blogs/2008/08/22/rant-desktop-effects-never-more/
"At least one good thing came out of this ordeal: I found out why kwin consumes so much CPU. If you’re affected by this problem, turn glib support off in Qt. (export QT_NO_GLIB=1 before KDE is started, or compile Qt with the -no-glib option)"
Fiat
Ta DUH!
I will be dancing when this stuff *actually* works. Now it still has serious bugs and it is Alpha quality and unstable.
"the windows-can-cover-the-panel option" doesn't work. I moved the existhing default Panel to the top of the screen and enabled auto-hide. It seems to be 'permanent hide' since it doesn't unhide.
Making a new Panel for the top of the screen worked better. Auto-hide works, but the gray flash when it unhides is annoying.
Default bottom panel is interesting. Auto-hide results in the contents auto hiding but the blank panel doesn't go away.
> Now it still has serious bugs and it is
> Alpha quality and unstable.
well .. yes .. it's a new feature that is still being worked on. i put an hour or two into it each week at this point, so it should be ready well in advance of the 4.2 feature freeze.
Post a Comment