[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/os...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/os... |
Date: |
Sat, 02 Aug 2003 05:07:13 -0400 |
CVSROOT: /cvsroot/libvob
Module name: libvob
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/08/02 05:07:11
Modified files:
include/vob/jni: Types.hxx
include/vob/os : Os.hxx
org/nongnu/libvob: VobMouseEvent.java
org/nongnu/libvob/gl: GL.java
org/nongnu/libvob/impl/gl: GLScreen.java
src/jni : Main.cxx
src/os : Os-GLX.cxx
Log message:
Get the actual modifiers info from GL to binder
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/jni/Types.hxx.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/include/vob/os/Os.hxx.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/VobMouseEvent.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/gl/GL.java.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/impl/gl/GLScreen.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/jni/Main.cxx.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/src/os/Os-GLX.cxx.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: libvob/include/vob/jni/Types.hxx
diff -u libvob/include/vob/jni/Types.hxx:1.26
libvob/include/vob/jni/Types.hxx:1.27
--- libvob/include/vob/jni/Types.hxx:1.26 Wed Jul 30 06:49:32 2003
+++ libvob/include/vob/jni/Types.hxx Sat Aug 2 05:07:10 2003
@@ -33,7 +33,6 @@
#include <vob/Vob.hxx>
#include <vob/Types.hxx>
#include <vob/util/ObjectStorer.hxx>
-#include <vob/os/Os.hxx>
#include <vob/Debug.hxx>
#include <vob/jni/Strings.hxx>
@@ -44,6 +43,9 @@
namespace Vob {
+ namespace Os {
+ class RenderingSurface;
+ }
namespace Primitives {
}
namespace Vobs {
Index: libvob/include/vob/os/Os.hxx
diff -u libvob/include/vob/os/Os.hxx:1.6 libvob/include/vob/os/Os.hxx:1.7
--- libvob/include/vob/os/Os.hxx:1.6 Thu Jul 24 03:20:27 2003
+++ libvob/include/vob/os/Os.hxx Sat Aug 2 05:07:11 2003
@@ -39,7 +39,8 @@
};
virtual ~Eventhandler() { } // not called by Window..
virtual void keystroke(const char *str) {}
- virtual void mouse(int x, int y, int button, int type) {}
+ virtual void mouse(int x, int y, int button, int type,
+ int modifiers) {}
virtual void timeout(int id) {}
virtual void windowClosed() {}
virtual void resize(int w, int h) { repaint(); }
Index: libvob/org/nongnu/libvob/VobMouseEvent.java
diff -u libvob/org/nongnu/libvob/VobMouseEvent.java:1.1
libvob/org/nongnu/libvob/VobMouseEvent.java:1.2
--- libvob/org/nongnu/libvob/VobMouseEvent.java:1.1 Sat Aug 2 03:42:44 2003
+++ libvob/org/nongnu/libvob/VobMouseEvent.java Sat Aug 2 05:07:11 2003
@@ -6,6 +6,8 @@
* This class exists because of the strange behaviour of
* java.awt.MouseEvent (i.e. aliasing BUTTON2 and ALT etc.).
* It also allows our OpenGL code to never depend on AWT classes.
+ * <p>
+ * Limitation: we do not allow mouse button chords.
*/
public class VobMouseEvent {
public final static int MOUSE_PRESSED = 1827;
@@ -14,6 +16,7 @@
public final static int MOUSE_DRAGGED = 1830;
public final static int MOUSE_WHEEL = 1831;
+ // DO NOT CHANGE WITHOUT CHANGING OPENGL CODE AS WELL
public final static int SHIFT_MASK = 1;
public final static int CONTROL_MASK = 2;
public final static int ALT_MASK = 4;
@@ -33,6 +36,13 @@
*/
public int getButton() { return this.button; }
+ /** Create a new vob mouse event.
+ * @param type MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_CLICKED,
MOUSE_DRAGGED, or MOUSE_WHEEL
+ * @param x,y The coordinates
+ * @param wheelDelta The wheel movement
+ * @param modifiers Bitwise or of SHIFT_MASK, CONTROL_MASK, ALT_MASK
+ * @param button The mouse button being pressed.
+ */
public VobMouseEvent(
int type,
int x,
@@ -46,6 +56,11 @@
this.wheelDelta = wheelDelta;
this.modifiers = modifiers;
this.button = button;
+ }
+
+ public String toString() {
+ return "[VobMouseEvent: "+type+" "+x+" "+y+" "
+ +wheelDelta+" "+modifiers+" "+button+"]";
}
}
Index: libvob/org/nongnu/libvob/gl/GL.java
diff -u libvob/org/nongnu/libvob/gl/GL.java:1.21
libvob/org/nongnu/libvob/gl/GL.java:1.22
--- libvob/org/nongnu/libvob/gl/GL.java:1.21 Tue Jul 22 08:01:50 2003
+++ libvob/org/nongnu/libvob/gl/GL.java Sat Aug 2 05:07:11 2003
@@ -113,7 +113,11 @@
/** Receive a keystroke event.
*/
void keystroke(String s);
- void mouse(int x, int y, int button, int type);
+ /** Receive a mouse event.
+ * The modifiers are coded (hard-coded) with the
+ * org.nongnu.libvob.VobMouseEvent modifier masks.
+ */
+ void mouse(int x, int y, int button, int type, int modifiers);
void timeout(int id);
void windowClosed();
}
Index: libvob/org/nongnu/libvob/impl/gl/GLScreen.java
diff -u libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.7
libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.8
--- libvob/org/nongnu/libvob/impl/gl/GLScreen.java:1.7 Sat Aug 2 03:42:45 2003
+++ libvob/org/nongnu/libvob/impl/gl/GLScreen.java Sat Aug 2 05:07:11 2003
@@ -37,7 +37,7 @@
import org.nongnu.libvob.gl.*;
public class GLScreen extends GLRenderingSurface implements GraphicsAPI.Window
{
-public static final String rcsid = "$Id: GLScreen.java,v 1.7 2003/08/02
07:42:45 tjl Exp $";
+public static final String rcsid = "$Id: GLScreen.java,v 1.8 2003/08/02
09:07:11 tjl Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.out.println("GLScreen:: " + s); }
@@ -100,14 +100,15 @@
return false;
}
- public void mouse(int x, int y, int button, int what) {
+ public void mouse(int x, int y, int button, int what,
+ int modifiers) {
// Handle mouse wheel.
if(button == 4 || button == 5) {
int r = (button == 4 ? 1 : -1);
VobMouseEvent ev = new VobMouseEvent(
VobMouseEvent.MOUSE_WHEEL,
x, y,
- r, 0, 0);
+ r, modifiers, 0);
binder.mouse(ev);
return;
}
@@ -120,14 +121,14 @@
(what==PRESS ? VobMouseEvent.MOUSE_PRESSED
: VobMouseEvent.MOUSE_RELEASED),
x, y,
- 0, 0, button
+ 0, modifiers, button
);
if(what == RELEASE && !didDrag) {
binder.mouse(ev);
ev = new VobMouseEvent(
VobMouseEvent.MOUSE_CLICKED,
x, y,
- 0, 0, button
+ 0, modifiers, button
);
}
notDragging(x, y);
@@ -139,7 +140,7 @@
ev = new VobMouseEvent(
VobMouseEvent.MOUSE_DRAGGED,
x, y,
- 0, 0, button
+ 0, modifiers, button
);
break;
default:
Index: libvob/src/jni/Main.cxx
diff -u libvob/src/jni/Main.cxx:1.20 libvob/src/jni/Main.cxx:1.21
--- libvob/src/jni/Main.cxx:1.20 Thu Jul 31 10:05:17 2003
+++ libvob/src/jni/Main.cxx Sat Aug 2 05:07:11 2003
@@ -124,7 +124,7 @@
env->GetMethodID(cls,
"keystroke", "(Ljava/lang/String;)V");
mid_mousepress =
- env->GetMethodID(cls, "mouse", "(IIII)V");
+ env->GetMethodID(cls, "mouse", "(IIIII)V");
mid_timeout =
env->GetMethodID(cls, "timeout", "(I)V");
mid_windowClosed =
@@ -153,9 +153,9 @@
DBG(dbg_event) << "Call finished\n";
}
- virtual void mouse(int x, int y, int button, int type) {
+ virtual void mouse(int x, int y, int button, int type, int modifiers) {
- jnienv_eventloop->CallVoidMethod(globalRef, mid_mousepress, x, y,
button, type);
+ jnienv_eventloop->CallVoidMethod(globalRef, mid_mousepress, x, y,
button, type, modifiers);
javaExc(jnienv_eventloop, "mouse");
}
virtual void timeout(int id) {
Index: libvob/src/os/Os-GLX.cxx
diff -u libvob/src/os/Os-GLX.cxx:1.8 libvob/src/os/Os-GLX.cxx:1.9
--- libvob/src/os/Os-GLX.cxx:1.8 Thu Jul 31 10:05:17 2003
+++ libvob/src/os/Os-GLX.cxx Sat Aug 2 05:07:11 2003
@@ -568,6 +568,15 @@
eventhandler->timeout(id);
}
+ int modmask(int state) {
+ int mask = 0;
+ if(state & ShiftMask)
+ mask |= 1;
+ if(state & ControlMask)
+ mask |= 2;
+ return mask;
+ }
+
void deliverEvent(XEvent *e) {
DBG(dbg_ctrl) << "event "<<xw<<" "<<e->type<<"\n";
if(!eventhandler) {
@@ -615,7 +624,9 @@
eventhandler->mouse(e->xbutton.x, e->xbutton.y, button,
(e->type == ButtonPress ?
eventhandler->PRESS :
- eventhandler->RELEASE));
+ eventhandler->RELEASE),
+ modmask(e->xbutton.state)
+ );
break;
}
case MotionNotify: {
@@ -623,7 +634,9 @@
DBG(dbg_ctrl) << "Motion: " << button << " " <<e->xmotion.x <<
" "
<< e->xmotion.y<<"\n";
eventhandler->mouse(e->xmotion.x, e->xmotion.y, button,
- eventhandler->MOTION);
+ eventhandler->MOTION,
+ modmask(e->xbutton.state)
+ );
break;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] libvob include/vob/jni/Types.hxx include/vob/os...,
Tuomas J. Lukka <=