comparison 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
comparison
equal deleted inserted replaced
14711:70c3e1dfcbee 14712:82e7ce311065
343 343
344 #if GTK_CHECK_VERSION(3,0,0) 344 #if GTK_CHECK_VERSION(3,0,0)
345 gtk_widget_set_window(widget, 345 gtk_widget_set_window(widget,
346 gdk_window_new(gtk_widget_get_parent_window(widget), 346 gdk_window_new(gtk_widget_get_parent_window(widget),
347 &attributes, attributes_mask)); 347 &attributes, attributes_mask));
348 gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
349 #else 348 #else
350 widget->window = gdk_window_new(gtk_widget_get_parent_window(widget), 349 widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
351 &attributes, attributes_mask); 350 &attributes, attributes_mask);
352 gdk_window_set_user_data(widget->window, widget); 351 #endif
353 #endif 352 gdk_window_set_user_data(gtk_widget_get_window(widget), widget);
354 353
355 attributes.x = 0; 354 attributes.x = 0;
356 attributes.y = 0; 355 attributes.y = 0;
357 attributes.event_mask = gtk_widget_get_events(widget); 356 attributes.event_mask = gtk_widget_get_events(widget);
358 357
359 #if GTK_CHECK_VERSION(3,0,0)
360 form->bin_window = gdk_window_new(gtk_widget_get_window(widget), 358 form->bin_window = gdk_window_new(gtk_widget_get_window(widget),
361 &attributes, attributes_mask); 359 &attributes, attributes_mask);
362 #else
363 form->bin_window = gdk_window_new(widget->window,
364 &attributes, attributes_mask);
365 #endif
366 gdk_window_set_user_data(form->bin_window, widget); 360 gdk_window_set_user_data(form->bin_window, widget);
367 361
368 #if GTK_CHECK_VERSION(3,0,0) 362 #if GTK_CHECK_VERSION(3,0,0)
369 { 363 {
370 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget); 364 GtkStyleContext * const sctx = gtk_widget_get_style_context(widget);
420 gtk_widget_set_mapped(widget, TRUE); 414 gtk_widget_set_mapped(widget, TRUE);
421 #else 415 #else
422 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); 416 GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
423 #endif 417 #endif
424 418
425 #if GTK_CHECK_VERSION(3,0,0)
426 gdk_window_show(gtk_widget_get_window(widget)); 419 gdk_window_show(gtk_widget_get_window(widget));
427 #else
428 gdk_window_show(widget->window);
429 #endif
430 gdk_window_show(form->bin_window); 420 gdk_window_show(form->bin_window);
431 421
432 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next) 422 for (tmp_list = form->children; tmp_list; tmp_list = tmp_list->next)
433 { 423 {
434 GtkFormChild *child = tmp_list->data; 424 GtkFormChild *child = tmp_list->data;
591 if (gtk_widget_get_realized(widget)) 581 if (gtk_widget_get_realized(widget))
592 #else 582 #else
593 if (GTK_WIDGET_REALIZED(widget)) 583 if (GTK_WIDGET_REALIZED(widget))
594 #endif 584 #endif
595 { 585 {
596 #if GTK_CHECK_VERSION(3,0,0)
597 gdk_window_move_resize(gtk_widget_get_window(widget), 586 gdk_window_move_resize(gtk_widget_get_window(widget),
598 allocation->x, allocation->y, 587 allocation->x, allocation->y,
599 allocation->width, allocation->height); 588 allocation->width, allocation->height);
600 #else
601 gdk_window_move_resize(widget->window,
602 allocation->x, allocation->y,
603 allocation->width, allocation->height);
604 #endif
605 gdk_window_move_resize(GTK_FORM(widget)->bin_window, 589 gdk_window_move_resize(GTK_FORM(widget)->bin_window,
606 0, 0, 590 0, 0,
607 allocation->width, allocation->height); 591 allocation->width, allocation->height);
608 } 592 }
609 #if GTK_CHECK_VERSION(3,0,0) 593 #if GTK_CHECK_VERSION(3,0,0)