[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob/org/nongnu/libvob Binder.java impl/awt/A...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob/org/nongnu/libvob Binder.java impl/awt/A... |
Date: |
Sat, 02 Aug 2003 03:42:45 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/08/02 03:42:45
Modified files:
org/nongnu/libvob: Binder.java
org/nongnu/libvob/impl/awt: AWTScreen.java
org/nongnu/libvob/impl/gl: GLScreen.java
Added files:
org/nongnu/libvob: VobMouseEvent.java
Log message:
Tests pass for new mouse event code. It may not work, though
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/VobMouseEvent.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/Binder.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/awt/AWTScreen.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLScreen.java.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: libvob/org/nongnu/libvob/Binder.java
diff -u libvob/org/nongnu/libvob/Binder.java:1.2
libvob/org/nongnu/libvob/Binder.java:1.3
--- libvob/org/nongnu/libvob/Binder.java:1.2 Fri Mar 7 06:38:19 2003
+++ libvob/org/nongnu/libvob/Binder.java Sat Aug 2 03:42:44 2003
@@ -26,7 +26,6 @@
package org.nongnu.libvob;
import java.util.*;
import java.io.*;
-import java.awt.event.MouseEvent;
/** An interface for receiving keystrokes and mouse events.
* One binder is usually associated with each window.
@@ -37,7 +36,7 @@
void keystroke(String s);
/** A mouse event.
*/
- void mouse(MouseEvent e);
+ void mouse(VobMouseEvent e);
/** Set the Screen this Binder is connected to. To be used
* only in Screen.Screen().
Index: libvob/org/nongnu/libvob/impl/awt/AWTScreen.java
diff -u libvob/org/nongnu/libvob/impl/awt/AWTScreen.java:1.8
libvob/org/nongnu/libvob/impl/awt/AWTScreen.java:1.9
--- libvob/org/nongnu/libvob/impl/awt/AWTScreen.java:1.8 Fri May 16
07:02:41 2003
+++ libvob/org/nongnu/libvob/impl/awt/AWTScreen.java Sat Aug 2 03:42:44 2003
@@ -37,7 +37,7 @@
public abstract class AWTScreen
extends GraphicsAPI.AbstractWindow
implements MouseListener, MouseMotionListener,
JUpdateManager.EventProcessor {
- public static final String rcsid = "$Id: AWTScreen.java,v 1.8 2003/05/16
11:02:41 humppake Exp $";
+ public static final String rcsid = "$Id: AWTScreen.java,v 1.9 2003/08/02
07:42:44 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.out.println(s); }
@@ -237,8 +237,27 @@
}
} else if(e instanceof MouseEvent) {
MouseEvent me = (MouseEvent) e;
+ int vet = 0;
+ int veb = 0;
+ // XXX MOUSE WHEEL NOT HANDLED
+ switch(me.getID()) {
+ case MouseEvent.MOUSE_PRESSED: vet =
VobMouseEvent.MOUSE_PRESSED; break;
+ case MouseEvent.MOUSE_RELEASED: vet =
VobMouseEvent.MOUSE_RELEASED; break;
+ case MouseEvent.MOUSE_CLICKED: vet =
VobMouseEvent.MOUSE_CLICKED; break;
+ case MouseEvent.MOUSE_DRAGGED: vet =
VobMouseEvent.MOUSE_DRAGGED; break;
+ }
+ switch(me.getButton()) {
+ case MouseEvent.BUTTON1: veb = 1; break;
+ case MouseEvent.BUTTON2: veb = 2; break;
+ case MouseEvent.BUTTON3: veb = 3; break;
+ }
+ if(vet == 0 || veb == 0) throw new Error("Event Type!");
- binder.mouse(me);
+ // XXX MODIFIERS NOT HANDLED
+ binder.mouse(
+ new VobMouseEvent(
+ vet, me.getX(), me.getY(), 0, 0, veb
+ ));
}
}
Index: libvob/org/nongnu/libvob/impl/gl/GLScreen.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.6
libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.7
--- libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.6 Fri May 23 16:48:49 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLScreen.java Sat Aug 2 03:42:45 2003
@@ -37,22 +37,13 @@
import org.nongnu.libvob.gl.*;
public class GLScreen extends GLRenderingSurface implements GraphicsAPI.Window
{
-public static final String rcsid = "$Id: GLScreen.java,v 1.6 2003/05/23
20:48:49 mudyc Exp $";
+public static final String rcsid = "$Id: GLScreen.java,v 1.7 2003/08/02
07:42:45 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.out.println("GLScreen:: " + s); }
java.awt.Canvas fakeSource = new java.awt.Canvas();
HashMap timeouts = new HashMap();
-
- static int mapButton(int button) {
- switch(button) {
- case 1 : return InputEvent.BUTTON1_MASK;
- case 2 : return InputEvent.BUTTON2_MASK;
- case 3 : return InputEvent.BUTTON3_MASK;
- }
- return 0;
- }
class GLEventHandler implements GL.EventHandler {
public void repaint() {
@@ -113,40 +104,31 @@
// Handle mouse wheel.
if(button == 4 || button == 5) {
int r = (button == 4 ? 1 : -1);
- MouseWheelEvent ev = new MouseWheelEvent(fakeSource,
- MouseWheelEvent.MOUSE_WHEEL,
- 0,
- 0,
+ VobMouseEvent ev = new VobMouseEvent(
+ VobMouseEvent.MOUSE_WHEEL,
x, y,
- 1,
- false,
- MouseWheelEvent.WHEEL_UNIT_SCROLL,
- r, r);
+ r, 0, 0);
binder.mouse(ev);
return;
}
if(dbg) pa("GLScreen mouseEvent: "+x+" "+y+" "+button+" "+what);
- MouseEvent ev = null;
+ VobMouseEvent ev = null;
switch(what) {
case PRESS: case RELEASE:
- ev = new MouseEvent(fakeSource,
- (what==PRESS ? MouseEvent.MOUSE_PRESSED
- : MouseEvent.MOUSE_RELEASED),
- 0,
- mapButton(button),
+ ev = new VobMouseEvent(
+ (what==PRESS ? VobMouseEvent.MOUSE_PRESSED
+ : VobMouseEvent.MOUSE_RELEASED),
x, y,
- 1,
- false);
+ 0, 0, button
+ );
if(what == RELEASE && !didDrag) {
binder.mouse(ev);
- ev = new MouseEvent(fakeSource,
- MouseEvent.MOUSE_CLICKED,
- 0,
- mapButton(button),
+ ev = new VobMouseEvent(
+ VobMouseEvent.MOUSE_CLICKED,
x, y,
- 1,
- false);
+ 0, 0, button
+ );
}
notDragging(x, y);
break;
@@ -154,13 +136,11 @@
if(button == 0) return ;
if(!isDragging(x, y))
return ;
- ev = new MouseEvent(fakeSource,
- MouseEvent.MOUSE_DRAGGED,
- 0,
- mapButton(button),
+ ev = new VobMouseEvent(
+ VobMouseEvent.MOUSE_DRAGGED,
x, y,
- 1,
- false);
+ 0, 0, button
+ );
break;
default:
return ;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob/org/nongnu/libvob Binder.java impl/awt/A...,
Tuomas J. Lukka <=