From a53d3c76c09dec5fe9d1a1bb3fd1f4671149385d Mon Sep 17 00:00:00 2001 From: fanlusky <1730976608@qq.com> Date: Sat, 11 Jul 2026 18:42:59 +0800 Subject: [PATCH] [Regression]: The boundary overflow issue of the vertical candidate window should be determined and resolved based on the maximum possible window size. --- server/src/utils/window_utils.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/server/src/utils/window_utils.cpp b/server/src/utils/window_utils.cpp index 720618b4..ba8ce42c 100644 --- a/server/src/utils/window_utils.cpp +++ b/server/src/utils/window_utils.cpp @@ -1,4 +1,5 @@ #include "window_utils.h" +#include "config/ime_config.h" #include "defines/globals.h" #include "ipc/ipc.h" #include "webview_utils.h" @@ -117,12 +118,20 @@ int AdjustCandidateWindowPosition( // { Global::MarginTop = 0; + const bool is_vertical = GetConfiguredCandidateWindowLayout() == "vertical"; + static double max_vertical_container_height = ::DEFAULT_WINDOW_HEIGHT; + if (is_vertical && containerSize.second > max_vertical_container_height) + { + max_vertical_container_height = containerSize.second; + } + properPos->first = point->x; properPos->second = point->y + 3; MonitorCoordinates coordinates = GetMonitorCoordinates(); FLOAT scale = GetForegroundWindowScale(); int width = containerSize.first * scale; - int height = static_cast(std::ceil(containerSize.second * scale)); + const double boundary_height_dip = is_vertical ? max_vertical_container_height : containerSize.second; + const int boundary_height = static_cast(std::ceil(boundary_height_dip * scale)); if (properPos->first < coordinates.left) { properPos->first = coordinates.left + 2; @@ -136,9 +145,13 @@ int AdjustCandidateWindowPosition( // properPos->first = coordinates.right - width - 2; } - if (properPos->second + height > coordinates.bottom) + if (properPos->second + boundary_height > coordinates.bottom) { - properPos->second = properPos->second - height - 30 - 2; + properPos->second = properPos->second - boundary_height - 30 - 2; + if (is_vertical && containerSize.second < max_vertical_container_height) + { + Global::MarginTop = static_cast(std::ceil(max_vertical_container_height - containerSize.second)); + } } return 0; }