Revision: 1779
http://svn.sourceforge.net/vexi/?rev=1779&view=rev
Author: clrg
Date: 2007-04-02 02:31:11 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
Non-working mouse wheel implementation in AWT.java
Modified Paths:
--------------
core/trunk/org.vexi.core/src/org/vexi/plat/AWT.java
Modified: core/trunk/org.vexi.core/src/org/vexi/plat/AWT.java
===================================================================
--- core/trunk/org.vexi.core/src/org/vexi/plat/AWT.java 2007-04-02 05:54:39 UTC
(rev 1778)
+++ core/trunk/org.vexi.core/src/org/vexi/plat/AWT.java 2007-04-02 09:31:11 UTC
(rev 1779)
@@ -36,6 +36,8 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.ColorModel;
@@ -317,7 +319,7 @@
protected static class AWTSurface extends Surface.DoubleBufferedSurface
- implements MouseListener, MouseMotionListener, KeyListener,
ComponentListener, WindowListener {
+ implements MouseListener, MouseMotionListener, MouseWheelListener,
KeyListener, ComponentListener, WindowListener {
public void blit(PixelBuffer s, int sx, int sy, int dx, int dy, int
dx2, int dy2) {
discoverInsets();
@@ -442,6 +444,7 @@
window.addKeyListener(this);
window.addComponentListener(this);
window.addMouseMotionListener(this);
+ window.addMouseWheelListener(this);
window.addWindowListener(this);
// IMPORTANT: this must be called before render() to ensure
@@ -453,6 +456,7 @@
public void _dispose() {
window.removeMouseListener(this);
+ window.removeMouseWheelListener(this);
// removed to work around a jdk1.3 bug
/* window.removeKeyListener(this); */
@@ -532,6 +536,11 @@
if (m.getClickCount() == 2)
DoubleClick(modifiersToButtonNumber(m.getModifiers()));
else Click(modifiersToButtonNumber(m.getModifiers()));
}
+ public void mouseWheelMoved(MouseWheelEvent e) {
+ int notches = e.getWheelRotation();
+ // FIXME: take into account WHEEL_BLOCK_SCROLL / WHEEL_UNIT_SCROLL
+ VScroll(notches);
+ }
String translateKey(KeyEvent k) {
switch (k.getKeyCode()) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn