Skip to content

Commit

Permalink
Reset hover index when window is updated or hide
Browse files Browse the repository at this point in the history
Fix #1167
  • Loading branch information
wengxt committed Nov 3, 2024
1 parent 42f847f commit aa66a26
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ui/classic/inputwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ void InputWindow::setTextToLayout(
}

std::pair<int, int> InputWindow::update(InputContext *inputContext) {
hoverIndex_ = -1;
if ((parent_->suspended() &&
parent_->instance()->currentUI() != "kimpanel") ||
!inputContext) {
hoverIndex_ = -1;
visible_ = false;
return {0, 0};
}
Expand Down
5 changes: 1 addition & 4 deletions src/ui/classic/waylandinputwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
*
*/
#include "waylandinputwindow.h"
#include <cstddef>
#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 <linux/input-event-codes.h>
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/ui/classic/xcbinputwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void XCBInputWindow::update(InputContext *inputContext) {
if (!visible()) {
if (oldVisible) {
xcb_unmap_window(ui_->connection(), wid_);
hoverIndex_ = -1;
}
return;
}
Expand Down

0 comments on commit aa66a26

Please sign in to comment.