]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0521: GtkForm handling is outdated v8.0.0521
authorBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 16:07:40 +0000 (18:07 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 29 Mar 2017 16:07:40 +0000 (18:07 +0200)
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)

src/gui_gtk_f.c
src/gui_gtk_f.h
src/version.c

index 182fe82f96120a1bfb51e1789c36724cbbdfd7bd..287a87e4984a5d4c0f794c6db5fcf5d8cddd1e87 100644 (file)
@@ -92,14 +92,6 @@ static void gtk_form_position_child(GtkForm *form,
                                    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);
@@ -171,9 +163,6 @@ gtk_form_put(GtkForm        *form,
        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))
@@ -301,19 +290,7 @@ gtk_form_init(GtkForm *form)
     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;
 }
 
@@ -414,11 +391,6 @@ gtk_form_realize(GtkWidget *widget)
     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;
@@ -540,33 +512,11 @@ gtk_form_unrealize(GtkWidget *widget)
     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));
+    g_return_if_fail(requisition != NULL);
 
-#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)
@@ -735,28 +685,9 @@ gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
        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);
-           }
-       }
-    }
+       gtk_container_propagate_expose(GTK_CONTAINER(widget),
+               GTK_WIDGET(((GtkFormChild *)tmp_list->data)->widget),
+               event);
 
     return FALSE;
 }
@@ -1068,86 +999,6 @@ gtk_form_position_children(GtkForm *form)
        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)
index 7bcf48b830a3367b4f913d4f32333c5077df5db6..be7693a4da71e01f1e830dd68ba629d3a7d3f8b9 100644 (file)
@@ -43,19 +43,7 @@ struct _GtkForm
     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;
 };
 
index 5705d983748b52502fb377de0e340a163ef1ee60..539052b51102219034350d68f602c075866ce211 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    521,
 /**/
     520,
 /**/