summaryrefslogtreecommitdiff
path: root/src/gui_gtk_f.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-29 18:07:40 +0200
committerBram Moolenaar <Bram@vim.org>2017-03-29 18:07:40 +0200
commit99a6e8dd824399332563caa6cacfcda33da1f366 (patch)
tree297332b659dce7484455fb3ce364e50650d15a36 /src/gui_gtk_f.c
parentace95989ed81929a84e205b26d0972cb9d6b4b19 (diff)
downloadvim-git-99a6e8dd824399332563caa6cacfcda33da1f366.tar.gz
patch 8.0.0521: GtkForm handling is outdatedv8.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)
Diffstat (limited to 'src/gui_gtk_f.c')
-rw-r--r--src/gui_gtk_f.c157
1 files changed, 4 insertions, 153 deletions
diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c
index 182fe82f9..287a87e49 100644
--- a/src/gui_gtk_f.c
+++ b/src/gui_gtk_f.c
@@ -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)