浏览代码

migrate refresh requests into core api

David Rose 16 年之前
父节点
当前提交
b01400ff97
共有 2 个文件被更改,包括 8 次插入17 次删除
  1. 7 0
      direct/src/plugin/p3dInstance.cxx
  2. 1 17
      direct/src/plugin_npapi/ppInstance.cxx

+ 7 - 0
direct/src/plugin/p3dInstance.cxx

@@ -483,6 +483,13 @@ handle_event(P3D_event_data event) {
 
   switch (er->what) {
   case nullEvent:
+    // We appear to get this event pretty frequently when nothing else
+    // is going on.  Great; we'll take advantage of it to request a
+    // refresh, which will cause updateEvt to be triggered (if the
+    // instance is still onscreen).
+    if (_instance_window_opened && _swbuffer != NULL && _swbuffer->ready_for_read()) {
+      request_refresh();
+    }
     break;
 
   case mouseDown:

+ 1 - 17
direct/src/plugin_npapi/ppInstance.cxx

@@ -479,24 +479,8 @@ handle_event(void *event) {
   }
 
 #ifdef __APPLE__
-  EventRecord *er = (EventRecord *)event;
-
-  switch (er->what) {
-  case nullEvent:
-    // We appear to get this event pretty frequently when nothing else
-    // is going on.  Great; we'll take advantage of it to invalidate
-    // the instance rectangle, which will cause updateEvt to be
-    // triggered (if the instance is still onscreen).
-    if (_got_window && _python_window_open) {
-      NPRect rect = { 0, 0, _window.height, _window.width };
-      browser->invalidaterect(_npp_instance, &rect);
-    }
-    break;
-  }
-
-  // All other events we feed down to the plugin for processing.
   P3D_event_data edata;
-  edata._event = er;
+  edata._event = (EventRecord *)event;
   P3D_instance_handle_event(_p3d_inst, edata);
 
 #endif  // __APPLE__