gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/fb.cpp


From: Udo Giacomozzi
Subject: [Gnash-commit] gnash ChangeLog gui/fb.cpp
Date: Tue, 01 Jan 2008 14:51:56 +0000

CVSROOT:        /cvsroot/gnash
Module name:    gnash
Changes by:     Udo Giacomozzi <udog>   08/01/01 14:51:56

Modified files:
        .              : ChangeLog 
        gui            : fb.cpp 

Log message:
        gui/fb.cpp: Limit calls to notify_mouse_moved(), process more events at 
once (8 -> 100 max)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5284&r2=1.5285
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/fb.cpp?cvsroot=gnash&r1=1.46&r2=1.47

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnash/gnash/ChangeLog,v
retrieving revision 1.5284
retrieving revision 1.5285
diff -u -b -r1.5284 -r1.5285
--- ChangeLog   1 Jan 2008 10:45:58 -0000       1.5284
+++ ChangeLog   1 Jan 2008 14:51:55 -0000       1.5285
@@ -1,3 +1,8 @@
+2008-01-01 Udo Giacomozzi <address@hidden>
+
+       * gui/fb.cpp: Limit calls to notify_mouse_moved(), process
+         more events at once (8 -> 100 max)    
+
 2008-01-01 Sandro Santilli <address@hidden>
 
        * libamf/element.{cpp,h}: improve const correctness.

Index: gui/fb.cpp
===================================================================
RCS file: /cvsroot/gnash/gnash/gui/fb.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- gui/fb.cpp  20 Dec 2007 15:35:42 -0000      1.46
+++ gui/fb.cpp  1 Jan 2008 14:51:56 -0000       1.47
@@ -1126,6 +1126,10 @@
   static int new_mouse_y = 0;
   static int new_mouse_btn = 0;
   
+  int notify_x;     // coordinate to be sent via notify_mouse_moved()
+  int notify_y;
+  bool move_pending = false;  // true: notify_mouse_moved() should be called
+  
   // this is necessary for our quick'n'dirty touchscreen calibration: 
   static int coordinatedebug = getenv("DUMP_RAW")!=NULL;
   
@@ -1137,7 +1141,7 @@
   
   // Assuming we will never read less than one full struct...  
   
-  while ((loops++ < 8) && (read(input_fd, &ev, sizeof ev) == (sizeof ev))) {
+  while ((loops++ < 100) && (read(input_fd, &ev, sizeof ev) == (sizeof ev))) {
   
     if (ev.type == EV_SYN) {    // synchronize (apply information)
     
@@ -1156,10 +1160,21 @@
         else
           { cx=mouse_x; cy=mouse_y; }
               
-        notify_mouse_moved(int(cx / xscale), int(cy / yscale));
+        // Don't call notify_mouse_moved() here because this would lead to
+        // lots of calls, especially for touchscreens. Instead we save the
+        // coordinate and call notify_mouse_moved() only once.
+        notify_x = cx / xscale;
+        notify_y = cy / yscale;
+        move_pending = true;        
       }
       
       if (new_mouse_btn != mouse_btn) {
+      
+        if (move_pending) {
+          notify_mouse_moved(notify_x, notify_y);
+          move_pending = false;
+        }
+      
         mouse_btn = new_mouse_btn;
         notify_mouse_clicked(mouse_btn, 1);  // mark=??
       }
@@ -1194,6 +1209,9 @@
   
   } 
  
+  if (move_pending) 
+    notify_mouse_moved(notify_x, notify_y);
+ 
 } //check_mouse
 #endif
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]