Re: [gdk/directfb] Wrong GDK events delivered sometimes



Hi

I've prepared a patch that takes care of fixing some bugs related to the generation of crossing events and to cursor's shape

1) the dfb backend currently receives twice in a row a DEWT_ENTER: i asked directfb-dev if this is something normal dfb operating (i doubt it) or more likely a bug in the way the dfb event buffer is parsed by gtk/dfb. As i received no answers, found nothing better than dropping the exceeding dwet_enter dfb event.

2) wrong enter/leave crossing events are generated when entering a gdkwindow, the patch fixes that.

3) if cursor exits a toplevel gdkwindow while "I" shaped, then when it re-enters the window gets not arrow shaped, the patch also fixes that.

Tests i did with gtk-demo, gimp and dillo showed no drawbacks.

Sven, Mike: if this patch is ok, could you please apply?

thanks

Attilio
Index: gdk/directfb/gdkevents-directfb.c
===================================================================
--- gdk/directfb/gdkevents-directfb.c	(revisione 17194)
+++ gdk/directfb/gdkevents-directfb.c	(copia locale)
@@ -142,7 +142,13 @@
       switch (event->clazz)
         {
         case DFEC_WINDOW:
-          dfb_events_process_window_event (&event->window);
+          /* TODO workaround to prevent two DWET_ENTER in a row from being delivered */
+          if (event->window.type == DWET_ENTER ) {
+            if ( i>0 && buf[i-1].window.type != DWET_ENTER )
+              dfb_events_process_window_event (&event->window);
+          }
+          else
+            dfb_events_process_window_event (&event->window);
           break;
         default:
           break;
@@ -488,6 +494,10 @@
     int wy=_gdk_directfb_mouse_y;
 	child = gdk_directfb_child_at (_gdk_parent_root, &wx, &wy);
 
+    /* first let's see if any cossing event has to be send */
+    gdk_directfb_window_send_crossing_events (NULL, child, GDK_CROSSING_NORMAL);
+
+    /* then dispatch the motion event to the window the cursor it's inside */
 	event_win = gdk_directfb_pointer_event_window (child, GDK_MOTION_NOTIFY);
 
 
@@ -531,8 +541,9 @@
 	      }
 	  }
           /* make sure crossing events go to the event window found */
-        GdkWindow *ev_win = ( event_win == NULL ) ? gdk_window_at_pointer (NULL,NULL) :event_win;
+/*        GdkWindow *ev_win = ( event_win == NULL ) ? gdk_window_at_pointer (NULL,NULL) :event_win;
 	     gdk_directfb_window_send_crossing_events (NULL,ev_win,GDK_CROSSING_NORMAL);
+*/
       }
       break;
 
@@ -660,6 +671,10 @@
 
         child = gdk_directfb_child_at (window, &dfbevent->x, &dfbevent->y);
 
+        /* this makes sure pointer is set correctly when it previously left
+         * a window being not standard shaped
+         */
+        gdk_window_set_cursor (window, NULL);
         gdk_directfb_window_send_crossing_events (NULL, child,
                                                   GDK_CROSSING_NORMAL);
 


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