diff --git a/src/unix/ibus/ibus_header.h b/src/unix/ibus/ibus_header.h index 0daa9f183..11a86005e 100644 --- a/src/unix/ibus/ibus_header.h +++ b/src/unix/ibus/ibus_header.h @@ -40,8 +40,8 @@ static_assert(std::is_same::value, "guint must be uint."); static_assert(std::is_same::value, "gchar must be char."); static_assert(std::is_same::value, "gboolean must be int."); -#if !IBUS_CHECK_VERSION(1, 5, 4) -#error "ibus-mozc requires IBus>=1.5.4" -#endif // libibus (<1.5.4) +#if !IBUS_CHECK_VERSION(1, 5, 33) +#error "ibus-mozc requires IBus>=1.5.33" +#endif // libibus (<1.5.33) #endif // MOZC_UNIX_IBUS_IBUS_HEADER_H_ diff --git a/src/unix/ibus/ibus_wrapper.cc b/src/unix/ibus/ibus_wrapper.cc index 2c18c004c..b825a6b40 100644 --- a/src/unix/ibus/ibus_wrapper.cc +++ b/src/unix/ibus/ibus_wrapper.cc @@ -42,9 +42,9 @@ static_assert(std::is_same::value, "gchar must be char."); static_assert(std::is_same::value, "gboolean must be int."); static_assert(std::is_same::value, "gpointer must be void*."); -#if !IBUS_CHECK_VERSION(1, 5, 4) -#error "ibus-mozc requires IBus>=1.5.4" -#endif // libibus (<1.5.4) +#if !IBUS_CHECK_VERSION(1, 5, 33) +#error "ibus-mozc requires IBus>=1.5.33" +#endif // libibus (<1.5.33) namespace mozc { namespace ibus { diff --git a/src/unix/ibus/preedit_handler.cc b/src/unix/ibus/preedit_handler.cc index a04f92f14..681aab5ad 100644 --- a/src/unix/ibus/preedit_handler.cc +++ b/src/unix/ibus/preedit_handler.cc @@ -55,35 +55,20 @@ IbusTextWrapper ComposePreeditText(const commands::Preedit& preedit) { IBusAttrUnderline attr = IBUS_ATTR_UNDERLINE_ERROR; switch (segment.annotation()) { case commands::Preedit::Segment::NONE: - attr = IBUS_ATTR_UNDERLINE_NONE; + // No decoration break; case commands::Preedit::Segment::UNDERLINE: - attr = IBUS_ATTR_UNDERLINE_SINGLE; + text.AppendAttribute(IBUS_ATTR_TYPE_HINT, IBUS_ATTR_PREEDIT_WHOLE, + start, end); break; case commands::Preedit::Segment::HIGHLIGHT: - attr = IBUS_ATTR_UNDERLINE_DOUBLE; + text.AppendAttribute(IBUS_ATTR_TYPE_HINT, IBUS_ATTR_PREEDIT_SELECTION, + start, end); break; default: LOG(ERROR) << "unknown annotation:" << segment.annotation(); break; } - end += segment.value_length(); - text.AppendAttribute(IBUS_ATTR_TYPE_UNDERLINE, attr, start, end); - - // Many applications show a single underline regardless of using - // IBUS_ATTR_UNDERLINE_SINGLE or IBUS_ATTR_UNDERLINE_DOUBLE for some - // reasons. Here we add a background color for the highlighted candidate - // to make it easiliy distinguishable. - if (segment.annotation() == commands::Preedit::Segment::HIGHLIGHT) { - constexpr uint kBackgroundColor = 0xD1EAFF; - text.AppendAttribute(IBUS_ATTR_TYPE_BACKGROUND, kBackgroundColor, start, - end); - // IBUS_ATTR_TYPE_FOREGROUND is necessary to highlight the segment on - // Firefox. - constexpr uint kForegroundColor = 0x000000; - text.AppendAttribute(IBUS_ATTR_TYPE_FOREGROUND, kForegroundColor, start, - end); - } start = end; }