comparison src/gui_gtk_x11.c @ 1884:3dd986bfef63 v7.2.181

updated for version 7.2-181
author vimboss
date Sun, 17 May 2009 14:24:23 +0000
parents f10fe14748e2
children 430f555d7d15
comparison
equal deleted inserted replaced
1883:c8f343a465a2 1884:3dd986bfef63
617 /* 617 /*
618 * This should be maybe completely removed. 618 * This should be maybe completely removed.
619 * Doesn't seem possible, since check_copy_area() relies on 619 * Doesn't seem possible, since check_copy_area() relies on
620 * this information. --danielk 620 * this information. --danielk
621 */ 621 */
622 /*ARGSUSED*/
623 static gint 622 static gint
624 visibility_event(GtkWidget *widget, GdkEventVisibility *event, gpointer data) 623 visibility_event(GtkWidget *widget UNUSED,
624 GdkEventVisibility *event,
625 gpointer data UNUSED)
625 { 626 {
626 gui.visibility = event->state; 627 gui.visibility = event->state;
627 /* 628 /*
628 * When we do an gdk_window_copy_area(), and the window is partially 629 * When we do an gdk_window_copy_area(), and the window is partially
629 * obscured, we want to receive an event to tell us whether it worked 630 * obscured, we want to receive an event to tell us whether it worked
636 } 637 }
637 638
638 /* 639 /*
639 * Redraw the corresponding portions of the screen. 640 * Redraw the corresponding portions of the screen.
640 */ 641 */
641 /*ARGSUSED*/
642 static gint 642 static gint
643 expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) 643 expose_event(GtkWidget *widget UNUSED,
644 GdkEventExpose *event,
645 gpointer data UNUSED)
644 { 646 {
645 /* Skip this when the GUI isn't set up yet, will redraw later. */ 647 /* Skip this when the GUI isn't set up yet, will redraw later. */
646 if (gui.starting) 648 if (gui.starting)
647 return FALSE; 649 return FALSE;
648 650
666 668
667 #ifdef FEAT_CLIENTSERVER 669 #ifdef FEAT_CLIENTSERVER
668 /* 670 /*
669 * Handle changes to the "Comm" property 671 * Handle changes to the "Comm" property
670 */ 672 */
671 /*ARGSUSED2*/
672 static gint 673 static gint
673 property_event(GtkWidget *widget, GdkEventProperty *event, gpointer data) 674 property_event(GtkWidget *widget,
675 GdkEventProperty *event,
676 gpointer data UNUSED)
674 { 677 {
675 if (event->type == GDK_PROPERTY_NOTIFY 678 if (event->type == GDK_PROPERTY_NOTIFY
676 && event->state == (int)GDK_PROPERTY_NEW_VALUE 679 && event->state == (int)GDK_PROPERTY_NEW_VALUE
677 && GDK_WINDOW_XWINDOW(event->window) == commWindow 680 && GDK_WINDOW_XWINDOW(event->window) == commWindow
678 && GET_X_ATOM(event->atom) == commProperty) 681 && GET_X_ATOM(event->atom) == commProperty)
738 if (blink_state == BLINK_OFF) 741 if (blink_state == BLINK_OFF)
739 gui_update_cursor(TRUE, FALSE); 742 gui_update_cursor(TRUE, FALSE);
740 blink_state = BLINK_NONE; 743 blink_state = BLINK_NONE;
741 } 744 }
742 745
743 /*ARGSUSED*/
744 static gint 746 static gint
745 blink_cb(gpointer data) 747 blink_cb(gpointer data UNUSED)
746 { 748 {
747 if (blink_state == BLINK_ON) 749 if (blink_state == BLINK_ON)
748 { 750 {
749 gui_undraw_cursor(); 751 gui_undraw_cursor();
750 blink_state = BLINK_OFF; 752 blink_state = BLINK_OFF;
779 blink_state = BLINK_ON; 781 blink_state = BLINK_ON;
780 gui_update_cursor(TRUE, FALSE); 782 gui_update_cursor(TRUE, FALSE);
781 } 783 }
782 } 784 }
783 785
784 /*ARGSUSED*/
785 static gint 786 static gint
786 enter_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data) 787 enter_notify_event(GtkWidget *widget UNUSED,
788 GdkEventCrossing *event UNUSED,
789 gpointer data UNUSED)
787 { 790 {
788 if (blink_state == BLINK_NONE) 791 if (blink_state == BLINK_NONE)
789 gui_mch_start_blink(); 792 gui_mch_start_blink();
790 793
791 /* make sure keyboard input goes there */ 794 /* make sure keyboard input goes there */
793 gtk_widget_grab_focus(gui.drawarea); 796 gtk_widget_grab_focus(gui.drawarea);
794 797
795 return FALSE; 798 return FALSE;
796 } 799 }
797 800
798 /*ARGSUSED*/
799 static gint 801 static gint
800 leave_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data) 802 leave_notify_event(GtkWidget *widget UNUSED,
803 GdkEventCrossing *event UNUSED,
804 gpointer data UNUSED)
801 { 805 {
802 if (blink_state != BLINK_NONE) 806 if (blink_state != BLINK_NONE)
803 gui_mch_stop_blink(); 807 gui_mch_stop_blink();
804 808
805 return FALSE; 809 return FALSE;
806 } 810 }
807 811
808 /*ARGSUSED*/
809 static gint 812 static gint
810 focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data) 813 focus_in_event(GtkWidget *widget,
814 GdkEventFocus *event UNUSED,
815 gpointer data UNUSED)
811 { 816 {
812 gui_focus_change(TRUE); 817 gui_focus_change(TRUE);
813 818
814 if (blink_state == BLINK_NONE) 819 if (blink_state == BLINK_NONE)
815 gui_mch_start_blink(); 820 gui_mch_start_blink();
824 gtk_main_quit(); 829 gtk_main_quit();
825 830
826 return TRUE; 831 return TRUE;
827 } 832 }
828 833
829 /*ARGSUSED*/
830 static gint 834 static gint
831 focus_out_event(GtkWidget *widget, GdkEventFocus *event, gpointer data) 835 focus_out_event(GtkWidget *widget UNUSED,
836 GdkEventFocus *event UNUSED,
837 gpointer data UNUSED)
832 { 838 {
833 gui_focus_change(FALSE); 839 gui_focus_change(FALSE);
834 840
835 if (blink_state != BLINK_NONE) 841 if (blink_state != BLINK_NONE)
836 gui_mch_stop_blink(); 842 gui_mch_stop_blink();
954 } 960 }
955 961
956 /* 962 /*
957 * Main keyboard handler: 963 * Main keyboard handler:
958 */ 964 */
959 /*ARGSUSED*/
960 static gint 965 static gint
961 key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data) 966 key_press_event(GtkWidget *widget UNUSED,
967 GdkEventKey *event,
968 gpointer data UNUSED)
962 { 969 {
963 #ifdef HAVE_GTK2 970 #ifdef HAVE_GTK2
964 /* 256 bytes is way over the top, but for safety let's reduce it only 971 /* 256 bytes is way over the top, but for safety let's reduce it only
965 * for GTK+ 2 where we know for sure how large the string might get. 972 * for GTK+ 2 where we know for sure how large the string might get.
966 * (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) */ 973 * (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) */
1223 1230
1224 return TRUE; 1231 return TRUE;
1225 } 1232 }
1226 1233
1227 #if defined(FEAT_XIM) && defined(HAVE_GTK2) 1234 #if defined(FEAT_XIM) && defined(HAVE_GTK2)
1228 /*ARGSUSED0*/
1229 static gboolean 1235 static gboolean
1230 key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer data) 1236 key_release_event(GtkWidget *widget UNUSED,
1237 GdkEventKey *event,
1238 gpointer data UNUSED)
1231 { 1239 {
1232 /* 1240 /*
1233 * GTK+ 2 input methods may do fancy stuff on key release events too. 1241 * GTK+ 2 input methods may do fancy stuff on key release events too.
1234 * With the default IM for instance, you can enter any UCS code point 1242 * With the default IM for instance, you can enter any UCS code point
1235 * by holding down CTRL-SHIFT and typing hexadecimal digits. 1243 * by holding down CTRL-SHIFT and typing hexadecimal digits.
1241 1249
1242 /**************************************************************************** 1250 /****************************************************************************
1243 * Selection handlers: 1251 * Selection handlers:
1244 */ 1252 */
1245 1253
1246 /*ARGSUSED*/
1247 static gint 1254 static gint
1248 selection_clear_event(GtkWidget *widget, 1255 selection_clear_event(GtkWidget *widget UNUSED,
1249 GdkEventSelection *event, 1256 GdkEventSelection *event,
1250 gpointer user_data) 1257 gpointer user_data UNUSED)
1251 { 1258 {
1252 if (event->selection == clip_plus.gtk_sel_atom) 1259 if (event->selection == clip_plus.gtk_sel_atom)
1253 clip_lose_selection(&clip_plus); 1260 clip_lose_selection(&clip_plus);
1254 else 1261 else
1255 clip_lose_selection(&clip_star); 1262 clip_lose_selection(&clip_star);
1263 #define RS_NONE 0 /* selection_received_cb() not called yet */ 1270 #define RS_NONE 0 /* selection_received_cb() not called yet */
1264 #define RS_OK 1 /* selection_received_cb() called and OK */ 1271 #define RS_OK 1 /* selection_received_cb() called and OK */
1265 #define RS_FAIL 2 /* selection_received_cb() called and failed */ 1272 #define RS_FAIL 2 /* selection_received_cb() called and failed */
1266 static int received_selection = RS_NONE; 1273 static int received_selection = RS_NONE;
1267 1274
1268 /*ARGSUSED*/
1269 static void 1275 static void
1270 selection_received_cb(GtkWidget *widget, 1276 selection_received_cb(GtkWidget *widget UNUSED,
1271 GtkSelectionData *data, 1277 GtkSelectionData *data,
1272 guint time_, 1278 guint time_ UNUSED,
1273 gpointer user_data) 1279 gpointer user_data UNUSED)
1274 { 1280 {
1275 VimClipboard *cbd; 1281 VimClipboard *cbd;
1276 char_u *text; 1282 char_u *text;
1277 char_u *tmpbuf = NULL; 1283 char_u *tmpbuf = NULL;
1278 #ifdef HAVE_GTK2 1284 #ifdef HAVE_GTK2
1412 1418
1413 /* 1419 /*
1414 * Prepare our selection data for passing it to the external selection 1420 * Prepare our selection data for passing it to the external selection
1415 * client. 1421 * client.
1416 */ 1422 */
1417 /*ARGSUSED*/
1418 static void 1423 static void
1419 selection_get_cb(GtkWidget *widget, 1424 selection_get_cb(GtkWidget *widget UNUSED,
1420 GtkSelectionData *selection_data, 1425 GtkSelectionData *selection_data,
1421 guint info, 1426 guint info,
1422 guint time_, 1427 guint time_ UNUSED,
1423 gpointer user_data) 1428 gpointer user_data UNUSED)
1424 { 1429 {
1425 char_u *string; 1430 char_u *string;
1426 char_u *tmpbuf; 1431 char_u *tmpbuf;
1427 long_u tmplen; 1432 long_u tmplen;
1428 int length; 1433 int length;
1676 dx = x < 0 ? -x : x - gui.drawarea->allocation.width; 1681 dx = x < 0 ? -x : x - gui.drawarea->allocation.width;
1677 dy = y < 0 ? -y : y - gui.drawarea->allocation.height; 1682 dy = y < 0 ? -y : y - gui.drawarea->allocation.height;
1678 1683
1679 offshoot = dx > dy ? dx : dy; 1684 offshoot = dx > dy ? dx : dy;
1680 1685
1681 /* Make a linearly declaying timer delay with a threshold of 5 at a 1686 /* Make a linearly decaying timer delay with a threshold of 5 at a
1682 * distance of 127 pixels from the main window. 1687 * distance of 127 pixels from the main window.
1683 * 1688 *
1684 * One could think endlessly about the most ergonomic variant here. 1689 * One could think endlessly about the most ergonomic variant here.
1685 * For example it could make sense to calculate the distance from the 1690 * For example it could make sense to calculate the distance from the
1686 * drags start instead... 1691 * drags start instead...
1705 } 1710 }
1706 1711
1707 /* 1712 /*
1708 * Timer used to recognize multiple clicks of the mouse button. 1713 * Timer used to recognize multiple clicks of the mouse button.
1709 */ 1714 */
1710 /*ARGSUSED0*/
1711 static gint 1715 static gint
1712 motion_repeat_timer_cb(gpointer data) 1716 motion_repeat_timer_cb(gpointer data UNUSED)
1713 { 1717 {
1714 int x; 1718 int x;
1715 int y; 1719 int y;
1716 GdkModifierType state; 1720 GdkModifierType state;
1717 1721
1747 /* Don't happen again. We will get reinstalled in the synthetic event 1751 /* Don't happen again. We will get reinstalled in the synthetic event
1748 * if needed -- thus repeating should still work. */ 1752 * if needed -- thus repeating should still work. */
1749 return FALSE; 1753 return FALSE;
1750 } 1754 }
1751 1755
1752 /*ARGSUSED2*/
1753 static gint 1756 static gint
1754 motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) 1757 motion_notify_event(GtkWidget *widget,
1758 GdkEventMotion *event,
1759 gpointer data UNUSED)
1755 { 1760 {
1756 if (event->is_hint) 1761 if (event->is_hint)
1757 { 1762 {
1758 int x; 1763 int x;
1759 int y; 1764 int y;
1775 /* 1780 /*
1776 * Mouse button handling. Note please that we are capturing multiple click's 1781 * Mouse button handling. Note please that we are capturing multiple click's
1777 * by our own timeout mechanism instead of the one provided by GTK+ itself. 1782 * by our own timeout mechanism instead of the one provided by GTK+ itself.
1778 * This is due to the way the generic VIM code is recognizing multiple clicks. 1783 * This is due to the way the generic VIM code is recognizing multiple clicks.
1779 */ 1784 */
1780 /*ARGSUSED2*/
1781 static gint 1785 static gint
1782 button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) 1786 button_press_event(GtkWidget *widget,
1787 GdkEventButton *event,
1788 gpointer data UNUSED)
1783 { 1789 {
1784 int button; 1790 int button;
1785 int repeated_click = FALSE; 1791 int repeated_click = FALSE;
1786 int x, y; 1792 int x, y;
1787 int_u vim_modifiers; 1793 int_u vim_modifiers;
1853 #ifdef HAVE_GTK2 1859 #ifdef HAVE_GTK2
1854 /* 1860 /*
1855 * GTK+ 2 doesn't handle mouse buttons 4, 5, 6 and 7 the same way as GTK+ 1. 1861 * GTK+ 2 doesn't handle mouse buttons 4, 5, 6 and 7 the same way as GTK+ 1.
1856 * Instead, it abstracts scrolling via the new GdkEventScroll. 1862 * Instead, it abstracts scrolling via the new GdkEventScroll.
1857 */ 1863 */
1858 /*ARGSUSED2*/
1859 static gboolean 1864 static gboolean
1860 scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) 1865 scroll_event(GtkWidget *widget,
1866 GdkEventScroll *event,
1867 gpointer data UNUSED)
1861 { 1868 {
1862 int button; 1869 int button;
1863 int_u vim_modifiers; 1870 int_u vim_modifiers;
1864 1871
1865 if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget)) 1872 if (gtk_socket_id != 0 && !GTK_WIDGET_HAS_FOCUS(widget))
1894 return TRUE; 1901 return TRUE;
1895 } 1902 }
1896 #endif /* HAVE_GTK2 */ 1903 #endif /* HAVE_GTK2 */
1897 1904
1898 1905
1899 /*ARGSUSED*/
1900 static gint 1906 static gint
1901 button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) 1907 button_release_event(GtkWidget *widget UNUSED,
1908 GdkEventButton *event,
1909 gpointer data UNUSED)
1902 { 1910 {
1903 int x, y; 1911 int x, y;
1904 int_u vim_modifiers; 1912 int_u vim_modifiers;
1905 1913
1906 /* Remove any motion "machine gun" timers used for automatic further 1914 /* Remove any motion "machine gun" timers used for automatic further
2098 } 2106 }
2099 2107
2100 /* 2108 /*
2101 * DND receiver. 2109 * DND receiver.
2102 */ 2110 */
2103 /*ARGSUSED2*/
2104 static void 2111 static void
2105 drag_data_received_cb(GtkWidget *widget, 2112 drag_data_received_cb(GtkWidget *widget,
2106 GdkDragContext *context, 2113 GdkDragContext *context,
2107 gint x, 2114 gint x,
2108 gint y, 2115 gint y,
2109 GtkSelectionData *data, 2116 GtkSelectionData *data,
2110 guint info, 2117 guint info,
2111 guint time_, 2118 guint time_,
2112 gpointer user_data) 2119 gpointer user_data UNUSED)
2113 { 2120 {
2114 GdkModifierType state; 2121 GdkModifierType state;
2115 2122
2116 /* Guard against trash */ 2123 /* Guard against trash */
2117 if (data->data == NULL 2124 if (data->data == NULL
2141 /* 2148 /*
2142 * GnomeClient interact callback. Check for unsaved buffers that cannot 2149 * GnomeClient interact callback. Check for unsaved buffers that cannot
2143 * be abandoned and pop up a dialog asking the user for confirmation if 2150 * be abandoned and pop up a dialog asking the user for confirmation if
2144 * necessary. 2151 * necessary.
2145 */ 2152 */
2146 /*ARGSUSED0*/
2147 static void 2153 static void
2148 sm_client_check_changed_any(GnomeClient *client, 2154 sm_client_check_changed_any(GnomeClient *client,
2149 gint key, 2155 gint key,
2150 GnomeDialogType type, 2156 GnomeDialogType type,
2151 gpointer data) 2157 gpointer data)
2249 /* 2255 /*
2250 * "save_yourself" signal handler. Initiate an interaction to ask the user 2256 * "save_yourself" signal handler. Initiate an interaction to ask the user
2251 * for confirmation if necessary. Save the current editing session and tell 2257 * for confirmation if necessary. Save the current editing session and tell
2252 * the session manager how to restart Vim. 2258 * the session manager how to restart Vim.
2253 */ 2259 */
2254 /*ARGSUSED1*/
2255 static gboolean 2260 static gboolean
2256 sm_client_save_yourself(GnomeClient *client, 2261 sm_client_save_yourself(GnomeClient *client,
2257 gint phase, 2262 gint phase,
2258 GnomeSaveStyle save_style, 2263 GnomeSaveStyle save_style,
2259 gboolean shutdown, 2264 gboolean shutdown,
2337 /* 2342 /*
2338 * Called when the session manager wants us to die. There isn't much to save 2343 * Called when the session manager wants us to die. There isn't much to save
2339 * here since "save_yourself" has been emitted before (unless serious trouble 2344 * here since "save_yourself" has been emitted before (unless serious trouble
2340 * is happening). 2345 * is happening).
2341 */ 2346 */
2342 /*ARGSUSED0*/
2343 static void 2347 static void
2344 sm_client_die(GnomeClient *client, gpointer data) 2348 sm_client_die(GnomeClient *client, gpointer data)
2345 { 2349 {
2346 /* Don't write messages to the GUI anymore */ 2350 /* Don't write messages to the GUI anymore */
2347 full_screen = FALSE; 2351 full_screen = FALSE;
2377 2381
2378 # ifdef USE_XSMP 2382 # ifdef USE_XSMP
2379 /* 2383 /*
2380 * GTK tells us that XSMP needs attention 2384 * GTK tells us that XSMP needs attention
2381 */ 2385 */
2382 /*ARGSUSED*/
2383 static gboolean 2386 static gboolean
2384 local_xsmp_handle_requests(source, condition, data) 2387 local_xsmp_handle_requests(source, condition, data)
2385 GIOChannel *source; 2388 GIOChannel *source UNUSED;
2386 GIOCondition condition; 2389 GIOCondition condition;
2387 gpointer data; 2390 gpointer data;
2388 { 2391 {
2389 if (condition == G_IO_IN) 2392 if (condition == G_IO_IN)
2390 { 2393 {
2478 * 2481 *
2479 * The GNOME session support is much cooler anyway. Unlike this ugly 2482 * The GNOME session support is much cooler anyway. Unlike this ugly
2480 * WM_SAVE_YOURSELF hack it actually stores the session... And yes, 2483 * WM_SAVE_YOURSELF hack it actually stores the session... And yes,
2481 * it should work with KDE as well. 2484 * it should work with KDE as well.
2482 */ 2485 */
2483 /*ARGSUSED1*/
2484 static GdkFilterReturn 2486 static GdkFilterReturn
2485 global_event_filter(GdkXEvent *xev, GdkEvent *event, gpointer data) 2487 global_event_filter(GdkXEvent *xev,
2488 GdkEvent *event UNUSED,
2489 gpointer data UNUSED)
2486 { 2490 {
2487 XEvent *xevent = (XEvent *)xev; 2491 XEvent *xevent = (XEvent *)xev;
2488 2492
2489 if (xevent != NULL 2493 if (xevent != NULL
2490 && xevent->type == ClientMessage 2494 && xevent->type == ClientMessage
2491 && xevent->xclient.message_type == GET_X_ATOM(wm_protocols_atom) 2495 && xevent->xclient.message_type == GET_X_ATOM(wm_protocols_atom)
2492 && xevent->xclient.data.l[0] == GET_X_ATOM(save_yourself_atom)) 2496 && (long_u)xevent->xclient.data.l[0]
2497 == GET_X_ATOM(save_yourself_atom))
2493 { 2498 {
2494 out_flush(); 2499 out_flush();
2495 ml_sync_all(FALSE, FALSE); /* preserve all swap files */ 2500 ml_sync_all(FALSE, FALSE); /* preserve all swap files */
2496 /* 2501 /*
2497 * Set the window's WM_COMMAND property, to let the window manager 2502 * Set the window's WM_COMMAND property, to let the window manager
2510 # else /* !HAVE_GTK2 */ 2515 # else /* !HAVE_GTK2 */
2511 2516
2512 /* 2517 /*
2513 * GDK handler for X ClientMessage events. 2518 * GDK handler for X ClientMessage events.
2514 */ 2519 */
2515 /*ARGSUSED2*/
2516 static GdkFilterReturn 2520 static GdkFilterReturn
2517 gdk_wm_protocols_filter(GdkXEvent *xev, GdkEvent *event, gpointer data) 2521 gdk_wm_protocols_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
2518 { 2522 {
2519 /* From example in gdkevents.c/gdk_wm_protocols_filter */ 2523 /* From example in gdkevents.c/gdk_wm_protocols_filter */
2520 XEvent *xevent = (XEvent *)xev; 2524 XEvent *xevent = (XEvent *)xev;
2556 2560
2557 2561
2558 /* 2562 /*
2559 * Setup the window icon & xcmdsrv comm after the main window has been realized. 2563 * Setup the window icon & xcmdsrv comm after the main window has been realized.
2560 */ 2564 */
2561 /*ARGSUSED*/
2562 static void 2565 static void
2563 mainwin_realize(GtkWidget *widget, gpointer data) 2566 mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
2564 { 2567 {
2565 /* If you get an error message here, you still need to unpack the runtime 2568 /* If you get an error message here, you still need to unpack the runtime
2566 * archive! */ 2569 * archive! */
2567 #ifdef magick 2570 #ifdef magick
2568 # undef magick 2571 # undef magick
2710 2713
2711 return cursor; 2714 return cursor;
2712 } 2715 }
2713 2716
2714 #ifdef HAVE_GTK_MULTIHEAD 2717 #ifdef HAVE_GTK_MULTIHEAD
2715 /*ARGSUSED1*/
2716 static void 2718 static void
2717 mainwin_screen_changed_cb(GtkWidget *widget, 2719 mainwin_screen_changed_cb(GtkWidget *widget,
2718 GdkScreen *previous_screen, 2720 GdkScreen *previous_screen UNUSED,
2719 gpointer data) 2721 gpointer data UNUSED)
2720 { 2722 {
2721 if (!gtk_widget_has_screen(widget)) 2723 if (!gtk_widget_has_screen(widget))
2722 return; 2724 return;
2723 2725
2724 /* 2726 /*
2755 * dummy blank cursor. 2757 * dummy blank cursor.
2756 * 2758 *
2757 * Don't try to set any VIM scrollbar sizes anywhere here. I'm relying on the 2759 * Don't try to set any VIM scrollbar sizes anywhere here. I'm relying on the
2758 * fact that the main VIM engine doesn't take them into account anywhere. 2760 * fact that the main VIM engine doesn't take them into account anywhere.
2759 */ 2761 */
2760 /*ARGSUSED1*/
2761 static void 2762 static void
2762 drawarea_realize_cb(GtkWidget *widget, gpointer data) 2763 drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
2763 { 2764 {
2764 GtkWidget *sbar; 2765 GtkWidget *sbar;
2765 2766
2766 #ifdef FEAT_XIM 2767 #ifdef FEAT_XIM
2767 xim_init(); 2768 xim_init();
2787 } 2788 }
2788 2789
2789 /* 2790 /*
2790 * Properly clean up on shutdown. 2791 * Properly clean up on shutdown.
2791 */ 2792 */
2792 /*ARGSUSED0*/
2793 static void 2793 static void
2794 drawarea_unrealize_cb(GtkWidget *widget, gpointer data) 2794 drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
2795 { 2795 {
2796 /* Don't write messages to the GUI anymore */ 2796 /* Don't write messages to the GUI anymore */
2797 full_screen = FALSE; 2797 full_screen = FALSE;
2798 2798
2799 #ifdef FEAT_XIM 2799 #ifdef FEAT_XIM
2825 gdk_cursor_destroy(gui.blank_pointer); 2825 gdk_cursor_destroy(gui.blank_pointer);
2826 gui.blank_pointer = NULL; 2826 gui.blank_pointer = NULL;
2827 #endif 2827 #endif
2828 } 2828 }
2829 2829
2830 /*ARGSUSED0*/
2831 static void 2830 static void
2832 drawarea_style_set_cb(GtkWidget *widget, 2831 drawarea_style_set_cb(GtkWidget *widget UNUSED,
2833 GtkStyle *previous_style, 2832 GtkStyle *previous_style UNUSED,
2834 gpointer data) 2833 gpointer data UNUSED)
2835 { 2834 {
2836 gui_mch_new_colors(); 2835 gui_mch_new_colors();
2837 } 2836 }
2838 2837
2839 /* 2838 /*
2840 * Callback routine for the "delete_event" signal on the toplevel window. 2839 * Callback routine for the "delete_event" signal on the toplevel window.
2841 * Tries to vim gracefully, or refuses to exit with changed buffers. 2840 * Tries to vim gracefully, or refuses to exit with changed buffers.
2842 */ 2841 */
2843 /*ARGSUSED*/
2844 static gint 2842 static gint
2845 delete_event_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) 2843 delete_event_cb(GtkWidget *widget UNUSED,
2844 GdkEventAny *event UNUSED,
2845 gpointer data UNUSED)
2846 { 2846 {
2847 gui_shell_closed(); 2847 gui_shell_closed();
2848 return TRUE; 2848 return TRUE;
2849 } 2849 }
2850 2850
2962 int min_width; 2962 int min_width;
2963 int min_height; 2963 int min_height;
2964 2964
2965 /* At start-up, don't try to set the hints until the initial 2965 /* At start-up, don't try to set the hints until the initial
2966 * values have been used (those that dictate our initial size) 2966 * values have been used (those that dictate our initial size)
2967 * Let forced (i.e., correct) values thruogh always. 2967 * Let forced (i.e., correct) values through always.
2968 */ 2968 */
2969 if (!(force_width && force_height) && init_window_hints_state > 0) 2969 if (!(force_width && force_height) && init_window_hints_state > 0)
2970 { 2970 {
2971 /* Don't do it! */ 2971 /* Don't do it! */
2972 init_window_hints_state = 2; 2972 init_window_hints_state = 2;
3140 static int clicked_page; /* page clicked in tab line */ 3140 static int clicked_page; /* page clicked in tab line */
3141 3141
3142 /* 3142 /*
3143 * Handle selecting an item in the tab line popup menu. 3143 * Handle selecting an item in the tab line popup menu.
3144 */ 3144 */
3145 /*ARGSUSED*/
3146 static void 3145 static void
3147 tabline_menu_handler(GtkMenuItem *item, gpointer user_data) 3146 tabline_menu_handler(GtkMenuItem *item UNUSED, gpointer user_data)
3148 { 3147 {
3149 /* Add the string cmd into input buffer */ 3148 /* Add the string cmd into input buffer */
3150 send_tabline_menu_event(clicked_page, (int)(long)user_data); 3149 send_tabline_menu_event(clicked_page, (int)(long)user_data);
3151 3150
3152 if (gtk_main_level() > 0) 3151 if (gtk_main_level() > 0)
3242 } 3241 }
3243 3242
3244 /* 3243 /*
3245 * Handle selecting one of the tabs. 3244 * Handle selecting one of the tabs.
3246 */ 3245 */
3247 /*ARGSUSED*/
3248 static void 3246 static void
3249 on_select_tab( 3247 on_select_tab(
3250 GtkNotebook *notebook, 3248 GtkNotebook *notebook UNUSED,
3251 GtkNotebookPage *page, 3249 GtkNotebookPage *page UNUSED,
3252 gint idx, 3250 gint idx,
3253 gpointer data) 3251 gpointer data UNUSED)
3254 { 3252 {
3255 if (!ignore_tabline_evt) 3253 if (!ignore_tabline_evt)
3256 { 3254 {
3257 if (send_tabline_event(idx + 1) && gtk_main_level() > 0) 3255 if (send_tabline_event(idx + 1) && gtk_main_level() > 0)
3258 gtk_main_quit(); 3256 gtk_main_quit();
3782 wm_protocols_atom = gdk_atom_intern("WM_PROTOCOLS", FALSE); 3780 wm_protocols_atom = gdk_atom_intern("WM_PROTOCOLS", FALSE);
3783 save_yourself_atom = gdk_atom_intern("WM_SAVE_YOURSELF", FALSE); 3781 save_yourself_atom = gdk_atom_intern("WM_SAVE_YOURSELF", FALSE);
3784 #endif 3782 #endif
3785 3783
3786 if (gtk_socket_id != 0) 3784 if (gtk_socket_id != 0)
3787 /* make sure keybord input can go to the drawarea */ 3785 /* make sure keyboard input can go to the drawarea */
3788 GTK_WIDGET_SET_FLAGS(gui.drawarea, GTK_CAN_FOCUS); 3786 GTK_WIDGET_SET_FLAGS(gui.drawarea, GTK_CAN_FOCUS);
3789 3787
3790 /* 3788 /*
3791 * Set clipboard specific atoms 3789 * Set clipboard specific atoms
3792 */ 3790 */
3920 } 3918 }
3921 3919
3922 /* 3920 /*
3923 * This signal informs us about the need to rearrange our sub-widgets. 3921 * This signal informs us about the need to rearrange our sub-widgets.
3924 */ 3922 */
3925 /*ARGSUSED*/
3926 static gint 3923 static gint
3927 form_configure_event(GtkWidget *widget, GdkEventConfigure *event, 3924 form_configure_event(GtkWidget *widget UNUSED,
3928 gpointer data) 3925 GdkEventConfigure *event,
3926 gpointer data UNUSED)
3929 { 3927 {
3930 int usable_height = event->height; 3928 int usable_height = event->height;
3931 3929
3932 /* When in a GtkPlug, we can't guarantee valid heights (as a round 3930 /* When in a GtkPlug, we can't guarantee valid heights (as a round
3933 * no. of char-heights), so we have to manually sanitise them. 3931 * no. of char-heights), so we have to manually sanitise them.
3946 /* 3944 /*
3947 * Function called when window already closed. 3945 * Function called when window already closed.
3948 * We can't do much more here than to trying to preserve what had been done, 3946 * We can't do much more here than to trying to preserve what had been done,
3949 * since the window is already inevitably going away. 3947 * since the window is already inevitably going away.
3950 */ 3948 */
3951 /*ARGSUSED0*/
3952 static void 3949 static void
3953 mainwin_destroy_cb(GtkObject *object, gpointer data) 3950 mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED)
3954 { 3951 {
3955 /* Don't write messages to the GUI anymore */ 3952 /* Don't write messages to the GUI anymore */
3956 full_screen = FALSE; 3953 full_screen = FALSE;
3957 3954
3958 gui.mainwin = NULL; 3955 gui.mainwin = NULL;
3978 * Thus set hints at start-up to ensure correct init. size, then a 3975 * Thus set hints at start-up to ensure correct init. size, then a
3979 * second after the final attempt to reset the real minimum hinst (done by 3976 * second after the final attempt to reset the real minimum hinst (done by
3980 * scrollbar init.), actually do the standard hinst and stop the timer. 3977 * scrollbar init.), actually do the standard hinst and stop the timer.
3981 * We'll not let the default hints be set while this timer's active. 3978 * We'll not let the default hints be set while this timer's active.
3982 */ 3979 */
3983 /*ARGSUSED*/
3984 static gboolean 3980 static gboolean
3985 check_startup_plug_hints(gpointer data) 3981 check_startup_plug_hints(gpointer data UNUSED)
3986 { 3982 {
3987 if (init_window_hints_state == 1) 3983 if (init_window_hints_state == 1)
3988 { 3984 {
3989 /* Safe to use normal hints now */ 3985 /* Safe to use normal hints now */
3990 init_window_hints_state = 0; 3986 init_window_hints_state = 0;
4053 4049
4054 if (mask & WidthValue) 4050 if (mask & WidthValue)
4055 Columns = w; 4051 Columns = w;
4056 if (mask & HeightValue) 4052 if (mask & HeightValue)
4057 { 4053 {
4058 if (p_window > h - 1 || !option_was_set((char_u *)"window")) 4054 if (p_window > (long)h - 1 || !option_was_set((char_u *)"window"))
4059 p_window = h - 1; 4055 p_window = h - 1;
4060 Rows = h; 4056 Rows = h;
4061 } 4057 }
4062 4058
4063 pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width); 4059 pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
4227 4223
4228 return OK; 4224 return OK;
4229 } 4225 }
4230 4226
4231 4227
4232 /*ARGSUSED0*/
4233 void 4228 void
4234 gui_mch_exit(int rc) 4229 gui_mch_exit(int rc UNUSED)
4235 { 4230 {
4236 if (gui.mainwin != NULL) 4231 if (gui.mainwin != NULL)
4237 gtk_widget_destroy(gui.mainwin); 4232 gtk_widget_destroy(gui.mainwin);
4238 4233
4239 if (gtk_main_level() > 0) 4234 if (gtk_main_level() > 0)
4284 * DISABLED: When doing ":set lines+=1" this function would first invoke 4279 * DISABLED: When doing ":set lines+=1" this function would first invoke
4285 * gui_resize_shell() with the old size, then the normal callback would 4280 * gui_resize_shell() with the old size, then the normal callback would
4286 * report the new size through form_configure_event(). That caused the window 4281 * report the new size through form_configure_event(). That caused the window
4287 * layout to be messed up. 4282 * layout to be messed up.
4288 */ 4283 */
4289 /*ARGSUSED0*/
4290 static gboolean 4284 static gboolean
4291 force_shell_resize_idle(gpointer data) 4285 force_shell_resize_idle(gpointer data)
4292 { 4286 {
4293 if (gui.mainwin != NULL 4287 if (gui.mainwin != NULL
4294 && GTK_WIDGET_REALIZED(gui.mainwin) 4288 && GTK_WIDGET_REALIZED(gui.mainwin)
4312 #endif /* HAVE_GTK2 */ 4306 #endif /* HAVE_GTK2 */
4313 4307
4314 /* 4308 /*
4315 * Set the windows size. 4309 * Set the windows size.
4316 */ 4310 */
4317 /*ARGSUSED2*/
4318 void 4311 void
4319 gui_mch_set_shellsize(int width, int height, 4312 gui_mch_set_shellsize(int width, int height,
4320 int min_width, int min_height, 4313 int min_width UNUSED, int min_height UNUSED,
4321 int base_width, int base_height, 4314 int base_width UNUSED, int base_height UNUSED,
4322 int direction) 4315 int direction UNUSED)
4323 { 4316 {
4324 #ifndef HAVE_GTK2 4317 #ifndef HAVE_GTK2
4325 /* Hack: When the form already is at the desired size, the window might 4318 /* Hack: When the form already is at the desired size, the window might
4326 * have been resized with the mouse. Force a resize by setting a 4319 * have been resized with the mouse. Force a resize by setting a
4327 * different size first. */ 4320 * different size first. */
4411 *screen_w -= get_menu_tool_width(); 4404 *screen_w -= get_menu_tool_width();
4412 *screen_h -= get_menu_tool_height(); 4405 *screen_h -= get_menu_tool_height();
4413 } 4406 }
4414 4407
4415 #if defined(FEAT_TITLE) || defined(PROTO) 4408 #if defined(FEAT_TITLE) || defined(PROTO)
4416 /*ARGSUSED*/
4417 void 4409 void
4418 gui_mch_settitle(char_u *title, char_u *icon) 4410 gui_mch_settitle(char_u *title, char_u *icon UNUSED)
4419 { 4411 {
4420 # ifdef HAVE_GTK2 4412 # ifdef HAVE_GTK2
4421 if (title != NULL && output_conv.vc_type != CONV_NONE) 4413 if (title != NULL && output_conv.vc_type != CONV_NONE)
4422 title = string_convert(&output_conv, title, NULL); 4414 title = string_convert(&output_conv, title, NULL);
4423 # endif 4415 # endif
4491 #ifndef HAVE_GTK2 4483 #ifndef HAVE_GTK2
4492 /* 4484 /*
4493 * Get a font structure for highlighting. 4485 * Get a font structure for highlighting.
4494 * "cbdata" is a pointer to the global gui structure. 4486 * "cbdata" is a pointer to the global gui structure.
4495 */ 4487 */
4496 /*ARGSUSED*/
4497 static void 4488 static void
4498 font_sel_ok(GtkWidget *wgt, gpointer cbdata) 4489 font_sel_ok(GtkWidget *wgt, gpointer cbdata)
4499 { 4490 {
4500 gui_T *vw = (gui_T *)cbdata; 4491 gui_T *vw = (gui_T *)cbdata;
4501 GtkFontSelectionDialog *fs = (GtkFontSelectionDialog *)vw->fontdlg; 4492 GtkFontSelectionDialog *fs = (GtkFontSelectionDialog *)vw->fontdlg;
4507 gtk_widget_hide(vw->fontdlg); 4498 gtk_widget_hide(vw->fontdlg);
4508 if (gtk_main_level() > 0) 4499 if (gtk_main_level() > 0)
4509 gtk_main_quit(); 4500 gtk_main_quit();
4510 } 4501 }
4511 4502
4512 /*ARGSUSED*/
4513 static void 4503 static void
4514 font_sel_cancel(GtkWidget *wgt, gpointer cbdata) 4504 font_sel_cancel(GtkWidget *wgt, gpointer cbdata)
4515 { 4505 {
4516 gui_T *vw = (gui_T *)cbdata; 4506 gui_T *vw = (gui_T *)cbdata;
4517 4507
4518 gtk_widget_hide(vw->fontdlg); 4508 gtk_widget_hide(vw->fontdlg);
4519 if (gtk_main_level() > 0) 4509 if (gtk_main_level() > 0)
4520 gtk_main_quit(); 4510 gtk_main_quit();
4521 } 4511 }
4522 4512
4523 /*ARGSUSED*/
4524 static void 4513 static void
4525 font_sel_destroy(GtkWidget *wgt, gpointer cbdata) 4514 font_sel_destroy(GtkWidget *wgt, gpointer cbdata)
4526 { 4515 {
4527 gui_T *vw = (gui_T *)cbdata; 4516 gui_T *vw = (gui_T *)cbdata;
4528 4517
4618 4607
4619 #if defined(FEAT_XFONTSET) || defined(PROTO) 4608 #if defined(FEAT_XFONTSET) || defined(PROTO)
4620 /* 4609 /*
4621 * Try to load the requested fontset. 4610 * Try to load the requested fontset.
4622 */ 4611 */
4623 /*ARGSUSED2*/
4624 GuiFontset 4612 GuiFontset
4625 gui_mch_get_fontset(char_u *name, int report_error, int fixed_width) 4613 gui_mch_get_fontset(char_u *name, int report_error, int fixed_width)
4626 { 4614 {
4627 GdkFont *font; 4615 GdkFont *font;
4628 4616
4861 4849
4862 styled_font[0] = &gui.bold_font; 4850 styled_font[0] = &gui.bold_font;
4863 styled_font[1] = &gui.ital_font; 4851 styled_font[1] = &gui.ital_font;
4864 styled_font[2] = &gui.boldital_font; 4852 styled_font[2] = &gui.boldital_font;
4865 4853
4866 /* First free whatever was freviously there. */ 4854 /* First free whatever was previously there. */
4867 for (i = 0; i < 3; ++i) 4855 for (i = 0; i < 3; ++i)
4868 if (*styled_font[i]) 4856 if (*styled_font[i])
4869 { 4857 {
4870 gdk_font_unref(*styled_font[i]); 4858 gdk_font_unref(*styled_font[i]);
4871 *styled_font[i] = NULL; 4859 *styled_font[i] = NULL;
5010 4998
5011 /* 4999 /*
5012 * Initialize Vim to use the font or fontset with the given name. 5000 * Initialize Vim to use the font or fontset with the given name.
5013 * Return FAIL if the font could not be loaded, OK otherwise. 5001 * Return FAIL if the font could not be loaded, OK otherwise.
5014 */ 5002 */
5015 /*ARGSUSED1*/
5016 int 5003 int
5017 gui_mch_init_font(char_u *font_name, int fontset) 5004 gui_mch_init_font(char_u *font_name, int fontset UNUSED)
5018 { 5005 {
5019 #ifdef HAVE_GTK2 5006 #ifdef HAVE_GTK2
5020 PangoFontDescription *font_desc; 5007 PangoFontDescription *font_desc;
5021 PangoLayout *layout; 5008 PangoLayout *layout;
5022 int width; 5009 int width;
5324 5311
5325 #if defined(FEAT_EVAL) || defined(PROTO) 5312 #if defined(FEAT_EVAL) || defined(PROTO)
5326 /* 5313 /*
5327 * Return the name of font "font" in allocated memory. 5314 * Return the name of font "font" in allocated memory.
5328 */ 5315 */
5329 /*ARGSUSED*/
5330 char_u * 5316 char_u *
5331 gui_mch_get_fontname(GuiFont font, char_u *name) 5317 gui_mch_get_fontname(GuiFont font, char_u *name UNUSED)
5332 { 5318 {
5333 # ifdef HAVE_GTK2 5319 # ifdef HAVE_GTK2
5334 if (font != NOFONT) 5320 if (font != NOFONT)
5335 { 5321 {
5336 char *pangoname = pango_font_description_to_string(font); 5322 char *pangoname = pango_font_description_to_string(font);
5730 static void 5716 static void
5731 draw_under(int flags, int row, int col, int cells) 5717 draw_under(int flags, int row, int col, int cells)
5732 { 5718 {
5733 int i; 5719 int i;
5734 int offset; 5720 int offset;
5735 const static int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; 5721 static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 };
5736 int y = FILL_Y(row + 1) - 1; 5722 int y = FILL_Y(row + 1) - 1;
5737 5723
5738 /* Undercurl: draw curl at the bottom of the character cell. */ 5724 /* Undercurl: draw curl at the bottom of the character cell. */
5739 if (flags & DRAW_UNDERC) 5725 if (flags & DRAW_UNDERC)
5740 { 5726 {
6400 6386
6401 #ifdef FEAT_SNIFF 6387 #ifdef FEAT_SNIFF
6402 /* 6388 /*
6403 * Callback function, used when data is available on the SNiFF connection. 6389 * Callback function, used when data is available on the SNiFF connection.
6404 */ 6390 */
6405 /* ARGSUSED */
6406 static void 6391 static void
6407 sniff_request_cb( 6392 sniff_request_cb(
6408 gpointer data, 6393 gpointer data,
6409 gint source_fd, 6394 gint source_fd,
6410 GdkInputCondition condition) 6395 GdkInputCondition condition)
6709 } 6694 }
6710 6695
6711 /* 6696 /*
6712 * Disown the selection. 6697 * Disown the selection.
6713 */ 6698 */
6714 /*ARGSUSED*/
6715 void 6699 void
6716 clip_mch_lose_selection(VimClipboard *cbd) 6700 clip_mch_lose_selection(VimClipboard *cbd UNUSED)
6717 { 6701 {
6718 /* WEIRD: when using NULL to actually disown the selection, we lose the 6702 /* WEIRD: when using NULL to actually disown the selection, we lose the
6719 * selection the first time we own it. */ 6703 * selection the first time we own it. */
6720 /* 6704 /*
6721 gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, (guint32)GDK_CURRENT_TIME); 6705 gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, (guint32)GDK_CURRENT_TIME);
6739 6723
6740 /* 6724 /*
6741 * Send the current selection to the clipboard. Do nothing for X because we 6725 * Send the current selection to the clipboard. Do nothing for X because we
6742 * will fill in the selection only when requested by another app. 6726 * will fill in the selection only when requested by another app.
6743 */ 6727 */
6744 /*ARGSUSED*/
6745 void 6728 void
6746 clip_mch_set_selection(VimClipboard *cbd) 6729 clip_mch_set_selection(VimClipboard *cbd UNUSED)
6747 { 6730 {
6748 } 6731 }
6749 6732
6750 6733
6751 #if defined(FEAT_MENU) || defined(PROTO) 6734 #if defined(FEAT_MENU) || defined(PROTO)
6948 if (id >= GDK_LAST_CURSOR) 6931 if (id >= GDK_LAST_CURSOR)
6949 id = GDK_LEFT_PTR; 6932 id = GDK_LEFT_PTR;
6950 else 6933 else
6951 id &= ~1; /* they are always even (why?) */ 6934 id &= ~1; /* they are always even (why?) */
6952 } 6935 }
6953 else if (shape < sizeof(mshape_ids) / sizeof(int)) 6936 else if (shape < (int)(sizeof(mshape_ids) / sizeof(int)))
6954 id = mshape_ids[shape]; 6937 id = mshape_ids[shape];
6955 else 6938 else
6956 return; 6939 return;
6957 # ifdef HAVE_GTK_MULTIHEAD 6940 # ifdef HAVE_GTK_MULTIHEAD
6958 c = gdk_cursor_new_for_display( 6941 c = gdk_cursor_new_for_display(