summaryrefslogtreecommitdiff
path: root/src/gui_x11.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-24 15:54:21 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-24 15:54:21 +0100
commitfc3abf47fbe1e426f2b676c316c81ee9ff607075 (patch)
tree87b9be7b053e71ee6ec750f7c0f0387e9287d4c0 /src/gui_x11.c
parent135059724f140ceac889c9f8136bd1bf5c41d49d (diff)
downloadvim-git-fc3abf47fbe1e426f2b676c316c81ee9ff607075.tar.gz
patch 8.1.0806: too many #ifdefsv8.1.0806
Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 2.
Diffstat (limited to 'src/gui_x11.c')
-rw-r--r--src/gui_x11.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/src/gui_x11.c b/src/gui_x11.c
index 1c55805d3..c8a3b773a 100644
--- a/src/gui_x11.c
+++ b/src/gui_x11.c
@@ -748,7 +748,7 @@ gui_x11_leave_cb(
gui_focus_change(FALSE);
}
-#if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE)
+#if defined(X_HAVE_UTF8_STRING)
# if X_HAVE_UTF8_STRING
# define USE_UTF8LOOKUP
# endif
@@ -810,13 +810,12 @@ gui_x11_key_hit_cb(
if (status == XLookupNone || status == XLookupChars)
key_sym = XK_VoidSymbol;
-# ifdef FEAT_MBYTE
/* 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
+# ifdef USE_UTF8LOOKUP
&& !enc_utf8
-# endif
+# endif
)
{
int maxlen = len * 4 + 40; /* guessed */
@@ -829,7 +828,6 @@ gui_x11_key_hit_cb(
string_alloced = True;
len = convert_input(p, len, maxlen);
}
-# endif
/* Translate CSI to K_CSI, otherwise it could be recognized as the
* start of a special key. */
@@ -901,10 +899,7 @@ gui_x11_key_hit_cb(
&& (ev_press->state & Mod1Mask)
&& !(key_sym == XK_BackSpace || key_sym == XK_Delete)
&& (string[0] & 0x80) == 0
-#ifdef FEAT_MBYTE
- && !enc_dbcs
-#endif
- )
+ && !enc_dbcs)
{
#if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF)
/* Ignore ALT keys when they are used for the menu only */
@@ -930,7 +925,6 @@ gui_x11_key_hit_cb(
&& !(key_sym == XK_Tab && (ev_press->state & ShiftMask)))
{
string[0] |= 0x80;
-#ifdef FEAT_MBYTE
if (enc_utf8) /* convert to utf-8 */
{
string[1] = string[0] & 0xbf;
@@ -944,7 +938,6 @@ gui_x11_key_hit_cb(
else
len = 2;
}
-#endif
}
else
ev_press->state |= Mod1Mask;
@@ -983,10 +976,7 @@ gui_x11_key_hit_cb(
if (len == -3 || key_sym == XK_space || key_sym == XK_Tab
|| key_sym == XK_Return || key_sym == XK_Linefeed
|| key_sym == XK_Escape
-#ifdef FEAT_MBYTE
- || (enc_dbcs && len == 1 && (ev_press->state & Mod1Mask))
-#endif
- )
+ || (enc_dbcs && len == 1 && (ev_press->state & Mod1Mask)))
{
modifiers = 0;
if (ev_press->state & ShiftMask)
@@ -2375,7 +2365,6 @@ gui_mch_draw_string(
int flags)
{
int cells = len;
-#ifdef FEAT_MBYTE
static void *buf = NULL;
static int buflen = 0;
char_u *p;
@@ -2399,17 +2388,17 @@ gui_mch_draw_string(
while (p < s + len)
{
c = utf_ptr2char(p);
-# ifdef FEAT_XFONTSET
+#ifdef FEAT_XFONTSET
if (current_fontset != NULL)
{
-# ifdef SMALL_WCHAR_T
+# ifdef SMALL_WCHAR_T
if (c >= 0x10000)
c = 0xbf; /* show chars > 0xffff as ? */
-# endif
+# endif
((wchar_t *)buf)[wlen] = c;
}
else
-# endif
+#endif
{
if (c >= 0x10000)
c = 0xbf; /* show chars > 0xffff as ? */
@@ -2431,8 +2420,6 @@ gui_mch_draw_string(
}
}
-#endif
-
#ifdef FEAT_XFONTSET
if (current_fontset != NULL)
{
@@ -2452,12 +2439,10 @@ gui_mch_draw_string(
if (flags & DRAW_TRANSP)
{
-#ifdef FEAT_MBYTE
if (enc_utf8)
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), buf, wlen);
else
-#endif
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), (char *)s, len);
}
@@ -2472,24 +2457,20 @@ gui_mch_draw_string(
FILL_Y(row), gui.char_width * cells, gui.char_height);
XSetForeground(gui.dpy, gui.text_gc, prev_fg_color);
-#ifdef FEAT_MBYTE
if (enc_utf8)
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), buf, wlen);
else
-#endif
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), (char *)s, len);
}
else
{
/* XmbDrawImageString has bug, don't use it for fontset. */
-#ifdef FEAT_MBYTE
if (enc_utf8)
XDrawImageString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), buf, wlen);
else
-#endif
XDrawImageString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col),
TEXT_Y(row), (char *)s, len);
}
@@ -2497,12 +2478,10 @@ gui_mch_draw_string(
/* Bold trick: draw the text again with a one-pixel offset. */
if (flags & DRAW_BOLD)
{
-#ifdef FEAT_MBYTE
if (enc_utf8)
XDrawString16(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col) + 1,
TEXT_Y(row), buf, wlen);
else
-#endif
XDrawString(gui.dpy, gui.wid, gui.text_gc, TEXT_X(col) + 1,
TEXT_Y(row), (char *)s, len);
}
@@ -2628,10 +2607,8 @@ gui_mch_draw_hollow_cursor(guicolor_T color)
{
int w = 1;
-#ifdef FEAT_MBYTE
if (mb_lefthalve(gui.row, gui.col))
w = 2;
-#endif
gui_mch_set_fg_color(color);
XDrawRectangle(gui.dpy, gui.wid, gui.text_gc, FILL_X(gui.col),
FILL_Y(gui.row), w * gui.char_width - 1, gui.char_height - 1);