A vertical layout adaptation method and system for a multi-language operating system
Patent Information
- Application Number
- CN202610994324.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2046-07-06
AI Technical Summary
由于窗口、菜单栏、按钮、输入框等控件通常按照横排模式设计,在屏幕整体旋转或文字旋转后,容易出现图形元素方向异常、文字排列不符合竖排习惯、光标移动方向与视觉方向不一致、窗口标题栏位置错乱等问题
本发明通过监控系统语言信息确定当前布局模式并提供给图形界面框架和窗口管理器,可使操作系统能够根据竖排书写语言自动进入竖排布局模式,无需针对单个应用逐一配置,降低了竖排界面适配成本;在竖排布局模式下,本发明并非仅对文字或屏幕进行单独旋转,而是在屏幕整体旋转输出之前,对控件布局方向、图形元素绘制方向、文字元素行间递进方向以及文字整体显示方向进行方向预补偿处理,使屏幕旋转输出后图形元素能够保持正常显示,文字元素能够形成符合竖排书写习惯的显示状态;同时,本发明进一步在窗口管理器中对光标移动方向和窗口标题栏方位进行预补偿处理,使屏幕整体旋转输出后光标移动方向与用户视觉方向保持一致,并使窗口标题栏保持在符合用户操作习惯的位置。本发明能够在Linux操作系统层面实现图形界面框架、窗口管理器和显示输出之间的协同适配,避免现有方案中仅局部文字旋转导致的控件方向异常、交互方向不一致和窗口装饰位置错乱等问题,从而提高多语言操作系统对蒙古文、锡伯文等竖排书写语言的系统级适配能力和用户交互体验。
Smart Images

Figure CN122507438B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer operating system graphical interface display technology, specifically to a vertical layout adaptation method and system for multilingual operating systems. Background Technology
[0002] With the widespread use of the Linux operating system in different language environments, the operating system interface needs to adapt to the writing and reading habits of different ethnic scripts. Existing operating systems and their graphical interface frameworks are usually based on a horizontal layout, mainly supporting text arrangement methods from left to right (LTR) or from right to left (RTL). For vertical writing languages such as Mongolian and Xibe, which are written from top to bottom and progress in columns, existing systems usually still use a horizontal interface structure, or simply rotate the text for display, making it difficult to form a system-level interface layout that conforms to vertical reading habits.
[0003] Existing vertical display solutions mostly focus on text rendering and adaptation for individual applications or partial menus, failing to provide unified and coordinated handling for control layout, graphic element drawing, text line progression direction, cursor movement direction, and window title bar positioning within the operating system interface. Since windows, menu bars, buttons, input boxes, and other controls are typically designed in a horizontal layout, issues such as abnormal graphic element orientation, text arrangement not conforming to vertical layout conventions, cursor movement direction inconsistent with visual direction, and misaligned window title bar positions easily arise after the entire screen or text is rotated.
[0004] Furthermore, different applications may be developed using different graphical interface frameworks, and these frameworks do not support vertical layouts uniformly. Developers often need to adapt these frameworks separately for specific applications or controls, resulting in high maintenance costs, limited adaptation scope, and difficulty in providing a consistent and stable vertical display environment across the entire operating system. Therefore, there is an urgent need for a vertical layout adaptation method for multilingual operating systems that can automatically determine the layout mode based on the system's language environment and coordinate the processing of graphics, text, cursors, and title bars in the graphical interface framework and window manager when the screen is rotated for output, thereby achieving system-level vertical layout adaptation. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a vertical layout adaptation method and system for multi-language operating systems to achieve system-level vertical layout adaptation, in view of the above-mentioned problems of the prior art.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: A vertical layout adaptation method for multilingual operating systems, applied to the Linux operating system including the graphical interface framework and window manager, includes the following steps: S1 monitors the system language information, determines the current layout mode based on the current system language information, and provides the current layout mode to the graphical interface framework and window manager. S2, when the current layout mode is a vertical layout mode, before the screen is rotated and output, the operating system interface is subjected to orientation pre-compensation processing, including: adjusting the layout direction of the graphical interface frame controls to right to left, performing pre-rotation processing on the graphic elements in the controls to match the overall screen rotation output direction, adjusting the line progression direction of the text elements in the controls from top to bottom to bottom to top, and performing rotation processing on the text elements in the controls to match the vertical display direction. S3, perform pre-compensation processing on cursor movement direction and window title bar orientation in window manager, including: pre-mapping cursor movement direction to match the direction of the overall screen rotation output to be executed, and performing orientation pre-compensation processing on window title bar according to the target display orientation of title bar after the overall screen rotation output. S4, after completing the orientation pre-compensation and cursor movement direction and window title bar orientation pre-compensation, generates a screen rotation control command according to the target screen orientation corresponding to the vertical layout mode to rotate and output the screen display content of the current display device as a whole, so that the operating system interface switches to the vertical display state.
[0007] Further, in step S1, the system language information is monitored, and the current layout mode is determined based on the current system language information, including the following steps: When the Linux operating system starts up or a user switches the system language, retrieve the language attribute from the Accountsservice system account service. Determine whether the language attribute belongs to the language attribute corresponding to the preset vertical writing language. If so, set the current layout mode to vertical layout mode; otherwise, set the current layout mode to normal layout mode. When a user switches the system language, the system language is updated by calling the SetLanguage method through the inter-process communication interface of the Accountsservice system account service. The layout mode parameters are set according to the updated system language. The layout mode parameters corresponding to the preset vertical writing language are set to the vertical layout mode, and the layout mode parameters corresponding to other languages are set to the normal layout mode. The preset vertical writing language includes one or more of Mongolian, Xibe and Manchu.
[0008] Furthermore, in step S2, the layout direction of the controls in the graphical interface framework is adjusted to be from right to left, including the following steps: Call the layout direction setting interface setLayoutDirection in the graphical interface framework to adjust the arrangement direction of control elements, text alignment direction, and control interaction logic from left to right to right to left RightToLeft, and perform direction pre-compensation processing for graphic elements and text elements based on the right-to-left control layout.
[0009] Furthermore, in step S2, when performing pre-rotation processing on the graphic elements within the control to match the overall screen rotation output direction, specifically, pre-rotating the graphic elements within the control 90 degrees clockwise includes the following steps: In the custom style class of the graphical interface framework UKUIConfigStyle, modify the Qt control drawing interface. At the entry point of the control drawing interface, using the center option->rect of the current control drawing area as the rotation reference, call the painter rotation interface QPainter::rotate to rotate the graphic elements within the control 90 degrees clockwise. The control drawing interface includes one or more of the following: drawControl, drawPrimitive, and drawComplexControl.
[0010] Further, in step S2, the line progression direction of the text elements within the control is adjusted from top to bottom to bottom to top, and the text elements within the control are rotated to match the vertical display direction, including the following steps: In the custom style class of the graphical interface framework UKUIConfigStyle, the function adjustTextLayoutLinesBottomUp is called to adjust the text lines from bottom to top. This function generates multiple text lines based on the text layout object QTextLayout and the width of the control's text area, and performs soft wrapping on each text line according to the width of the control's text area. The height of each text line and the total height of all text lines are calculated. Using the total height of all text lines as the reverse adjustment benchmark, the target vertical coordinate of the current text line is calculated based on the cumulative height of the text lines before the current text line and the height of the current text line. The position of each text line in the text layout object is updated according to the target vertical coordinate of each text line, so that the logical first line is located at the bottom of the text layout area, and the subsequent text lines are arranged upwards in sequence, so that the line progression direction of the multi-line text elements in the control is adjusted to be from bottom to top. In the control drawing interface, the center of the current control drawing area, option->rect, is used as the rotation reference. The QPainter::rotate interface is called to rotate the text element as a whole. The rotation is a 180-degree clockwise rotation.
[0011] Furthermore, step S2, which involves rotating the text elements within the control to match the vertical display direction, also includes the following steps: For list controls or table controls that do not display text through the regular control drawing interface, in the text drawing interface drawItemText and the image drawing interface drawItemPixmap, the text displayed therein is rotated 180 degrees clockwise at the function entry point with the center of the current control drawing area as the rotation reference. For text display elements developed using the declarative interface language Qml, the transformation property of the text display element is set to scaling transformation, and the horizontal scaling parameter and vertical scaling parameter are set to negative values based on the center of the control's width and height, so that the text display element rotates 180 degrees clockwise; wherein, the text display element includes one or more of the following: Text static text display element, TextInput text input element, and Label label text display element.
[0012] Furthermore, in step S3, the cursor movement direction is pre-mapped to match the overall screen rotation output direction to be executed, including the following steps: The cursor output transformation compensation function cursor_apply_output_transform_compensation in the window manager is called to obtain the cursor position and cursor movement direction based on the current output transformation parameter whr_output->transform and the cursor motion parameter cursor_feed_motion. If the current layout mode is a vertical layout mode, the cursor movement direction increment is mapped from (dx, dy) to (-dy, dx) so that the cursor rotates 90 degrees clockwise relative to the movement direction.
[0013] Furthermore, in step S3, when performing orientation pre-compensation processing on the window title bar based on the target display orientation of the title bar after the overall screen rotation output, specifically, the window title bar is pre-moved to the right side of the window so that the window title bar is located at the top of the window after the overall screen rotation output, including the following steps: In the window decoration system of the window manager, the geometric information of the title bar to be drawn is obtained through the title bar geometry information acquisition function ssd_update_titlebar and the decoration region update function scene_decoration_update_region. The geometric information includes one or more of the following: window width, window height, title bar height and border thickness. If the current layout mode is a portrait layout mode, the title bar starting position is set to the position determined by the window width and border thickness using the title bar position adjustment function ssd_update_titlebar, the title bar width and height are set to the dimensions determined by the title bar height and window height, and the window decoration margin is set using the window decoration margin setting function ky_scene_decoration_set_margin, so that the title bar moves from the top of the window to the right side of the window, so that after the screen content is rotated 90 degrees counterclockwise, the title bar is located at the top of the window.
[0014] Further, in step S4, a screen rotation control command is generated according to the target screen orientation corresponding to the vertical layout mode to rotate and output the screen display content of the current display device as a whole, including the following steps: Get the screen identifier (screen-id) of the current display device; If the current layout mode is a portrait layout mode, the overall screen rotation output function is called. The overall screen rotation output function calls the display configuration management tool kscreen-doctor to generate and execute the screen rotation control instruction rotation.left, which sets the output direction of the target display device to a left rotation state, based on the screen identifier screen-id of the current display device. This causes the screen display content of the current display device to rotate 90 degrees counterclockwise and output, forming the overall portrait display interface of the system.
[0015] A vertical layout adaptation system for a multilingual operating system includes an interconnected microprocessor and a memory, the microprocessor being programmed or configured to perform the steps of a vertical layout adaptation method for a multilingual operating system.
[0016] Compared with the prior art, the advantages of the present invention are as follows: This invention determines the current layout mode by monitoring system language information and provides it to the graphical interface framework and window manager. This allows the operating system to automatically enter the vertical layout mode based on the vertical writing language, eliminating the need for individual configuration for each application and reducing the adaptation cost of vertical interfaces. In the vertical layout mode, this invention does not only rotate the text or screen individually, but also performs directional pre-compensation processing on the control layout direction, graphic element drawing direction, text element line progression direction, and overall text display direction before the screen is rotated and output. This ensures that graphic elements can maintain normal display after the screen is rotated and that text elements can form a display state that conforms to vertical writing habits. At the same time, this invention further performs pre-compensation processing on the cursor movement direction and window title bar position in the window manager, ensuring that the cursor movement direction is consistent with the user's visual direction after the screen is rotated and that the window title bar is kept in a position that conforms to the user's operating habits. This invention enables collaborative adaptation between the graphical interface framework, window manager, and display output at the Linux operating system level, avoiding problems such as abnormal control orientation, inconsistent interaction direction, and disordered window decoration position caused by only local text rotation in existing solutions. This improves the system-level adaptation capability and user interaction experience of multilingual operating systems for vertically written languages such as Mongolian and Xibe. Attached Figure Description
[0017] Figure 1 This is a flowchart of the vertical layout adaptation method according to an embodiment of the present invention.
[0018] Figure 2 This is a schematic diagram of the overall architecture corresponding to the vertical layout adaptation method in a specific application embodiment.
[0019] Figure 3 This is a flowchart illustrating the execution of the vertical layout adaptation method in a specific application embodiment.
[0020] Figure 4 This is a schematic diagram of the screen transformation process during the execution of the vertical layout adaptation method in a specific application embodiment (taking Mongolian script as an example). Detailed Implementation
[0021] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.
[0022] In the prior art, Chinese invention patent "A method, device, and mobile terminal for displaying menus on a mobile terminal" (publication number CN102566926A) proposes a method for vertically displaying menus on a mobile terminal. This method triggers a pre-set vertical menu display function in response to user operation commands and displays the menu according to the corresponding vertical display mode. Its main purpose is to provide a vertical menu display function to enrich the user's operating experience, especially to meet the needs of users who prefer vertical reading habits, such as those using Chinese. However, this patent relies on the user to manually trigger the vertical function and cannot automatically adjust the screen orientation in real time to achieve system-level vertical adaptation by monitoring the system's language environment; it only provides a local vertical adjustment for the menu interface.
[0023] US Patent “Method and Apparatus for Displaying Vertical Text” (Publication No. US20130067394A1) discloses a method and apparatus for displaying vertical text on an electronic device, mainly involving arranging text vertically from top to bottom on a display screen to accommodate the reading habits of certain Asian languages. However, this patent focuses on the vertical arrangement of text content and does not address the rotation of the entire operating system interface, nor does it address the layout adjustment of elements such as window title bars, system icons, and text.
[0024] To address the lack of system-level vertical layout support in existing Linux operating systems, which makes it difficult to adapt to vertical writing languages such as Mongolian and Xibe, this invention provides a vertical layout adaptation method for multilingual operating systems. This method determines the current layout mode by monitoring system language information. When the current layout mode is vertical, before the overall screen rotation, it performs orientation pre-compensation processing on the operating system interface. This includes adjusting the layout direction of the graphical interface frame controls to right-to-left, pre-rotating the graphic elements within the controls to match the overall screen rotation direction, adjusting the line progression direction of the text elements within the controls from top-down to bottom-up, and rotating the text elements within the controls to match the vertical display direction. Simultaneously, in the window manager, it performs pre-compensation processing on the cursor movement direction and the window title bar position to match the cursor movement direction with the visual direction after the overall screen rotation, and to ensure the window title bar remains at the top of the window after the overall screen rotation. Finally, it generates a screen rotation control command based on the target screen orientation corresponding to the vertical layout mode, rotating the screen display content of the current display device to switch the operating system interface to a vertical display state. Through the above solution, the present invention does not simply rotate the text content separately, but starts from the overall architecture of the Linux graphical display system and coordinates the graphical interface framework, window manager and display output process to make the control layout, graphic drawing, text arrangement, cursor mapping and window title bar position all coordinated with the display direction of vertical writing languages, thereby achieving system-level vertical layout adaptation for vertical writing languages such as Mongolian and Xibe.
[0025] Specifically, this embodiment provides a vertical layout adaptation method for multi-language operating systems, applied to a Linux operating system including a graphical user interface framework and a window manager. The graphical user interface framework can be the Qt graphical user interface framework, and the window manager can be a window manager based on the Wayland display protocol. The Linux operating system includes a vertical layout control module, a graphics and text preprocessing module, a cursor direction control module, a title bar orientation control module, and a screen rotation output module. The vertical layout control module monitors system language information and determines the current layout mode; the graphics and text preprocessing module performs orientation pre-compensation processing on the control layout direction, graphic elements, and text elements before screen rotation output; the cursor direction control module performs pre-compensation processing on the cursor movement direction; the title bar orientation control module performs pre-compensation processing on the window title bar orientation; and the screen rotation output module generates a screen rotation control command based on the target screen orientation corresponding to the vertical layout mode to rotate the screen display content of the current display device.
[0026] like Figure 1As shown, the vertical layout adaptation method in this embodiment includes the following steps: S1 monitors the system language information, determines the current layout mode based on the current system language information, and provides the current layout mode to the graphical interface framework and window manager.
[0027] Specifically, during Linux operating system startup, the vertical layout control module is invoked by default via the systemd service. As the overall scheduler of the vertical layout mechanism, this module monitors changes in the system language, sets the current layout mode, and issues commands to each submodule in real time to switch layouts. After startup, the vertical layout control module monitors changes in system language information. When the Linux operating system starts or a user switches the system language, it retrieves the language attribute from the Accountsservice system account service and determines whether the language attribute corresponds to the preset vertical writing language. If the language attribute corresponds to the preset vertical writing language, the current layout mode is set to vertical layout mode; otherwise, the current layout mode is set to normal layout mode.
[0028] When a user switches the system language, the `SetLanguage` method within the `DBus` service is called via the inter-process communication interface of the system account service (`Accountsservice`) to update the system language, and the layout mode parameters are set according to the updated system language. Specifically, a `LayoutService DBus` module can be constructed to store the layout mode parameters. When the updated system language is a preset vertical writing language, the corresponding layout mode parameter `LayoutMode` is set to the vertical layout mode; when the updated system language is another language, the corresponding layout mode parameter is set to the normal layout mode. The preset vertical writing language includes one or more of Mongolian, Xibe, and Manchu; in this embodiment, Mongolian and Xibe can be used as the languages that trigger the vertical layout mode.
[0029] The LayoutService DBus module provides the current layout mode to the graphical user interface framework and window manager, enabling them to perform subsequent pre-compensation processing based on unified layout mode parameters. In practice, the LayoutService DBus module provides layout mode query and layout mode change notification interfaces, allowing the graphics and text preprocessing module, cursor direction control module, title bar orientation control module, and overall screen rotation output module to obtain the current layout mode. When LayoutMode changes from normal to vertical, each module enters the vertical layout processing flow; when LayoutMode changes from vertical to normal, each module can revert to the normal landscape display mode.
[0030] S2, when the current layout mode is a vertical layout mode, before the screen is rotated and output, the operating system interface is subjected to orientation pre-compensation processing, including: adjusting the layout direction of the graphical interface frame controls to right to left, performing pre-rotation processing on the graphic elements in the controls to match the overall screen rotation output direction, adjusting the line progression direction of the text elements in the controls from top to bottom to bottom to top, and performing rotation processing on the text elements in the controls to match the vertical display direction.
[0031] Specifically, the graphics and text preprocessing module mainly adjusts the display direction of graphic elements and the display and line progression direction of text elements in advance by modifying the layout mode and drawing process of Qt controls in custom classes. This ensures that the graphics elements remain upright after screen rotation and conform to the vertical layout orientation. The main steps are as follows: When the current layout mode is vertical, the `setLayoutDirection(Qt::RightToLeft)` interface in the graphical interface framework is first called to set the Qt layout mode to `Qt::RightToLeft`. This adjusts the arrangement direction of control elements, text alignment, and control interaction logic from left to right to right to left (`RightToLeft`), horizontally reversing the alignment and interaction logic of control elements and text. Furthermore, pre-compensation processing for the direction of graphic and text elements is performed based on the right-to-left control layout. Therefore, after the content is subsequently rotated and output, the arrangement direction of the controls is consistent with the interface direction of a vertically written language.
[0032] For the graphic elements within the control, modify the Qt control drawing interface in the custom style class of the graphical interface framework UKUIConfigStyle. At the function entry points of the drawing control interface function drawControl(), the basic primitive drawing interface function drawPrimitive(), and the composite control drawing interface function drawComplexControl() in the control drawing interface, use the center option->rect of the current control drawing area as the rotation reference, and call the painter rotation interface QPainter::rotate(90) to rotate the graphic elements within the control 90 degrees clockwise. By pre-rotating the graphic elements before the overall screen rotation output, all graphic elements can be rotated 90 degrees counterclockwise for output. This ensures that after the overall screen rotates 90 degrees counterclockwise, the graphical interface can adapt to the display direction of the vertical text, and the control graphic elements still maintain their positive display.
[0033] In one alternative implementation, before calling QPainter::rotate, the painter state can be saved first, and a local drawing coordinate system can be established with the center of the current control's drawing area, option->rect. After the drawing of the graphic element is completed, the painter state can be restored to avoid the rotation transformation of the current control affecting the drawing of subsequent controls or other interface elements.
[0034] For text elements within a control, in the custom style class of the graphical interface framework UKUIConfigStyle, the function adjustTextLayoutLinesBottomUp is called to adjust the text lines from bottom to top. This function generates multiple text lines based on the text layout object QTextLayout and the width of the control's text area, and performs soft wrapping on each text line according to the width of the control's text area. The height of each text line and the total height of all text lines are calculated, and the total height of all text lines is used as the reverse adjustment benchmark. The target ordinate of the current text line is calculated based on the cumulative height of the text lines before the current text line and the height of the current text line. The position of each text line in the text layout object is updated according to the target ordinate of each text line, so that the logical first line is located at the bottom of the text layout area, and the subsequent text lines are arranged upwards in sequence, thereby adjusting the line progression direction of the multi-line text elements within the control to be from bottom to top.
[0035] Specifically, the function `adjustTextLayoutLinesBottomUp` adjusts the text lines from bottom to top. It takes a `QTextLayout` object and the width of the control's text area. First, it calls `QTextLayout::beginLayout()`, then it calls `QTextLayout::createLine()` repeatedly to generate each text line `QTextLine`, and then uses `QTextLine::setLineWidth()` to make the text wrap softly according to the control's width. Next, it calculates the line height `lineHeight_i` of each text line and the total height `H` of all text lines, and uses this total height as the reverse adjustment benchmark. It uses the cumulative height `P_i` of the lines before the `i`th line as the offset, and calculates the ordinate of the `i`th line according to `y_i = H - P_i - lineHeight_i`. Finally, it writes back the position of each text line using `QTextLine::setPosition(QPoint(0,y_i))`, so that the logical first line is at the bottom of the text layout area, and the subsequent text lines are arranged upwards in sequence. Finally, it calls `QTextLayout::draw()` to complete the drawing. Therefore, without changing the text content, font, horizontal writing direction, horizontal alignment, and soft line break rules, the line progression direction of multi-line text elements within the control is adjusted from top to bottom to bottom to top, so that after the screen is rotated and output, the line progression direction of the text elements can be converted from the original top to bottom to adapt to the display direction of vertical writing languages.
[0036] After adjusting the text line progression direction, in the control drawing interface, using the center option->rect of the current control drawing area as the rotation reference, the painter rotation interface QPainter::rotate(180) is called to rotate the entire text element. The rotation process involves rotating the entire text 180 degrees clockwise. Through the above adjustment of the text line progression direction and the overall text rotation, it can be ensured that after the screen is rotated and output, the text element forms a vertical display state, and the text line progression direction changes from top to bottom to left to right.
[0037] Furthermore, for list controls or table controls that do not display text through conventional control drawing interfaces, in the text drawing interface `drawItemText()` and the image drawing interface `drawItemPixmap()`, at the function entry point, `QPainter::rotate(180)` is called with the center of the current control's drawing area, `option->rect`, as the rotation reference to rotate the displayed text 180 degrees clockwise. This process can cover list controls, table controls, and other UI elements that do not use conventional control drawing interfaces such as `drawControl`, `drawPrimitive`, and `drawComplexControl`, ensuring that their text display direction is consistent with the text of other controls.
[0038] For text display elements developed using the declarative UI language Qml, the transform property of the text display elements (such as Text static text display elements, TextInput text input elements, and Label label text display elements) is set to scale transformation. Using the center of the control's width and height as a reference, the horizontal and vertical scaling parameters are set to negative values (e.g., xScale / yScale are set to -1), causing the text display elements to rotate 180 degrees clockwise. By setting the transform property of Qml text display elements to scale, the Qml-based interface can also be displayed vertically after the entire screen is rotated.
[0039] S3, in the window manager, pre-compensate the cursor movement direction and the window title bar position, including: pre-mapping the cursor movement direction to match the direction of the overall screen rotation output to be executed, and performing position pre-compensation processing on the window title bar according to the target display position of the title bar after the overall screen rotation output.
[0040] The cursor direction control module is responsible for adjusting the cursor movement direction in real time according to the layout mode to ensure that the cursor movement direction remains the same as the visual direction after screen rotation. The main working steps are as follows: For the pre-compensation processing of the cursor movement direction, the cursor output transformation compensation function cursor_apply_output_transform_compensation() in the window manager is called to obtain the cursor position and cursor movement direction based on the current output transformation parameter whr_output->transform and the cursor motion parameter cursor_feed_motion.
[0041] If the current layout mode is portrait, the cursor movement direction increment is mapped from (dx, dy) to (-dy, dx) to rotate the relative movement direction of the cursor 90 degrees clockwise. Since the screen display content will subsequently be output after rotating 90 degrees counterclockwise, pre-rotating the relative movement direction of the cursor clockwise by 90 degrees ensures that the cursor movement direction after the overall screen rotation output remains consistent with the user's visual direction.
[0042] In actual implementation, after receiving motion events from the mouse, touchpad, or other pointer input devices, the cursor direction control module first converts the input events into cursor movement direction increments (dx, dy), and then determines whether to execute the above direction mapping based on the current layout mode. When the current layout mode is normal, the direction mapping is not executed, or the default cursor movement direction is restored.
[0043] For pre-compensation processing of the window title bar position, the title bar position control module can adjust the application title bar position in real time according to the layout mode to ensure that the window title bar is always at the top of the window. Specifically, the window title bar is pre-moved to the right side of the window so that the window title bar is at the top of the window after the entire screen is rotated. Normally, the title bar is controlled by the decoration system of the window manager and is located at the top of the window, with minimize and other control buttons located to its right. This embodiment modifies the decoration system in the window manager to pre-move the title bar to the right side of the window, so that the title bar is moved to the right side of the window before the entire screen is rotated, thus ensuring that the title bar is still displayed at the top of the window after the entire screen content is rotated 90 degrees counterclockwise.
[0044] Specifically, in the window decoration system of the window manager, the geometric information of the title bar to be drawn is obtained through the title bar geometry information acquisition function `ssd_update_titlebar()` and the decoration region update function `scene_decoration_update_region()`. This geometric information includes one or more of the following: window width, window height, title bar height, and border thickness. The window width can be represented as `geometry.width`, the window height as `geometry.height`, the title bar height as `theme->title_height`, and the border thickness as `theme->border_width`.
[0045] If the current layout mode is portrait, the title bar's starting position is set to the position determined by the window width and border thickness using the title bar position adjustment function `ssd_update_titlebar()`, and its width and height are set to the dimensions determined by the title bar height and window height. The window decoration margin is then set using the window decoration margin setting function `ky_scene_decoration_set_margin()`, moving the title bar from the top of the window to the right side so that after the entire screen content is rotated 90 degrees counter-clockwise, the title bar is positioned at the top of the window. This step modifies the existing decoration system in the window manager.
[0046] In one specific implementation, the `ssd_update_titlebar()` function in the window manager can be used to set the starting position of the title bar to `(geometry.width, -theme->border_width)`, and the title bar width and height to `(theme->title_height, geometry.height)`. Then, `ky_scene_decoration_set_margin()` and `view->margin.off_x = theme->title_height` can be used to move the title bar to the right side of the window. Furthermore, the minimize, maximize, close buttons, drag area, and hit area in the title bar can be updated synchronously, ensuring that the title bar and its control buttons remain visible and interactive even after the screen is rotated.
[0047] S4, after completing the orientation pre-compensation and cursor movement direction and window title bar orientation pre-compensation, generates a screen rotation control command according to the target screen orientation corresponding to the vertical layout mode to rotate and output the screen display content of the current display device as a whole, so that the operating system interface switches to the vertical display state.
[0048] Specifically, before executing the overall screen rotation output, the screen rotation output module can confirm that the graphics and text preprocessing module, cursor direction control module, and title bar orientation control module have all completed their corresponding pre-compensation processing. After completing the pre-compensation processing, the screen identifier (screen-id) of the current display device is obtained. If the current layout mode is a portrait layout mode, the overall screen rotation output function is called. Based on the screen identifier (screen-id) of the current display device, the overall screen rotation output function calls the display configuration management tool kscreen-doctor to generate and execute the screen rotation control instruction rotation.left, which sets the output direction of the target display device to a left rotation state. This causes the screen display content of the current display device to rotate 90 degrees counterclockwise, forming the overall portrait display interface of the system.
[0049] In one specific implementation, the overall screen rotation output function can generate a display output rotation control command for the target display device based on its screen identifier (screen-id). After other modules complete all pre-operations, the display configuration management tool kscreen-doctor executes the command `kscreen-doctoroutput.[screen-id].rotation.left`, causing the entire screen to rotate 90 degrees counterclockwise, thus achieving portrait display. If the Linux operating system has multiple display devices, the screen identifier (screen-id) of each device can be obtained separately, and the overall screen rotation output can be performed on the target display device or all display devices with portrait layout enabled, according to the display requirements corresponding to the portrait layout mode.
[0050] After the above steps, the operating system interface switches to a portrait display mode. In this portrait mode, graphic elements remain upright, text elements are displayed vertically, the cursor moves in the same direction as the viewer, and the window title bar is located at the top of the window. By coordinating control layout direction adjustments, graphic element pre-rotation processing, text element line-by-line progression direction adjustments and overall rotation processing, cursor movement direction pre-mapping processing, window title bar orientation pre-compensation processing, and overall screen rotation output processing, system-level portrait layout adaptation for vertical writing languages such as Mongolian and Xibe can be achieved.
[0051] In another embodiment, when the current layout mode is normal, the layout direction of the graphical interface frame controls is maintained or restored to the normal layout direction. Pre-rotation processing of graphic elements within the controls is not performed, the in-line progression direction of text elements within the controls is not reversed and the overall rotation is not performed, the vertical pre-mapping processing of the cursor movement direction is not performed, and the window title bar is maintained or restored to the top of the window in normal landscape display mode. At the same time, the output direction of the current display device is maintained or restored to the normal landscape display direction.
[0052] In the above embodiments, the graphical interface framework, window manager, display configuration management tool, and system account service can run on the same Linux operating system, or they can be managed uniformly by the vertical layout control module as different system components. By combining system language recognition, graphics and text preprocessing, cursor direction control, title bar orientation control, and overall screen rotation output, this invention can achieve unified and stable vertical layout adaptation at the operating system level. Furthermore, the method of this embodiment is applicable to Wayland-based Linux operating systems and is compatible with Weston, Sway, and other mainstream window managers, enabling cross-window manager vertical display support.
[0053] In a specific application embodiment, the Mongolian version of the openKylin 2.0 open-source desktop operating system is selected as the implementation environment to further illustrate the present invention. Figure 2 This diagram illustrates the overall architecture of the vertical layout mechanism for a multi-language operating system, primarily explaining the relationships between various modules within the openKylin 2.0 operating system and the data flow between them. Figure 2 As shown, the vertical layout control module serves as the system-level control entry point, determining the current layout mode based on system language information and providing layout mode information to relevant modules in the graphical interface framework and window manager. At the GUI framework layer, the graphics and text preprocessing module is embedded in the Qt framework, performing pre-compensation processing on the control layout direction, graphic element drawing direction, and text element display direction before the overall screen rotation output. At the Wayland window system layer, the title bar orientation control module is located in the window control system, pre-adjusting the window title bar position, while the cursor direction control module is located in the input management section, mapping and adjusting the cursor movement direction. The window compositing system, Wayland input management, libDRM, and underlying display components such as OpenGL / Vulkan jointly complete window compositing, input event processing, and display output, thereby achieving system-level collaborative adaptation of the operating system interface in vertical layout mode.
[0054] Figure 3 The flowchart illustrates the execution process of the vertical layout mechanism for multilingual operating systems, demonstrating the main flow of implementing vertical layout for languages such as Mongolian and Xibe based on the openKylin 2.0 system. Figure 3 As shown, the specific steps are as follows: Step 201: Upon startup, the "Vertical Layout Control" module is invoked by default via the systemd service. Step 202: The "Vertical Layout Control" module monitors changes in the system language and sets the system language through the "SetLanguage" function in the Accountsservice. Step 203: Set the layout mode according to the new language. If it is Mongolian or Xibe, set "LayoutMode" to "vertical". If it is another language, set it to "normal". Step 204: If the current layout mode is "vertical", then enter the portrait layout series settings; otherwise, enter the normal landscape display mode. Step 205: Set the layout mode of Qt to RTL mode using setLayoutDirection(Qt::RightToLeft); Step 206: Modify the core interfaces of the three functions drawControl(), drawPrimitive(), and drawComplexControl(). At the function entry point, call QPainter::rotate(90) with the center of the drawing area option->rect as the reference to rotate all graphic elements 90 degrees clockwise. Step 207: Call the text layout line adjustment function adjustTextLayoutLinesBottomUp to change the line order of the text elements from top to bottom to bottom to top. Then, based on the center of the drawing area option->rect, call QPainter::rotate(180) to rotate the text elements 180 degrees clockwise. Step 208: Call the cursor_apply_output_transform_compensation() function to obtain the cursor position and movement direction based on the two parameters wlr_output->transform and cursor_feed_motion, and modify the cursor movement direction (dx, dy) to (-dy, dx), thereby rotating the relative movement direction of the cursor 90 degrees clockwise. Step 209: Obtain the geometric information of the window and title bar using the functions `ssd_update_titlebar()` and `scene_decoration_update_region()`, including the window's width (`geometry.width`), height (`geometry.height`), title bar height (`theme->title_height`), and border thickness (`theme->border_width`). Then, in the window manager, use the function `ssd_update_titlebar()` to set the starting position of the title bar to `(geometry.width, -theme->border_width)`, and the width and height to `(theme->title_height, geometry.height)`. Finally, use `ky_scene_decoration_set_margin()` and `view->margin.off_x = theme->title_height` to move the title bar from the top of the window to the right side of the window. Step 210: For the portrait layout series settings, obtain the current display device, and rotate the screen 90 degrees counterclockwise to portrait mode using the kscreen-doctoroutput.[screen-id].rotation.left command.
[0055] Figure 4 This diagram illustrates the screen transition process of a vertical layout mechanism for multilingual operating systems, showcasing the main steps involved in implementing the vertical layout. Figure 4 The Mongolian characters in (1) from top to bottom and (8) from left to right mean "open recently used document", "copy", and "paste". It can be seen that the method of the present invention can achieve a better vertical layout adaptation.
[0056] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention automatically determines the current layout mode based on system language information and triggers vertical layout switching when it recognizes vertical writing language environments such as Mongolian and Xibe languages. This eliminates the need for users to manually adjust the screen orientation or configure individual applications one by one, thereby reducing the adaptation cost of vertical interfaces and improving the automatic adaptation capability of multilingual operating systems.
[0057] 2. Before the screen is rotated and output, the present invention performs orientation pre-compensation processing on the layout direction of controls, the drawing direction of graphic elements, the line progression direction of text elements, and the overall display direction of text, so that graphic elements can maintain a positive display after the screen is rotated and output, and text elements can form a display state that conforms to the vertical writing habit, avoiding problems such as unintuitive text display and mismatch between control structure and text direction caused by the existing horizontal display method.
[0058] 3. This invention performs pre-compensation processing on the cursor movement direction in the window manager, so that the cursor movement direction is consistent with the user's visual direction after the screen is rotated and output, thereby avoiding the problem of inconsistent mouse, touchpad or touch operation direction with display direction in vertical mode, and improving the accuracy and naturalness of user operation.
[0059] 4. This invention performs pre-compensation processing on the window title bar position, so that the window title bar can still be located at the top of the window after the screen is rotated and output. This avoids the problem of the title bar, window control buttons and window decoration area being out of place due to screen rotation, and improves the stability and usability of window management in vertical layout mode.
[0060] 5. This invention achieves unified vertical layout adaptation at the operating system level through the collaborative processing between the graphical interface framework, window manager, and screen display output. Compared with partial vertical display solutions that only target text, menus, or individual applications, it can ensure consistent vertical display effects of controls, text, cursors, and window decorations in the operating system interface over a wider range, thereby improving the interface adaptability and interactive experience for users of vertical writing languages such as Mongolian and Xibe.
[0061] The present invention further provides a vertical layout adaptation system for multilingual operating systems, including a microprocessor and a memory interconnected thereto, wherein the microprocessor is programmed or configured to perform the steps of a vertical layout adaptation method for multilingual operating systems.
[0062] The system of the present invention corresponds to the method described above and has the same advantages as the method described above.
[0063] The present invention can implement all or part of the processes in the methods of the above embodiments, or it can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. Computer-readable media include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. The memory is used to store computer programs and / or modules. The processor implements various functions by running or executing the computer programs and / or modules stored in the memory, and by calling data stored in the memory. The memory may include high-speed random access memory, as well as non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital (SD) cards, flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0064] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A vertical layout adaptation method for multilingual operating systems, applied to a Linux operating system including a graphical interface framework and a window manager, characterized in that, Including the following steps: S1 monitors the system language information, determines the current layout mode based on the current system language information, and provides the current layout mode to the graphical interface framework and window manager. S2, when the current layout mode is a vertical layout mode, before the screen is rotated and output, the operating system interface is subjected to orientation pre-compensation processing, including: adjusting the layout direction of the graphical interface frame controls to right to left, performing pre-rotation processing on the graphic elements in the controls to match the overall screen rotation output direction, adjusting the line progression direction of the text elements in the controls from top to bottom to bottom to top, and performing rotation processing on the text elements in the controls to match the vertical display direction. S3, perform pre-compensation processing on cursor movement direction and window title bar orientation in window manager, including: pre-mapping cursor movement direction to match the direction of the overall screen rotation output to be executed, and performing orientation pre-compensation processing on window title bar according to the target display orientation of title bar after the overall screen rotation output. S4, after completing the orientation pre-compensation and cursor movement direction and window title bar orientation pre-compensation, generates a screen rotation control command according to the target screen orientation corresponding to the vertical layout mode to rotate and output the screen display content of the current display device as a whole, so that the operating system interface switches to the vertical display state. In step S3, when performing orientation pre-compensation processing on the window title bar based on the target display orientation of the title bar after the overall screen rotation, the window title bar is specifically moved to the right side of the window in advance so that the window title bar is located at the top of the window after the overall screen rotation. This includes the following steps: In the window decoration system of the window manager, the geometric information of the title bar to be drawn is obtained through the title bar geometry information acquisition function ssd_update_titlebar and the decoration region update function scene_decoration_update_region. The geometric information includes one or more of the following: window width, window height, title bar height and border thickness. If the current layout mode is a portrait layout mode, the title bar starting position is set to the position determined by the window width and border thickness using the title bar position adjustment function ssd_update_titlebar, the title bar width and height are set to the dimensions determined by the title bar height and window height, and the window decoration margin is set using the window decoration margin setting function ky_scene_decoration_set_margin, so that the title bar moves from the top of the window to the right side of the window, so that after the screen content is rotated 90 degrees counterclockwise, the title bar is located at the top of the window.
2. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S1, the system language information is monitored, and the current layout mode is determined based on the current system language information, including the following steps: When the Linux operating system starts up or a user switches the system language, retrieve the language attribute from the Accountsservice system account service. Determine whether the language attribute belongs to the language attribute corresponding to the preset vertical writing language. If so, set the current layout mode to vertical layout mode; otherwise, set the current layout mode to normal layout mode. When a user switches the system language, the system language is updated by calling the SetLanguage method through the inter-process communication interface of the Accountsservice system account service. The layout mode parameters are set according to the updated system language. The layout mode parameters corresponding to the preset vertical writing language are set to the vertical layout mode, and the layout mode parameters corresponding to other languages are set to the normal layout mode. The preset vertical writing language includes one or more of Mongolian, Xibe and Manchu.
3. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S2, the layout direction of the controls in the graphical interface framework is adjusted to be from right to left, including the following steps: Call the layout direction setting interface setLayoutDirection in the graphical interface framework to adjust the arrangement direction of control elements, text alignment direction, and control interaction logic from left to right to right to left RightToLeft, and perform direction pre-compensation processing for graphic elements and text elements based on the right-to-left control layout.
4. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S2, when performing pre-rotation processing on the graphic elements within the control to match the overall screen rotation output direction, specifically, pre-rotating the graphic elements within the control 90 degrees clockwise includes the following steps: In the custom style class of the graphical interface framework UKUIConfigStyle, modify the Qt control drawing interface. At the entry point of the control drawing interface, using the center option->rect of the current control drawing area as the rotation reference, call the painter rotation interface QPainter::rotate to rotate the graphic elements within the control 90 degrees clockwise. The control drawing interface includes one or more of the following: drawControl, drawPrimitive, and drawComplexControl.
5. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S2, the line progression direction of the text elements within the control is adjusted from top to bottom to bottom to top, and the text elements within the control are rotated to match the vertical display direction, including the following steps: In the custom style class of the graphical interface framework UKUIConfigStyle, the function adjustTextLayoutLinesBottomUp is called to adjust the text lines from bottom to top. This function generates multiple text lines based on the text layout object QTextLayout and the width of the control's text area, and performs soft wrapping on each text line according to the width of the control's text area. The height of each text line and the total height of all text lines are calculated. Using the total height of all text lines as the reverse adjustment benchmark, the target vertical coordinate of the current text line is calculated based on the cumulative height of the text lines before the current text line and the height of the current text line. The position of each text line in the text layout object is updated according to the target vertical coordinate of each text line, so that the logical first line is located at the bottom of the text layout area, and the subsequent text lines are arranged upwards in sequence, so that the line progression direction of the multi-line text elements in the control is adjusted to be from bottom to top. In the control drawing interface, the center of the current control drawing area, option->rect, is used as the rotation reference. The QPainter::rotate interface is called to rotate the text element as a whole. The rotation is a 180-degree clockwise rotation.
6. The vertical layout adaptation method for multi-language operating systems according to claim 5, characterized in that, Step S2, which involves rotating the text elements within the control to match the vertical display direction, also includes the following steps: For list controls or table controls that do not display text through the regular control drawing interface, in the text drawing interface drawItemText and the image drawing interface drawItemPixmap, the text displayed therein is rotated 180 degrees clockwise at the function entry point with the center of the current control drawing area as the rotation reference. For text display elements developed using the declarative interface language Qml, the transformation property of the text display element is set to scaling transformation, and the horizontal scaling parameter and vertical scaling parameter are set to negative values based on the center of the control's width and height, so that the text display element rotates 180 degrees clockwise; wherein, the text display element includes one or more of the following: Text static text display element, TextInput text input element, and Label label text display element.
7. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S3, the cursor movement direction is pre-mapped to match the overall screen rotation output direction to be executed, including the following steps: The cursor output transformation compensation function cursor_apply_output_transform_compensation in the window manager is called to obtain the cursor position and cursor movement direction based on the current output transformation parameter whr_output->transform and the cursor motion parameter cursor_feed_motion. If the current layout mode is a vertical layout mode, the cursor movement direction increment is mapped from (dx, dy) to (-dy, dx) so that the cursor rotates 90 degrees clockwise relative to the movement direction.
8. The vertical layout adaptation method for multi-language operating systems according to claim 1, characterized in that, In step S4, a screen rotation control command is generated based on the target screen orientation corresponding to the vertical layout mode to rotate and output the overall screen display content of the current display device, including the following steps: Get the screen identifier (screen-id) of the current display device; If the current layout mode is a portrait layout mode, the overall screen rotation output function is called. The overall screen rotation output function calls the display configuration management tool kscreen-doctor to generate and execute the screen rotation control instruction rotation.left, which sets the output direction of the target display device to a left rotation state, based on the screen identifier screen-id of the current display device. This causes the screen display content of the current display device to rotate 90 degrees counterclockwise and output, forming the overall portrait display interface of the system.
9. A vertical layout adaptation system for multi-language operating systems, comprising interconnected microprocessors and memory, characterized in that, The microprocessor is programmed or configured to perform the steps of the vertical layout adaptation method for a multilingual operating system as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for displaying menu of mobile terminal, and mobile terminal
CN102566926A
Pointer invocable navigational user interface
US20130067394A1
User interface with vertical text elements for an east-asian defined layout
CN102609194A
Display implementation method for longitudinal multi-column layout of traditional Mongolian mobile terminal
CN113742020A