comparison src/gui_gtk_x11.c @ 14800:40e19745ad12 v8.1.0412

patch 8.1.0412: cannot build with GTK 2.4 commit https://github.com/vim/vim/commit/92cbf62b872c2cfccb2fe4f9c46881c69d488c8a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 19 22:40:03 2018 +0200 patch 8.1.0412: cannot build with GTK 2.4 Problem: Cannot build with GTK 2.4. Solution: Add back a few #ifdefs. (Ken Takata, closes https://github.com/vim/vim/issues/3447) Also support older GTK. (Tom Christensen)
author Christian Brabandt <cb@256bit.org>
date Wed, 19 Sep 2018 22:45:05 +0200
parents 11978f68a8c3
children 27b9a84395b5
comparison
equal deleted inserted replaced
14799:4ad0a0a53290 14800:40e19745ad12
3413 { 3413 {
3414 if (!ignore_tabline_evt) 3414 if (!ignore_tabline_evt)
3415 send_tabline_event(idx + 1); 3415 send_tabline_event(idx + 1);
3416 } 3416 }
3417 3417
3418 # if GTK_CHECK_VERSION(2,10,0)
3418 /* 3419 /*
3419 * Handle reordering the tabs (using D&D). 3420 * Handle reordering the tabs (using D&D).
3420 */ 3421 */
3421 static void 3422 static void
3422 on_tab_reordered( 3423 on_tab_reordered(
3431 tabpage_move(idx + 1); 3432 tabpage_move(idx + 1);
3432 else 3433 else
3433 tabpage_move(idx); 3434 tabpage_move(idx);
3434 } 3435 }
3435 } 3436 }
3437 # endif
3436 3438
3437 /* 3439 /*
3438 * Show or hide the tabline. 3440 * Show or hide the tabline.
3439 */ 3441 */
3440 void 3442 void
3514 gtk_widget_show(label); 3516 gtk_widget_show(label);
3515 gtk_notebook_insert_page(GTK_NOTEBOOK(gui.tabline), 3517 gtk_notebook_insert_page(GTK_NOTEBOOK(gui.tabline),
3516 page, 3518 page,
3517 event_box, 3519 event_box,
3518 nr++); 3520 nr++);
3521 # if GTK_CHECK_VERSION(2,10,0)
3519 gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), 3522 gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline),
3520 page, 3523 page,
3521 TRUE); 3524 TRUE);
3525 # endif
3522 } 3526 }
3523 3527
3524 event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page); 3528 event_box = gtk_notebook_get_tab_label(GTK_NOTEBOOK(gui.tabline), page);
3525 g_object_set_data(G_OBJECT(event_box), "tab_num", 3529 g_object_set_data(G_OBJECT(event_box), "tab_num",
3526 GINT_TO_POINTER(tab_num)); 3530 GINT_TO_POINTER(tab_num));
3912 # if !GTK_CHECK_VERSION(3,14,0) 3916 # if !GTK_CHECK_VERSION(3,14,0)
3913 gtk_misc_set_padding(GTK_MISC(label), 2, 2); 3917 gtk_misc_set_padding(GTK_MISC(label), 2, 2);
3914 # endif 3918 # endif
3915 gtk_container_add(GTK_CONTAINER(event_box), label); 3919 gtk_container_add(GTK_CONTAINER(event_box), label);
3916 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, event_box); 3920 gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, event_box);
3921 # if GTK_CHECK_VERSION(2,10,0)
3917 gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE); 3922 gtk_notebook_set_tab_reorderable(GTK_NOTEBOOK(gui.tabline), page, TRUE);
3923 # endif
3918 } 3924 }
3919 3925
3920 g_signal_connect(G_OBJECT(gui.tabline), "switch-page", 3926 g_signal_connect(G_OBJECT(gui.tabline), "switch-page",
3921 G_CALLBACK(on_select_tab), NULL); 3927 G_CALLBACK(on_select_tab), NULL);
3928 # if GTK_CHECK_VERSION(2,10,0)
3922 g_signal_connect(G_OBJECT(gui.tabline), "page-reordered", 3929 g_signal_connect(G_OBJECT(gui.tabline), "page-reordered",
3923 G_CALLBACK(on_tab_reordered), NULL); 3930 G_CALLBACK(on_tab_reordered), NULL);
3931 # endif
3924 3932
3925 /* Create a popup menu for the tab line and connect it. */ 3933 /* Create a popup menu for the tab line and connect it. */
3926 tabline_menu = create_tabline_menu(); 3934 tabline_menu = create_tabline_menu();
3927 g_signal_connect_swapped(G_OBJECT(gui.tabline), "button-press-event", 3935 g_signal_connect_swapped(G_OBJECT(gui.tabline), "button-press-event",
3928 G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu)); 3936 G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu));
6393 /* Flush any output to the screen */ 6401 /* Flush any output to the screen */
6394 void 6402 void
6395 gui_mch_flush(void) 6403 gui_mch_flush(void)
6396 { 6404 {
6397 if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin)) 6405 if (gui.mainwin != NULL && gtk_widget_get_realized(gui.mainwin))
6406 #if GTK_CHECK_VERSION(2,4,0)
6398 gdk_display_flush(gtk_widget_get_display(gui.mainwin)); 6407 gdk_display_flush(gtk_widget_get_display(gui.mainwin));
6408 #else
6409 gdk_display_sync(gtk_widget_get_display(gui.mainwin));
6410 #endif
6399 } 6411 }
6400 6412
6401 /* 6413 /*
6402 * Clear a rectangular region of the screen from text pos (row1, col1) to 6414 * Clear a rectangular region of the screen from text pos (row1, col1) to
6403 * (row2, col2) inclusive. 6415 * (row2, col2) inclusive.