Fwd: [Bug 34362] mouse button support

Charles Samuels charles at kde.org
Fri Dec 27 00:21:02 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 26 December 2002 3:43, Ralf Nolden wrote:
> On Donnerstag, 26. Dezember 2002 18:56, Charles Samuels wrote:
> > I wrote once an app that would bind it to commands (in my case, dcop
> > noatun Noatun forward... ;).
> >
> > I think it belongs in KAction, i.e., shouldn't be any different than
> > keyboard shortcuts.  At least it's the most versatile way, as we already
> > have the infrastructure.
> >
> > I'm not volunteering ;)
>
> so, does your app volunteer ? .-)

You'll have to ask its agent ;)

It's just a XGrabButton call.

Then you take the KApplication::x11Event function to pick it up and WHAM, 
global Events.  I think by binding it to an entire Konqueror window, change 
the RootWindow(..) call to topLevelWindow->handle().


    Display *dpy = XOpenDisplay(0);

    XGrabButton(dpy, 5, AnyModifier, RootWindow(dpy, 0), True, ButtonPress, 
GrabModeAsync, GrabModeAsync, None, None);
    XGrabButton(dpy, 6, AnyModifier, RootWindow(dpy, 0), True, ButtonPress, 
GrabModeAsync, GrabModeAsync, None, None);

    while (1)
    {
        XEvent e;
        XNextEvent(dpy, &e);

        switch (e.xbutton.button)
        {
        case 5:
            {
                string command="dcop `dcop | grep noatun` Noatun back";
                system(command.c_str());
                break;
            }
        case 6:
            {
                string command="dcop `dcop | grep noatun` Noatun forward";
                system(command.c_str());
                break;
            }
        }
    }





- -- 
Charles Samuels <charles at kde.org>
Windows NT: Designed for the Internet
The Internet: Designed for Unix
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+C5zyWS4Pv66UcxkRAna6AKCJuCL/82NJBNGm1qzJ3p1/0dq4oACgxCAL
Pyl3fIn66BY91eG1XzF1gM8=
=6oQT
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list