Linux operating system desktop environment window self-adaption method and system

By monitoring peripheral events and using the X11 library to quickly arrange windows, the problem of missing window adaptation and self-alignment functions in the desktop environment of Linux operating system is solved, and the adaptive segmentation display of windows is realized, improving the convenience and flexibility of user experience sex.

CN119065763APending Publication Date: 2024-12-03KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410991870.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The desktop environment of the Linux operating system lacks window adaptation and self-arrangement functions, which leads to the user need to manually drag and adjust the window position when the windows are opened on large screen monitors, which cannot meet the convenience needs.

Method used

By monitoring specified peripheral events, such as mouse drag or shortcut keys, we can obtain the top-level window in the current desktop environment, and use the X11 library to quickly arrange and fill the display screen area to achieve adaptive segmentation display of the window.

Benefits of technology

It realizes the fast adaptive segmentation display of the desktop environment window of the Linux operating system, making it execute in parallel, improving the convenience and flexibility of the user experience, and is suitable for a variety of Linux desktop environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065763A_ABST
    Figure CN119065763A_ABST
Patent Text Reader

Abstract

The invention discloses a Linux operating system desktop environment window self-adaption method and system, the Linux operating system desktop environment window self-adaption arrangement method comprises the following steps: S1, monitoring a specified peripheral event, and if the specified peripheral event is monitored, skipping to the step S2; s2, obtaining a top layer window in the current desktop environment according to a window top layer flag of the desktop window; and S3, quickly arranging and displaying the top layer windows in the current desktop environment and paving the top layer windows in the current display screen area. According to the method, the desktop windows are quickly and adaptively segmented and displayed in the Linux operating system desktop environment to be executed in parallel, the windows are quickly switched to the working windows to be displayed in parallel, and the method can be suitable for the Loongson desktop environment, the megabit desktop environment, the X86 desktop environment, the ARM desktop environment and the server environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of operating system window adaptation, and in particular relates to a method and system for Linux operating system desktop environment window adaptation. Background Art

[0003] With the continuous development of computer technology, more and more computer users are using large-screen monitors such as 24 inches, 27 inches, 32 inches, etc. for office work, entertainment, and study. Unlike small-screen monitors, on a large-screen monitor, it has become a normal practice for users to open multiple windows and work in parallel to complete tasks.

[0004] When users open multiple windows, they often fix one or more windows, use the mouse to drag other windows to the appropriate position, and then drag the mouse to adjust the size of the window. This process often takes several seconds to more than ten seconds, which cannot meet the convenience needs of users. In the process of using desktop windows, especially in the use of large-screen displays, the self-adaptation and self-arrangement of desktop windows in parallel will greatly improve the convenience, flexibility and comfort of users and increase the competitiveness of products.

[0005] Currently, in Windows platforms, the desktop window is not adaptive in versions before Windows 10. In versions after Windows 10, dragging the left and right edges of the window will trigger the automatic arrangement of the left and right columns of windows. The window is not adaptive in Apple's computer device Mac OS operating system. When using the Android tablet device browser, the window is not adaptive. When using the iPad tablet device Safari browser, when dragging the browser tab, you can see that the window is equally divided and adaptively arranged. Currently, only the iPad tablet device Safari browser can adaptively divide the tabs equally.

[0006] The Linux operating system provides a variety of desktop environments for users to choose from. Gnome is a popular desktop environment in the Linux environment, developed based on the GTK graphics library, and is widely used in various server operating systems such as Red Hat Enterprise Linux and Centos. KDE is a desktop environment developed based on the QT graphics library, but has fewer users in China. Other niche desktop environments include Unity, Xfce, LXDE, Cinnamon, MATE, etc.

[0007] The desktop environment (sometimes called desktop manager) of the Linux operating system is an implementation of the desktop analogy, which consists of multiple software. The software in a desktop environment shares the same graphical user interface and provides a unified user interface to multiple users. In a typical desktop environment, these software provide computer users with windows, folder management, toolbars, taskbars, wallpapers, logins, lock screens, desktop icons, and pointers. The design and functional characteristics of different desktop environments give them a unique theme appearance. Desktop windows usually refer to a variety of office software, multimedia software, system programs, games, utilities, chat software, programming, art tools, etc. running on the desktop environment. On different operating systems, the design and functional characteristics of the desktop environment give it a unique look and feel, such as window display, full-screen display, Logo transparency, and real-time taskbar thumbnails. This process is an important part of desktop environment application management. The desktop environment of the Bank Kylin Desktop Operating System and the Galaxy Kylin Advanced Server Operating System uses the self-developed UKUI desktop environment. The UKUI desktop environment is a new desktop environment developed by the Kylin team based on user needs, providing an easy-to-use, user-friendly interactive style. Window adaptation automatically arranges and lays out desktop application windows in the entire display area according to a certain method to execute tasks in parallel. However, the UKUI desktop environment, like other Linux operating system desktop environments, does not have the functions of window adaptation and self-arrangement. Therefore, how to achieve window adaptation in the Linux operating system desktop environment has become a key technical problem that needs to be solved urgently. Summary of the invention

[0008] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a method and system for window adaptation in a Linux operating system desktop environment are provided. The present invention aims to realize rapid adaptive splitting and displaying of desktop windows in a Linux operating system desktop environment so that they can be executed in parallel, and windows can be quickly switched to working windows for parallel display. The method is applicable to Loongson desktop environment, Zhaoxin desktop environment, X86 desktop, ARM desktop environment and server environment.

[0009] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0010] A method for adaptively arranging windows in a Linux desktop environment comprises the following steps:

[0011] S1, monitor the specified peripheral event, if the specified peripheral event is detected, jump to step S2;

[0012] S2, get the top-level window in the current desktop environment;

[0013] S3, quickly arrange and display the top-level windows in the current desktop environment and fill the current display screen area.

[0014] Optionally, the peripheral event specified in step S1 is an event of a mouse dragging a window or an event triggered by a keyboard shortcut, wherein the event of a mouse dragging a window is achieved by monitoring and obtaining mouse button events through the function cmd_mousedown(), monitoring and obtaining mouse movement events through the function cmd_mousemove(), and monitoring and identifying window movement through window position information.

[0015] Optionally, obtaining the top-level window in the current desktop environment in step S2 includes:

[0016] S2.1, determining the current desktop environment in the system, including: using a library function provided by the operating system to obtain a display device set and a default display device in the operating system, and using the default display device as the current desktop environment in the system;

[0017] S2.2, obtaining a set of program windows in the current desktop environment;

[0018] S2.3, for each program window in the program window set, determine whether the program window is a top-level window by querying the structure identifier corresponding to the program window, thereby obtaining all top-level windows in the current desktop environment.

[0019] Optionally, the structure identifier in step S2.3 includes a window top-level flag bit windows_top_flags, and the value of the window top-level flag bit windows_top_flags is true or false. If the value of the window top-level flag bit windows_top_flags is true, it is determined whether the program window is a top-level window; and when the system manages program windows, if it is monitored that a program window is currently being operated or used by the user and is not covered by other program windows, then in the structure identifier corresponding to the program window, the corresponding window top-level flag bit windows_top_flags is set to true; otherwise, the corresponding window top-level flag bit windows_top_flags is set to false.

[0020] Optionally, in step S3, arranging and displaying the top-level windows in the current desktop environment and filling the current display screen area includes:

[0021] S3.1, use the Get_current_workspace function provided by the X11 library to obtain the current workspace, then use the Get_current_screen function provided by the X11 library to obtain the current display device, Get_display_name function to obtain the display device name, or Get_Current_monitor function to obtain the current monitor, then use point (0,0) as the coordinate of the upper left corner of the current display screen area, the x value increases to the right, and the y value increases downward, the y-axis coordinate of the lower right corner of the current display screen area is the value obtained by subtracting the height of the toolbar panel from the height of the current display device's refresh rate, and the x-axis coordinate is the width of the current display device's refresh rate, thereby determining the grid size of the current desktop environment;

[0022] S3.2, determine the number of top-level windows in the current desktop environment and the upper left corner position, width and height of each top-level window, and determine the new upper left corner position, width and height required for each top-level window to be arranged and displayed to fill the current display screen area in combination with the grid size of the current desktop environment and the number of top-level windows and the upper left corner position, width and height of each top-level window, and arrange the top-level windows in the current desktop environment according to the new size and position and display them to fill the current display screen area.

[0023] Optionally, when determining the number of top-level windows in the current desktop environment and the size and position of each top-level window in step S3.2, the enumeration type edge_or_corner is used to record the size and position of each top-level window, and the fields contained in the enumeration type edge_or_corner include none, left, top_left, top, top_right, right, bottom_right, bottom and bottom_left, where none indicates whether it is selected, left indicates the left edge distance, top_left indicates the upper left corner distance, top indicates the top edge distance, top_right indicates the upper right corner distance, right indicates the right edge distance, bottom_right indicates the lower right corner distance, bottom indicates the bottom edge distance, and bottom_left indicates the lower left corner distance.

[0024] Optionally, in step S3.2, combining the grid size of the current desktop environment and the number of top-level windows as well as the upper left corner position, width and height of each top-level window to respectively determine the new upper left corner position, width and height required for each top-level window to be arranged and displayed and to fill the current display screen area includes:

[0025] S3.2.1, determining the number of sub-grids that the grid of the current desktop environment needs to be divided into according to the number of top-level windows, if the number of top-level windows is an even number, determining the number of sub-grids to be the number of top-level windows; if the number of top-level windows is an odd number, determining the number of sub-grids to be the number of top-level windows plus 1;

[0026] S3.2.2, dividing the grid size of the current desktop environment into sub-grids equally according to the number of sub-grids;

[0027] S3.2.3, determine the center point position of each subgrid according to the upper left corner position, width and height of each subgrid, assign each subgrid to a top-level window according to the distance between the center point position of the subgrid and the center point position of the top-level window, and if there are any remaining subgrids, merge the subgrid with the adjacent subgrids in the same column so that the subgrids and the top-level windows correspond one to one;

[0028] S3.2.4, dynamically adjusting the size of the subgrid according to the top-level window, including: for each column of subgrids, using the width of a single top-level window corresponding to each column of subgrids or the average width of multiple top-level windows as the column width of the subgrid, and dividing the grid width of the current desktop environment in proportion according to the column width ratio of each column of subgrids, thereby determining the width of each column of subgrids and the position in the width direction; for each column of subgrids, if the column of subgrids contains only one subgrid, the height of the subgrid is the grid height of the current desktop environment; if the column of subgrids contains only multiple subgrids, dividing the grid height of the current desktop environment in proportion according to the height ratio of the top-level windows corresponding to the multiple subgrids, thereby determining the height of each subgrid in the column of subgrids and the position in the height direction, thereby determining the upper left corner position, width and height of each subgrid;

[0029] S3.2.5, using the upper left corner position, width and height of each sub-grid as the new upper left corner position, width and height required for the corresponding top-level windows to be arranged and displayed to fill the current display screen area.

[0030] In addition, the present invention also provides a system for adaptively arranging windows in a Linux desktop environment, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the method for adaptively arranging windows in the Linux desktop environment.

[0031] In addition, the present invention also provides a computer-readable storage medium, in which a computer program / instruction is stored. The computer program / instruction is programmed or configured to execute the method of adaptive window arrangement of the Linux desktop environment through a processor.

[0032] In addition, the present invention also provides a computer program product, including a computer program / instruction, which is programmed or configured to execute the method for adaptively arranging windows in the Linux desktop environment through a processor.

[0033] Compared with the prior art, the present invention mainly has the following advantages: the window adaptive arrangement method of the Linux desktop environment of the present invention monitors the specified peripheral events, and if the specified peripheral events are monitored, the top-level windows in the current desktop environment are obtained, and the top-level windows in the current desktop environment are quickly arranged and displayed and cover the current display screen area, so that the desktop windows can be quickly adaptively split and displayed for the Linux operating system desktop environment so that they can be executed in parallel, and the windows can be quickly switched to the working windows for parallel display, and can be applicable to various Linux desktop environments including Loongson desktop environment, Zhaoxin desktop environment, X86 desktop, ARM desktop environment and server environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 Schematic diagram of the basic flow of the method of the embodiment of the present invention.

[0035] Figure 2 Schematic diagram of the drawing principle of the window and the screen in the embodiment of the present invention.

[0036] Figure 3 Schematic diagram of the principle of top-level window identification in an embodiment of the present invention.

[0037] Figure 4 Schematic diagram of fast arrangement display of dual top-level windows in an embodiment of the present invention.

[0038] Figure 5 Schematic diagram of the rapid arrangement and display of three top-level windows in an embodiment of the present invention. DETAILED DESCRIPTION

[0039] Embodiment 1:

[0040] like Figure 1 As shown, the method for adaptively arranging windows in a Linux desktop environment in this embodiment includes the following steps:

[0041] S1, monitor the specified peripheral event, if the specified peripheral event is detected, jump to step S2;

[0042] S2, get the top-level window in the current desktop environment;

[0043] S3, quickly arrange and display the top-level windows in the current desktop environment and fill the current display screen area.

[0044] The peripheral event specified in step S1 of this embodiment is the event of the mouse dragging the window. In addition, other types of mouse events or other peripheral events corresponding to peripherals such as keyboards and touchpads can be used as needed. The specific selection can be based on actual needs and will not be described one by one here. In this embodiment, the event of the mouse dragging the window is achieved by monitoring and obtaining mouse button events through the function cmd_mousedown(), monitoring and obtaining mouse movement events through the function cmd_mousemove(), and identifying window movement through window position information monitoring. In this embodiment, the window is automatically set by the mouse and the window, and the mouse movement structure is set as follows:

[0045] struct mousemove{ / / Mouse movement structure

[0046] Window window; / / Window ID

[0047] int clear_modifiers; / / flag

[0048] int opsync; / / Synchronization bit flag.

[0049] int polar_coordinates; / / Polar coordinates flag.

[0050] int x; / / The target X coordinate of the mouse movement.

[0051] int y; / / The target Y coordinate of the mouse movement.

[0052] int screen; / / screen number

[0053] useconds_t delay; / / Simulate the delay time between mouse movements

[0054] int step; / / The step size or precision of movement.

[0055] };

[0056] Use the extended functions provided by X11 to obtain the active window of the current desktop environment, the window title, the window focus, whether the window is maximized, whether it can be moved and simulate keyboard and mouse events, obtain the PID of the window, and set the top_flag mark of the active window's PID.

[0057] The top-level window is a specific identifier that marks the mouse, keyboard, and coordinate values. It uses CurrentWindow_sequenc to locate the current window and calls X11 to generate events (simulating mouse and keyboard events). For devices with multiple displays, Display(0) is defined as the current display device.

[0058] #define CURRENTWINDOW(0)

[0059] The top-level window is the window that the current user is operating or using and is not covered by other windows. The window flag is used to mark whether the window is a top-level window.

[0060] #define WINDOW_TOP_FLAGS TRUE;

[0061] The current display screen is a rectangular refresh area. The width and height are obtained by obtaining the resolution of the rectangular area, and a grid is set by the screen resolution width and height (for example, the current display resolution is 2560x1600. In this grid, there are one or more top-level windows. The fast window adaptation is to adapt the top-level window so that it can quickly adapt to the entire grid area by obtaining the current window position and moving the mouse. The grid area is identified by the xcurrDisplay structure.

[0062] The desktop window uses a logical unit when drawing graphics. The size of each logical unit is determined by the mapping mode. The logical unit can be the same as the device unit (a pixel on the screen or printer), a physical unit (such as millimeters), or a user-defined unit. In the application, the mapping mode is used. When the application draws graphics in its client area, it must give the position on the display device. The position is represented by two coordinates, x and y, where x represents the horizontal coordinate and y represents the vertical coordinate. In the window creation function, these coordinates use a "logical unit". When the function sends the output to a physical device (usually a display), it converts the logical coordinates into device coordinates (such as pixels on the screen or printer). The conversion between logical coordinates and device coordinates is determined by the mapping mode. The mapping mode is stored in the device environment. Under the Linux system, there can be four or more workspaces, each of which runs a desktop window, and the display device can have single or multiple screens. Device coordinates refer to the coordinates on the output device. The device coordinates on the screen are usually called screen coordinates. The device coordinates specify the position of an object using the horizontal and vertical distances from the object to the upper left corner of the window. They are expressed in pixels. The X axis of the device coordinates is positive to the right, the Y axis is positive downward, and the origin of the coordinates is located in the upper left corner of the window. If the device is a VGA display, it is automatically converted into pixels. The logical coordinates are the coordinates used by the system for recording. The direction and unit of the logical coordinates are the same as those of the device coordinates. They are also expressed in pixels. The X axis is positive to the right, the Y axis is positive downward, and the origin of the coordinates (0,0) is located in the upper left corner of the window. For example, Figure 2 shown.

[0063] Logical coordinates and device coordinates are generally consistent in the default mode. The window is a non-scrolling window. The window is a scrolling window. The vertical scroll bar is located at the top of the scroll border, and the horizontal scroll bar is located at the far left. The following three types of device coordinates are included to meet various needs: 1) Active workspace. In the Linux system, four workspaces are usually set as common workspaces. Each workspace can have several windows. The current workspace is set as the active workspace. The flag flag (1,0,0,0) can be set to mark the workspace status. 1 is the active workspace. 2) Window coordinate area, the display area of ​​the application, that is, the current display device, the upper left corner of the client area is (0,0), and the lower right corner is (height-toolbar height, width). 3) Active window coordinates, the entire window of the program, including the title bar, menu, scroll bar, and the upper left corner of the window is (x, y) using the obtained window device environment. 4) Layer the current desktop window. The desktop window is overlayable. The window is marked by setting a flag. The top window is marked by setting a window top flag window_top_flags. Only the window with the window top flag window_top_flags set is adaptive. In step S2 of this embodiment, obtaining the top window in the current desktop environment includes:

[0064] S2.1, determining the current desktop environment in the system, including: using a library function provided by the operating system to obtain a display device set and a default display device in the operating system, and using the default display device as the current desktop environment in the system;

[0065] S2.2, obtaining a set of program windows in the current desktop environment;

[0066] S2.3, for each program window in the program window set, determine whether the program window is a top-level window by querying the structure identifier corresponding to the program window, thereby obtaining all top-level windows in the current desktop environment. In this embodiment, the content of the structure corresponding to the program window is as follows:

[0067] typedef struct xcurrDisplay{

[0068] Display*xdpy; / / Pointer to the Display structure,

[0069] char*display_name; / / indicates the display name used to connect to the X server

[0070] charcodemap_t* charcodes; / / pointer to character code mapping

[0071] int charcode_len; / / length of character encoding mapping

[0072] XModifierKeymap *modmap; / / pointer to XModifierKeymap

[0073] KeySym*keymap; / / Pointer to KeySym array

[0074] int keycode_high; / / keyboard code high value

[0075] int keycode_low; / / keyboard code low value

[0076] int keysyms_per_keycode; / / keyboard symbol

[0077] int close_display_when_freed; / / display connection

[0078] bool visable; / / Is the current display visible?

[0079] bool windows_top_flags; / / window top flag

[0080] int debug; / / output debugging information

[0081] int features_mask; / / feature mask

[0082] }xcurrDisplay_t;

[0083] Refer to the fields of the structure xcurrDisplay_t corresponding to the above program window, as shown in Figure 3As shown, querying the structure xcurrDisplay_t corresponding to the program window can determine whether the program window is a top-level window. In step S2.3 of this embodiment, the structure identifier includes the window top-level flag bit windows_top_flags, and the window top-level flag bit windows_top_flags takes a value of true (true) or false (false). If the window top-level flag bit windows_top_flags takes a value of true, it is determined whether the program window is a top-level window. And when the system manages program windows, if it is detected that a certain program window is currently operated or used by the user and is not covered by other program windows, the corresponding window top-level flag bit windows_top_flags is set to true in the structure identifier corresponding to the program window; otherwise, the corresponding window top-level flag bit windows_top_flags is set to false.

[0084] Linux can use the Get_current_workspace provided by the X11 library through the operating system to obtain the workspace, and then Get_current_screen to obtain the current display device, Get_display_name or Get_Current_monitor and other methods to obtain a display device, or specify the full window coordinates or screen coordinates. Point (0,0) is the upper left corner of the client area. The value of x increases to the right, and the value of y increases downward. The window sets the initial display area by setting the coordinates of the screen. The lower right corner of the screen is the height of the current screen resolution minus the height of the toolbar, and the width is the width of the screen resolution. In step S3 of this embodiment, the top-level windows in the current desktop environment are arranged and displayed to fill the current display screen area, including:

[0085] S3.1, use the Get_current_workspace function provided by the X11 library to obtain the current workspace, then use the Get_current_screen function provided by the X11 library to obtain the current display device, Get_display_name function to obtain the display device name, or Get_Current_monitor function to obtain the current monitor to obtain the current display device, then use point (0,0) as the coordinate of the upper left corner of the current display screen area, the value of x increases to the right, and the value of y increases downward, the y-axis coordinate of the lower right corner of the current display screen area is the value obtained by subtracting the height of the toolbar panel from the height of the current display device's refresh rate, and the x-axis coordinate is the width of the current display device's refresh rate, thereby determining the grid size of the current desktop environment; for example, the resolution size of 4K is 3840×2160, and the value obtained by subtracting the height of the toolbar panel 160 from the height 2160 is 2000, that is, the y-axis coordinate of the lower right corner of the current display screen area is 2000; the width is 3840, that is, the x-axis coordinate of the lower right corner of the current display screen area is 3840;

[0086] S3.2, determine the number of top-level windows in the current desktop environment and the upper left corner position, width and height of each top-level window, and determine the new upper left corner position, width and height required for each top-level window to be arranged and displayed and cover the current display screen area in combination with the grid size of the current desktop environment and the number of top-level windows and the upper left corner position, width and height of each top-level window, and arrange and display the top-level windows in the current desktop environment according to the new size and position and cover the current display screen area. In this embodiment, only the top-level window is adapted, and an enumeration edge_or_corner is used to mark the moving position of the window:

[0087] typedef enum{

[0088] none,left,top_left,top,top_right,right,

[0089] bottom_right,bottom,bottom_left,

[0090] }edge_or_corner;

[0091] Among them, typedef enum defines an enumeration edge_or_corner, none indicates whether it is selected, left indicates the distance to the left edge, top_left indicates the distance to the upper left corner, top indicates the distance to the top edge, top_right indicates the distance to the upper right corner, right indicates the distance to the right edge, bottom_right indicates the distance to the lower right corner, bottom indicates the distance to the bottom edge, and bottom_left indicates the distance to the lower left corner. Therefore, in step S3.2 of this embodiment, determining the number of top-level windows in the current desktop environment and the size and position of each top-level window includes using the enumeration type edge_or_corner to record the size and position of each top-level window, and the fields contained in the enumeration type edge_or_corner include none, left, top_left, top, top_right, right, bottom_right, bottom and bottom_left, where none indicates whether it is selected, left indicates the left edge distance, top_left indicates the upper left corner distance, top indicates the top edge distance, top_right indicates the upper right corner distance, right indicates the right edge distance, bottom_right indicates the lower right corner distance, bottom indicates the bottom edge distance, and bottom_left indicates the lower left corner distance.

[0092] In step S3.2 of this embodiment, the new upper left corner position, width and height required for each top-level window to be arranged and displayed and cover the current display screen area are determined in combination with the grid size of the current desktop environment and the number of top-level windows and the upper left corner position, width and height of each top-level window, including:

[0093] S3.2.1, determining the number of sub-grids that the grid of the current desktop environment needs to be divided into according to the number of top-level windows, if the number of top-level windows is an even number, determining the number of sub-grids to be the number of top-level windows; if the number of top-level windows is an odd number, determining the number of sub-grids to be the number of top-level windows plus 1;

[0094] S3.2.2, dividing the grid size of the current desktop environment into sub-grids equally according to the number of sub-grids;

[0095] S3.2.3, determine the center point position of each subgrid according to the upper left corner position, width and height of each subgrid, assign each subgrid to a top-level window according to the distance between the center point position of the subgrid and the center point position of the top-level window, and if there are any remaining subgrids, merge the subgrid with the adjacent subgrids in the same column so that the subgrids and the top-level windows correspond one to one;

[0096] S3.2.4, dynamically adjusting the size of the subgrid according to the top-level window, including: for each column of subgrids, using the width of a single top-level window corresponding to each column of subgrids or the average width of multiple top-level windows as the column width of the subgrid, and dividing the grid width of the current desktop environment in proportion according to the column width ratio of each column of subgrids, thereby determining the width of each column of subgrids and the position in the width direction; for each column of subgrids, if the column of subgrids contains only one subgrid, the height of the subgrid is the grid height of the current desktop environment; if the column of subgrids contains only multiple subgrids, dividing the grid height of the current desktop environment in proportion according to the height ratio of the top-level windows corresponding to the multiple subgrids, thereby determining the height of each subgrid in the column of subgrids and the position in the height direction, thereby determining the upper left corner position, width and height of each subgrid;

[0097] S3.2.5, using the upper left corner position, width and height of each sub-grid as the new upper left corner position, width and height required for the corresponding top-level windows to be arranged and displayed to fill the current display screen area.

[0098] In this embodiment, the window and position in the current window are obtained by judging windows_top_flags in the grid. Under the current large screen size display screen, the application desktop window is more commonly used to be divided proportionally, divided into three equal parts, four equal parts, etc. The window is evenly divided to display the window, and the open windows become rectangular. The resolution of the current window is obtained, and the current window is divided equally according to the length of the obtained resolution and the number of active windows. The height is the height of the current resolution. Figure 4 As shown in the figure, for window self-adaptation, when there are two top-level active windows on the desktop, just drag the position of the desktop window with the mouse slightly, and the desktop window will be evenly divided according to the original width and height ratio of the application in the grid. For window self-adaptation, when there are three or four active windows on the desktop, take three windows as an example, Figure 5 As shown, the method of this embodiment can set the window in the grid to a rectangular area of ​​width / 2 and height / 2. As long as the position of the desktop window is slightly dragged with the mouse, the desktop window will be evenly divided according to the original width and height ratio of the application in the grid. The window adaptation in this embodiment refers to quickly moving the application window to the grid-divided area and working in parallel with the equally divided windows by dragging the mouse. For example, at 4K resolution (3840×2160), the y-axis coordinate of the lower right corner of the current display screen area is 2000, and the x-axis coordinate of the lower right corner of the current display screen area is 3840. Width / 2 is 3840 / 2, and height / 2 is 2000 / 2.

[0099] In summary, the window adaptive arrangement method of the Linux desktop environment in this embodiment beautifies the multiple applications and multi-window display of the desktop window under the Linux system, can conveniently and quickly adaptively display the applications running on the window, is convenient for user selection, can also quickly preview the ongoing applications, and is convenient for application switching between applications.

[0100] In addition, this embodiment also provides a system for adaptively arranging windows in a Linux desktop environment, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the method for adaptively arranging windows in a Linux desktop environment.

[0101] In addition, this embodiment also provides a computer-readable storage medium, in which a computer program / instruction is stored. The computer program / instruction is programmed or configured to execute the method of adaptive window arrangement of the Linux desktop environment through a processor.

[0102] In addition, this embodiment also provides a computer program product, including a computer program / instruction, which is programmed or configured to execute the method for adaptively arranging windows in the Linux desktop environment through a processor.

[0103] Embodiment 2:

[0104] This embodiment is basically the same as the first embodiment, and the main difference is that the peripheral event specified in step S1 of this embodiment is a shortcut key trigger event, for example, by capturing a key press or release event, as long as the specified shortcut key or shortcut key combination is triggered, step S2 can be jumped to obtain the top-level window in the current desktop environment, and the top-level window in the current desktop environment is quickly arranged and displayed and spread over the current display screen area. The window adaptive arrangement method of the Linux desktop environment of this embodiment can also realize the beautification of multiple applications and multi-window display of the desktop window under the Linux system, and can conveniently and quickly adaptively display the application running on the window, which is convenient for user selection, and can also quickly preview the application in progress, and also facilitate application switching between applications.

[0105] In addition, this embodiment also provides a system for adaptively arranging windows in a Linux desktop environment, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the method for adaptively arranging windows in a Linux desktop environment.

[0106] In addition, this embodiment also provides a computer-readable storage medium, in which a computer program / instruction is stored. The computer program / instruction is programmed or configured to execute the method of adaptive window arrangement of the Linux desktop environment through a processor.

[0107] In addition, this embodiment also provides a computer program product, including a computer program / instruction, which is programmed or configured to execute the method for adaptively arranging windows in the Linux desktop environment through a processor.

[0108] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0109] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A method for adaptively arranging windows in a Linux desktop environment, characterized in that: The steps include: S1, monitor the specified peripheral event, if the specified peripheral event is detected, jump to step S2; S2, get the top-level window in the current desktop environment; S3, quickly arrange and display the top-level windows in the current desktop environment and fill the current display screen area.

2. The method for adaptively arranging windows in a Linux desktop environment according to claim 1, characterized in that: The peripheral event specified in step S1 is the event of the mouse dragging the window or the event triggered by the keyboard shortcut key, wherein the event of the mouse dragging the window is achieved by monitoring and obtaining the mouse button event through the function cmd_mousedown(), monitoring and obtaining the mouse movement event through the function cmd_mousemove(), and monitoring and identifying the window movement through the window position information.

3. The method for adaptively arranging windows in a Linux desktop environment according to claim 2, characterized in that: Acquiring the top-level window in the current desktop environment in step S2 includes: S2.1, determining the current desktop environment in the system, including: using a library function provided by the operating system to obtain a display device set and a default display device in the operating system, and using the default display device as the current desktop environment in the system; S2.2, obtaining a set of program windows in the current desktop environment; S2.3, for each program window in the program window set, determine whether the program window is a top-level window by querying the structure identifier corresponding to the program window, thereby obtaining all top-level windows in the current desktop environment.

4. The method for adaptively arranging windows in a Linux desktop environment according to claim 3, characterized in that: In step S2.3, the structure identifier includes a window top-level flag bit windows_top_flags, and the value of the window top-level flag bit windows_top_flags is true or false. If the value of the window top-level flag bit windows_top_flags is true, it is determined whether the program window is a top-level window; and when the system manages program windows, if it is monitored that a certain program window is currently being operated or used by the user and is not covered by other program windows, the corresponding window top-level flag bit windows_top_flags in the structure identifier corresponding to the program window is set to true; otherwise, the corresponding window top-level flag bit windows_top_flags is set to false.

5. The method for adaptively arranging windows in a Linux desktop environment according to claim 3, characterized in that: In step S3, the top-level windows in the current desktop environment are arranged and displayed to fill the current display screen area, including: S3.1, use the Get_current_workspace function provided by the X11 library to obtain the current workspace, then use the Get_current_screen function provided by the X11 library to obtain the current display device, Get_display_name function to obtain the display device name, or Get_Current_monitor function to obtain the current monitor, then use point (0,0) as the coordinate of the upper left corner of the current display screen area, the x value increases to the right, and the y value increases downward, the y-axis coordinate of the lower right corner of the current display screen area is the value obtained by subtracting the height of the toolbar panel from the height of the current display device's refresh rate, and the x-axis coordinate is the width of the current display device's refresh rate, thereby determining the grid size of the current desktop environment; S3.2, determine the number of top-level windows in the current desktop environment and the upper left corner position, width and height of each top-level window, and determine the new upper left corner position, width and height required for each top-level window to be arranged and displayed to fill the current display screen area in combination with the grid size of the current desktop environment and the number of top-level windows and the upper left corner position, width and height of each top-level window, and arrange the top-level windows in the current desktop environment according to the new size and position and display them to fill the current display screen area.

6. The method for adaptively arranging windows in a Linux desktop environment according to claim 5, characterized in that: In step S3.2, determining the number of top-level windows in the current desktop environment and the size and position of each top-level window includes using the enumeration type edge_or_corner to record the size and position of each top-level window, and the fields contained in the enumeration type edge_or_corner include none, left, top_left, top, top_right, right, bottom_right, bottom and bottom_left, where none indicates whether it is selected, left indicates the left edge distance, top_left indicates the upper left corner distance, top indicates the top edge distance, top_right indicates the upper right corner distance, right indicates the right edge distance, bottom_right indicates the lower right corner distance, bottom indicates the bottom edge distance, and bottom_left indicates the lower left corner distance.

7. The method for adaptively arranging windows in a Linux desktop environment according to claim 5, characterized in that: In step S3.2, the new upper left corner position, width and height required for each top-level window to be arranged and displayed and fill the current display screen area are determined in combination with the grid size of the current desktop environment, the number of top-level windows, and the upper left corner position, width and height of each top-level window, including: S3.2.1, determining the number of sub-grids that the grid of the current desktop environment needs to be divided into according to the number of top-level windows, if the number of top-level windows is an even number, determining the number of sub-grids to be the number of top-level windows; if the number of top-level windows is an odd number, determining the number of sub-grids to be the number of top-level windows plus 1; S3.2.2, dividing the grid size of the current desktop environment into sub-grids equally according to the number of sub-grids; S3.2.3, determine the center point position of each subgrid according to the upper left corner position, width and height of each subgrid, assign each subgrid to a top-level window according to the distance between the center point position of the subgrid and the center point position of the top-level window, and if there are any remaining subgrids, merge the subgrid with the adjacent subgrids in the same column so that the subgrids and the top-level windows correspond one to one; S3.2.4, dynamically adjusting the size of the subgrid according to the top-level window, including: for each column of subgrids, using the width of a single top-level window corresponding to each column of subgrids or the average width of multiple top-level windows as the column width of the subgrid, and dividing the grid width of the current desktop environment in proportion according to the column width ratio of each column of subgrids, thereby determining the width of each column of subgrids and the position in the width direction; for each column of subgrids, if the column of subgrids contains only one subgrid, the height of the subgrid is the grid height of the current desktop environment; if the column of subgrids contains only multiple subgrids, dividing the grid height of the current desktop environment in proportion according to the height ratio of the top-level windows corresponding to the multiple subgrids, thereby determining the height of each subgrid in the column of subgrids and the position in the height direction, thereby determining the upper left corner position, width and height of each subgrid; S3.2.5, using the upper left corner position, width and height of each sub-grid as the new upper left corner position, width and height required for the corresponding top-level windows to be arranged and displayed to fill the current display screen area.

8. A system for adaptively arranging windows in a Linux desktop environment, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the method for adaptively arranging windows in a Linux desktop environment as claimed in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program / instruction stored therein, characterized in that: The computer program / instruction is programmed or configured to execute the method for adaptively arranging windows in a Linux desktop environment as claimed in any one of claims 1 to 7 through a processor.

10. A computer program product comprising a computer program / instructions, characterized in that The computer program / instruction is programmed or configured to execute the method for adaptively arranging windows in a Linux desktop environment as claimed in any one of claims 1 to 7 through a processor.