/[gzz]/gzz/gfx/jni/GzzGL-jni.cxx
ViewVC logotype

Diff of /gzz/gfx/jni/GzzGL-jni.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.76 by tjl, Thu Jan 16 11:24:36 2003 UTC revision 1.77 by tjl, Thu Jan 16 12:54:24 2003 UTC
# Line 136  void releaseWindow() { Line 136  void releaseWindow() {
136      DBG(dbg) << "Release current "<<wid<<"\n";      DBG(dbg) << "Release current "<<wid<<"\n";
137  }  }
138    
139    /** If an exception occurred, print a debug message for it and clear it.
140    */
141    void javaExc(JNIEnv *env, const char *where) {
142        if(env->ExceptionOccurred()) {
143            cerr << "Exception in "<<where<<"\n";
144             env->ExceptionDescribe();
145             env->ExceptionClear();
146        }
147    }
148    
149  struct GZZJNIEventHandler : public Os::Eventhandler {  struct GZZJNIEventHandler : public Os::Eventhandler {
150    
151      jobject globalRef;      jobject globalRef;
# Line 168  struct GZZJNIEventHandler : public Os::E Line 178  struct GZZJNIEventHandler : public Os::E
178      void repaint() {      void repaint() {
179          DBG(dbg_event) << "CALLING REPAINT!!!\n";          DBG(dbg_event) << "CALLING REPAINT!!!\n";
180          jnienv_eventloop->CallVoidMethod(globalRef, mid_repaint);          jnienv_eventloop->CallVoidMethod(globalRef, mid_repaint);
181            javaExc(jnienv_eventloop, "repaint");
         if(jnienv_eventloop->ExceptionOccurred()) {  
             cerr << "Java exception in event handler!\n";  
             throw JavaException();  
         }  
182    
183          // jnienv_eventloop->DeleteLocalRef(cls);          // jnienv_eventloop->DeleteLocalRef(cls);
184    
# Line 184  struct GZZJNIEventHandler : public Os::E Line 190  struct GZZJNIEventHandler : public Os::E
190          DBG(dbg_event) << "Keystroke has been sent\n";          DBG(dbg_event) << "Keystroke has been sent\n";
191    
192          jnienv_eventloop->CallVoidMethod(globalRef, mid_keystroke, jstr);          jnienv_eventloop->CallVoidMethod(globalRef, mid_keystroke, jstr);
193            javaExc(jnienv_eventloop, "keystroke");
194    
195          DBG(dbg_event) << "Call finished\n";          DBG(dbg_event) << "Call finished\n";
196      }      }
# Line 191  struct GZZJNIEventHandler : public Os::E Line 198  struct GZZJNIEventHandler : public Os::E
198      virtual void mouse(int x, int y, int button, int type) {      virtual void mouse(int x, int y, int button, int type) {
199    
200          jnienv_eventloop->CallVoidMethod(globalRef, mid_mousepress, x, y, button, type);          jnienv_eventloop->CallVoidMethod(globalRef, mid_mousepress, x, y, button, type);
201            javaExc(jnienv_eventloop, "mouse");
202      }      }
203      virtual void timeout(int id) {      virtual void timeout(int id) {
204          jnienv_eventloop->CallVoidMethod(globalRef, mid_timeout, id);          jnienv_eventloop->CallVoidMethod(globalRef, mid_timeout, id);
205            javaExc(jnienv_eventloop, "timeout");
206      }      }
207      virtual void windowClosed() {      virtual void windowClosed() {
208          jnienv_eventloop->CallVoidMethod(globalRef, mid_windowClosed);          jnienv_eventloop->CallVoidMethod(globalRef, mid_windowClosed);
209            javaExc(jnienv_eventloop, "windowClosed");
210      }      }
211  };  };
212    

Legend:
Removed from v.1.76  
changed lines
  Added in v.1.77

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26