diff src/gui_gtk_f.c @ 14712:82e7ce311065 v8.1.0368

patch 8.1.0368: GTK code has too many #ifdefs and GTK 2.10 building fails commit https://github.com/vim/vim/commit/25328e39d2a6e3ded82bf282a2e248ce7209f1b4 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 11 21:30:09 2018 +0200 patch 8.1.0368: GTK code has too many #ifdefs and GTK 2.10 building fails Problem: GTK code has too many #ifdefs and building fails with GTK 2.10. Solution: Always use gtk_widget_get_window() and define it for older GTK versions. (Ken Takata, closes #3421)
author Christian Brabandt <cb@256bit.org>
date Tue, 11 Sep 2018 21:45:06 +0200
parents 049857c9b1c4
children 11978f68a8c3
line wrap: on
line diff
--- a/src/gui_gtk_f.c
+++ b/src/gui_gtk_f.c
@@ -345,24 +345,18 @@ gtk_form_realize(GtkWidget *widget)
     gtk_widget_set_window(widget,
 			  gdk_window_new(gtk_widget_get_parent_window(widget),
 					 &attributes, attributes_mask));
-    gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
 #else
     widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
 				    &attributes, attributes_mask);
-    gdk_window_set_user_data(widget->window, widget);
 #endif
+    gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
 
     attributes.x = 0;
     attributes.y = 0;
     attributes.event_mask = gtk_widget_get_events(widget);
 
-#if GTK_CHECK_VERSION(3,0,0)
     form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
 				      &attributes, attributes_mask);
-#else
-    form->bin_window = gdk_window_new(widget->window,
-				      &attributes, attributes_mask);
-#endif
     gdk_window_set_user_data(form->bin_window, widget);
 
 #if GTK_CHECK_VERSION(3,0,0)
@@ -422,11 +416,7 @@ gtk_form_map(GtkWidget *widget)
     GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
 #endif
 
-#if GTK_CHECK_VERSION(3,0,0)
     gdk_window_show(gtk_widget_get_window(widget));
-#else
-    gdk_window_show(widget->window);
-#endif
     gdk_window_show(form->bin_window);
 
     for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
@@ -593,15 +583,9 @@ gtk_form_size_allocate(GtkWidget *widget
     if (GTK_WIDGET_REALIZED(widget))
 #endif
     {
-#if GTK_CHECK_VERSION(3,0,0)
 	gdk_window_move_resize(gtk_widget_get_window(widget),
 			       allocation->x, allocation->y,
 			       allocation->width, allocation->height);
-#else
-	gdk_window_move_resize(widget->window,
-			       allocation->x, allocation->y,
-			       allocation->width, allocation->height);
-#endif
 	gdk_window_move_resize(GTK_FORM(widget)->bin_window,
 			       0, 0,
 			       allocation->width, allocation->height);