Re: delete event handling



On 28 Jan 2000, Havoc Pennington wrote:

> 
> This is a change for 1.4 discussed with Owen; basically it drops
> delete_event if there's a grab held by a widget other than the window
> receiving the delete_event. The patch lacks get_arg()/set_arg()
> support, it would need that before commit.

> retrieving revision 1.112.2.6
> diff -u -u -r1.112.2.6 gtkmain.c
> --- gtk/gtkmain.c	1999/09/03 20:08:13	1.112.2.6
> +++ gtk/gtkmain.c	2000/01/27 23:58:52
> @@ -677,11 +677,15 @@
>        break;
>        
>      case GDK_DELETE:
> -      gtk_widget_ref (event_widget);
> -      if (!gtk_widget_event (event_widget, event) &&
> -	  !GTK_OBJECT_DESTROYED (event_widget))
> -	gtk_widget_destroy (event_widget);
> -      gtk_widget_unref (event_widget);
> +      if (GTK_WINDOW(event_widget)->never_drop_delete_event ||
> +          grab_widget == event_widget)
> +        {
> +          gtk_widget_ref (event_widget);
> +          if (!gtk_widget_event (event_widget, event) &&
> +              !GTK_OBJECT_DESTROYED (event_widget))
> +            gtk_widget_destroy (event_widget);
> +          gtk_widget_unref (event_widget);
> +        }
>        break;
>        
>      case GDK_DESTROY:

come to think of it, i think we should apply something like this to
current CVS, so 1.2.7 does behave sane. if we simply ignore delete
events that occour on a window which is not holding the current grab,
gtk behaves as if the user never sent a delete event. so i don't think
we'd break existing code with this, not even such code that tries to
handle the current problem:

    case GDK_DELETE:
      gtk_widget_ref (event_widget);
      if ((!grabs || gtk_widget_get_toplevel (grabs->data) == event_widget) &&
          !gtk_widget_event (event_widget, event))
        gtk_widget_destroy (event_widget);
      gtk_widget_unref (event_widget);
      break;

owen, you see any problems with that?

---
ciaoTJ



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