Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions WeaselUI/WeaselPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,8 @@ LRESULT WeaselPanel::OnDestroy(UINT uMsg,
m_hoverIndex = -1;
m_lastMousePos = {-1, -1};
m_sticky = false;
m_lastWindowPos = {-1, -1};
m_hasLastWindowPos = false;
delete m_layout;
m_layout = NULL;
return 0;
Expand Down Expand Up @@ -1287,6 +1289,11 @@ void WeaselPanel::_RepositionWindow(const bool& adj) {
y = rcWorkArea.top; // over workarea top
// memorize adjusted position (to avoid window bouncing on height change)
m_inputPos.bottom = y;
if (m_hasLastWindowPos && m_lastWindowPos.x == x && m_lastWindowPos.y == y &&
!m_redraw_by_monitor_change)
return;
m_lastWindowPos = {x, y};
m_hasLastWindowPos = true;
SetWindowPos(HWND_TOPMOST, x, y, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREDRAW);
}
Expand Down
2 changes: 2 additions & 0 deletions WeaselUI/WeaselPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class WeaselPanel
const bool& m_in_server;

CRect m_inputPos;
CPoint m_lastWindowPos = {-1, -1};
bool m_hasLastWindowPos = false;
int m_offsetys[MAX_CANDIDATES_COUNT]; // offset y for candidates when
// vertical layout over bottom
int m_offsety_preedit;
Expand Down
10 changes: 8 additions & 2 deletions WeaselUI/WeaselUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,29 @@ UINT_PTR UIImpl::timer = 0;
void UIImpl::Show() {
if (!panel.IsWindow())
return;
panel.ShowWindow(SW_SHOWNA);
bool already_shown = shown && panel.IsWindowVisible();
shown = true;
if (timer) {
KillTimer(panel.m_hWnd, AUTOHIDE_TIMER);
timer = 0;
}
if (already_shown)
return;
panel.ShowWindow(SW_SHOWNA);
}

void UIImpl::Hide() {
if (!panel.IsWindow())
return;
panel.ShowWindow(SW_HIDE);
bool already_hidden = !shown && !panel.IsWindowVisible();
shown = false;
if (timer) {
KillTimer(panel.m_hWnd, AUTOHIDE_TIMER);
timer = 0;
}
if (already_hidden)
return;
panel.ShowWindow(SW_HIDE);
}

void UIImpl::ShowWithTimeout(size_t millisec) {
Expand Down
Loading