diff src/gui_x11.c @ 18788:e1f4e9d78a6a v8.1.2383

patch 8.1.2383: using old C style comments Commit: https://github.com/vim/vim/commit/734a867ffe198886da7365b618be67ab8ed9d9f6 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 2 22:49:38 2019 +0100 patch 8.1.2383: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate.
author Bram Moolenaar <Bram@vim.org>
date Mon, 02 Dec 2019 23:00:04 +0100
parents df141c730008
children aadd1cae2ff5
line wrap: on
line diff
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -57,7 +57,7 @@
 #define VIM_NAME	"vim"
 #define VIM_CLASS	"Vim"
 
-/* Default resource values */
+// Default resource values
 #define DFLT_FONT		"7x13"
 #ifdef FONTSET_ALWAYS
 # define DFLT_MENU_FONT		XtDefaultFontSet
@@ -74,7 +74,7 @@
 # define DFLT_TOOLTIP_BG_COLOR	"#ffff91"
 # define DFLT_TOOLTIP_FG_COLOR	"#000000"
 #else
-/* use the default (CDE) colors */
+// use the default (CDE) colors
 # define DFLT_MENU_BG_COLOR	""
 # define DFLT_MENU_FG_COLOR	""
 # define DFLT_SCROLL_BG_COLOR	""
@@ -85,9 +85,9 @@
 
 Widget vimShell = (Widget)0;
 
-static Atom   wm_atoms[2];	/* Window Manager Atoms */
-#define DELETE_WINDOW_IDX 0	/* index in wm_atoms[] for WM_DELETE_WINDOW */
-#define SAVE_YOURSELF_IDX 1	/* index in wm_atoms[] for WM_SAVE_YOURSELF */
+static Atom   wm_atoms[2];	// Window Manager Atoms
+#define DELETE_WINDOW_IDX 0	// index in wm_atoms[] for WM_DELETE_WINDOW
+#define SAVE_YOURSELF_IDX 1	// index in wm_atoms[] for WM_SAVE_YOURSELF
 
 #ifdef FEAT_XFONTSET
 /*
@@ -198,7 +198,7 @@ static struct specialkey
     {XK_F32,		'F', 'M'},
     {XK_F33,		'F', 'N'},
     {XK_F34,		'F', 'O'},
-    {XK_F35,		'F', 'P'},	/* keysymdef.h defines up to F35 */
+    {XK_F35,		'F', 'P'},	// keysymdef.h defines up to F35
 #ifdef SunXK_F36
     {SunXK_F36,		'F', 'Q'},
     {SunXK_F37,		'F', 'R'},
@@ -215,7 +215,7 @@ static struct specialkey
     {XK_Next,		'k', 'N'},
     {XK_Print,		'%', '9'},
 
-    /* Keypad keys: */
+    // Keypad keys:
 #ifdef XK_KP_Left
     {XK_KP_Left,	'k', 'l'},
     {XK_KP_Right,	'k', 'r'},
@@ -247,7 +247,7 @@ static struct specialkey
     {XK_KP_9,		'K', 'L'},
 #endif
 
-    /* End of list marker: */
+    // End of list marker:
     {(KeySym)0,	    0, 0}
 };
 
@@ -267,19 +267,19 @@ static struct specialkey
 #define XtCMenuFontSet		"MenuFontSet"
 
 
-/* Resources for setting the foreground and background colors of menus */
+// Resources for setting the foreground and background colors of menus
 #define XtNmenuBackground	"menuBackground"
 #define XtCMenuBackground	"MenuBackground"
 #define XtNmenuForeground	"menuForeground"
 #define XtCMenuForeground	"MenuForeground"
 
-/* Resources for setting the foreground and background colors of scrollbars */
+// Resources for setting the foreground and background colors of scrollbars
 #define XtNscrollBackground	"scrollBackground"
 #define XtCScrollBackground	"ScrollBackground"
 #define XtNscrollForeground	"scrollForeground"
 #define XtCScrollForeground	"ScrollForeground"
 
-/* Resources for setting the foreground and background colors of tooltip */
+// Resources for setting the foreground and background colors of tooltip
 #define XtNtooltipBackground	"tooltipBackground"
 #define XtCTooltipBackground	"TooltipBackground"
 #define XtNtooltipForeground	"tooltipForeground"
@@ -383,7 +383,7 @@ static XtResource vim_resources[] =
 	(XtPointer)SB_DEFAULT_WIDTH
     },
 #ifdef FEAT_MENU
-# ifdef FEAT_GUI_ATHENA		/* with Motif the height is always computed */
+# ifdef FEAT_GUI_ATHENA		// with Motif the height is always computed
     {
 	XtNmenuHeight,
 	XtCMenuHeight,
@@ -391,7 +391,7 @@ static XtResource vim_resources[] =
 	sizeof(int),
 	XtOffsetOf(gui_T, menu_height),
 	XtRImmediate,
-	(XtPointer)MENU_DEFAULT_HEIGHT	    /* Should figure out at run time */
+	(XtPointer)MENU_DEFAULT_HEIGHT	    // Should figure out at run time
     },
 # endif
     {
@@ -473,7 +473,7 @@ static XtResource vim_resources[] =
 	XtRString,
 	DFLT_TOOLTIP_FONT
     },
-    /* This one may not be really needed? */
+    // This one may not be really needed?
     {
 	"balloonEvalFontSet",
 	XtCFontSet,
@@ -483,7 +483,7 @@ static XtResource vim_resources[] =
 	XtRImmediate,
 	(XtPointer)NOFONTSET
     },
-#endif /* FEAT_BEVAL_GUI */
+#endif // FEAT_BEVAL_GUI
 #ifdef FEAT_XIM
     {
 	"preeditType",
@@ -503,7 +503,7 @@ static XtResource vim_resources[] =
 	XtRString,
 	NULL
     },
-#endif /* FEAT_XIM */
+#endif // FEAT_XIM
 };
 
 /*
@@ -514,7 +514,7 @@ static XtResource vim_resources[] =
  */
 static XrmOptionDescRec cmdline_options[] =
 {
-    /* We handle these options ourselves */
+    // We handle these options ourselves
     {"-bg",		".background",	    XrmoptionSepArg,	NULL},
     {"-background",	".background",	    XrmoptionSepArg,	NULL},
     {"-fg",		".foreground",	    XrmoptionSepArg,	NULL},
@@ -572,12 +572,12 @@ channel_poll_cb(
 {
     XtIntervalId    *channel_timer = (XtIntervalId *)client_data;
 
-    /* Using an event handler for a channel that may be disconnected does
-     * not work, it hangs.  Instead poll for messages. */
+    // Using an event handler for a channel that may be disconnected does
+    // not work, it hangs.  Instead poll for messages.
     channel_handle_events(TRUE);
     parse_queued_messages();
 
-    /* repeat */
+    // repeat
     *channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
 						 channel_poll_cb, client_data);
 }
@@ -602,7 +602,7 @@ gui_x11_visibility_cb(
     XSetGraphicsExposures(gui.dpy, gui.text_gc,
 	    gui.visibility != VisibilityUnobscured);
 
-    /* This is needed for when redrawing is slow. */
+    // This is needed for when redrawing is slow.
     gui_mch_update();
 }
 
@@ -619,14 +619,14 @@ gui_x11_expose_cb(
     if (event->type != Expose)
 	return;
 
-    out_flush();	    /* make sure all output has been processed */
+    out_flush();	    // make sure all output has been processed
 
     gevent = (XExposeEvent *)event;
     gui_redraw(gevent->x, gevent->y, gevent->width, gevent->height);
 
     new_x = FILL_X(0);
 
-    /* Clear the border areas if needed */
+    // Clear the border areas if needed
     if (gevent->x < new_x)
 	XClearArea(gui.dpy, gui.wid, 0, 0, new_x, 0, False);
     if (gevent->y < FILL_Y(0))
@@ -636,7 +636,7 @@ gui_x11_expose_cb(
     if (gevent->y > FILL_Y(Rows))
 	XClearArea(gui.dpy, gui.wid, 0, FILL_Y((int)Rows), 0, 0, False);
 
-    /* This is needed for when redrawing is slow. */
+    // This is needed for when redrawing is slow.
     gui_mch_update();
 }
 
@@ -783,8 +783,8 @@ gui_x11_key_hit_cb(
     if (xic)
     {
 # ifdef USE_UTF8LOOKUP
-	/* XFree86 4.0.2 or newer: Be able to get UTF-8 characters even when
-	 * the locale isn't utf-8. */
+	// XFree86 4.0.2 or newer: Be able to get UTF-8 characters even when
+	// the locale isn't utf-8.
 	if (enc_utf8)
 	    len = Xutf8LookupString(xic, ev_press, (char *)string,
 				  sizeof(string_shortbuf), &key_sym, &status);
@@ -797,8 +797,8 @@ gui_x11_key_hit_cb(
 	    string = (char_u *)XtMalloc(len + 1);
 	    string_alloced = True;
 # ifdef USE_UTF8LOOKUP
-	    /* XFree86 4.0.2 or newer: Be able to get UTF-8 characters even
-	     * when the locale isn't utf-8.  */
+	    // XFree86 4.0.2 or newer: Be able to get UTF-8 characters even
+	    // when the locale isn't utf-8.
 	    if (enc_utf8)
 		len = Xutf8LookupString(xic, ev_press, (char *)string,
 						      len, &key_sym, &status);
@@ -810,15 +810,15 @@ gui_x11_key_hit_cb(
 	if (status == XLookupNone || status == XLookupChars)
 	    key_sym = XK_VoidSymbol;
 
-	/* Do conversion from 'termencoding' to 'encoding'.  When using
-	 * Xutf8LookupString() it has already been done. */
+	// Do conversion from 'termencoding' to 'encoding'.  When using
+	// Xutf8LookupString() it has already been done.
 	if (len > 0 && input_conv.vc_type != CONV_NONE
 # ifdef USE_UTF8LOOKUP
 		&& !enc_utf8
 # endif
 		)
 	{
-	    int		maxlen = len * 4 + 40;	/* guessed */
+	    int		maxlen = len * 4 + 40;	// guessed
 	    char_u	*p = (char_u *)XtMalloc(maxlen);
 
 	    mch_memmove(p, string, len);
@@ -829,8 +829,8 @@ gui_x11_key_hit_cb(
 	    len = convert_input(p, len, maxlen);
 	}
 
-	/* Translate CSI to K_CSI, otherwise it could be recognized as the
-	 * start of a special key. */
+	// Translate CSI to K_CSI, otherwise it could be recognized as the
+	// start of a special key.
 	for (i = 0; i < len; ++i)
 	    if (string[i] == CSI)
 	    {
@@ -864,7 +864,7 @@ gui_x11_key_hit_cb(
 #endif
 
     if (key_sym == XK_space)
-	string[0] = ' ';	/* Otherwise Ctrl-Space doesn't work */
+	string[0] = ' ';	// Otherwise Ctrl-Space doesn't work
 
     /*
      * Only on some machines ^_ requires Ctrl+Shift+minus.  For consistency,
@@ -874,7 +874,7 @@ gui_x11_key_hit_cb(
 	string[0] = Ctrl__;
 
 #ifdef XK_ISO_Left_Tab
-    /* why do we get XK_ISO_Left_Tab instead of XK_Tab for shift-tab? */
+    // why do we get XK_ISO_Left_Tab instead of XK_Tab for shift-tab?
     if (key_sym == XK_ISO_Left_Tab)
     {
 	key_sym = XK_Tab;
@@ -883,10 +883,10 @@ gui_x11_key_hit_cb(
     }
 #endif
 
-    /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
-     * that already has the 8th bit set.  And not when using a double-byte
-     * encoding, setting the 8th bit may make it the lead byte of a
-     * double-byte character. */
+    // Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
+    // that already has the 8th bit set.  And not when using a double-byte
+    // encoding, setting the 8th bit may make it the lead byte of a
+    // double-byte character.
     if (len == 1
 	    && (ev_press->state & Mod1Mask)
 	    && !(key_sym == XK_BackSpace || key_sym == XK_Delete)
@@ -894,7 +894,7 @@ gui_x11_key_hit_cb(
 	    && !enc_dbcs)
     {
 #if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF)
-	/* Ignore ALT keys when they are used for the menu only */
+	// Ignore ALT keys when they are used for the menu only
 	if (gui.menu_is_active
 		&& (p_wak[0] == 'y'
 		    || (p_wak[0] == 'm' && gui_is_menu_shortcut(string[0]))))
@@ -911,13 +911,13 @@ gui_x11_key_hit_cb(
 	len2 = XLookupString(ev_press, (char *)string2, sizeof(string2),
 							     &key_sym2, NULL);
 	if (key_sym2 == XK_space)
-	    string2[0] = ' ';	    /* Otherwise Meta-Ctrl-Space doesn't work */
+	    string2[0] = ' ';	    // Otherwise Meta-Ctrl-Space doesn't work
 	if (	   len2 == 1
 		&& string[0] == string2[0]
 		&& !(key_sym == XK_Tab && (ev_press->state & ShiftMask)))
 	{
 	    string[0] |= 0x80;
-	    if (enc_utf8) /* convert to utf-8 */
+	    if (enc_utf8) // convert to utf-8
 	    {
 		string[1] = string[0] & 0xbf;
 		string[0] = ((unsigned)string[0] >> 6) + 0xc0;
@@ -942,8 +942,8 @@ gui_x11_key_hit_cb(
 	len = -3;
     }
 
-    /* Check for special keys.  Also do this when len == 1 (key has an ASCII
-     * value) to detect backspace, delete and keypad keys. */
+    // Check for special keys.  Also do this when len == 1 (key has an ASCII
+    // value) to detect backspace, delete and keypad keys.
     if (len == 0 || len == 1)
     {
 	for (i = 0; special_keys[i].key_sym != (KeySym)0; i++)
@@ -959,12 +959,12 @@ gui_x11_key_hit_cb(
 	}
     }
 
-    /* Unrecognised key is ignored. */
+    // Unrecognised key is ignored.
     if (len == 0)
 	goto theend;
 
-    /* Special keys (and a few others) may have modifiers.  Also when using a
-     * double-byte encoding (can't set the 8th bit). */
+    // Special keys (and a few others) may have modifiers.  Also when using a
+    // double-byte encoding (can't set the 8th bit).
     if (len == -3 || key_sym == XK_space || key_sym == XK_Tab
 	    || key_sym == XK_Return || key_sym == XK_Linefeed
 	    || key_sym == XK_Escape
@@ -1040,7 +1040,7 @@ gui_x11_key_hit_cb(
     }
 #endif
 theend:
-    {}	    /* some compilers need a statement here */
+    {}	    // some compilers need a statement here
 #ifdef FEAT_XIM
     if (string_alloced)
 	XtFree((char *)string);
@@ -1065,7 +1065,7 @@ gui_x11_mouse_cb(
 
     if (event->type == MotionNotify)
     {
-	/* Get the latest position, avoids lagging behind on a drag. */
+	// Get the latest position, avoids lagging behind on a drag.
 	x = event->xmotion.x;
 	y = event->xmotion.y;
 	x_modifiers = event->xmotion.state;
@@ -1077,10 +1077,10 @@ gui_x11_mouse_cb(
 	 */
 	gui_mch_mousehide(FALSE);
 
-	if (button != MOUSE_DRAG)	/* just moving the rodent */
+	if (button != MOUSE_DRAG)	// just moving the rodent
 	{
 #ifdef FEAT_MENU
-	    if (dud)			/* moved in vimForm */
+	    if (dud)			// moved in vimForm
 		y -= gui.menu_height;
 #endif
 	    gui_mouse_moved(x, y);
@@ -1093,7 +1093,7 @@ gui_x11_mouse_cb(
 	y = event->xbutton.y;
 	if (event->type == ButtonPress)
 	{
-	    /* Handle multiple clicks */
+	    // Handle multiple clicks
 	    if (!timed_out)
 	    {
 		XtRemoveTimeOut(timer);
@@ -1104,7 +1104,7 @@ gui_x11_mouse_cb(
 			gui_x11_timer_cb, &timed_out);
 	    switch (event->xbutton.button)
 	    {
-		/* keep in sync with gui_gtk_x11.c */
+		// keep in sync with gui_gtk_x11.c
 		case Button1:	button = MOUSE_LEFT;	break;
 		case Button2:	button = MOUSE_MIDDLE;	break;
 		case Button3:	button = MOUSE_RIGHT;	break;
@@ -1115,13 +1115,13 @@ gui_x11_mouse_cb(
 		case 8:		button = MOUSE_X1;	break;
 		case 9:		button = MOUSE_X2;	break;
 		default:
-		    return;	/* Unknown button */
+		    return;	// Unknown button
 	    }
 	}
 	else if (event->type == ButtonRelease)
 	    button = MOUSE_RELEASE;
 	else
-	    return;	/* Unknown mouse event type */
+	    return;	// Unknown mouse event type
 
 	x_modifiers = event->xbutton.state;
 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
@@ -1134,7 +1134,7 @@ gui_x11_mouse_cb(
 	vim_modifiers |= MOUSE_SHIFT;
     if (x_modifiers & ControlMask)
 	vim_modifiers |= MOUSE_CTRL;
-    if (x_modifiers & Mod1Mask)	    /* Alt or Meta key */
+    if (x_modifiers & Mod1Mask)	    // Alt or Meta key
 	vim_modifiers |= MOUSE_ALT;
 
     gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
@@ -1166,14 +1166,14 @@ gui_mch_prepare(int *argc, char **argv)
     arg = 1;
     while (arg < *argc)
     {
-	/* Look for argv[arg] in cmdline_options[] table */
+	// Look for argv[arg] in cmdline_options[] table
 	for (i = 0; i < (int)XtNumber(cmdline_options); i++)
 	    if (strcmp(argv[arg], cmdline_options[i].option) == 0)
 		break;
 
 	if (i < (int)XtNumber(cmdline_options))
 	{
-	    /* Remember finding "-rv" or "-reverse" */
+	    // Remember finding "-rv" or "-reverse"
 	    if (strcmp("-rv", argv[arg]) == 0
 		    || strcmp("-reverse", argv[arg]) == 0)
 		found_reverse_arg = TRUE;
@@ -1182,7 +1182,7 @@ gui_mch_prepare(int *argc, char **argv)
 		    && arg + 1 < *argc)
 		font_argument = argv[arg + 1];
 
-	    /* Found match in table, so move it into gui_argv */
+	    // Found match in table, so move it into gui_argv
 	    gui_argv[gui_argc++] = argv[arg];
 	    if (--*argc > arg)
 	    {
@@ -1190,7 +1190,7 @@ gui_mch_prepare(int *argc, char **argv)
 						    * sizeof(char *));
 		if (cmdline_options[i].argKind != XrmoptionNoArg)
 		{
-		    /* Move the options argument as well */
+		    // Move the options argument as well
 		    gui_argv[gui_argc++] = argv[arg];
 		    if (--*argc > arg)
 			mch_memmove(&argv[arg], &argv[arg + 1], (*argc - arg)
@@ -1203,7 +1203,7 @@ gui_mch_prepare(int *argc, char **argv)
 #ifdef FEAT_NETBEANS_INTG
 	    if (strncmp("-nb", argv[arg], 3) == 0)
 	{
-	    gui.dofork = FALSE;	/* don't fork() when starting GUI */
+	    gui.dofork = FALSE;	// don't fork() when starting GUI
 	    netbeansArg = argv[arg];
 	    mch_memmove(&argv[arg], &argv[arg + 1],
 					    (--*argc - arg) * sizeof(char *));
@@ -1243,9 +1243,9 @@ gui_mch_init_check(void)
 
 # if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
     {
-	/* The call to XtOpenDisplay() may have set the locale from the
-	 * environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a
-	 * decimal point, not a comma. */
+	// The call to XtOpenDisplay() may have set the locale from the
+	// environment. Set LC_NUMERIC to "C" to make sure that strtod() uses a
+	// decimal point, not a comma.
 	char *p = setlocale(LC_NUMERIC, NULL);
 
 	if (p == NULL || strcmp(p, "C") != 0)
@@ -1293,7 +1293,7 @@ gui_mch_init(void)
     unsigned	w, h;
 
 #if 0
-    /* Uncomment this to enable synchronous mode for debugging */
+    // Uncomment this to enable synchronous mode for debugging
     XSynchronize(gui.dpy, True);
 #endif
 
@@ -1312,9 +1312,8 @@ gui_mch_init(void)
      * Get the colors ourselves.  Using the automatic conversion doesn't
      * handle looking for approximate colors.
      */
-    /* NOTE: These next few lines are an exact duplicate of gui_athena.c's
-     * gui_mch_def_colors().  Why?
-     */
+    // NOTE: These next few lines are an exact duplicate of gui_athena.c's
+    // gui_mch_def_colors().  Why?
     gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
     gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
     gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
@@ -1325,16 +1324,16 @@ gui_mch_init(void)
 #endif
 
 #if defined(FEAT_MENU) && defined(FEAT_GUI_ATHENA)
-    /* If the menu height was set, don't change it at runtime */
+    // If the menu height was set, don't change it at runtime
     if (gui.menu_height != MENU_DEFAULT_HEIGHT)
 	gui.menu_height_fixed = TRUE;
 #endif
 
-    /* Set default foreground and background colours */
+    // Set default foreground and background colours
     gui.norm_pixel = gui.def_norm_pixel;
     gui.back_pixel = gui.def_back_pixel;
 
-    /* Check if reverse video needs to be applied (on Sun it's done by X) */
+    // Check if reverse video needs to be applied (on Sun it's done by X)
     if (gui.rsrc_rev_video && gui_get_lightness(gui.back_pixel)
 					  > gui_get_lightness(gui.norm_pixel))
     {
@@ -1344,8 +1343,8 @@ gui_mch_init(void)
 	gui.def_back_pixel = gui.back_pixel;
     }
 
-    /* Get the colors from the "Normal", "Tooltip", "Scrollbar" and "Menu"
-     * group (set in syntax.c or in a vimrc file) */
+    // Get the colors from the "Normal", "Tooltip", "Scrollbar" and "Menu"
+    // group (set in syntax.c or in a vimrc file)
     set_normal_colors();
 
     /*
@@ -1377,8 +1376,8 @@ gui_mch_init(void)
     if (gui_win_x != -1 && gui_win_y != -1)
 	gui_mch_set_winpos(gui_win_x, gui_win_y);
 
-    /* Now adapt the supplied(?) geometry-settings */
-    /* Added by Kjetil Jacobsen <kjetilja@stud.cs.uit.no> */
+    // Now adapt the supplied(?) geometry-settings
+    // Added by Kjetil Jacobsen <kjetilja@stud.cs.uit.no>
     if (gui.geom != NULL && *gui.geom != NUL)
     {
 	mask = XParseGeometry((char *)gui.geom, &x, &y, &w, &h);
@@ -1427,10 +1426,10 @@ gui_mch_init(void)
 		    vim_mask_icon_height));
 	XtSetValues(vimShell, arg, (Cardinal)2);
 #else
-/* Use Pixmaps, looking much nicer. */
-
-/* If you get an error message here, you still need to unpack the runtime
- * archive! */
+// Use Pixmaps, looking much nicer.
+
+// If you get an error message here, you still need to unpack the runtime
+// archive!
 # ifdef magick
 #  undef magick
 # endif
@@ -1481,7 +1480,7 @@ gui_mch_init(void)
 
     attr.valuemask = 0L;
     attr.valuemask = XpmCloseness | XpmReturnPixels | XpmColormap | XpmDepth;
-    attr.closeness = 65535;	/* accuracy isn't crucial */
+    attr.closeness = 65535;	// accuracy isn't crucial
     attr.colormap = cmap;
     attr.depth = DefaultDepthOfScreen(scr);
 
@@ -1511,7 +1510,7 @@ gui_mch_init(void)
 #endif
 
 #ifdef USE_XSMP
-    /* Attach listener on ICE connection */
+    // Attach listener on ICE connection
     if (-1 != xsmp_icefd)
 	_xsmp_xtinputid = XtAppAddInput(app_context, xsmp_icefd,
 		(XtPointer)XtInputReadMask, local_xsmp_handle_requests, NULL);
@@ -1569,7 +1568,7 @@ gui_mch_new_colors(void)
     int
 gui_mch_open(void)
 {
-    /* Actually open the window */
+    // Actually open the window
     XtRealizeWidget(vimShell);
     XtManageChild(XtNameToWidget(vimShell, "*vimForm"));
 
@@ -1599,7 +1598,7 @@ gui_mch_open(void)
 #ifdef FEAT_CLIENTSERVER
     if (serverName == NULL && serverDelayedStartName != NULL)
     {
-	/* This is a :gui command in a plain vim with no previous server */
+	// This is a :gui command in a plain vim with no previous server
 	commWindow = XtWindow(vimShell);
 	(void)serverRegisterName(gui.dpy, serverDelayedStartName);
     }
@@ -1618,7 +1617,7 @@ gui_mch_open(void)
 
 
 #if defined(FEAT_MENU) && defined(FEAT_GUI_ATHENA)
-    /* The Athena GUI needs this again after opening the window */
+    // The Athena GUI needs this again after opening the window
     gui_position_menu();
 # ifdef FEAT_TOOLBAR
     gui_mch_set_toolbar_pos(0, gui.menu_height, gui.menu_width,
@@ -1626,9 +1625,9 @@ gui_mch_open(void)
 # endif
 #endif
 
-    /* Get the colors for the highlight groups (gui_check_colors() might have
-     * changed them) */
-    highlight_gui_started();		/* re-init colors and fonts */
+    // Get the colors for the highlight groups (gui_check_colors() might have
+    // changed them)
+    highlight_gui_started();		// re-init colors and fonts
 
 #ifdef FEAT_XIM
     xim_init();
@@ -1653,13 +1652,13 @@ gui_init_tooltip_font(void)
 
     if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False)
     {
-	/* Failed. What to do? */
+	// Failed. What to do?
     }
 }
 #endif
 
 #if defined(FEAT_MENU) || defined(PROTO)
-/* Convert the menu font/fontset name to an XFontStruct/XFontset */
+// Convert the menu font/fontset name to an XFontStruct/XFontset
     void
 gui_init_menu_font(void)
 {
@@ -1673,7 +1672,7 @@ gui_init_menu_font(void)
 
     if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False)
     {
-	/* Failed. What to do? */
+	// Failed. What to do?
     }
 #else
     from.addr = (char *)gui.rsrc_menu_font_name;
@@ -1683,7 +1682,7 @@ gui_init_menu_font(void)
 
     if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontStruct, &to) == False)
     {
-	/* Failed. What to do? */
+	// Failed. What to do?
     }
 #endif
 }
@@ -1693,8 +1692,8 @@ gui_init_menu_font(void)
 gui_mch_exit(int rc UNUSED)
 {
 #if 0
-    /* Lesstif gives an error message here, and so does Solaris.  The man page
-     * says that this isn't needed when exiting, so just skip it. */
+    // Lesstif gives an error message here, and so does Solaris.  The man page
+    // says that this isn't needed when exiting, so just skip it.
     XtCloseDisplay(gui.dpy);
 #endif
     VIM_CLEAR(gui_argv);
@@ -1788,8 +1787,8 @@ gui_mch_init_font(
 #endif
 
 #ifdef FEAT_GUI_MOTIF
-    /* A font name equal "*" is indicating, that we should activate the font
-     * selection dialogue to get a new font name. So let us do it here. */
+    // A font name equal "*" is indicating, that we should activate the font
+    // selection dialogue to get a new font name. So let us do it here.
     if (font_name != NULL && STRCMP(font_name, "*") == 0)
 	font_name = gui_xm_select_font(hl_get_font_name());
 #endif
@@ -1797,8 +1796,8 @@ gui_mch_init_font(
 #ifdef FEAT_XFONTSET
     if (do_fontset)
     {
-	/* If 'guifontset' is set, VIM treats all font specifications as if
-	 * they were fontsets, and 'guifontset' becomes the default. */
+	// If 'guifontset' is set, VIM treats all font specifications as if
+	// they were fontsets, and 'guifontset' becomes the default.
 	if (font_name != NULL)
 	{
 	    fontset = (XFontSet)gui_mch_get_fontset(font_name, FALSE, TRUE);
@@ -1876,9 +1875,9 @@ gui_mch_init_font(
     }
     else
     {
-	/* When not using the font specified by the resources, also don't use
-	 * the bold/italic fonts, otherwise setting 'guifont' will look very
-	 * strange. */
+	// When not using the font specified by the resources, also don't use
+	// the bold/italic fonts, otherwise setting 'guifont' will look very
+	// strange.
 	if (gui.bold_font != NOFONT)
 	{
 	    XFreeFont(gui.dpy, (XFontStruct *)gui.bold_font);
@@ -1911,7 +1910,7 @@ gui_mch_get_font(char_u *name, int giveE
 {
     XFontStruct	*font;
 
-    if (!gui.in_use || name == NULL)	/* can't do this when GUI not running */
+    if (!gui.in_use || name == NULL)	// can't do this when GUI not running
 	return NOFONT;
 
     font = XLoadQueryFont(gui.dpy, (char *)name);
@@ -1961,13 +1960,13 @@ gui_mch_get_fontname(GuiFont font, char_
 
     if (name != NULL && font == NULL)
     {
-	/* In this case, there's no way other than doing this. */
+	// In this case, there's no way other than doing this.
 	ret = vim_strsave(name);
     }
     else if (font != NULL)
     {
-	/* In this case, try to retrieve the XLFD corresponding to 'font'->fid;
-	 * if failed, use 'name' unless it's NULL. */
+	// In this case, try to retrieve the XLFD corresponding to 'font'->fid;
+	// if failed, use 'name' unless it's NULL.
 	unsigned long value = 0L;
 
 	if (XGetFontProperty(font, XA_FONT, &value))
@@ -2141,7 +2140,7 @@ check_fontset_sanity(XFontSet fs)
 	    return FAIL;
 	}
     }
-    /* scan base font width */
+    // scan base font width
     min_width = 32767;
     for (i = 0; i < fn; i++)
     {
@@ -2166,7 +2165,7 @@ check_fontset_sanity(XFontSet fs)
 	    return FAIL;
 	}
     }
-    /* it seems ok. Good Luck!! */
+    // it seems ok. Good Luck!!
     return OK;
 }
 
@@ -2202,7 +2201,8 @@ fontset_height2(XFontSet fs)
 }
 #endif
 
-/* NOT USED YET
+#if 0
+// NOT USED YET
     static int
 fontset_descent(XFontSet fs)
 {
@@ -2211,7 +2211,7 @@ fontset_descent(XFontSet fs)
     extents = XExtentsOfFontSet (fs);
     return extents->max_logical_extent.height + extents->max_logical_extent.y;
 }
-*/
+#endif
 
     static int
 fontset_ascent(XFontSet fs)
@@ -2222,7 +2222,7 @@ fontset_ascent(XFontSet fs)
     return -extents->max_logical_extent.y;
 }
 
-#endif /* FEAT_XFONTSET */
+#endif // FEAT_XFONTSET
 
 /*
  * Return the Pixel value (color) for the given color name.
@@ -2233,7 +2233,7 @@ gui_mch_get_color(char_u *name)
 {
     guicolor_T	requested;
 
-    /* can't do this when GUI not running */
+    // can't do this when GUI not running
     if (!gui.in_use || name == NULL || *name == NUL)
 	return INVALCOLOR;
 
@@ -2257,14 +2257,15 @@ gui_mch_get_rgb_color(int r, int g, int 
     XColor	available;
     Colormap	colormap;
 
-/* Using XParseColor() is very slow, put rgb in XColor directly.
+#if 0
+// Using XParseColor() is very slow, put rgb in XColor directly.
 
     char	spec[8]; // space enough to hold "#RRGGBB"
     vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b);
     if (XParseColor(gui.dpy, colormap, (char *)spec, &available) != 0
 	    && XAllocColor(gui.dpy, colormap, &available) != 0)
 	return (guicolor_T)available.pixel;
-*/
+#endif
     colormap = DefaultColormap(gui.dpy, DefaultScreen(gui.dpy));
     vim_memset(&available, 0, sizeof(XColor));
     available.red = r << 8;
@@ -2362,9 +2363,9 @@ gui_mch_draw_string(
 
     if (enc_utf8)
     {
-	/* Convert UTF-8 byte sequence to 16 bit characters for the X
-	 * functions.  Need a buffer for the 16 bit characters.  Keep it
-	 * between calls, because allocating it each time is slow. */
+	// Convert UTF-8 byte sequence to 16 bit characters for the X
+	// functions.  Need a buffer for the 16 bit characters.  Keep it
+	// between calls, because allocating it each time is slow.
 	if (buflen < len)
 	{
 	    XtFree((char *)buf);
@@ -2382,7 +2383,7 @@ gui_mch_draw_string(
 	    {
 # ifdef SMALL_WCHAR_T
 		if (c >= 0x10000)
-		    c = 0xbf;		/* show chars > 0xffff as ? */
+		    c = 0xbf;		// show chars > 0xffff as ?
 # endif
 		((wchar_t *)buf)[wlen] = c;
 	    }
@@ -2390,7 +2391,7 @@ gui_mch_draw_string(
 #endif
 	    {
 		if (c >= 0x10000)
-		    c = 0xbf;		/* show chars > 0xffff as ? */
+		    c = 0xbf;		// show chars > 0xffff as ?
 		((XChar2b *)buf)[wlen].byte1 = (unsigned)c >> 8;
 		((XChar2b *)buf)[wlen].byte2 = c;
 	    }
@@ -2412,9 +2413,9 @@ gui_mch_draw_string(
 #ifdef FEAT_XFONTSET
     if (current_fontset != NULL)
     {
-	/* Setup a clip rectangle to avoid spilling over in the next or
-	 * previous line.  This is apparently needed for some fonts which are
-	 * used in a fontset. */
+	// Setup a clip rectangle to avoid spilling over in the next or
+	// previous line.  This is apparently needed for some fonts which are
+	// used in a fontset.
 	XRectangle	clip;
 
 	clip.x = 0;
@@ -2455,7 +2456,7 @@ gui_mch_draw_string(
     }
     else
     {
-	/* XmbDrawImageString has bug, don't use it for fontset. */
+	// XmbDrawImageString has bug, don't use it for fontset.
 	if (enc_utf8)
 	    XDrawImageString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
 		    TEXT_Y(row), buf, wlen);
@@ -2464,7 +2465,7 @@ gui_mch_draw_string(
 		    TEXT_Y(row), (char *)s, len);
     }
 
-    /* Bold trick: draw the text again with a one-pixel offset. */
+    // Bold trick: draw the text again with a one-pixel offset.
     if (flags & DRAW_BOLD)
     {
 	if (enc_utf8)
@@ -2475,17 +2476,17 @@ gui_mch_draw_string(
 		    TEXT_Y(row), (char *)s, len);
     }
 
-    /* Undercurl: draw curl at the bottom of the character cell. */
+    // Undercurl: draw curl at the bottom of the character cell.
     if (flags & DRAW_UNDERC)
 	draw_curl(row, col, cells);
 
-    /* Underline: draw a line at the bottom of the character cell. */
+    // Underline: draw a line at the bottom of the character cell.
     if (flags & DRAW_UNDERL)
     {
 	int	y = FILL_Y(row + 1) - 1;
 
-	/* When p_linespace is 0, overwrite the bottom row of pixels.
-	 * Otherwise put the line just below the character. */
+	// When p_linespace is 0, overwrite the bottom row of pixels.
+	// Otherwise put the line just below the character.
 	if (p_linespace > 1)
 	    y -= p_linespace - 1;
 	XDrawLine(gui.dpy, gui.wid, gui.text_gc, FILL_X(col),
@@ -2543,12 +2544,12 @@ gui_mch_beep(void)
     void
 gui_mch_flash(int msec)
 {
-    /* Do a visual beep by reversing the foreground and background colors */
+    // Do a visual beep by reversing the foreground and background colors
     XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, 0, 0,
 	    FILL_X((int)Columns) + gui.border_offset,
 	    FILL_Y((int)Rows) + gui.border_offset);
     XSync(gui.dpy, False);
-    ui_delay((long)msec, TRUE);	/* wait for a few msec */
+    ui_delay((long)msec, TRUE);	// wait for a few msec
     XFillRectangle(gui.dpy, gui.wid, gui.invert_gc, 0, 0,
 	    FILL_X((int)Columns) + gui.border_offset,
 	    FILL_Y((int)Rows) + gui.border_offset);
@@ -2614,7 +2615,7 @@ gui_mch_draw_part_cursor(int w, int h, g
 
     XFillRectangle(gui.dpy, gui.wid, gui.text_gc,
 #ifdef FEAT_RIGHTLEFT
-	    /* vertical line should be on the right of current point */
+	    // vertical line should be on the right of current point
 	    CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w :
 #endif
 		FILL_X(gui.col),
@@ -2677,8 +2678,8 @@ gui_mch_wait_for_chars(long wtime)
 				(long_u)(wtime == 0 ? 1L : wtime),
 						 gui_x11_timer_cb, &timed_out);
 #ifdef FEAT_JOB_CHANNEL
-    /* If there is a channel with the keep_open flag we need to poll for input
-     * on them. */
+    // If there is a channel with the keep_open flag we need to poll for input
+    // on them.
     if (channel_any_keep_open())
 	channel_timer = XtAppAddTimeOut(app_context, (long_u)20,
 				   channel_poll_cb, (XtPointer)&channel_timer);
@@ -2688,7 +2689,7 @@ gui_mch_wait_for_chars(long wtime)
     desired = (XtIMAll);
     while (!timed_out)
     {
-	/* Stop or start blinking when focus changes */
+	// Stop or start blinking when focus changes
 	if (gui.in_focus != focus)
 	{
 	    if (gui.in_focus)
@@ -2705,7 +2706,7 @@ gui_mch_wait_for_chars(long wtime)
 	parse_queued_messages();
 # ifdef FEAT_TIMERS
 	if (did_add_timer)
-	    /* Need to recompute the waiting time. */
+	    // Need to recompute the waiting time.
 	    break;
 # endif
 #endif
@@ -2741,7 +2742,9 @@ gui_mch_wait_for_chars(long wtime)
  * Output routines.
  */
 
-/* Flush any output to the screen */
+/*
+ * Flush any output to the screen
+ */
     void
 gui_mch_flush(void)
 {
@@ -2763,8 +2766,8 @@ gui_mch_clear_block(
 
     x = FILL_X(col1);
 
-    /* Clear one extra pixel at the far right, for when bold characters have
-     * spilled over to the next column. */
+    // Clear one extra pixel at the far right, for when bold characters have
+    // spilled over to the next column.
     XFillRectangle(gui.dpy, gui.wid, gui.back_gc, x, FILL_Y(row1),
 	    (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1),
 	    (row2 - row1 + 1) * gui.char_height);
@@ -2784,10 +2787,10 @@ gui_mch_clear_all(void)
 gui_mch_delete_lines(int row, int num_lines)
 {
     if (gui.visibility == VisibilityFullyObscured)
-	return;	    /* Can't see the window */
-
-    /* copy one extra pixel at the far right, for when bold has spilled
-     * over */
+	return;	    // Can't see the window
+
+    // copy one extra pixel at the far right, for when bold has spilled
+    // over
     XCopyArea(gui.dpy, gui.wid, gui.wid, gui.text_gc,
 	FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
 	gui.char_width * (gui.scroll_region_right - gui.scroll_region_left + 1)
@@ -2809,10 +2812,10 @@ gui_mch_delete_lines(int row, int num_li
 gui_mch_insert_lines(int row, int num_lines)
 {
     if (gui.visibility == VisibilityFullyObscured)
-	return;	    /* Can't see the window */
-
-    /* copy one extra pixel at the far right, for when bold has spilled
-     * over */
+	return;	    // Can't see the window
+
+    // copy one extra pixel at the far right, for when bold has spilled
+    // over
     XCopyArea(gui.dpy, gui.wid, gui.wid, gui.text_gc,
 	FILL_X(gui.scroll_region_left), FILL_Y(row),
 	gui.char_width * (gui.scroll_region_right - gui.scroll_region_left + 1)
@@ -2839,18 +2842,18 @@ gui_x11_check_copy_area(void)
 
     XFlush(gui.dpy);
 
-    /* Wait to check whether the scroll worked or not */
+    // Wait to check whether the scroll worked or not
     for (;;)
     {
 	if (XCheckTypedEvent(gui.dpy, NoExpose, &event))
-	    return;	/* The scroll worked. */
+	    return;	// The scroll worked.
 
 	if (XCheckTypedEvent(gui.dpy, GraphicsExpose, &event))
 	{
 	    gevent = (XGraphicsExposeEvent *)&event;
 	    gui_redraw(gevent->x, gevent->y, gevent->width, gevent->height);
 	    if (gevent->count == 0)
-		return;		/* This was the last expose event */
+		return;		// This was the last expose event
 	}
 	XSync(gui.dpy, False);
     }
@@ -2931,7 +2934,7 @@ gui_mch_menu_hidden(vimmenu_T *menu, int
     void
 gui_mch_draw_menubar(void)
 {
-    /* Nothing to do in X */
+    // Nothing to do in X
 }
 
     void
@@ -2943,7 +2946,7 @@ gui_x11_menu_cb(
     gui_menu_cb((vimmenu_T *)client_data);
 }
 
-#endif /* FEAT_MENU */
+#endif // FEAT_MENU
 
 
 
@@ -2973,11 +2976,11 @@ gui_x11_wm_protocol_handler(
 						  wm_atoms[SAVE_YOURSELF_IDX])
     {
 	out_flush();
-	ml_sync_all(FALSE, FALSE);	/* preserve all swap files */
-
-	/* Set the window's WM_COMMAND property, to let the window manager
-	 * know we are done saving ourselves.  We don't want to be restarted,
-	 * thus set argv to NULL. */
+	ml_sync_all(FALSE, FALSE);	// preserve all swap files
+
+	// Set the window's WM_COMMAND property, to let the window manager
+	// know we are done saving ourselves.  We don't want to be restarted,
+	// thus set argv to NULL.
 	XSetCommand(gui.dpy, XtWindow(vimShell), NULL, 0);
 	return;
     }
@@ -3093,7 +3096,7 @@ gui_mch_start_blink(void)
 {
     if (blink_timer != (XtIntervalId)0)
 	XtRemoveTimeOut(blink_timer);
-    /* Only switch blinking on if none of the times is zero */
+    // Only switch blinking on if none of the times is zero
     if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
     {
 	blink_timer = XtAppAddTimeOut(app_context, blink_waittime,
@@ -3158,7 +3161,7 @@ gui_x11_callbacks(Widget textArea, Widge
     XtAddEventHandler(textArea, KeyPressMask, FALSE, gui_x11_key_hit_cb,
 	(XtPointer)0);
 
-    /* get pointer moved events from scrollbar, needed for 'mousefocus' */
+    // get pointer moved events from scrollbar, needed for 'mousefocus'
     XtAddEventHandler(vimForm, PointerMotionMask,
 	FALSE, gui_x11_mouse_cb, (XtPointer)1);
     XtAddEventHandler(textArea, ButtonPressMask | ButtonReleaseMask |
@@ -3203,8 +3206,8 @@ gui_x11_get_last_mouse_event(void)
 
 #if defined(FEAT_SIGN_ICONS) || defined(PROTO)
 
-/* Signs are currently always 2 chars wide.  Hopefully the font is big enough
- * to provide room for the bitmap! */
+// Signs are currently always 2 chars wide.  Hopefully the font is big enough
+// to provide room for the bitmap!
 # define SIGN_WIDTH (gui.char_width * 2)
 
     void
@@ -3252,9 +3255,9 @@ gui_mch_register_sign(char_u *signfile)
 							 &sign, NULL, &attrs);
 	if (status == 0)
 	{
-	    /* Sign width is fixed at two columns now.
-	    if (sign->width > gui.sign_width)
-		gui.sign_width = sign->width + 8; */
+	    // Sign width is fixed at two columns now.
+	    // if (sign->width > gui.sign_width)
+	    //     gui.sign_width = sign->width + 8;
 	}
 	else
 	    emsg(_(e_signdata));
@@ -3272,8 +3275,8 @@ gui_mch_destroy_sign(void *sign)
 
 
 #ifdef FEAT_MOUSESHAPE
-/* The last set mouse pointer shape is remembered, to be used when it goes
- * from hidden to not hidden. */
+// The last set mouse pointer shape is remembered, to be used when it goes
+// from hidden to not hidden.
 static int last_shape = 0;
 #endif
 
@@ -3282,7 +3285,7 @@ static int last_shape = 0;
  */
     void
 gui_mch_mousehide(
-    int		hide)	/* TRUE = use blank ptr, FALSE = use parent ptr */
+    int		hide)	// TRUE = use blank ptr, FALSE = use parent ptr
 {
     if (gui.pointer_hidden != hide)
     {
@@ -3300,27 +3303,27 @@ gui_mch_mousehide(
 
 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
 
-/* Table for shape IDs.  Keep in sync with the mshape_names[] table in
- * misc2.c! */
+// Table for shape IDs.  Keep in sync with the mshape_names[] table in
+// misc2.c!
 static int mshape_ids[] =
 {
-    XC_left_ptr,		/* arrow */
-    0,				/* blank */
-    XC_xterm,			/* beam */
-    XC_sb_v_double_arrow,	/* updown */
-    XC_sizing,			/* udsizing */
-    XC_sb_h_double_arrow,	/* leftright */
-    XC_sizing,			/* lrsizing */
-    XC_watch,			/* busy */
-    XC_X_cursor,		/* no */
-    XC_crosshair,		/* crosshair */
-    XC_hand1,			/* hand1 */
-    XC_hand2,			/* hand2 */
-    XC_pencil,			/* pencil */
-    XC_question_arrow,		/* question */
-    XC_right_ptr,		/* right-arrow */
-    XC_center_ptr,		/* up-arrow */
-    XC_left_ptr			/* last one */
+    XC_left_ptr,		// arrow
+    0,				// blank
+    XC_xterm,			// beam
+    XC_sb_v_double_arrow,	// updown
+    XC_sizing,			// udsizing
+    XC_sb_h_double_arrow,	// leftright
+    XC_sizing,			// lrsizing
+    XC_watch,			// busy
+    XC_X_cursor,		// no
+    XC_crosshair,		// crosshair
+    XC_hand1,			// hand1
+    XC_hand2,			// hand2
+    XC_pencil,			// pencil
+    XC_question_arrow,		// question
+    XC_right_ptr,		// right-arrow
+    XC_center_ptr,		// up-arrow
+    XC_left_ptr			// last one
 };
 
     void
@@ -3341,7 +3344,7 @@ mch_set_mouse_shape(int shape)
 	    if (id >= XC_num_glyphs)
 		id = XC_left_ptr;
 	    else
-		id &= ~1;	/* they are always even (why?) */
+		id &= ~1;	// they are always even (why?)
 	}
 	else
 	    id = mshape_ids[shape];
@@ -3365,8 +3368,8 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
     if (menu->id != NULL && menu->parent != NULL
 				       && menu_is_toolbar(menu->parent->name))
     {
-	/* Always destroy and create the balloon, in case the string was
-	 * changed. */
+	// Always destroy and create the balloon, in case the string was
+	// changed.
 	if (menu->tip != NULL)
 	{
 	    gui_mch_destroy_beval_area(menu->tip);