Am Samstag, den 26.01.2008, 12:02 +0100 schrieb Ulrich von Zadow:
> Frederik Elwert wrote:
> > For a project, we want to use a scroll wheel for user input. I hoped
> > that the MouseEvent would also handle mouse scroll events. As far as I
> > know, X handles scroll-up events as button 4 and scroll down as button
> > 5. But in libavg, the button code is 0 in both cases.

I just did a bit more research: xev shows the following information:

left mb: 1
right mb: 3
middle mb: 2
scroll up: 4
scroll down: 5

SVG 1.2 defines an extra WheelEvent:
http://www.w3.org/TR/SVGMobile12/svgudom.html#events__WheelEvent
It counts the "clicks" the wheel has been rotated, either positive or
negative.

DOM3 defines something similar, MouseWheelEvent:
http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-MouseWheelEvent
It counts a "delta", giving the distance the wheel has been moved.

I don't really understand when these extra events are triggered and how
they count clicks/delta. So I for my part would be satisfied with a
normal MouseEvent showing discrete values for wheel up/down.

> > Also, I have a question regarding the <x>buttonstate properties of the
> > MouseEvent. I had expected that this would be True whenever the
> > according button is pressed. So when I hold the left mouse button and
> > click with the right, I would have expected the MouseEvent of the right
> > click to have leftbuttonstate to be True. But leftbuttonstate is only
> > true for events with button == 1. So are <x>buttonstate properties just
> > another way to express the information held in the button property?

This is more curiosity, maybe I just totally misunderstood how these
properties work.

> Can you send some simple code that reproduces these two issues so I can
> test easily?

Here's the test I used:

----8<----
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import avg

def test(event):
    print event.button, event.leftbuttonstate

testfile = open('test.avg', 'w')
testfile.write('''<?xml version="1.0"?>
<avg width="100" height="100" oncursorup="test" oncursordown="test">
</avg>
''')
testfile.close()

player = avg.Player()
player.loadFile('test.avg')

player.play()

---->8----



-- 
Frederik Elwert, M.A.

Feldstr. 79A
28203 Bremen
0421.277 85 30

ICQ# 255-031-612
JabberID [EMAIL PROTECTED]


_______________________________________________
libavg-users mailing list
[email protected]
https://mail.datenhain.de/mailman/listinfo/libavg-users

Reply via email to