contextaction (mouse) plugins
Chani
chanika at gmail.com
Sat Jun 6 00:48:39 CEST 2009
here's the beginning of my gsoc project. :)
I've basically copied the wallpaper plugin code to create the ContextAction
plugin. there are two functions that get called: contextEvent and wheelEvent.
right now I'm passing the entire event to the plugin, even though I don't
really want plugins to look at the buttons or modifiers that triggered them.
the event has three position functions and the wheel also has a delta, and I
don't like functions with a lot of parameters.
Containment has gained the setContextAction function in the attached diff
(again I was copying wallpaper code). ContainmentPrivate keeps a QHash of the
loaded plugins; the key is a string representation of the button (and optional
modifiers) that triggers it. when there's a mouse or wheel event, Containment
looks in that hashmap to find the matching plugin (if any). the list of plugins
is saved in the containment's config under [ContextActions] and loaded if it
exists.
there are two plugins I've added to kdebase - one is just a dummy for testing,
and the other is the switch-virtual-desktop plugin I mentioned on my blog.
the code is still rough in places - I haven't written any config UI at all, and
haven't tried to make any plugin itself configurable (I think it'll be annoying
to do that without some UI in place). also, the contextMenuEvent function is
currently eating any rightclicks; dealing with that properly won't be trivial.
still, I figured I'd put my code out here for some initial API review. and if
anyone can come up with a better class name than ContextAction, tell me :)
the full code is available at http://gitorious.org/plasma-mouse-plugins in the
gsoc branch of each repo. attached is just the public API bit.
--
This message brought to you by eevil bananas and the number 3.
www.chani3.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: containment.h.diff
Type: text/x-patch
Size: 855 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090605/97374805/attachment.diff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contextaction.h
Type: text/x-chdr
Size: 9191 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090605/97374805/attachment.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090605/97374805/attachment.sig
More information about the Plasma-devel
mailing list