From aa66a2600e17e2ee5c03e90713b20e20da0df131 Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Sun, 3 Nov 2024 09:39:18 -0800 Subject: [PATCH] Reset hover index when window is updated or hide Fix #1167 --- src/ui/classic/inputwindow.cpp | 2 +- src/ui/classic/waylandinputwindow.cpp | 5 +---- src/ui/classic/xcbinputwindow.cpp | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/classic/inputwindow.cpp b/src/ui/classic/inputwindow.cpp index e0ae4f5c8..f65c48412 100644 --- a/src/ui/classic/inputwindow.cpp +++ b/src/ui/classic/inputwindow.cpp @@ -271,10 +271,10 @@ void InputWindow::setTextToLayout( } std::pair InputWindow::update(InputContext *inputContext) { + hoverIndex_ = -1; if ((parent_->suspended() && parent_->instance()->currentUI() != "kimpanel") || !inputContext) { - hoverIndex_ = -1; visible_ = false; return {0, 0}; } diff --git a/src/ui/classic/waylandinputwindow.cpp b/src/ui/classic/waylandinputwindow.cpp index c05b4328f..5b8bc950e 100644 --- a/src/ui/classic/waylandinputwindow.cpp +++ b/src/ui/classic/waylandinputwindow.cpp @@ -5,18 +5,14 @@ * */ #include "waylandinputwindow.h" -#include -#include "fcitx/misc_p.h" #include "common.h" #include "waylandim_public.h" #include "waylandui.h" #include "waylandwindow.h" #include "wl_compositor.h" #include "wl_region.h" -#include "wp_fractional_scale_manager_v1.h" #include "zwp_input_method_v2.h" #include "zwp_input_panel_v1.h" -#include "zwp_input_popup_surface_v2.h" #ifdef __linux__ #include @@ -151,6 +147,7 @@ void WaylandInputWindow::update(fcitx::InputContext *ic) { if (!visible()) { CLASSICUI_DEBUG() << "Hide Wayland Input Window."; + hoverIndex_ = -1; window_->hide(); repaintIC_.unwatch(); panelSurface_.reset(); diff --git a/src/ui/classic/xcbinputwindow.cpp b/src/ui/classic/xcbinputwindow.cpp index 93c3b55c8..ac5ef85e7 100644 --- a/src/ui/classic/xcbinputwindow.cpp +++ b/src/ui/classic/xcbinputwindow.cpp @@ -165,6 +165,7 @@ void XCBInputWindow::update(InputContext *inputContext) { if (!visible()) { if (oldVisible) { xcb_unmap_window(ui_->connection(), wid_); + hoverIndex_ = -1; } return; }