Method of displaying window and electronic device

CN115220826BActive Publication Date: 2026-09-25HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110406595.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-15
Publication Date
2026-09-25
Estimated Expiration
2041-04-15

AI Technical Summary

Technical Problem

[0003]在一些情况下,当用户打开多个窗口时,会有一些窗口被上层的窗口遮挡,导致其位于电子设备的显示屏幕中,但是对用户视觉不可见,对于这类窗口,仍占用大量的系统资源

Benefits of technology

[0008]基于本申请实施例,电子设备可以根据桌面内窗口的层叠顺序,获得所有响应于用户的操作能够显示的窗口,有利于后续计算不可见窗口。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115220826B_ABST
    Figure CN115220826B_ABST
Patent Text Reader

Abstract

The application provides a window display method and an electronic device. The method comprises the following steps: the electronic device captures a first message of window change; the electronic device acquires a first target window with a layering order according to the first message; the electronic device divides a display area of a desktop of the electronic device except a task bar into a plurality of areas according to vertex coordinates of an inner window of the desktop; the electronic device respectively marks the plurality of areas using window handles, and each area in the plurality of areas cannot be repeatedly marked; the electronic device determines a second target window visible to a user in the desktop according to the window handles of the plurality of area marks; the electronic device determines a third target window invisible to the user according to the first target window and the second target window; and the electronic device minimizes the third target window. The technical scheme can reduce system resources occupied by the electronic device and reduce system power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic technology, and more specifically, to a method and electronic device for window display. Background Technology

[0002] When users use electronic devices, such as those with a Windows operating system (Microsoft Windows), they often need to open multiple windows. Each open window consumes corresponding system resources. When a window is visible to the user, the system allocates relatively more resources to it. When a window is minimized, the system reduces the resources allocated to the minimized window to save power.

[0003] In some cases, when a user opens multiple windows, some windows may be obscured by the uppermost window, causing them to appear on the electronic device's display screen but not to be visible to the user. These types of windows still consume a significant amount of system resources. Summary of the Invention

[0004] This application provides a method and electronic device for window display. This technical solution can identify invisible windows on the desktop of an electronic device and minimize them, thereby reducing the system resources occupied by the electronic device and reducing system power consumption.

[0005] In a first aspect, a method for displaying a window is provided, applied to an electronic device. The method includes: the electronic device capturing a first message indicating a window change; the electronic device obtaining a first target window with a stacking order based on the first message; the electronic device dividing the desktop display area (excluding the taskbar) into multiple regions based on the vertex coordinates of windows within the desktop; the electronic device marking the multiple regions using window handles, wherein each region cannot be marked repeatedly; the electronic device determining a second target window visible to the user within the desktop based on the window handles of the marked regions; the electronic device determining a third target window invisible to the user based on the first target window and the second target window; and the electronic device minimizing the third target window.

[0006] Based on the embodiments of this application, after capturing a message indicating a window change, the electronic device can obtain a first target window opened by the user on the desktop. Then, based on the vertex coordinates of the windows on the desktop, the desktop (excluding the taskbar) is divided into multiple regions. These regions are then marked using window handles, thereby identifying a second target window visible to the user. Combined with the first target window, an invisible third target window is determined, and then this third target window is minimized. This technical solution can identify and minimize invisible windows on the electronic device's desktop, reducing system resource consumption and power consumption.

[0007] In conjunction with the first aspect, in some implementations of the first aspect, the electronic device obtaining a first target window with a stacking order according to the first message includes: the electronic device obtaining the bottommost window in the stacking order of windows within the desktop, excluding the desktop windows; the electronic device searching upwards from the bottommost window according to the stacking order of windows within the desktop to obtain the first target window, wherein the first target window is a window that can be displayed in response to user operations.

[0008] Based on the embodiments of this application, the electronic device can obtain all windows that can be displayed in response to user operations according to the stacking order of windows on the desktop, which is beneficial for subsequent calculation of invisible windows.

[0009] In conjunction with the first aspect, in some implementations of the first aspect, the electronic device divides the display area of ​​the desktop of the electronic device, excluding the taskbar, into multiple areas based on the vertex coordinates of the windows within the desktop, including: the electronic device dividing the length of the display area in the first direction into multiple parts based on the coordinates of the vertices of the windows within the desktop in the first direction; and the electronic device dividing the length of the display area in the second direction into multiple parts based on the coordinates of the vertices of the windows within the desktop in the second direction.

[0010] Based on the embodiments of this application, the display area of ​​the desktop of an electronic device, excluding the taskbar, is divided into multiple parts in the first direction according to the coordinates of the vertices of the windows within the desktop in the first direction. The display area of ​​the desktop of an electronic device, excluding the taskbar, is divided into multiple parts in the second direction according to the coordinates of the vertices of the windows within the desktop in the second direction. This allows the display area to be divided into multiple regions, which is beneficial for subsequent calculation of invisible windows.

[0011] In conjunction with the first aspect, in some implementations of the first aspect, the electronic device uses window handles to mark the plurality of regions respectively, including: the electronic device marks the regions sequentially downwards using the window handles, starting from the topmost window, according to the stacking order of the windows in the desktop.

[0012] Based on the embodiments of this application, window handles are used to mark windows sequentially from the topmost window according to the stacking order of windows on the desktop, thereby determining the windows visible to the user on the desktop.

[0013] In conjunction with the first aspect, in some implementations of the first aspect, before the electronic device obtains a first target window with a stacking order based on the first message, the method further includes: the electronic device storing the first message in a first queue, the first queue holding one message at a time; and the electronic device reading the first message from the first queue.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, the interval at which the electronic device reads the first message from the first queue is greater than or equal to a first preset duration.

[0015] This technical solution can avoid excessive message stacking, which could lead to erroneous operations.

[0016] In conjunction with the first aspect, in some implementations of the first aspect, the third target window includes a first window and a second window, and the first window partially obscures the second window, the second target window includes the third window, and before the electronic device minimizes the third target window, the method further includes: the electronic device inserting a fourth window after the first window; the electronic device inserting a fifth window after the second window; wherein the fourth window and the fifth window are invisible to the user.

[0017] Based on the embodiments of this application, by inserting an additional window after the window that needs to be minimized, the additional window can be used as a reference position of the minimized window in the window stacking order, so as to avoid disorder of the stacking order after the minimized window is restored.

[0018] The fourth window can be positioned and sized the same as or different from the first window on the desktop. Similarly, the fifth window can also be positioned and sized the same as or different from the first window. Both the fourth and fifth windows consume almost no system resources.

[0019] Alternatively, the fourth window can be inserted before the first window, and the fifth window can be inserted before the second window.

[0020] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: in response to a first operation by a user, the electronic device inserts the first window after the fourth window and inserts the second window after the fifth window; the electronic device displays a first interface, the first interface including the first window and the second window, wherein the first window partially obscures the second window.

[0021] Based on the embodiments of this application, when the minimized first and second windows are restored, they are inserted after the fourth and fifth windows respectively in their original order. This ensures that their positions in the window stacking order are the same as before minimization, thereby avoiding disorder in the stacking order after the minimized windows are restored.

[0022] In conjunction with the first aspect, in some implementations of the first aspect, the third target window includes a first window, the second target window includes a second window and a third window, and the third window partially obscures the second window and the first window partially obscures the second window. Before the electronic device minimizes the third target window, the method further includes: the electronic device creating a sixth window, the sixth window being located in front of the first window; wherein the vertex coordinates of the sixth window are located outside the desktop of the electronic device.

[0023] Based on the embodiments of this application, the vertex coordinates of the sixth window are located outside the desktop of the electronic device, but the position of the sixth window in the window stacking order is before the first window. The sixth window can capture the system's operation of finding the focus window when the third window disappears, so as not to affect the position of the first window and the second window in the window stacking order.

[0024] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: in response to a second operation by a user, the electronic device displays a second interface, the second interface including the first window and the second window, wherein the first window partially obscures the second window.

[0025] Based on the embodiments of this application, the second operation can be the operation of minimizing or closing the third window, in which case the first window can be restored to its original position. This technical solution can avoid disordered stacking order after the minimized window is restored.

[0026] In a second aspect, an electronic device is provided, including one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause a method for displaying a window as described in the first aspect and any possible implementation thereof to be performed.

[0027] Thirdly, a chip is provided, the chip including a processor and a communication interface, the communication interface being used to receive signals and transmit the signals to the processor, the processor processing the signals such that a window display method as described in the first aspect above and any possible implementation thereof is executed.

[0028] Fourthly, a computer-readable storage medium is provided, wherein computer instructions are stored therein, which, when executed on a computer, cause a method for displaying a window as described in the first aspect and any possible implementation thereof to be performed.

[0029] Fifthly, a computer program product is provided, including computer instructions that, when executed on an electronic device, cause a method for displaying a window as described in the first aspect and any possible implementation thereof to be performed. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of a set of GUIs provided in the embodiments of this application.

[0031] Figure 2 yes Figure 1 A schematic diagram of the coordinates after window discretization.

[0032] Figure 3 This is a schematic diagram illustrating the handling of a window as provided in an embodiment of this application.

[0033] Figure 4 This is a schematic diagram of another set of GUIs provided in the embodiments of this application.

[0034] Figure 5 This is a schematic diagram of another set of GUIs provided in the embodiments of this application.

[0035] Figure 6 This is a timing diagram of a window display provided in an embodiment of this application.

[0036] Figure 7 This is a schematic flowchart of a window display method provided in an embodiment of this application.

[0037] Figure 8 yes Figure 7 A schematic flowchart for calculating invisible windows.

[0038] Figure 9 This is a schematic flowchart of a window display method provided in an embodiment of this application. Detailed Implementation

[0039] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0040] The window display method in this application embodiment can be applied to electronic devices such as tablet computers, laptop computers, personal computers, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application embodiment does not impose any restrictions on the specific type of electronic device.

[0041] When users use electronic devices, they often need to open multiple windows. Each open window consumes corresponding system resources. When a window is visible to the user, the system allocates relatively more resources to it. When a window is minimized, the system reduces the resources allocated to the minimized window to save power.

[0042] In some cases, when a user opens multiple windows, some windows may be obscured by the uppermost window, causing them to appear on the electronic device's display screen but not to be visible to the user. These types of windows still consume a significant amount of system resources.

[0043] In view of this, embodiments of this application provide a method and electronic device for displaying windows, which can minimize invisible windows and restore them to their original positions when the minimized windows need to be restored. During this process, the user is not visually aware of it, so as not to affect the user's use, while also reducing the power consumption of the system.

[0044] Figure 1 This is a schematic diagram of a set of graphical user interfaces (GUIs) provided in the embodiments of this application. Among them, from Figure 1 (a) to (b) in the figure illustrate the process of discretizing windows in the display interface of an electronic device.

[0045] See Figure 1 In (a), the GUI can be the display desktop 210 of the electronic device 200, which can include a display area 211 and a taskbar 215. The display area 211 includes windows 212, 213 and 214, wherein the z-order of the three windows in the display area 211 from top to bottom is window 213, window 212 and window 214, that is, window 213 is at the top of the display desktop and is the focused window.

[0046] Among them, the electronic device 200 can use the display desktop 210 as the entire canvas, and obtain all windows displayed on the display desktop 210 that can be operated by the user with the keyboard or mouse. These windows can correspond one-to-one with the windows in the taskbar.

[0047] Specifically, after obtaining the bottom-most window in the z-order of the windows within the desktop 210, the electronic device 200 can use a system interface, such as the getnextwindow interface, to search upwards in z-order for all windows, thereby obtaining all windows that can be operated by the user using the keyboard or mouse.

[0048] For example, if window 213 is a file manager window, window 212 is a Huawei Music window, and window 213 is a Huawei PC Manager window, then the windows opened in the taskbar are the file manager, Huawei Music, and Huawei PC Manager. Therefore, the electronic device 200 can obtain the three windows that the user can actually operate, as well as the z-order of these three windows.

[0049] See Figure 1 In (b), the GUI illustrates the process of discretizing the display area 211 according to the displayed window. Figure 1 In (a), the electronic device 200 has already obtained the three windows displayed in the display area 211 and the z-order of the three windows. Then, the electronic device 200 can divide the display area into multiple regions according to the vertex coordinates of the three windows.

[0050] like Figure 1 As shown in (b), the coordinates of the four vertices of window 213 are A1, A2, A3, and A4, the coordinates of the four vertices of window 212 are B1, B2, B3, and B4, and the coordinates of the four vertices of window 213 are C1, C2, C3, and C4. Therefore, along the x-axis of display area 211, by dividing the horizontal coordinates of these three windows, a total of 7 regions can be formed. Along the y-axis of display area 211, by dividing the horizontal coordinates of these three windows, a total of 6 regions can be formed. Thus, the entire display area 211 is divided into 42 small regions, and each region belongs to the same window. This allows for mapping a large number of pixels (e.g., 1280*760) within display area 211 to the coordinates of these 42 small regions, thereby reducing the complexity of data computation.

[0051] It should be understood that Figure 1 In (b) of the above, the lower boundary of window 214 overlaps with the upper boundary of the taskbar by, for example, by one pixel. Therefore, the display area 211 can be divided into 6 regions along the y-axis.

[0052] In some examples, the lower boundary of window 214 may not overlap with the upper boundary of the taskbar. In this case, the display area 211 can be divided into 7 areas along the y-axis. This embodiment of the application does not limit this.

[0053] Figure 2 yes Figure 1 A schematic diagram of the coordinates after window discretization.

[0054] See Figure 2 After dividing the display area 211 into 42 smaller areas, these 42 smaller areas can be mapped to the discretized coordinate system. Figure 2 The region corresponding to coordinates (0, 0) to (7, 6) in the data corresponds to... Figure 1 Display area 211 in the middle, Figure 2 The region corresponding to coordinates a3(2,2) to a2(5,4) in the equation corresponds to Figure 1 Window 212 in the middle, Figure 2 The region corresponding to coordinates b3(1,1) to b2(4,5) in the data corresponds to... Figure 1 Window 213 in the middle, Figure 2 The region corresponding to coordinates c3(3,0) to c2(6,3) in the equation corresponds to... Figure 1 Window 214 in the middle.

[0055] With the above settings, a large number of pixels in the display area 211 can be represented by the discretized coordinates. When calculating the window in the display area 211, the electronic device 200 only needs to calculate the 42 regions in the discretized coordinate system, without having to consider the coordinates of each pixel in the original display area 211, which effectively reduces the complexity of data calculation.

[0056] After discretizing the vertex coordinates of the windows in the display area 211, the area where the window is located can be marked using the window handle, starting from the top-level window in the z-order (i.e., the focus window) according to the z-order of the windows. Each area cannot be marked repeatedly.

[0057] Figure 3 This is a schematic diagram illustrating the handling of a window as provided in an embodiment of this application.

[0058] See Figure 3According to the z-order of the windows, the marking starts from the top-level window 213. Assuming the handle of window 213 is 1, the six regions in the area where window 213 is located, with coordinates from (2, 2) to (5, 4), are marked as 1. Then, the window 212, located at the second level of the z-order, is marked. Assuming the handle of window 212 is 2, since the area in which window 212 is located has coordinates from (1, 1) to (4, 5), a total of 12 regions, but four of these regions have already been marked as 1, and no region can be marked twice, the remaining eight regions are marked as 2. Then, the window 214, located at the bottom level of the z-order, is marked. Assuming the handle of window 214 is 3, since the area in which window 214 is located has coordinates from (3, 0) to (6, 3), a total of 9 regions, but two of these regions have already been marked as 1 and one region has been marked as 2, and no region can be marked twice, the remaining six regions are marked as 3.

[0059] For the desktop window, i.e. the display area 211, assuming the handle of the desktop window is 4, the coordinates of the area where the display area 211 is located are from (0, 0) to (7, 6), a total of 42 areas, but 6 of them have been marked as 1, 8 as 2, and 6 as 3. Each area cannot be marked repeatedly, so the remaining 22 areas are marked as 4.

[0060] Once all areas have been marked, the electronic device 200 can traverse all areas and count the number of different marked window handles, thereby determining the number of visible windows within the display area 211.

[0061] For example, such as Figure 3 As shown, after marking the 42 areas within display area 211, four different window handles (1 to 4) are identified. This allows calculation that, besides the desktop window (display area 211), there are three visible windows. Combining this with the initial data obtained by the electronic device 200 regarding all windows that can be displayed via keyboard and mouse operations, it is possible to determine which windows are invisible. The number of invisible windows can be obtained by subtracting the number of visible windows from the initial number of all windows. Furthermore, by comparing the initial number of all windows with the number of visible windows, it is possible to determine which windows are invisible.

[0062] It should be understood that this embodiment uses the handle of window 213 as 1, the handle of window 212 as 2, the handle of window 214 as 3, and the handle of desktop window as 4 as an example for illustration. In other examples, the handles of the above windows can also be represented by other values, and this embodiment does not limit this.

[0063] In this embodiment of the application, for invisible windows, the electronic device can temporarily minimize them by calling the system interface to reduce the system resources they occupy. When the user operates the window to make the original position of the minimized window visible, the window is restored in time. During this process, the user is not visually aware of it, so it will not affect the user's use, while also reducing the power consumption of the system.

[0064] The operation of minimizing an invisible window can be achieved by sending a message to the window, or by using the Windows system's native external interface, showwindow.

[0065] If a window needs to be restored from minimized, the user can use a combination of keyboard shortcuts, click the mouse, or perform other operations. However, no matter which method is used, the window will become the focus window. In the embodiment of this application, restoring the minimized window means restoring the window to its state before it was minimized, that is, restoring the minimized window according to the original window's z-order.

[0066] For example, if window A obscures window B, causing window B to be minimized, and the user moves window A so that window B is partially exposed, the restored window B cannot be in front of window A. If window B is restored to be in front of window A, the user will feel uncomfortable. Therefore, after being restored, window B still needs to be behind window A, meaning that the focus window is still window A.

[0067] The window display method provided in this application embodiment can restore the minimized window according to the original window's z-order. However, in some special cases, such as when the user clicks the window quickly, the window's z-order may be disordered.

[0068] Although the Windows system provides the ShowWindow interface, by setting some parameters such as the SW_SHOWNOACTIVATE parameter, it can restore the window from a minimized state to the most recent window state, including the nearest position and z-order. However, although the restored window will not become the focus window, the z-order of the windows can easily be disordered. That is, the restored window jumps to the front of all windows, but it is not the focus window.

[0069] For example, if window A obscures window B, causing window B to be minimized, and the user moves window A so that window B is partially exposed, the restored window B will be in front of window A. However, the user's input and other operations will still be in window A, which will make the user feel uncomfortable.

[0070] For the rare scenario of disordered z-order of the window, this application provides a method for window display that can avoid the above-mentioned problem.

[0071] Figure 4 This is a schematic diagram of another set of GUIs provided in the embodiments of this application. Among them, from Figure 4 Figures (a) through (e) illustrate the process of minimizing an invisible window and restoring a minimized window.

[0072] See Figure 4 In (a), the display area 311 of the electronic device includes window 312 and window 313, wherein window 312 is located above window 313, that is, window 312 is the focus window, and window 312 partially obscures window 313. When the electronic device detects that the user has opened window 314, it can display as shown in (a). Figure 4 The GUI shown in (b) is shown in the image.

[0073] See Figure 4 In (b), the user opens window 314, and window 314 completely obscures windows 312 and 313, that is, the focus window of display area 311 is 314.

[0074] See Figure 4 In step (c), window 312b can be inserted after window 312. Window 312b has the same size and position as window 312, and there are no other windows between window 312 and window 312b. Similarly, window 313b can be inserted after window 313. Window 313b has the same size and position as window 313, and there are no other windows between window 313 and window 313b. Window 312b and window 313b are used for subsequent calculations to determine whether windows 312 and 313 need to be restored. After window 312 is minimized, window 312b can replace the position of window 312 in the window z-order order. After window 313 is minimized, window 313b can replace the position of window 313 in the window z-order order.

[0075] In addition, by setting the window properties of windows 312b and 313b, windows 312b and 313b can be made invisible to the user. For example, windows 312b and 313b will not appear in the taskbar or in preview mode, and the user will not be able to operate on the windows. For example, the user cannot operate windows 312b and 313b using the keyboard, mouse, or shortcut keys, and windows 312b and 313b basically do not consume system resources.

[0076] After windows 312b and 313b are inserted, windows 312 and 313 are minimized to reduce their system resource usage and save system power consumption.

[0077] See Figure 4In (d), after windows 312 and 313 are minimized, windows 312b and 313b remain in their original positions. Therefore, when the user minimizes or closes window 314, the electronic device can display as shown in (d). Figure 4 The GUI shown in (e) is shown in the image.

[0078] See Figure 4 In (e), windows 312 and 313 are displayed in the display area 311 of the electronic device, with window 312 located above window 313.

[0079] After window 314 is closed or minimized, the electronic device needs to restore the minimized windows 312 and 313. When restoring window 312, window 312 is inserted after window 312b. When restoring window 313, window 313 is inserted after or before window 313b. This ensures that the positions of windows 312 and 313 in the window z-order are consistent with their order before minimization, thus avoiding the problem of z-order disorder when minimizing windows are restored.

[0080] Specifically, electronic devices can perform the above functions by calling system interfaces. For example, after calling the showwindow interface, the electronic device can then call the setwindowpos interface to perform the above functions.

[0081] It should be understood that in practical applications, window 312 may include multiple subordinate windows. Therefore, when inserting window 312b, inserting window 312b after window 312 means inserting window 312 and its subordinate windows, thereby avoiding other visual effect problems. The same operation applies to window 313.

[0082] It should be understood that this example uses two invisible windows for illustration. In other examples, the number of invisible windows can be more, and this application embodiment does not limit this.

[0083] Based on the embodiments of this application, by inserting an additional window A1 after the invisible window A, when window A is minimized, window A1 can replace the position of window A in the window z-order order. When window A needs to be restored, window A is inserted after or before window A1, thereby ensuring that the position of window A in the window z-order order is consistent with the order before minimization.

[0084] In some cases, after the foreground window in the window z-order disappears, such as when minimized or closed, the system will search for the next foreground window according to the window z-order and set it as the focus window. However, this operation and the minimize / restore operation are almost simultaneous, which may cause the window z-order to become disordered.

[0085] For example, in a z-order window sequence, the windows from top to bottom are window A, window B, and window C. Window B partially obscures window C, while window A completely obscures window B and partially obscures window C (i.e., window B is minimized). When window B becomes visible again due to window A being minimized or closed, and the system searches for the next focus window, since window B is currently undergoing a restore operation, the system will most likely find window C as the focus window. The final result may be that window C appears before window B, which can be uncomfortable for the user.

[0086] In view of this, embodiments of this application provide a method for displaying a window that can avoid the above-mentioned problems.

[0087] Figure 5 This is a schematic diagram of another set of GUIs provided in the embodiments of this application. Among them, from Figure 5 Figures (a) to (d) illustrate the process of minimizing an invisible window and restoring a minimized window.

[0088] See Figure 5 In (a), the display area 411 of the electronic device includes window 412 and window 413, wherein window 412 is located above window 413, that is, window 412 is the focus window, and window 412 partially obscures window 413. When the electronic device detects that the user has opened window 414, it can display as shown in (a). Figure 5 The GUI shown in (b) is shown in the image.

[0089] See Figure 5 In (b), the user opens window 414, which completely obscures window 412 and partially obscures window 413. That is, the focus window of display area 411 is 414, and window 413 is partially visible.

[0090] See Figure 5 In step (c), a window 415 can be created, which can be set to capture the system's request to find the focus window. Then, the window 415 is inserted on top of the window 412, and the window 412 is minimized to save system resources.

[0091] For window 415, by setting its parameters, its coordinates can be positioned outside the display area 411. However, window 415 is above window 412 in the z-order of windows. Therefore, when window 414 is minimized or closed, the system finds the focus window as window 415, not window 412. When the electronic device detects the user's action of closing or minimizing window 414, it can display as follows: Figure 5 The GUI shown in (d) is shown in the image.

[0092] See Figure 5 In (d), the GUI is the display area 411 of the electronic device, which includes windows 412 and 413, with window 412 partially obscuring window 413. That is, the position of window 412 in the window z-order is consistent with the order before minimization, thereby avoiding window z-order disorder.

[0093] In some examples, when there are multiple windows that are completely obscured, the above functionality can be achieved simply by inserting window 415 above the topmost window in the z-order of the multiple obscured windows.

[0094] It should be understood that the window 415 in this application embodiment is not visible to the user. For example, the window 415 will not appear in the taskbar or in preview mode, and the user cannot operate the window. For example, the user cannot operate the window 415 using the keyboard, mouse, shortcut keys, etc., and the window 415 basically does not occupy system resources.

[0095] Based on the embodiments of this application, when window A is completely obscured, a window B can be created and inserted on top of window A, and window A can be minimized. When window A needs to be restored, the system will find window B when searching for the focus window, and window A can be restored normally, thus avoiding the window z-order order being disordered.

[0096] Figure 6 This is a timing diagram of a window display provided in an embodiment of this application, which may include steps 501 to 511.

[0097] 501, message hijacking that calls to system application programming interface (API) functions.

[0098] For example, you can use hooks to monitor messages that call system APIs. When an API is called, the hook can be the first to receive the message.

[0099] 502 indicates that when an API is invoked, the API call message will be sent to the system message monitoring module.

[0100] 503, the system message monitoring module sends the API call message to the window monitoring module.

[0101] 504, the window monitoring will send the production event message to the flow control queue based on the API call message.

[0102] For example, the production event could be minimizing the window, moving the window, etc.

[0103] 505, the flow control queue stores the latest received message.

[0104] It should be understood that there is only one position in this flow control queue for storing a single production event message.

[0105] 506, the flow control queue sends the window change event corresponding to the production event message to the window occlusion calculation module.

[0106] 507, The window occlusion calculation module obtains a snapshot of all current windows.

[0107] For example, retrieve all windows in the z-order of the desktop windows.

[0108] 508, The window occlusion calculation module filters all windows.

[0109] The window calculation module can filter the windows obtained in step 507 to obtain all windows that the user can operate with the mouse or keyboard, and these windows correspond one-to-one with the windows opened in the taskbar.

[0110] 509, The window occlusion calculation module calculates whether a window is visible or invisible.

[0111] The window occlusion calculation module can determine all visible windows using the above discretization algorithm and handle marking, and combine all the windows obtained in step 508 to determine the invisible windows.

[0112] 510, The window occlusion calculation module generates a window.

[0113] For example, such as Figure 4 As shown, the window occlusion calculation module generates windows 312b and 313b.

[0114] For example, such as Figure 5 As shown, the window occlusion calculation module generates window 415.

[0115] 511. The window occlusion calculation module sends the minimize command or restore command to the minimize scene and strategy module.

[0116] For example, such as Figure 4 As shown, the window occlusion calculation module sends the minimize command of the completely occluded window 312 to the minimize scene and strategy module. Alternatively, when window 312 needs to be restored, the restore command of window 312 is sent to the minimize scene and strategy module.

[0117] 512, The Minimize Scene and Strategy module performs a minimize operation on the window based on the minimize command, or performs a restore operation on the window based on the restore command.

[0118] For example, such as Figure 4 As shown, the minimize scene and strategy module performs a minimize operation on window 312 according to the minimize command of window 312. Alternatively, when window 312 needs to be restored, it performs a restore operation on window 312 according to the restore command of window 312.

[0119] It should be understood that the embodiments of this application do not limit the execution order of steps 501 to 512, or several of the steps may be executed simultaneously, etc., and the embodiments of this application do not limit this.

[0120] Figure 7 This is a schematic flowchart illustrating a window display method provided in an embodiment of this application. The method may include steps 601 to 604.

[0121] 610, hook the monitoring system window change messages and send the messages to the queue.

[0122] This involves using a hook to monitor window change messages of the monitoring system itself. Once a window change message is hooked, it is sent to a queue.

[0123] 620, Window change messages are entered into the queue.

[0124] The queue contains only one position to store a window change message. After each calculation is completed, messages in the queue are read again. If a message exists in the queue, the calculation continues, but a preset interval is required between two calculations. For example, the preset interval can be 30 milliseconds (ms). This avoids message stacking caused by processing too many messages simultaneously.

[0125] 630. Calculate the invisible window based on the window occlusion algorithm.

[0126] For detailed algorithm steps in step 630, please refer to [link / reference needed]. Figure 8 The relevant description in the document.

[0127] 640, Execution strategy.

[0128] Based on the results of the window occlusion algorithm, the execution strategy module can execute corresponding strategies, such as minimizing invisible windows and restoring minimized windows when they need to be restored.

[0129] Figure 8 yes Figure 7 A schematic flowchart illustrating the calculation of an invisible window. The method may include steps 701 through 704.

[0130] 631, retrieve a snapshot of all windows.

[0131] For example, after obtaining the bottom-most window in the desktop window z-order, use system interfaces such as getnextwindow to search upwards for all windows in the window z-order.

[0132] 632, Filter target windows, corresponding to the windows in the taskbar.

[0133] By setting certain filtering conditions, all windows obtained in step 631 can be filtered to obtain the target window that the user can operate using the keyboard or mouse. This target window corresponds one-to-one with the windows opened in the taskbar.

[0134] 633. Calculate the invisible windows based on window stacking and positional relationships.

[0135] Invisible windows can be calculated based on the window stacking order and window position relationships. For example, the windows are discretized using the discretization algorithm described above, and the positions of the discretized windows are marked with handles to determine all visible windows. Combined with the target window obtained in step 632, invisible windows are determined.

[0136] 634, Send the final calculation result.

[0137] The result calculated in step 633 is sent to the execution strategy module. For example, the execution strategy module can be the minimization scenario and strategy module in step 512 above.

[0138] Figure 9 This is a schematic flowchart illustrating a window display method provided in an embodiment of this application. The method can be applied to electronic devices and may include steps 710 to 770.

[0139] 710, the first message that the electronic device captures window changes.

[0140] The first message can be any message related to window changes, such as various system messages triggered by minimizing, maximizing, closing, or moving the window.

[0141] 720, the electronic device obtains a first target window with a stacking order according to the first message.

[0142] The first target window can be multiple windows with a certain stacking order, and the first target window can be a window that can be displayed on the desktop in response to user operations.

[0143] For example, the first target window can be multiple windows opened by the user, some of which are displayed on the desktop, some are minimized, or some are on the desktop but are obscured by other windows and therefore invisible to the user.

[0144] 730, the electronic device divides the display area of ​​the desktop of the electronic device, excluding the taskbar, into multiple areas according to the vertex coordinates of the windows in the desktop.

[0145] For example, see Figure 1 In (b), the electronic device divides the display area 211 into multiple areas based on the vertex coordinates of windows 212, 213 and 214 on the desktop.

[0146] 740, the electronic device uses window handles to mark the plurality of regions respectively, and each region in the plurality of regions cannot be marked repeatedly.

[0147] It should be understood that there is a one-to-one correspondence between a window handle and a window; that is, for the same window, the window handle is the same.

[0148] For example, see Figure 3 Multiple regions are marked using window handles.

[0149] 750, the electronic device determines a second target window visible to the user within the desktop based on the window handles of the plurality of region markers.

[0150] It should be understood that since window handles correspond one-to-one with windows, after marking the above-mentioned multiple areas, it is only necessary to traverse all window handles once, and based on the number of different window handles, it is possible to determine how many visible windows there are, and which window is the visible window.

[0151] For example, see Figure 3 If four different window handles are marked, then there are four visible windows. One of them is the desktop window. So, apart from the desktop window, there are three windows visible to the user on the desktop. That is, the second target window is these three visible windows.

[0152] 760, the electronic device determines a third target window that is not visible to the user based on the first target window and the second target window.

[0153] In this embodiment, after determining the visible second target window, the electronic device can determine which windows are invisible, i.e., the third target windows, by combining the first target window. The third target window can be one or more, and this embodiment does not limit this.

[0154] 770, the electronic device minimizes the third target window.

[0155] After identifying a third target window that is not visible to the user, the electronic device minimizes that third target window to save system resources.

[0156] Based on the embodiments of this application, after capturing a message indicating a window change, the electronic device can obtain a first target window opened by the user on the desktop. Then, based on the vertex coordinates of the windows on the desktop, the desktop (excluding the taskbar) is divided into multiple regions. These regions are then marked using window handles, thereby identifying a second target window visible to the user. Combined with the first target window, an invisible third target window is determined, and then this third target window is minimized. This technical solution can identify and minimize invisible windows on the electronic device's desktop, reducing system resource consumption and power consumption.

[0157] It should be understood that this application does not limit the order of execution of steps 710 to 770, or that several of the steps may be executed simultaneously, and the embodiments of this application do not limit this.

[0158] Optionally, the electronic device obtains a first target window with a stacking order according to the first message, including: the electronic device obtains the bottommost window in the stacking order of windows in the desktop (excluding desktop windows); the electronic device searches all windows upward from the bottommost window according to the stacking order of windows in the desktop to obtain the first target window, wherein the first target window is a window that can be displayed in response to user operations.

[0159] For example, see Figure 1 In (a), the order of windows 212, 213, and 214 in the window stacking order is window 213, window 212, and window 214, respectively. Therefore, the first target window is window 213, window 212, and window 214.

[0160] It should be understood that the desktop window is located at the bottom layer in the window stacking order.

[0161] Based on the embodiments of this application, the electronic device can obtain all windows that can be displayed in response to user operations according to the stacking order of windows on the desktop, which is beneficial for subsequent calculation of invisible windows.

[0162] Optionally, the electronic device divides the display area of ​​the desktop of the electronic device, excluding the taskbar, into multiple areas based on the vertex coordinates of the windows within the desktop, including: the electronic device dividing the length of the display area in the first direction into multiple parts based on the coordinates of the vertices of the windows within the desktop in the first direction; and the electronic device dividing the length of the display area in the second direction into multiple parts based on the coordinates of the vertices of the windows within the desktop in the second direction.

[0163] For example, see Figure 1 In (b), the first direction can be parallel to the axis of rotation of the electronic device (or the horizontal axis). In this first direction, the electronic device divides the display area 211 into 7 parts based on the coordinates of the vertices of windows 212, 213, and 214 on the desktop. The second direction can be perpendicular to the axis of rotation of the electronic device (or the vertical axis). In this second direction, the electronic device divides the display area 211 into 6 parts based on the coordinates of the vertices of windows 212, 213, and 214 on the desktop. Thus, the entire display area 211 is divided into 42 areas.

[0164] Based on the embodiments of this application, the display area of ​​the desktop of an electronic device, excluding the taskbar, is divided into multiple parts in the first direction according to the coordinates of the vertices of the windows within the desktop in the first direction. The display area of ​​the desktop of an electronic device, excluding the taskbar, is divided into multiple parts in the second direction according to the coordinates of the vertices of the windows within the desktop in the second direction. This allows the display area to be divided into multiple regions, which is beneficial for subsequent calculation of invisible windows.

[0165] Optionally, the electronic device uses window handles to mark the plurality of areas respectively, including: the electronic device marks the windows sequentially downwards from the topmost window according to the stacking order of the windows in the desktop.

[0166] Electronic devices use window handles to mark windows sequentially downwards from the topmost window according to their stacking order on the desktop. For example, see [link to example]. Figure 3 In the window stacking order, window 213 is located at the top layer, so its window handle is used to mark it. For example, if its window handle is 1, then all 6 regions containing window 213 are marked as 1. Then, windows 212 and 214, which are located after window 213, are marked respectively. Each region cannot be marked repeatedly until all regions are marked.

[0167] Based on the embodiments of this application, window handles are used to mark windows sequentially from the topmost window according to the stacking order of windows on the desktop, thereby determining the windows visible to the user on the desktop.

[0168] Optionally, before the electronic device obtains a first target window with a stacking order based on the first message, the method further includes: the electronic device storing the first message in a first queue, wherein the first queue holds one message at a time; and the electronic device reading the first message from the first queue.

[0169] For example, the first queue may be the flow control queue module in the above embodiments.

[0170] Optionally, the electronic device reads the first message from the first queue at an interval greater than or equal to a first preset duration.

[0171] For example, the first preset duration could be 30ms.

[0172] This technical solution can avoid excessive message stacking, which could lead to erroneous operations.

[0173] Optionally, the third target window includes a first window and a second window, and the first window partially obscures the second window. The second target window includes the third window. Before the electronic device minimizes the third target window, the method further includes: the electronic device inserting a fourth window after the first window; the electronic device inserting a fifth window after the second window; wherein the fourth window and the fifth window are not visible to the user.

[0174] For example, see Figure 4 (a) to (c), the third target window includes a first window and a second window. For example, the first window may be window 312, the second window may be window 313, the third window included in the second target window may be window 314, the fourth window may be window 312b, and the fifth window may be window 313b.

[0175] The fourth window can be in the same position and size as the first window on the desktop, or it can be different; the fifth window can be in the same position and size as the first window on the desktop, or it can be different.

[0176] It should be understood that the fourth and fifth windows can be made invisible to the user by setting their window properties. For example, the fourth and fifth windows will not appear in the taskbar or in preview mode, and the user will not be able to operate on them. For example, the user cannot operate the fourth and fifth windows using the keyboard, mouse, or shortcut keys, and the fourth and fifth windows do not consume system resources.

[0177] Based on the embodiments of this application, by inserting an additional window after the window that needs to be minimized, the additional window can be used as a reference position of the minimized window in the window stacking order, so as to avoid disorder of the stacking order after the minimized window is restored.

[0178] Alternatively, the fourth window can be inserted before the first window, and the fifth window can be inserted before the second window.

[0179] Optionally, the method further includes: in response to a first operation by a user, the electronic device inserts the first window after the fourth window and inserts the second window after the fifth window; the electronic device displays a first interface, the first interface including the first window and the second window, wherein the first window partially obscures the second window.

[0180] The first operation could be the user minimizing, closing, or moving the third window, making the first and second windows visible to the user. In this case, the electronic device needs to restore the first and second windows from minimized.

[0181] For example, see Figure 4 The first interface can be Figure 4 In the display interface of the electronic device in (e), after the third window 314 is minimized or closed, the first window 312 and the second window 313 are displayed on the desktop of the electronic device, and the first window 312 partially obscures the second window 313, that is, the positions of the first window and the second window after restoration are the same as before minimization.

[0182] Based on the embodiments of this application, when the minimized first and second windows are restored, they are inserted after the fourth and fifth windows respectively in their original order. This ensures that their positions in the window stacking order are the same as before minimization, thereby avoiding disorder in the stacking order after the minimized windows are restored.

[0183] Optionally, the third target window includes a first window, the second target window includes a second window and a third window, and the third window partially obscures the second window and the first window partially obscures the second window. Before the electronic device minimizes the third target window, the method further includes: the electronic device creating a sixth window, the sixth window being located in front of the first window; wherein the vertex coordinates of the sixth window are located outside the desktop of the electronic device.

[0184] For example, see Figure 5 The first window in the third target window can be window 412, the second window in the second target window can be window 413, and the second window in the second target window can be window 414. The sixth window can be window 415, whose vertex coordinates are located outside the desktop of the electronic device, that is, window 415 will not be displayed on the desktop, but its position in the window stacking order is before the first window, i.e., window 412.

[0185] Based on the embodiments of this application, the vertex coordinates of the sixth window are located outside the desktop of the electronic device, but the position of the sixth window in the window stacking order is before the first window. The sixth window can capture the system's operation of finding the focus window when the third window disappears, so as not to affect the position of the first window and the second window in the window stacking order.

[0186] Optionally, the method further includes: in response to a second operation by the user, the electronic device displays a second interface, the second interface including the first window and the second window, wherein the first window partially obscures the second window.

[0187] The second operation can be an action by which the user minimizes, closes, or moves the third window, making the first window visible to the user.

[0188] For example, see Figure 5 The second interface can be Figure 5 The display interface of the electronic device in (d) is shown. When the third window 414 is closed or minimized, the first window 412 and the second window 413 are displayed on the desktop of the electronic device, and the first window 412 partially obscures the second window 413, that is, the position of the first window is the same as before it was minimized.

[0189] Based on the embodiments of this application, the second operation can be the operation of minimizing or closing the third window, in which case the first window can be restored to its original position. This technical solution can avoid disordered stacking order after the minimized window is restored.

[0190] This application also provides an electronic device, including one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs including instructions that, when executed by one or more processors, cause a window display method as described in any of the possible implementations above to be performed.

[0191] This application also provides a chip, which includes a processor and a communication interface. The communication interface is used to receive signals and transmit the signals to the processor. The processor processes the signals so that the window display method described in any of the possible implementations above is executed.

[0192] This embodiment also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the window display method in the above embodiment.

[0193] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the window display method described in the above embodiment.

[0194] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component, or module. The apparatus may include a connected processor and a memory; wherein the memory is used to store computer execution instructions, and when the apparatus is running, the processor may execute the computer execution instructions stored in the memory to cause the chip to execute the window display method in the above method embodiments.

[0195] In this embodiment, the electronic device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding methods provided above, and will not be repeated here.

[0196] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0197] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0198] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0199] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0200] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0201] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0202] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for displaying a window, characterized in that, The method is applied to an electronic device, and the method includes: The electronic device captures the first message of a window change; The electronic device obtains a first target window with a stacking order according to the first message; The electronic device divides the display area of ​​the desktop (excluding the taskbar) into multiple areas based on the vertex coordinates of the windows within the desktop. The electronic device uses window handles to mark the plurality of regions respectively, and each region in the plurality of regions cannot be marked repeatedly; The electronic device determines a second target window visible to the user within the desktop based on the window handles of the multiple region markers; The electronic device determines a third target window that is invisible to the user based on the first target window and the second target window; The electronic device minimizes the third target window, wherein the third target window includes a first window and a second window, and the first window partially obscures the second window, the second target window includes the third window, and before the electronic device minimizes the third target window, the method further includes: The electronic device inserts a fourth window after the first window; The electronic device inserts a fifth window after the second window; The fourth and fifth windows are not visible to the user.

2. The method according to claim 1, characterized in that, The electronic device acquires a first target window with a stacking order according to the first message, including: The electronic device obtains the bottommost window (excluding the desktop window) in the stacking order of windows on the desktop according to the first message; The electronic device searches for all windows from the bottommost window upwards according to the stacking order of windows on the desktop to obtain the first target window, wherein the first target window is a window that can be displayed in response to user operations.

3. The method according to claim 1 or 2, characterized in that, The electronic device divides the desktop display area, excluding the taskbar, into multiple areas based on the vertex coordinates of the windows within the desktop, including: The electronic device divides the length of the display area in the first direction into multiple parts based on the coordinates of the vertices of the windows in the desktop in the first direction; The electronic device divides the length of the display area in the second direction into multiple parts based on the coordinates of the vertices of the windows within the desktop in the second direction.

4. The method according to claim 1 or 2, characterized in that, The electronic device uses window handles to mark the plurality of regions, including: The electronic device uses the window handles to mark the windows sequentially downwards, starting from the topmost window, according to the stacking order of the windows on the desktop.

5. The method according to claim 1 or 2, characterized in that, Before the electronic device acquires a first target window having a stacking order according to the first message, the method further includes: The electronic device stores the first message in a first queue, and the first queue holds one message at a time; The electronic device reads the first message from the first queue.

6. The method according to claim 5, characterized in that, The interval at which the electronic device reads the first message from the first queue is greater than or equal to a first preset duration.

7. The method according to claim 1, characterized in that, The method further includes: In response to the user's first operation, the electronic device inserts the first window after the fourth window and the second window after the fifth window; The electronic device displays a first interface, which includes a first window and a second window, wherein the first window partially obscures the second window.

8. The method according to claim 1 or 2, characterized in that, The third target window includes a first window, the second target window includes a second window and a third window, and the third window partially obscures the second window, and the first window partially obscures the second window. Before the electronic device minimizes the third target window, the method further includes: The electronic device creates a sixth window, which is positioned before the first window. The vertex coordinates of the sixth window are located outside the desktop of the electronic device.

9. The method according to claim 8, characterized in that, The method further includes: In response to a second user action, the electronic device displays a second interface, which includes the first window and the second window, wherein the first window partially obscures the second window.

10. An electronic device, characterized in that, It includes one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the method of displaying a window as described in any one of claims 1-9 to be performed.

11. A chip, characterized in that, The chip includes a processor and a communication interface, the communication interface being used to receive signals and transmit the signals to the processor, the processor processing the signals such that the window display method as described in any one of claims 1-9 is executed.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed on a computer, cause the method for displaying a window as described in any one of claims 1-9 to be performed.

Citation Information

Patent Citations

  • Depth buffer clipping for window management

    CN1044718A

  • Processor and method for information processing

    JP1996320777A