Patch 8.0.0521
Problem:    GtkForm handling is outdated.
Solution:   Get rid of event filter functions.  Get rid of GtkForm.width and
            .height.  Eliminate gtk_widget_size_request() calls. (Kazunobu
            Kuriyama)
Files:      src/gui_gtk_f.c, src/gui_gtk_f.h


*** ../vim-8.0.0520/src/gui_gtk_f.c     2016-09-09 22:00:25.000000000 +0200
--- src/gui_gtk_f.c     2017-03-29 17:34:14.302763381 +0200
***************
*** 92,105 ****
                                    gboolean force_allocate);
  static void gtk_form_position_children(GtkForm *form);
  
- #if !GTK_CHECK_VERSION(3,0,0)
- static GdkFilterReturn gtk_form_filter(GdkXEvent *gdk_xevent,
-                                      GdkEvent *event,
-                                      gpointer data);
- static GdkFilterReturn gtk_form_main_filter(GdkXEvent *gdk_xevent,
-                                           GdkEvent *event,
-                                           gpointer data);
- #endif
  #if !GTK_CHECK_VERSION(3,16,0)
  static void gtk_form_set_static_gravity(GdkWindow *window,
                                        gboolean use_static);
--- 92,97 ----
***************
*** 171,179 ****
        gtk_form_attach_child_window(form, child);
  
      gtk_widget_set_parent(child_widget, GTK_WIDGET(form));
- #if !GTK_CHECK_VERSION(3,0,0)
-     gtk_widget_size_request(child->widget, NULL);
- #endif
  
  #if GTK_CHECK_VERSION(3,0,0)
      if (gtk_widget_get_realized(GTK_WIDGET(form))
--- 163,168 ----
***************
*** 301,319 ****
      gtk_widget_set_has_window(GTK_WIDGET(form), TRUE);
  #endif
      form->children = NULL;
- 
- #if !GTK_CHECK_VERSION(3,0,0)
-     form->width = 1;
-     form->height = 1;
- #endif
- 
      form->bin_window = NULL;
- 
- #if !GTK_CHECK_VERSION(3,0,0)
-     form->configure_serial = 0;
-     form->visibility = GDK_VISIBILITY_PARTIAL;
- #endif
- 
      form->freeze_count = 0;
  }
  
--- 290,296 ----
***************
*** 414,424 ****
      gtk_style_set_background(widget->style, form->bin_window, 
GTK_STATE_NORMAL);
  #endif
  
- #if !GTK_CHECK_VERSION(3,0,0)
-     gdk_window_add_filter(widget->window, gtk_form_main_filter, form);
-     gdk_window_add_filter(form->bin_window, gtk_form_filter, form);
- #endif
- 
      for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
      {
        GtkFormChild *child = tmp_list->data;
--- 391,396 ----
***************
*** 540,572 ****
      static void
  gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition)
  {
- #if !GTK_CHECK_VERSION(3,0,0)
-     GList *tmp_list;
-     GtkForm *form;
- #endif
- 
      g_return_if_fail(GTK_IS_FORM(widget));
  
- #if !GTK_CHECK_VERSION(3,0,0)
-     form = GTK_FORM(widget);
- #endif
- 
- #if GTK_CHECK_VERSION(3,0,0)
      requisition->width = 1;
      requisition->height = 1;
- #else
-     requisition->width = form->width;
-     requisition->height = form->height;
- 
-     tmp_list = form->children;
- 
-     while (tmp_list)
-     {
-       GtkFormChild *child = tmp_list->data;
-       gtk_widget_size_request(child->widget, NULL);
-       tmp_list = tmp_list->next;
-     }
- #endif
  }
  
  #if GTK_CHECK_VERSION(3,0,0)
--- 512,522 ----
      static void
  gtk_form_size_request(GtkWidget *widget, GtkRequisition *requisition)
  {
      g_return_if_fail(GTK_IS_FORM(widget));
+     g_return_if_fail(requisition != NULL);
  
      requisition->width = 1;
      requisition->height = 1;
  }
  
  #if GTK_CHECK_VERSION(3,0,0)
***************
*** 735,762 ****
        return FALSE;
  
      for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
!     {
!       GtkFormChild    *formchild = tmp_list->data;
!       GtkWidget       *child     = formchild->widget;
!       /*
!        * The following chunk of code is taken from gtkcontainer.c.  The
!        * gtk1.x code synthesized expose events directly on the child widgets,
!        * which can't be done in gtk2
!        */
!       if (GTK_WIDGET_DRAWABLE(child) && GTK_WIDGET_NO_WINDOW(child)
!               && child->window == event->window)
!       {
!           GdkEventExpose child_event;
!           child_event = *event;
! 
!           child_event.region = gtk_widget_region_intersect(child, 
event->region);
!           if (!gdk_region_empty(child_event.region))
!           {
!               gdk_region_get_clipbox(child_event.region, &child_event.area);
!               gtk_widget_send_expose(child, (GdkEvent *)&child_event);
!           }
!       }
!     }
  
      return FALSE;
  }
--- 685,693 ----
        return FALSE;
  
      for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
!       gtk_container_propagate_expose(GTK_CONTAINER(widget),
!               GTK_WIDGET(((GtkFormChild *)tmp_list->data)->widget),
!               event);
  
      return FALSE;
  }
***************
*** 1068,1153 ****
        gtk_form_position_child(form, tmp_list->data, FALSE);
  }
  
- /* Callbacks */
- 
- /* The main event filter. Actually, we probably don't really need
-  * to install this as a filter at all, since we are calling it
-  * directly above in the expose-handling hack.
-  *
-  * This routine identifies expose events that are generated when
-  * we've temporarily moved the bin_window_origin, and translates
-  * them or discards them, depending on whether we are obscured
-  * or not.
-  */
- #if !GTK_CHECK_VERSION(3,0,0)
-     static GdkFilterReturn
- gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event UNUSED, gpointer data)
- {
-     XEvent *xevent;
-     GtkForm *form;
- 
-     xevent = (XEvent *) gdk_xevent;
-     form = GTK_FORM(data);
- 
-     switch (xevent->type)
-     {
-     case Expose:
-       if (xevent->xexpose.serial == form->configure_serial)
-       {
-           if (form->visibility == GDK_VISIBILITY_UNOBSCURED)
-               return GDK_FILTER_REMOVE;
-           else
-               break;
-       }
-       break;
- 
-     case ConfigureNotify:
-       if ((xevent->xconfigure.x != 0) || (xevent->xconfigure.y != 0))
-           form->configure_serial = xevent->xconfigure.serial;
-       break;
-     }
- 
-     return GDK_FILTER_CONTINUE;
- }
- 
- /* Although GDK does have a GDK_VISIBILITY_NOTIFY event,
-  * there is no corresponding event in GTK, so we have
-  * to get the events from a filter
-  */
-     static GdkFilterReturn
- gtk_form_main_filter(GdkXEvent *gdk_xevent,
-                    GdkEvent *event UNUSED,
-                    gpointer data)
- {
-     XEvent *xevent;
-     GtkForm *form;
- 
-     xevent = (XEvent *) gdk_xevent;
-     form = GTK_FORM(data);
- 
-     if (xevent->type == VisibilityNotify)
-     {
-       switch (xevent->xvisibility.state)
-       {
-       case VisibilityFullyObscured:
-           form->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
-           break;
- 
-       case VisibilityPartiallyObscured:
-           form->visibility = GDK_VISIBILITY_PARTIAL;
-           break;
- 
-       case VisibilityUnobscured:
-           form->visibility = GDK_VISIBILITY_UNOBSCURED;
-           break;
-       }
- 
-       return GDK_FILTER_REMOVE;
-     }
-     return GDK_FILTER_CONTINUE;
- }
- #endif /* !GTK_CHECK_VERSION(3,0,0) */
- 
  #if !GTK_CHECK_VERSION(3,16,0)
      static void
  gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
--- 999,1004 ----
*** ../vim-8.0.0520/src/gui_gtk_f.h     2016-08-29 22:42:20.000000000 +0200
--- src/gui_gtk_f.h     2017-03-29 17:34:14.302763381 +0200
***************
*** 43,61 ****
      GtkContainer container;
  
      GList *children;
- 
- #ifndef USE_GTK3
-     guint width;
-     guint height;
- #endif
- 
      GdkWindow *bin_window;
- 
- #ifndef USE_GTK3
-     GdkVisibilityState visibility;
-     gulong configure_serial;
- #endif
- 
      gint freeze_count;
  };
  
--- 43,49 ----
*** ../vim-8.0.0520/src/version.c       2017-03-29 17:30:23.168136866 +0200
--- src/version.c       2017-03-29 17:34:00.734844036 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     521,
  /**/

-- 
The term "free software" is defined by Richard M. Stallman as
being software that isn't necessarily for free.  Confusing?
Let's call it "Stallman software" then!
                                -- Bram Moolenaar

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui