Window control method, electronic device, computer program product, and storage medium
Patent Information
- Application Number
- CN202611323733.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-10-09
AI Technical Summary
[0005]本申请实施例提供一种窗口控制方法、电子设备、计算机程序产品及存储介质,用于解决窗口状态切换过程中显示不连续,出现窗口消失、区域空白或画面闪烁的技术问题,提高显示连续性
[0038]其中,第二方面至第四方面中任一种设计方式所带来的技术效果可参见第一方面中不同设计方式所带来的技术效果,此处不再赘述。
Smart Images

Figure CN122884593A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of desktop display technology, and in particular to a window control method, electronic device, computer program product, and storage medium. Background Technology
[0002] Applications running on electronic devices typically display their interface through windows. These windows can switch between various display states, such as normal display, maximized display, and minimized display. During these transitions, electronic devices usually display transition animations to present the visual changes of the window.
[0003] Currently, transition animations can be provided by the operating system. The switching of window display states and the display of transition animations are uniformly managed by the operating system's window manager, and the connection is completed within the operating system. When an electronic device runs a desktop enhancement program to replace or enhance the desktop functions provided by the operating system, the transition animation is provided by the desktop enhancement program. That is, after the window's state switching request arrives but before the window's display state changes, the window image is acquired, and the frames of the transition animation generated based on the window image are rendered in a window with a transparent background.
[0004] However, in this method, the display of the transition animation and the switching of the window display state are executed independently by the desktop enhancement program and the operating system, lacking a synchronization mechanism. Since both acquiring the window image and rendering the frame image take time, if the window switches its display state first, for example, disappearing from the screen after switching to a minimized display state, and the first frame of the transition animation has not yet been displayed, then the display area where the window was located before the switch will neither display the application interface content of the window nor the image of the transition animation, resulting in phenomena such as window disappearance, blank areas, or screen flickering, and poor display continuity. Summary of the Invention
[0005] This application provides a window control method, electronic device, computer program product, and storage medium to solve the technical problem of discontinuous display during window state switching, resulting in window disappearance, blank areas, or screen flickering, thereby improving display continuity.
[0006] To achieve the above objectives, the embodiments of this application adopt the following technical solutions: Firstly, a window control method is provided, comprising: an electronic device displaying a first window, the first window being in a first display state; and, in response to a first state switching request for the first window, the electronic device displaying a second window. The first state switching request is used to request switching the first window to a second display state, the second window being located above the first window and used to play a transition animation corresponding to the display state switching process of the first window, the transition animation being an animation generated based on the window image of the first window. After determining that the first frame of the transition animation has been rendered, the electronic device controls the first window to switch to the second display state.
[0007] The first state transition request can be triggered by clicking a control in the title bar of the first window, or by clicking an application icon associated with the first window in the taskbar. The window image is image data corresponding to the application interface content of the first window. The electronic device acquires the window image before the display state of the first window changes and generates a multi-frame image for the transition animation based on the window image. The multi-frame images are displayed sequentially in chronological order, with each frame differing from the previous frame in at least one of its position, size, shape, or transparency, thus presenting the visual changes of the first window during the display state transition. The completion of rendering of the first frame image means that the image data of the first frame image has been rendered and is ready for display. The electronic device can determine this based on the completion status of the first frame image at any stage of the rendering, submission, or composite display phase. For example, it can be determined based on the synchronous completion status generated after the graphics processor completes rendering, the return from the rendering interface used to submit image data, or the frame completion callback returned by the desktop compositing component.
[0008] When the transition animation is provided by a program such as a desktop enhancement program in the electronic device, the display of the transition animation is executed by the program, while the change of the first window's display state is executed by the operating system. These two processes are independent and lack a synchronization mechanism. If the electronic device controls the first window to switch its display state before the first frame image is displayed, and the first window is already invisible on the screen while the first frame image has not yet been displayed, then during the time interval between the first window switching its display state and the first frame image being displayed, the window display area before the first window switching will neither display the application interface content nor the transition animation image; it may only display the background image or the content of other windows located below the first window. In this embodiment, the electronic device uses the completion of rendering of the first frame image as a prerequisite for controlling the first window to switch its display state. The change of the first window's display state is postponed until after the first frame image has finished rendering. Since the second window is located above the first window, after the completion of rendering of the first frame image, the first frame image in the second window has already covered the window display area of the first window, and the application interface content displayed on the screen is borne by the first frame image. When the electronic device then controls the first window to switch to the second display state, the image displayed on the screen remains unchanged for the instants before and after the first window switches its display state.
[0009] In implementing the embodiments of this application, during the switching of the display state of the first window, the first frame image in the second window is rendered and displayed first, and the first window exits the display only after the second window is ready to be displayed. Throughout the entire window state switching process, the screen always displays an image carrying the application interface content, thereby solving the problems of window disappearance, blank areas, or screen flickering during window state switching and improving display continuity. Furthermore, the timing of the first window switching display state is determined by the completion status of the rendering of the first frame image, and does not depend on the switching link inside the operating system. The electronic device can verify and repair the display state of the window during the window state switching process, improving the controllability of the window state switching process.
[0010] In one possible implementation of the first aspect, the method further includes: in response to a second state switching request for the first window, the electronic device displays a second window. The second state switching request is used to request the first window to be restored to a first display state, and the second window is also used to play the frames of the transition animation in order from the last frame to the first frame. After the second window plays the first frame, the electronic device controls the first window to be restored to the first display state and keeps the second window displayed until it is determined that the first window meets a preset condition, after which the second window is hidden.
[0011] The second state transition request is the opposite of the first state transition request. When the second window plays the transition animation in reverse order, the last frame is displayed first, and the first frame is displayed last. The image position moves from the area where the application icon corresponding to the first window is located to the window display area after the first window is restored, and the image size gradually increases, showing the process of the first window restoring from the application icon position to the window itself. After the second window plays the first frame, the display screen shows the same application interface content as before the transition in the window display area of the first window. At this time, the electronic device controls the first window to restore its display state. After the first window restores its display state, the application interface content needs to be redrawn by the application corresponding to the first window. This process takes time, which is related to the window size, the complexity of the application interface content, and the application's own drawing speed, and may be longer than the display time of the transition animation. If the electronic device hides the second window immediately after controlling the first window to restore its display state, the window display area of the first window may be blank, have undrawn content in some areas, or display an old screen before the application has finished drawing or the operating system has displayed the application interface content. Therefore, the electronic device maintains the display of the second window, with the first frame image in the second window continuously covering the display area of the first window. Before the application completes its rendering, the screen still displays the complete application interface content. Thus, the first window resumes its display state and completes the rendering of the application interface content first, while the second window exits the display only after confirming that the first window meets preset conditions. This avoids the phenomenon of blank windows, unrendered areas, or screen flickering that would result from the second window disappearing first and the first window completing its rendering later.
[0012] In one possible implementation of the first aspect, the aforementioned preset conditions include one or more of the following: the window handle of the first window is valid, the first window is not minimized, the first window is visible, the display state of the first window is normal, the first window is not hidden, and the current window rectangle of the first window is valid.
[0013] Among them, "window handle valid" indicates that the window handle assigned to the first window by the operating system is still valid, the application corresponding to the first window is still running, and the first window has not been destroyed; "not in minimized state and normally in display state" indicates that the first window has exited the minimized display state and is in the display state requested by the state switching request; "visible state" indicates that the first window is visible in the window manager; "not hidden" indicates that the first window has not been excluded from the composition result by the desktop composition component of the operating system and is truly visible in the composition result; "current window rectangle valid" indicates that the window rectangle of the first window currently read by the electronic device is within the normal range.
[0014] The operating system's process of restoring the first window's display state only indicates that the window frame has begun to recover or the window state has begun to change; it does not indicate that the client area content of the first window has been fully drawn. Therefore, electronic devices need to detect multiple states of the first window to determine whether it has been fully restored. Meeting a single condition among these multiple conditions is insufficient to indicate that the first window has been fully restored. For example, the first window being visible only indicates that the visibility marker is visible; the client area content may not yet be fully drawn. Similarly, the first window's normal display state only indicates that the window state has been restored; the window rectangle may not yet have returned to its normal position. Therefore, electronic devices combine multiple conditions for judgment. When multiple conditions are met simultaneously, the first window is determined to meet preset conditions. This reduces the probability of hiding the second window when the first window's state field and window rectangle are inconsistent, avoiding display discontinuity issues.
[0015] In one possible implementation of the first aspect, the method further includes: the electronic device determining whether the first window meets a preset condition according to a preset period. Hiding the second window after determining that the first window meets the preset condition includes: hiding the second window after determining that the first window meets the preset condition a preset number of times consecutively.
[0016] The preset period is the time interval at which the electronic device performs detection. After the first window is restored to its display state, the electronic device reads the window handle state, display state, visibility state, and current window rectangle of the first window according to the preset period to determine whether each condition is met. Considering that a single detection may happen to fall within the stage where the state field of the first window is inconsistent with the window rectangle, a single detection result of meeting the preset conditions is insufficient to indicate that the first window has been stably restored. Therefore, the electronic device hides the second window only after confirming that the first window meets the preset conditions after a preset number of consecutive detections. Thus, by performing multiple consecutive detections, the situation where a single detection happens to occur where the state field is inconsistent with the window rectangle is filtered out, further reducing the probability of hiding the second window before the first window has been stably restored; at the same time, periodic detection can promptly detect the moment when the first window has been restored, shortening the unnecessary time that the second window is kept in place.
[0017] In one possible implementation of the first aspect, the method further includes: if it is determined within a preset waiting time that the first window does not meet the preset conditions, the electronic device hides the second window.
[0018] The preset waiting time is the maximum time an electronic device can keep displaying the second window. If the first window fails to meet the preset conditions for an extended period, such as the application corresponding to the first window not responding to window messages, the second window's continued display would obscure other content on the screen for an extended period. Therefore, the display duration of the second window is constrained by the preset waiting time. Even if the first window fails to meet the preset conditions for a long time, the second window will not remain on the screen indefinitely, ensuring display continuity while preventing the second window from obscuring other content for an extended period.
[0019] In one possible implementation of the first aspect, the first display state is a normal display state, and the second display state is a minimized display state. The normal display state is the display state in which the first window is neither in a maximized display state nor in a minimized display state. After controlling the first window to return to the first display state, the method further includes: the electronic device acquiring the current window rectangle of the first window; and, in the case of an abnormal current window rectangle, adjusting the position and size of the first window according to the first window rectangle, where the first window rectangle is the window rectangle when the first window is in the normal display state.
[0020] The operating system controls the switching of the display state of the first window, including modifying the state field and the window rectangle of the first window. The modification of the state field and the modification of the window rectangle are executed separately. When the time interval between two adjacent clicks on the same application icon is short, the first state switching request triggered by the first click arrives first, and the second state switching request triggered by the second click arrives later. In this embodiment, the electronic device inserts the processes of acquiring the window image and determining that the first frame image has been rendered between the request and the execution. The execution of the first state switching request is delayed. Before the first request is completed, the second state switching request may have already arrived, and the modification actions of the two requests are executed alternately. At this time, the state field of the first window may have been modified to the value corresponding to the normal display state, while the window rectangle is still in the coordinate area corresponding to the minimized display state. This coordinate area is outside the display screen. Although the first window has been restored to the display state, the window display area is outside the display screen, and the first window cannot be displayed normally on the display screen. After controlling the first window to restore the display state, the electronic device acquires and verifies the current window rectangle. If the current window rectangle is abnormal, the position and size of the first window are adjusted according to the first window rectangle when the first window is in the normal display state. As a result, the window display area of the first window returns to its normal position and size, and the first window is displayed normally on the screen, avoiding the problem that the window display area is outside the screen and cannot be viewed after the first window is restored.
[0021] In one possible implementation of the first aspect, before the first window switches to the second display state, the method further includes: the electronic device acquiring and caching the rectangle of the first window. The aforementioned adjustment of the position and size of the first window according to the first window rectangle includes: the electronic device acquiring the cached first window rectangle and adjusting the position and size of the first window according to the cached first window rectangle.
[0022] The first window rectangle is acquired before the first window switches to the second display state, while the first window is still in normal display mode. This acquired rectangle accurately reflects the true position and size of the first window in normal display mode, making it more accurate than rectangles acquired during or after the first window is switching. The electronic device caches this first window rectangle. If an anomaly occurs in the current window rectangle after the first window resumes display mode, the cached first window rectangle is used as the basis for repair. Therefore, the first window rectangle acquired and cached before switching display modes provides a reliable benchmark for repair, ensuring the first window returns to its normal position and size after repair, and preventing errors caused by using an abnormal window rectangle read during the switching process.
[0023] In one possible implementation of the first aspect, the first display state is a maximized display state, and the second display state is a minimized display state. After controlling the first window to return to the first display state, the method further includes: the electronic device acquiring the current window rectangle of the first window; and, if the current window rectangle is abnormal, adjusting the first window to the position and size corresponding to the maximized display state.
[0024] In this case, for the first window that was in maximized display before the switch, the window rectangle stored in the window layout recorded by the operating system is the window rectangle in the normal display state, which is different from the window rectangle corresponding to the maximized display state. If the first window is verified and repaired according to the window rectangle in the normal display state, an incorrect conclusion of size mismatch will be obtained. The position and size corresponding to the maximized display state are determined in real time by the operating system based on the display screen, such as the display area or working area of the display screen, and are reliable. Therefore, verification and repair are handled differently according to the display state of the first window before the switch. For the first window that was in maximized display state before the switch, the electronic device directly repairs the first window according to the position and size corresponding to the maximized display state, without relying on the cached first window rectangle. After repair, the window display area of the first window occupies the display area corresponding to the maximized display state, ensuring the accuracy of the repair.
[0025] In one possible implementation of the first aspect, the aforementioned current window rectangle anomaly includes one or more of the following: the coordinates of the current window rectangle are outside the preset coordinate range; the width of the current window rectangle is less than a first threshold and / or the height of the current window rectangle is less than a second threshold; the current window rectangle does not intersect with the preset display area; the difference between the size of the current window rectangle and the size of the current window image is greater than a third threshold.
[0026] The preset coordinate range is determined based on the coordinate range of the display screen. If the coordinates of the window rectangle are outside the preset coordinate range (e.g., within the coordinate area corresponding to the minimized display state), it indicates that the window rectangle may be the rectangle recorded by the operating system when the window is in the minimized display state, rather than the true rectangle when the window is in the normal display state. When the window is in the normal display state, the width and height of the window are usually not less than the resolvable size. If the width is less than the first threshold or the height is less than the second threshold, it indicates that the size of the window rectangle is abnormal and it is not the true rectangle in the normal display state. In the normal display state, the window is allowed to be partially outside the display screen, but the window rectangle usually intersects with the display screen, and the window has a viewable area on the display screen. If the window rectangle does not intersect with the preset display area, it indicates that the window is entirely outside the display screen. The current window image is an image acquired when the first window is in the normal display state, and the size of the window image is consistent with the window size in the normal display state. If the difference between the size of the window rectangle and the size of the current window image is greater than the third threshold, it indicates that the window rectangle does not match the window size when the window image was acquired, and the window rectangle may have deviated from the normal display state. Therefore, by combining multiple criteria, window rectangle anomalies can be determined, covering different anomalies such as window rectangles located outside the display screen, abnormal window rectangle sizes, and mismatches between window rectangles and window images. This improves the accuracy of window rectangle anomaly determination and provides reliable triggering conditions for the repair of the position and size of the first window.
[0027] In one possible implementation of the first aspect, the second display state is a minimized display state. The method further includes: after the last frame of the transition animation is played in the second window, the electronic device hides the second window.
[0028] The last frame is the last frame displayed in the transition animation, and its display area can be the same as the area where the application icon for the first window is located. After the first window is minimized, it is no longer displayed on the screen. When the transition animation reaches the last frame, the image has already reached the area where the application icon is located, and the minimized state of the first window is represented by the application icon. Therefore, after the last frame finishes playing, the second window is hidden, and the screen displays the desktop state of the minimized first window, seamlessly connecting the end of the transition animation with the desktop presentation.
[0029] In one possible implementation of the first aspect, the second display state is not a minimized display state. The method further includes: after the last frame of the transition animation is played in the second window, the electronic device continues to display the second window until it is determined that the first window meets preset conditions.
[0030] In scenarios where the second display state is not minimized (e.g., maximized), the first window remains on the screen after the display state is switched. The first window needs to be rearranged and its application interface content redrawn according to the new display state. Before this redrawing is complete, the first window's display area may not yet be fully rendered. Therefore, after the last frame is played, the second window continues to cover the first window until the first window meets preset conditions before hiding. The first window completes its state switching and content rendering below the upper-level second window, ensuring that the screen always displays an image carrying the application interface content. This avoids window blanking or screen flickering even when the new display state is not minimized.
[0031] In one possible implementation of the first aspect, the method further includes: the electronic device acquiring a first window rectangle and rendering a first frame image of a transition animation at a position corresponding to the first window rectangle in a second window, wherein the first window rectangle is the window rectangle when the first window is in a normal display state, and the normal display state is the display state in which the first window is neither in a maximized display state nor in a minimized display state.
[0032] The first frame image is the window image captured when the first window is in normal display mode. The size of the first frame image is the same as the size of the rectangle of the first window, and the display position of the first frame image coincides with the window display area of the first window. Therefore, before the first window switches display modes, the first frame image in the second window covers the first window in its original position. Although the application interface content of the first window is obscured by the first frame image, the first frame image presents the same application interface content as the first window, and the image displayed on the screen does not change. After the first frame image is rendered, the second window's takeover of the first window's display is seamless, providing a basis for the continuity of the screen image before and after the first window switches display modes.
[0033] In one possible implementation of the first aspect, the method further includes: in response to a second state switching request for the first window, the electronic device displays a second window and controls the first window to return to a first display state. The second state switching request is used to request the first window to return to the first display state, and the second window is also used to play the frames of the transition animation in order from the last frame to the first frame. After the second window plays the first frame, the electronic device keeps the second window displayed for a first duration, and then hides the second window. The first duration is a preset duration or a duration determined according to window information of the first window, which indicates the duration required for rendering the first window.
[0034] The window information may include one or more of the following: the window size of the first window, the type of application corresponding to the first window, and the historical time taken for the first window to restore the application interface content during the history state transition. When the first window size is large, the application takes longer to rearrange and draw the application interface content, resulting in a longer rendering time for the first window. Conversely, when the history restoration time for the first window is short, it indicates a faster drawing speed from the application, leading to a shorter rendering time for the first window. Therefore, the electronic device determines the first duration based on the window information, and the holding duration of the second window matches the actual drawing speed of the first window. This ensures display continuity while minimizing unnecessary holding time and preventing the second window from obscuring other content due to excessive holding time.
[0035] Secondly, an electronic device is provided, which has the function of implementing the window control method of the first aspect described above. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0036] Thirdly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, enable the computer to perform any of the window control methods described in the first aspect above.
[0037] Fourthly, a computer program product containing instructions is provided that, when run on a computer, enables the computer to execute any of the window control methods described in the first aspect above.
[0038] The technical effects of any of the design methods in the second to fourth aspects can be found in the technical effects of different design methods in the first aspect, and will not be repeated here. Attached Figure Description
[0039] Figure 1 This is a schematic diagram of a display screen of an electronic device provided in an embodiment of this application; Figure 2 This is a schematic diagram of a transition animation provided in an embodiment of this application; Figure 3 This is a schematic diagram of the architecture of a window control system provided in an embodiment of this application; Figure 4 This is a flowchart illustrating a window control method provided in an embodiment of this application; Figure 5 This is a flowchart illustrating another window control method provided in an embodiment of this application; Figure 6 This is a schematic diagram of a joint determination condition for a first window to satisfy preset conditions, provided in an embodiment of this application; Figure 7 This is a flowchart illustrating a process for determining whether a first window meets preset conditions, as provided in an embodiment of this application. Figure 8 This is a timing diagram illustrating an anomaly in a window rectangle provided in an embodiment of this application; Figure 9 This is a schematic diagram of the window rectangle anomaly detection and repair process involved in a window control method provided in an embodiment of this application; Figure 10 This is a timing diagram illustrating a window state switching method provided in an embodiment of this application; Figure 11 This is a hardware structure diagram of the electronic device provided in the embodiments of this application. Detailed Implementation
[0040] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These embodiments should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0041] In daily use, electronic devices typically install and run one or more applications. Once an application is running, the electronic device displays an application interface on its screen. This interface can include visual content such as text, images, controls, and video feeds; these elements are collectively referred to as the application interface content. For example, a document editing application's interface might include a text editing area and a toolbar, while a video playback application's interface might include a video feed area and playback control areas.
[0042] An application's user interface is displayed through a window. A window, managed by the operating system's window manager, is a display unit allocated by the operating system to an application, used to display the corresponding application's interface on the screen. The display area occupied by a window on the screen is called the window display area. The window display area can include the window border, title bar, and client area for displaying the application interface content, and can change with the window's position, size, or display status. The window position refers to the window's coordinate position on the screen, such as the coordinates of the window's top-left corner relative to the top-left corner of the screen. The window size refers to the width and height of the window's display area.
[0043] In this embodiment, the window display area can be represented by a window rectangle, which can also be called the window bounding rectangle (rect). The window rectangle includes the window position and the window size, and the window rectangle can be updated as the window position or window size changes.
[0044] A window can have several display states. These include normal display, maximized display, and minimized display. In maximized display, the window's display area occupies the entire display area of the screen, or the entire display area excluding the taskbar area. In minimized display, the window is not displayed on the screen, but the application it corresponds to is still running. In normal display, the window occupies a corresponding display area on the screen; the position and size of this area can change in response to actions performed on the window, and the window size can be smaller than or equal to the display area of the screen. In other words, normal display refers to a window that is neither maximized nor minimized.
[0045] In response to actions performed on a window, an electronic device can control the window to switch between different display states. Window state switching refers to the process of switching a window between different display states. Actions performed on a window can include clicking on controls in the window's title bar. See also Figure 1 , Figure 1 This is a schematic diagram of a display screen of an electronic device provided in an embodiment of this application. Figure 1As shown, the display screen 100 of the electronic device displays a window 101 in its normal display state. The title bar of window 101 may display a minimize button 111, a maximize button 112, and a close button 113. In response to a click on the minimize button 111, the electronic device control window 101 switches from its normal display state to its minimized state. In response to a click on the maximize button 112, the electronic device control window 101 switches from its normal display state to its maximized state. After window 101 switches to its maximized state, the maximize button 112 is replaced with a restore button (not shown in the figure). In response to a click on the restore button, the electronic device control window 101 switches from its maximized state to its normal display state.
[0046] Operations on a window can also include clicking on the application icon associated with the window in the taskbar. For example... Figure 1 As shown, the electronic device's display screen 100 also displays a taskbar 102, which displays application icons 121 associated with window 101. Application icons 121 are graphical identifiers of the window 101 corresponding to an application, and the association between application icons 121 and window 101 can be maintained by the operating system. In response to a click on an application icon 121 in the taskbar 102, the electronic device controls the window 101 to switch between a minimized and a normal display state, or to switch between a minimized and a maximized display state.
[0047] During window state transitions, electronic devices can display a series of continuously changing animated frames. This series of continuously changing animated frames is called a transition animation, also known as a transition screen animation. It is used to present the visual changes of a window during state transitions, making the transition process more seamless. A transition animation can include multiple frames of images, which are displayed sequentially in chronological order. Each frame differs from the previous frame in at least one of the following aspects: position, size, shape, or transparency. The window display area appears to change continuously.
[0048] Transition animations can be based on window images. A window image is image data corresponding to the application interface content of a window. When a window is in its normal or maximized display state, the electronic device can capture the window image through methods such as screenshots, window capture, or desktop image capture. Window capture refers to obtaining the displayed content of a specified window at the current moment through the window image acquisition interface provided by the operating system. Desktop image capture refers to obtaining an image of the electronic device's screen, and then the electronic device crops the area corresponding to the window from the image on the screen. Window images can include the application interface content of the window, such as text, images, controls, or video footage.
[0049] During window state transitions, electronic devices can generate multiple frames of images for the transition animation based on the window image. Each frame can be an image obtained by performing at least one of the following processes on the window image: position transformation, size scaling, transparency change, or shape deformation. When multiple frames are displayed sequentially, they can present the effect of a continuous change in the window's display state from before the state transition to after the state transition.
[0050] Taking the process of a window switching from a normal display state to a minimized display state as an example, the transition animation can gradually change the window's display area before the state switch to a preset target area. The preset target area is the display area where the last frame of the transition animation is located at the end of the transition animation, and it can be the same area as the application icon corresponding to the window. During the display of the transition animation, the first frame can be displayed in the window's display area before the state switch, and the last frame can be displayed in the preset target area. From the first frame to the last frame, the image position can move from the window display area to the preset target area, the image size can gradually shrink from the size of the window display area to the size of the preset target area, and the image transparency can also gradually change. In this way, the transition animation presents the process of the window gradually shrinking and moving from its normal display position to the application icon position.
[0051] See Figure 2 , Figure 2 This is a schematic diagram of a transition animation provided in an embodiment of this application. For example... Figure 2 As shown, the display screen 100 of the electronic device displays a window 101 in a normal display state, and the window 101 occupies a corresponding window display area on the display screen 100. During the process of the window 101 switching from a normal display state to a minimized display state, the transition animation includes multiple frames of images. The first frame of image is displayed at a position corresponding to the window display area before the state switch of the window 101. As the transition animation plays, the image gradually changes from the position of the first frame of image towards a preset target area, which is the area where the application icon 121 is located. The image then passes through the positions of the second and third frames of image, until the last frame of image reaches the preset target area. During the image change process, the size of the image also gradually shrinks from the size of the window display area to the size of the preset target area.
[0052] Similarly, during the transition from a minimized to a normal or maximized window, the transition animation can play in reverse order, with the last frame displayed first and the first frame displayed last. The last frame is displayed in the area where the application icon corresponds to the window, and the first frame is displayed in the window's display area after it is restored. As playback progresses, the image's position can move from the application icon area to the window's display area, and the image size can gradually increase from the application icon's size to the window's display area. During the transition from a normal to a maximized window, the transition animation can gradually change from the window's display area in the normal state to the window's display area in the maximized state. During the transition from a maximized to a normal window, the transition animation can change in the opposite direction.
[0053] Transition animations can be provided by the operating system. When the operating system provides transition animations, both window state switching and the display of the transition animations are managed uniformly by the operating system's window manager. The window manager controls the switching of window display states while simultaneously displaying the transition animations. The duration of the transition animations is coordinated with the window display state switching process; for example, the duration of the transition animation can be set to 200 milliseconds to present a continuous window state switching process. In essence, in scenarios where the operating system provides transition animations, both the display of the transition animations and the switching of window display states are executed by the operating system's window manager, and the transition between the animation visuals and the actual window visuals is handled internally by the window manager.
[0054] However, in some cases, the transition animations provided by the operating system may not meet the requirements. For example, the animation effects, duration, or curves of transition animations provided by the operating system are usually fixed and cannot be adjusted in response to window operations. Another example is when an electronic device runs a desktop enhancement program that replaces the operating system's default desktop functionality; the transition animations provided by the operating system and the desktop visual style provided by the enhancement program may be inconsistent. Furthermore, the process of providing transition animations by the operating system is completed internally; the desktop enhancement program on the electronic device cannot intervene in this process, adjust the timing between the transition animation and window display state switching, verify the window's display state during state switching, or repair the window if its display state is abnormal.
[0055] A desktop enhancement program is a program that runs within the desktop environment of an operating system, used to replace or enhance the desktop functionality provided by the operating system. Desktop enhancement programs can provide transition animations during window state transitions. In addition, they can provide one or more customizations, such as the desktop interface, application icon arrangement, and taskbar style. Because the transition animations provided by the desktop enhancement program replace those provided by the operating system, electronic devices need to obtain window images through the desktop enhancement program and display the frames of the transition animations provided by the desktop enhancement program based on those window images.
[0056] In scenarios where desktop enhancement programs provide transition animations, the way electronic devices display transition animations through desktop enhancement programs can include the following steps: After the window's state switching request arrives but before the window's display state changes, the window image is acquired. A window with a transparent background is created, and the frames of the transition animation generated based on the window image are rendered (or drawn) within the transparent window. The transparent window can cover the entire display area of the screen. Except for the area where the image is rendered, the remaining area of the transparent window remains transparent. The original content located below the transparent window on the screen can be displayed through the transparent area; therefore, only the area containing the image is displayed on the screen. During the transition animation playback, each frame of the image is scaled, shifted, or deformed between the window's display area before the window state switch and a preset target area, visually replacing the window to complete the state switching process.
[0057] It's important to understand that the frames of a transition animation are different from the window itself. A window is a display unit managed by the operating system's window manager, and its display state is determined by the operating system. The frames of a transition animation, on the other hand, are content rendered by the electronic device based on the window's image and displayed in a transparent window. The window's display state is unaffected by the transition animation. Even when a transition animation is in progress, the actual display state of the window is still determined by the operating system's window manager.
[0058] In scenarios where desktop enhancement programs provide transition animations, the transition animations are displayed by the desktop enhancement programs on the electronic device, while the window display state is changed by the operating system. The display of the transition animation and the change of the window display state are independent of each other, and there is no synchronization mechanism between the two. The display of the transition animation and the change of the window display state may not be synchronized in time.
[0059] Specifically, during the process of a window switching from a normal or maximized display state to a minimized display state, the electronic device needs to first acquire the window image, then generate and display the first frame of the transition animation based on the window image. This acquisition, generation, and display process takes time. If the electronic device controls the window to enter a minimized display state before the first frame is displayed, and the window is already invisible on the screen, but the first frame has not yet been displayed, then during the time between the window entering the minimized display state and the first frame being displayed, the window display area before the state switch will neither display the application interface content nor the transition animation image; it may only display the background image, desktop interface content, or content from other windows located below the window.
[0060] Based on this, this application provides a window control method. After a window's display state switching request arrives but before the display state changes, a window image is acquired. A transition animation generated based on the window image is displayed in a second window located above the first window. The window's display state is switched only after the first frame of the transition animation has been rendered. Through this method, during the window's display state switching process, the first frame image in the second window is rendered and displayed first, while the first window switches its display state. This ensures that the screen always displays an image carrying the window's application interface content, thus solving the problems of window disappearance, blank areas, or screen flickering during window state switching and improving display continuity.
[0061] The window control method provided in this application can be applied to electronic devices with displays, such as laptops, desktop computers, and tablets. This application does not limit the specific form of the electronic device. The window control method provided in this application can be applied to scenarios where window states are switched using desktop enhancement programs, window managers, virtual desktop switching, multi-tasking views, or taskbar replacement products. Similarly, the window control method provided in this application can also be applied to operating systems, but the method by which the operating system executes each step may differ from the method used in third-party software. In the following embodiments, the transition animation for window state switching provided by the electronic device for laptops and desktop enhancement programs is used as an example for illustration.
[0062] See Figure 3 , Figure 3 This is a schematic diagram of the architecture of a window control system provided in an embodiment of this application. Figure 3As shown, the window control system may include a message broker module 210, a window state cache module 220, a display continuity control module 230, an image acquisition module 240, and an anomaly detection module 250. The message broker module 210 receives state switching requests for the window and passes these requests to the display continuity control module 230. The window state cache module 220 stores data such as the window rectangle, window image, and window display state. The image acquisition module 240 acquires the window image and converts it into data suitable for rendering. The display continuity control module 230 controls the display and hiding of the second window and the timing of the first window's display state switching. The anomaly detection module 250 verifies whether the window rectangle is abnormal and corrects the window's position and size if the window rectangle is abnormal.
[0063] During window state switching, message broker module 210 forwards the received state switching request to display continuity control module 230. Display continuity control module 230 instructs image acquisition module 240 to acquire the window image of the first window and instructs anomaly detection module 250 to verify the window rectangle. Image acquisition module 240 stores the acquired window image in window state cache module 220. Display continuity control module 230 and anomaly detection module 250 read the required data from window state cache module 220, such as display continuity control module 230 reading the window image and the first window rectangle from window state cache module 220, and anomaly detection module 250 reading the first window rectangle from window state cache module 220. Display continuity control module 230 and anomaly detection module 250 can control the first window to switch display states or adjust the position and size of the first window through the window interface provided by the operating system. The specific details of this process are described below.
[0064] The following is combined with Figure 4 and Figure 5 This section explains the window control methods.
[0065] See Figure 4 , Figure 4 This is a flowchart illustrating a window control method provided in an embodiment of this application. The window control method can be applied to... Figure 3 The window control system shown is illustrated using the process of switching a window from a normal display state to a minimized display state as an example. Specifically, the first display state is the normal display state, and the second display state is the minimized display state. Figure 4 As shown, the method may include S401 to S411.
[0066] S401, The electronic device displays a first window on the display screen, and the first window is in a first display state.
[0067] The first window is the window displayed on the screen of the electronic device. The first window can be the window corresponding to any application. The first display state is the display state of the first window before the display state is switched. Since the electronic device displays the first window, the first window is visible on the screen, and the first display state can be the normal display state or the maximized display state. The second display state, corresponding to the first display state, is the display state of the first window after the display state is switched, and the second display state is different from the first display state. In this embodiment, the example of the first display state being the normal display state and the second display state being the minimized display state will be used for explanation.
[0068] In step S402, in response to a first state switching request for the first window, the electronic device determines whether the first window meets the switching conditions. If the first window meets the switching conditions, the electronic device executes step S403. If the first window does not meet the switching conditions, the electronic device does not execute step S403 or subsequent steps, and directly controls the first window to switch to the second display state.
[0069] A first state transition request is used to request a switch from the first window to the second display state. This request can be triggered by various actions performed on the first window. For example, it can be triggered by clicking the minimize button in the title bar of the first window. Another example is clicking the application icon associated with the first window in the taskbar. Yet another example is an action performed on an application icon, folder, taskbar overlay, or desktop entry point provided by a desktop enhancement program. It's understood that the display state requested by the first state transition request is the second display state. After the first state transition request arrives, the first window has not yet switched display states and remains in the first display state.
[0070] Upon receiving a first state switching request, the electronic device can first determine whether the first window meets the switching conditions. These conditions may include one or more of the following: the first window's handle is valid, the first window is visible, and the first window is not in a minimized state. The window handle is an identifier assigned to a window by the operating system; the electronic device uses the window handle to determine the window targeted by the first state switching request. If the first window does not meet the switching conditions, the electronic device may skip acquiring the window image and subsequent steps, for example, directly controlling the first window to switch to the second display state. If the first window meets the switching conditions, the electronic device acquires the window image of the first window. At this time, the first window is still in normal display mode, and the application interface content of the first window is fully displayed in the window display area. The window image acquired by the electronic device reflects the application interface content of the first window before the display state switch.
[0071] S403, the electronic device acquires the window image of the first window.
[0072] There are several ways for an electronic device to acquire a window image. For example, the electronic device can obtain the display content of the first window at the current moment through the window image acquisition interface provided by the operating system, thus obtaining the window image. Another example is that the electronic device can acquire the image of the display screen and extract the area corresponding to the first window from the image of the display screen to obtain the window image. Yet another example is that the electronic device can capture the first window through a graphics interface to obtain the window image. Graphics interfaces may include Graphics Device Interface (GDI), Desktop Duplication API (DDA), or Windows Graphics Capture (WGC), etc. The pixel data format of the window image acquired using different graphics interfaces can be different. The electronic device can convert the acquired pixel data into a texture that can be processed by the graphics processor for use in rendering each frame of the transition animation. The window image acquired by the electronic device can be pixel data in bitmap form or texture data that can be processed by the graphics processor; this application embodiment does not limit the specific form of the window image. After acquiring the window image, the electronic device can store the window image in the window state cache module for use when the first window subsequently restores its display state.
[0073] S404, The electronic device displays a second window, and renders the first frame of the transition animation at the position in the second window corresponding to the current window rectangle of the first window.
[0074] The second window is used by the electronic device to play transition animations, which correspond to the switching of the display state of the first window. After the second window is displayed, it sits on top of the first window. This means that the second window has a higher display layer on the screen than the first window. Display layer indicates the stacking order of windows on the screen; a window with a higher display layer can cover the area of a window with a lower display layer. Therefore, after the second window is displayed, it covers the display area of the first window on the screen, obscuring the application interface content of the first window.
[0075] The second window can take various forms. In one embodiment, the second window can be a transparent window covering the entire display area of the screen. The background of the transparent window remains transparent, and only the area containing the transition animation image is rendered within the transparent window. The original content below the transparent window on the screen is displayed through the transparent area, and only the transition animation image is shown on the screen. In another embodiment, the second window can be a top-level transparent window with the same window display area size as the first window. In yet another embodiment, the second window may not be a window managed by the operating system, but rather a visual layer added by the electronic device to the desktop composition component of the operating system. The desktop composition component is a component used by the operating system to composite the display screen, such as the desktop window manager (DWM) in Windows. The visual layer is a rendering layer that participates in the overlay process of the desktop composition component in compositing the display screen. The display hierarchy of the visual layer is higher than that of the first window, and the electronic device renders the frames of the transition animation in the visual layer. In a system employing DWM, the visual layer can be a visual object created by the electronic device through the DWM compositing interface. The visual object is attached to the DWM visual tree, and the hierarchical relationship of the visual tree determines the stacking order of each visual object in the compositing result. The electronic device sets the level of the visual object to be higher than the first window, thus placing the second window above the first window. All of the above-mentioned forms can achieve the second window being above the first window and rendering transition animations. This application embodiment does not limit the specific form of the second window. The rendering of each frame image in the second window can be performed by a desktop enhancement program in the electronic device calling a graphics rendering engine. The graphics rendering engine can include a 3D graphics interface (Direct3D, D3D), a system compositing interface (DirectComposition, DirectComposition), or a cross-platform rendering engine such as the Cocos engine. This application embodiment does not limit the type of graphics rendering engine.
[0076] It's important to understand that the second window may not accept input focus during display, and keyboard input operations targeting the area of the second window will not be responded to by the second window. In one implementation, click operations targeting the area of the second window can also penetrate the second window and be passed to the window below it, where the lower window will respond. In this way, the second window handles the display of transition animations during display without interfering with the normal response of the electronic device to operations.
[0077] After displaying the second window, the electronic device renders the first frame of the transition animation within it. The transition animation is generated based on the window image and consists of multiple frames. The first and last frames are displayed according to the playback order of the transition animation: the first frame is the first image displayed, and the last frame is the last image displayed. If the transition animation is played in reverse order, the last frame is displayed first, and the first frame is displayed last. It should be noted that the second window can be a newly created window during each window state switch, or a window that is pre-created and reused multiple times. In some implementations, the electronic device does not destroy the second window after a window state switch, but only hides it. It then displays the second window again and renders a new image at the start of the next window state switch, thus eliminating the window creation process and shortening the preparation time before the first frame is rendered.
[0078] The current window rectangle is the rectangle corresponding to the window display area currently occupied by the first window. In this embodiment, the first window is in a normal display state, and the current window rectangle of the first window is the same as the first window rectangle, which is the window rectangle when the first window is in a normal display state. Therefore, the electronic device renders the first frame image at the position corresponding to the current window rectangle in the second window, that is, it renders the first frame image at the position corresponding to the first window rectangle in the second window. The size of the first frame image is the same as the size of the current window rectangle, and the display position of the first frame image coincides with the window display area of the first window, covering the first window in its original position. The first frame image is the window image rendered at the position of the current window rectangle, that is, the content of the first frame image is the window image obtained by the electronic device in S403. In this way, before the first window switches display states, the first frame image in the second window already presents the same application interface content as the first window, and the image displayed on the screen does not change. When the first display state is the maximized display state, the current window rectangle of the first window is the rectangle corresponding to the display area actually occupied by the first window in the maximized display state, which is different from the first window rectangle (the window rectangle in the normal display state). At this time, the electronic device renders the first frame image in the second window at the position corresponding to the current window rectangle. The size of the first frame image is the same as the size of the current window rectangle, and the first frame image covers the first window in the maximized display state in its original position.
[0079] S405, the electronic device acquires the first window rectangle.
[0080] S406, the electronic device determines whether the first window rectangle is abnormal. If the first window rectangle is determined to be normal, the electronic device executes S407. If the first window rectangle is determined to be abnormal, the electronic device does not execute S407 and directly executes S408.
[0081] Electronic devices can obtain the first window rectangle either by reading it from the currently occupied display area of the first window, or by reading it from the operating system's window layout record. The window layout record is a data structure provided by the operating system, such as the `WINDOWPLACEMENT` structure in Windows. The window position structure can include a display state field and a normal rectangle field. The display state field records the current display state of the window, such as the `showCmd` field in the `WINDOWPLACEMENT` structure. The normal rectangle field records the window rectangle when the window is in its normal display state, such as the `rcNormalPosition` field in the `WINDOWPLACEMENT` structure. For a first window that was in its maximized state before switching, the window rectangle recorded in the normal rectangle field is the window rectangle in its normal display state, which is different from the window rectangle in its maximized state. The electronic device reads the window position structure through a window state query interface and retrieves the first window rectangle from the normal rectangle field. For the first window rectangle obtained, the electronic device can verify whether the first window rectangle is abnormal, and only cache the first window rectangle if the verification passes. The verification process is described in detail in the following window rectangle abnormality detection and repair process.
[0082] S407, the electronic device writes the first window rectangle into the window state cache module.
[0083] In one implementation, a cache record in the window state caching module may include one or more of the following fields: window handle of the first window, window title of the first window, window class name of the first window, first window rectangle, window image, valid flag of the window image, valid flag of the first window rectangle, display state of the first window before switching display states, and trigger time of this state switch. The display state may be recorded as a state value, with the value corresponding to normal display state, maximized display state, or minimized display state. The window title and window class name are used to identify the application corresponding to the first window. The valid flag of the window image is used to indicate whether the cached window image is available. After the electronic device retrieves the window image of the first window again, it can set the valid flag to valid. After the application corresponding to the first window exits, the electronic device sets the valid flag to invalid.
[0084] In step S408, the electronic device determines whether the first frame of the transition animation has been rendered. If it is determined that the first frame has been rendered, the electronic device executes step S409. Before the first frame has been rendered, the electronic device does not control the first window to switch display states; the first window remains in its first display state, and step S408 continues to execute.
[0085] The completion of rendering the first frame means that the image data of the first frame has been rendered by the electronic device and is ready for display. The electronic device can determine the completion of rendering of the first frame in several ways, such as based on the completion status of the first frame at each stage of the display process. The display process of the first frame can include a rendering stage, a submission stage, and a composite display stage. The rendering stage is complete when the image data of the first frame has been rendered by the electronic device. The submission stage is complete when the image data of the first frame has been submitted to the desktop compositing component. The composite display stage is complete when the first frame has been composited onto the display screen. The electronic device can determine the completion of rendering of the first frame based on the completion status of the first frame at any of the above stages.
[0086] For example, an electronic device can determine that the first frame of an image has been rendered based on the completion status corresponding to the rendering stage. The completion status corresponding to the rendering stage can be a synchronous completion status generated by the graphics processor after it has completed rendering the first frame of an image. The electronic device determines that the first frame of an image has been rendered when the graphics processor has completed rendering the first frame of an image and generated a synchronous completion status.
[0087] For example, an electronic device can determine that the first frame of the image has been rendered based on the completion status corresponding to the submission stage. The completion status corresponding to the submission stage can be a return from the rendering interface. The rendering interface is used to submit the image data of the rendered first frame of the image to the desktop compositing component. The return from the rendering interface indicates that the image data of the first frame of the image has been received by the desktop compositing component. When the rendering interface returns, the electronic device determines that the first frame of the image has been rendered.
[0088] For example, an electronic device can determine that the first frame of an image has been rendered based on the completion status corresponding to the compositing and display stage. The completion status corresponding to the compositing and display stage can be a frame completion callback. A frame completion callback is a message returned to the electronic device by the desktop compositing component or graphics interface after completing the compositing and display of a frame of an image. When the electronic device receives a frame completion callback, it indicates that the first frame of an image has been composited onto the display screen. Upon receiving a frame completion callback, the electronic device determines that the first frame of an image has been rendered.
[0089] S409, the electronic device controls the first window to switch to the second display state.
[0090] Before the first frame of the image is rendered, the first window maintains its first display state, and the application interface content of the first window is continuously displayed in the window display area. It is understood that there is a time interval between the arrival of the first state switching request and the moment the first window switches its display state. In related technologies, the electronic device controls the window to switch its display state immediately after the request arrives, and there is no verification step between the change in the window display state and the display of the transition animation. In this embodiment, the electronic device performs the processes of acquiring the window image, displaying the second window, and rendering the first frame of the image within the aforementioned time interval, and takes the completion of rendering of the first frame of the image as a prerequisite for controlling the switching of the first window's display state; that is, the change in the first window's display state is postponed until after the first frame of the image is rendered. By setting a verification step between the request and execution, a temporal connection is established between the change in the window display state and the display of the transition animation. After determining that the first frame of the image is rendered, the first frame of the image in the second window has already covered the first window in its original position, and the application interface content displayed on the screen is taken over by the first frame of the image. At this time, the electronic device controls the first window to switch to the second display state, that is, controls the first window to enter the minimized display state, and the first window disappears from the screen. Since the first frame image in the second window overlaps with the display area of the first window and has the same content, the image displayed on the screen does not change instantly before and after the first window disappears.
[0091] In one implementation, the electronic device can also control the first window to be hidden from the display screen, and the hidden first window no longer occupies the display area on the display screen. Unlike the minimized display state, the display state of the hidden first window can remain the same as before the switch. Controlling the first window to hide and controlling the first window to enter the minimized display state can both cause the first window to exit the display screen. This application embodiment will be described using the control of the first window to enter the minimized display state as an example.
[0092] In this way, during the process of switching display states of the first window, the second window first completes the rendering of the first frame image and takes over the display, and the first window exits the display only afterward. The screen always displays the screen containing the application interface content of the first window, thus avoiding the phenomenon of window disappearing, area blanking, or screen flickering caused by the first window disappearing first and the transition animation showing up later.
[0093] S410, the electronic device plays frames of the transition animation through a second window.
[0094] S411: After the electronic device finishes playing the last frame of the image, it hides the second window.
[0095] After the first window switches to the second display state, the second window plays the subsequent frames of the transition animation in chronological order. Each frame of the transition animation is generated based on the window image. In each frame, the image's position moves from the position corresponding to the rectangle of the first window towards a preset target area, and the image size shrinks from the size of the first window rectangle towards the size of the preset target area. The preset target area is the display area where the last frame of the transition animation is located, and this preset target area can be the same as the area where the application icon corresponding to the first window is located. During the playback of the transition animation, the screen displays the effect of the first window image gradually shrinking and moving towards the application icon position, visually presenting the process of the first window being minimized.
[0096] The last frame is the last frame displayed in the transition animation. In this embodiment, the second display state is a minimized display state, and the first window is already minimized, so it is no longer displayed on the screen. When the transition animation reaches the last frame, the image displayed on the screen has reached the preset target area, and the minimized display state of the first window is represented by the application icon. Therefore, after the second window finishes playing the last frame, the electronic device hides the second window, and the screen displays the desktop state after the first window is minimized, seamlessly connecting the end of the transition animation with the desktop presentation.
[0097] After the second window is hidden, the window image and rectangle of the first window are stored in the window state cache module for use when the first window is subsequently restored to its display state. Thus, when the first window is restored to its display state, the electronic device can directly read the cached window image and rectangle without needing to retrieve them again, shortening the processing time during the restoration process.
[0098] In this embodiment, during the process of the first window switching to the minimized display state, the second window takes over the display only after the first frame image is rendered, and the first window exits the display only after the second window takes over. Throughout the window state switching process, the application interface content of the first window is always displayed on the screen, thereby solving the problems of window disappearance, blank areas, or screen flickering during window state switching and improving display continuity.
[0099] In the above embodiments, after the first window is switched to a minimized display state, the first window is no longer displayed on the screen. If the electronic device receives a request to restore the first window again, it needs to restore the first window's display. In related technologies, the electronic device displays each frame of the transition animation through a desktop enhancement program, and simultaneously controls the first window to restore its display state through the operating system. After the first window is restored, the application interface content of the first window needs to be redrawn by the application corresponding to the first window. This process takes time, and the time required may be greater than the display time of the transition animation. If the electronic device ends the display of the transition animation before the application has finished drawing the application interface content, or before the operating system has displayed the application interface content, the window display area of the first window may not display the complete application interface content, resulting in blank areas, undrawn parts, or old images. Based on this, this application provides a window control method that controls the first window to first restore its display state, keeps the second window displayed, and then hides the second window after determining that the first window meets preset conditions. See also Figure 5 , Figure 5 This is a flowchart illustrating another window control method provided in an embodiment of this application. The flowchart is explained using the process of a first window restoring from a minimized display state to a normal display state as an example. Figure 5 As shown, the method may include S501 to S508.
[0100] S501, the electronic device responds to the second state switching request for the first window by reading the data corresponding to the first window from the window state cache module.
[0101] The second state transition request is used to request that the first window be restored to its first display state, that is, to request that the first window, which is currently in a minimized state, be restored to its normal display state. The second state transition request can be triggered by clicking the application icon associated with the first window in the taskbar, or by clicking an application icon provided by a desktop enhancement program. It can be understood that the second state transition request is the opposite of the first state transition request; the first state transition request requests the first window to enter a minimized state, and the second state transition request requests the first window to exit a minimized state.
[0102] After receiving the second state switching request, the electronic device can read the data corresponding to the first window from the window state cache module. The data in the window state cache module can be stored according to the window handle; that is, the electronic device uses the window handle of the first window as an index to find the data corresponding to the first window. The data corresponding to the first window may include the window image of the first window, the rectangle of the first window, and the display state of the first window before switching display states. The display state of the first window before switching display states indicates whether the first window was in a normal display state or a maximized display state before switching to a minimized display state.
[0103] In step S502, the electronic device determines whether the cached data is available. If the cached data is available, the electronic device executes step S503. If the cached data is unavailable, the electronic device does not display the second window and directly restores the display state of the first window.
[0104] It should be noted that if the window image corresponding to the first window is not cached in the window state caching module, or if the cached window image has expired, the electronic device will not display the second window, but will directly control the first window to restore its display state. The circumstances under which the cached window image becomes invalid can include one or more of the following: the application corresponding to the first window has exited, the window handle of the first window is invalid, or the cached window image has exceeded its validity period. When the electronic device reads the cache record, it first checks the validity marker of the window image. If the validity marker is invalid, it determines that the cached window image has expired, and cache records with invalid validity markers are not used to play transition animations. In this implementation, due to the lack of a window image, the electronic device cannot play transition animations and directly restores the display state of the first window; display continuity is handled by the operating system's default display process.
[0105] Even if the cached window image is valid but the first window rectangle is not cached in the window state cache module (e.g., the first window rectangle was determined to be abnormal and not written to the cache before the last display state switch), the electronic device can still display the second window and play the transition animation. In this case, the electronic device can read the window rectangle from the operating system's window layout record as the display position of the first frame image in the reverse-played transition animation. Since this window rectangle has not been verified, the electronic device will not use it as the basis for subsequent repair of the first window; the repair will be performed using the fallback method in the following window rectangle anomaly detection and repair process.
[0106] S503, the electronic device displays a second window, playing the frames of the transition animation in order from the last frame to the first frame.
[0107] With the window image of the first window cached in the window state caching module, the electronic device displays a second window, positioned above the first window. After the second window is displayed, the electronic device plays the frames of the transition animation in the second window in the order from the last frame to the first frame, i.e., in the reverse playback order of the transition animation. The display position of the first frame is determined based on the cached rectangle of the first window; if the first window rectangle is not cached, it is determined based on the window rectangle read from the window layout record. At this time, the position of the transition animation image moves from the preset target area to the position corresponding to the first window rectangle, and the image size enlarges from the size of the preset target area to the size of the first window rectangle, presenting the process of the first window returning to the window display area from the application icon position.
[0108] During the reverse playback of the transition animation, the first window remains minimized. No content is displayed in the first window's display area; the transition animation image shown on the screen is the only representation of the first window's application interface content.
[0109] S504, after the first frame of the image is played in the second window, the electronic device controls the first window to return to the first display state and keeps the second window displayed.
[0110] In the reverse-order transition animation, the first frame is the last frame displayed, and its position corresponds to the rectangle of the first window. After the first frame is played in the second window, the reverse transition animation reaches its end, and the display shows the same application interface content as before the first window switch, at the location of the first window rectangle. At this point, the electronic device controls the first window to return to its first display state, that is, to restore the first window from its minimized state to its normal display state. The time when the second state switching request arrives is t0, the time when the second window starts to display is t1, the time when the reverse-playing transition animation reaches the first frame is t2, the time when the electronic device controls the first window to return to its display state is t3, the time when the electronic device determines that the first window meets the preset conditions is t4, and the time when the second window is hidden is t5. Among them, t1 to t2 is the playback phase of the reverse transition animation, during which the second window's image zooms in from the preset target area to the position corresponding to the first window rectangle. t3 occurs after t2, meaning the first window only begins to recover after the reverse transition animation reaches its end. The first frame of the second window continuously covers the display area of the first window during t3 to t4, overriding the drawing process during the first window's recovery. t5 occurs after t4, meaning the second window only hides after determining that the first window meets preset conditions.
[0111] After the first window is restored to display, its application interface content needs to be redrawn by the corresponding application. This redrawing process takes time, depending on the window size, the complexity of the application content, and the application's own rendering speed. This time may exceed the remaining playback time of the transition animation. If the electronic device hides the second window immediately after the first window is restored to display, the first window's application interface content may not have been fully rendered, resulting in blank areas, undrawn sections, or the display of an older image.
[0112] Therefore, while controlling the first window to resume its display state, the electronic device maintains the display of the second window. The first frame image in the second window continuously covers the window display area of the first window. The content of the first frame image is the window image acquired before the first window switched, presenting the complete application interface content. During the period after the first window resumes its display state but before the application interface content is fully rendered, although the window display area of the first window may not yet be fully rendered, it is covered by the first frame image in the second window, and the screen still displays the complete application interface content.
[0113] S505, the electronic device determines whether the first window meets the preset conditions. If the first window meets the preset conditions, the electronic device executes S506. If the first window does not meet the preset conditions, the electronic device keeps displaying the second window and continues to execute S505.
[0114] The electronic device keeps the second window displayed until it determines that the first window meets preset conditions. After confirming that the first window meets the preset conditions, the electronic device hides the second window. The preset conditions are used to determine whether the first window has been fully restored. Since the operating system controls the process of restoring the display state of the first window, it only indicates that the window frame of the first window has begun to recover or the window state has begun to change, but it does not indicate that the content of the client area of the first window has been fully drawn. The electronic device needs to detect multiple states of the first window to determine whether the first window has been fully restored.
[0115] See Figure 6 , Figure 6 This is a schematic diagram illustrating a joint determination condition where a first window satisfies preset conditions, provided in an embodiment of this application. For example... Figure 6 As shown, the preset condition 600 may include one or more of the following: the window handle of the first window is valid 601, the first window is not in a minimized display state 602, the first window is in a visible state 603, the display state of the first window is consistent with the display state requested by the state switching request 604, the first window is not hidden 605, the current window rectangle of the first window is valid 606.
[0116] The condition that the window handle of the first window is valid means that the window handle assigned to the first window by the operating system is still valid, the application corresponding to the first window is still running, and the first window has not been destroyed. Electronic devices can query the existence status of a window based on its window handle, and if the window handle is valid, then the condition that the window handle is valid is met.
[0117] The first window not being in a minimized display state means that the first window has exited the minimized display state. For example, in Windows systems, the IsIconic interface returns false for the first window, or the showCmd field in the window position structure does not correspond to the minimized display state. The first window being in a visible state means that the first window's visibility marker in the window manager is visible. The first window's display state is consistent with the display state requested by the state switching request, meaning that the first window is already in the display state requested by the state switching request. In this embodiment, the second state switching request is used to request that the first window be restored to the normal display state, that is, the first window is already in the normal display state. The first window not being hidden means that the first window has not been excluded from the composition result by the operating system's desktop composition component. In one implementation, the operating system can hide and encapsulate windows that are logically visible but have not yet completed display preparation. For example, in Windows systems, the DWM sets the window to the cloaked state. Although the hidden and encapsulated window has a visibility marker, it does not participate in the composition output of the desktop composition component, and the window does not actually appear on the display screen. Therefore, the first window not being hidden means that the first window is visible in the composition result of the desktop composition component. The validity of the current window rectangle of the first window means that the window rectangle of the first window currently being read by the electronic device is within a normal range. For example, the width and height of the window rectangle are positive values, and the window rectangle intersects with the display screen. It should be noted that the implementation of the above conditions may differ in different operating systems. Taking Windows as an example, the window handle state can be determined by the return result of the IsWindow interface, the display state can be determined by the return result of the IsIconic interface or the showCmd field in the window position structure, the visible state can be determined by the return result of the IsWindowVisible interface, the hidden state can be determined by the window attribute query interface of DWM (e.g., querying the cloaked attribute of the window through the DwmGetWindowAttribute interface), and the current window rectangle can be read through the GetWindowRect interface.
[0118] In some embodiments, the satisfaction of a single condition among the above multiple conditions is insufficient to indicate that the first window has been fully restored. For example, the first window being visible only indicates that the visibility marker in the window manager is visible; the content of the client area of the first window may not yet be fully drawn. As another example, the display state of the first window being consistent with the display state requested by the state switching request only indicates that the window state field has been restored; the window rectangle of the first window may not yet have returned to its normal position. Therefore, the electronic device can combine multiple conditions for judgment, and determine that the first window meets the preset conditions when multiple conditions are simultaneously satisfied. Combining multiple conditions for judgment can reduce the probability of the electronic device hiding the second window when the state field and window rectangle of the first window are inconsistent, avoiding the problem of display discontinuity.
[0119] See Figure 7 , Figure 7 This is a flowchart illustrating a process for determining whether a first window meets preset conditions, provided in an embodiment of this application. It shows one implementation method in S505 where the electronic device determines whether the first window meets preset conditions. Figure 7 As shown, the method may include S701 to S703.
[0120] S701, the electronic device determines whether the first window meets the preset conditions according to a preset cycle.
[0121] The preset period is the time interval at which the electronic device performs detection. After the electronic device controls the first window to resume display, it reads the window handle state, display state, visible state, hidden state, and current window rectangle of the first window according to the preset period, determines whether each condition is met, and obtains the detection result for this round.
[0122] If the first window meets the preset conditions, the electronic device executes S702. If the first window does not meet the preset conditions, the electronic device continues to display the second window, continues to execute S701, and then executes S703.
[0123] S702, the electronic device determines whether the first window has met the preset conditions after a preset number of consecutive steps.
[0124] Considering that a single detection might happen to fall within a stage where the state field of the first window is inconsistent with the window rectangle, a single detection result meeting the preset conditions is insufficient to indicate that the first window has been stably restored. Therefore, the electronic device hides the second window only after confirming that the first window meets the preset conditions for a preset number of consecutive tests. For example, if the electronic device confirms that the first window meets the preset conditions in three consecutive rounds of detection, then it determines that the first window has been stably restored. If the first window does not meet the preset conditions for a preset number of consecutive tests, the electronic device returns to execute S701. If the first window meets the preset conditions for a preset number of consecutive tests, the electronic device continues to execute S506. By performing multiple consecutive tests, the situation where a single detection happens to coincide with an inconsistency between the state field and the window rectangle can be filtered out, further reducing the probability of hiding the second window before the first window has stabilized.
[0125] After determining that the first window meets the preset conditions through the above method, the electronic device continues to execute S506 to verify the current window rectangle of the first window before hiding the second window.
[0126] In another implementation, the electronic device may also determine whether the first window meets preset conditions in response to a window message issued by the operating system when the display state of the first window or the window rectangle changes. This application embodiment does not limit the method for determining whether the first window meets preset conditions. The above methods can be used individually or in combination, and this application embodiment does not limit this usage.
[0127] S703, the electronic device determines whether the first window does not meet the preset conditions within the preset waiting time.
[0128] If the first window fails to meet the preset conditions within a preset waiting time, the electronic device hides the second window. The preset waiting time is the maximum time the electronic device will display the second window. Even if the first window fails to meet the preset conditions for an extended period, the second window will not remain on the display indefinitely; the display duration of the second window is constrained by the preset waiting time. In this embodiment, the electronic device can periodically detect when the first window has fully recovered, thus reducing unnecessary time the second window is displayed.
[0129] S506, the electronic device determines whether the current window rectangle of the first window is abnormal. If the current window rectangle is determined to be abnormal, the electronic device executes S507. If the current window rectangle is determined not to be abnormal, the electronic device executes S508.
[0130] After confirming that the first window meets the preset conditions, it indicates that the first window has been restored. Before hiding the second window, the electronic device verifies the current window rectangle of the first window. If the current window rectangle is abnormal, the position and size of the first window are corrected first, and then the second window is hidden. The verification and correction process is described in detail in the window rectangle anomaly detection and correction process below. After the second window is hidden, the window display area of the first window displays the application interface content of the first window itself. For windows whose application interface content does not change during window state switching, both the first frame image in the second window and the application interface content of the first window display complete application interface content. The screen displays a continuous image before and after the second window is hidden.
[0131] S507, the electronic device adjusts the position and size of the first window according to the first window rectangle of the cache.
[0132] S508, the electronic device hides the second window.
[0133] In the above manner, during the process of restoring the display state of the first window, the first window restores its display state first and completes the drawing of the application interface content. The second window exits the display only after confirming that the first window meets the preset conditions. The screen always has a screen that carries the application interface content, thereby avoiding the phenomenon of blank windows, undrawn parts, or screen flickering caused by the second window disappearing first and the first window completing the drawing later.
[0134] For windows where the application interface content changes continuously, such as a window playing a video, each frame of the transition animation is generated based on the same window image, and the presented application interface content remains unchanged. However, there may be a sudden change in the image compared to the real-time content after the first window resumes display. In one implementation, the electronic device can continuously acquire the window image of the first window during the playback of the transition animation and update the image playing in the second window according to the acquisition time. For example, during the process of the first window resuming from a minimized display state, the electronic device continuously acquires the window image of the first window and uses the latest acquired window image to update the image currently displayed in the transition animation, thereby reducing the time difference between the application interface content presented in the second window and the real-time content of the first window. In this implementation, if the application corresponding to the first window stops rendering in the background, or if the cost of continuously acquiring the window image exceeds a preset cost, the electronic device can revert to generating each frame image based on the same window image. The display continuity control of the transition animation is not affected; only the temporal continuity of the dynamic content is affected.
[0135] In another implementation, the duration for which the electronic device keeps the second window displayed can be determined based on the window information of the first window. After the second window plays the first frame of an image, the electronic device keeps the second window displayed for a first duration before hiding it. The first duration can be a preset duration or a duration determined based on the window information of the first window. The window information may include one or more of the following: the window size of the first window, the type of application corresponding to the first window, and the historical time taken for the first window to restore the application interface content during historical state switching. For example, if the window size of the first window is larger than the preset size, the application takes a long time to rearrange and draw the application interface content, and the electronic device can set the first duration to a longer time. If the historical restoration time of the first window is short, the electronic device can set the first duration to a shorter time. By determining the first duration according to the window information, the duration for which the second window is kept displayed matches the actual drawing speed of the first window, ensuring display continuity while reducing unnecessary holding time.
[0136] The above explanation uses the example of the first window reverting from a minimized state to a normal state. In another embodiment, the first display state can be a maximized state. In this embodiment, the first window is in a maximized state before switching to the minimized state, and the second state switching request is used to request that the first window be restored to the maximized state. After the electronic device controls the first window to restore its display state, it also keeps the second window displayed until it determines that the first window meets preset conditions. The preset conditions, where the display state of the first window is consistent with the display state requested by the state switching request, mean that the first window is already in a maximized state, and the validity of the current window rectangle means that the current window rectangle is consistent with the display area corresponding to the maximized state.
[0137] The above describes the display handover process between the first and second windows. During this handover, the window rectangle of the first window may become abnormal. To understand the cause of this abnormality, we will first explain the process by which the operating system controls the switching of window display states.
[0138] The operating system controls the switching of the display state of the first window, including modifying the first window's status field and its rectangle. The status field marks the current display state of the first window, with values corresponding to normal, maximized, or minimized display states. For example, a status field value of 0 corresponds to normal display, 1 to maximized display, and 2 to minimized display. When controlling the switching of the first window's display state, the window manager modifies the first window's status field to the value corresponding to the target display state and also modifies the first window's rectangle to match the target display state. The modification of the status field and the modification of the window rectangle are executed separately and independently in time. If the status field has been modified to the value corresponding to the target display state but the window rectangle has not yet been modified, the first window's status field indicates the target display state, while the window rectangle remains the same as before the switch; the first window's status field and window rectangle are inconsistent.
[0139] When the window is minimized, the operating system records the window rectangle as being outside the display screen. For example, when a window is minimized, the operating system modifies the window rectangle to a rectangle within a coordinate region with both the x and y coordinates of -32000. This coordinate region corresponds to the minimized display state, and the window no longer occupies the display area on the screen.
[0140] When the first window resumes its display state, the time required to modify the window rectangle depends on the window size and the application it corresponds to. When the first window resumes from a minimized state to its normal display state, the window size returns to its normal size. The application needs to rearrange and redraw the application interface content according to the restored window size, a process that takes a relatively long time. When the first window enters a minimized state, the window size shrinks to the size corresponding to the minimized state, and the application does not need to rearrange the application interface content, resulting in a shorter time.
[0141] When the time interval between two consecutive clicks on the same application icon is less than a preset duration, the first state switching request triggered by the first click arrives first, followed by the second state switching request triggered by the second click. In this embodiment, the electronic device inserts the processes of acquiring the window image and determining that the first frame image has been rendered between the request and execution, thus delaying the execution of the first state switching request. Before the first state switching request is completed, the second state switching request has already arrived and begun execution, and the modification actions of the first and second state switching requests are executed alternately. That is, the time period from the arrival of the first state switching request to its completion constitutes a time window, and the aforementioned preset duration can be understood as the duration of this time window. The second state switching request is a request that arrives within the time window and is in the opposite direction to the first state switching request. The electronic device does not need to restrict the reception of the second state switching request, but rather handles the inconsistency between the state field and the window rectangle caused by the alternate execution of the modification actions of the two requests through the following window rectangle anomaly detection and repair process.
[0142] During the interleaved execution of the two modification requests, the status field modification of the second state transition request is completed first, and the status field of the first window is modified to the value corresponding to the normal display state. Because the window rectangle modification corresponding to the first state transition request takes less time, it completes before the modification of the window rectangle corresponding to the second state transition request. The window rectangle of the first window is modified to a rectangle within the coordinate area corresponding to the minimized display state, and remains in that coordinate area until the modification of the window rectangle corresponding to the second state transition request is completed. At this point, the status field of the first window is already at the value corresponding to the normal display state, but the window rectangle of the first window is still in the coordinate area corresponding to the minimized display state; the status field and the window rectangle of the first window are inconsistent. Although the first window has resumed its display state, its display area is outside the display screen, and the first window cannot be displayed correctly on the screen.
[0143] The above process is illustrated below with specific time points as examples. See [link to documentation]. Figure 8 , Figure 8This is a timing diagram illustrating an anomaly in the window rectangle provided in an embodiment of this application. A first state transition request 810 arrives at T0, and a second state transition request 820 arrives at T1. The time interval between T1 and T0 is less than a preset duration. Since modifying the state field is relatively simple, both the first state transition request 810 and the second state transition request 820 have completed their state field modifications by T2. Because the time consumed by modifying the window rectangle corresponding to the first state transition request 810 is short, the window rectangle modification corresponding to the first state transition request 810 is completed at T3, and the window rectangle modification corresponding to the second state transition request 820 is completed at T4. During the time interval from T3 to T4, the state field of the first window is already at the value corresponding to the normal display state, while the window rectangle of the first window is the coordinate area corresponding to the minimized display state; therefore, the state field of the first window and the window rectangle are inconsistent.
[0144] It should be noted that the duration of the time interval from T3 to T4 is not fixed and depends on the response speed of the application corresponding to the first window to the window messages issued by the operating system. The application needs to rearrange and redraw the application interface content according to the restored window size. Before the application interface content is rearranged and redrawn, the window rectangle of the first window remains in the coordinate area corresponding to the minimized display state, and the abnormal state persists. If the application response is slow, the abnormal state lasts for a longer period. If the application does not respond to the window messages, or if the modification of the window rectangle is overwritten by a subsequent state transition request window message, the modification of the window rectangle corresponding to the second state transition request cannot be completed, and the abnormal state persists for a long time, with the window rectangle of the first window remaining in the coordinate area corresponding to the minimized display state for an extended period.
[0145] To understand the persistent inconsistency between the aforementioned state field and the window rectangle, three types of window rectangles readable by the electronic device are explained. The first type is the current window rectangle of the first window, which corresponds to the actual display area occupied by the first window. After the first window resumes its display state, the electronic device reads the current window rectangle to obtain the actual position and size of the first window. The second type is the window rectangle recorded in the operating system's window layout record. The window layout record is the window rectangle recorded in the normal rectangle field of the window position structure, indicating the window's position when in normal display mode. For example, the window position structure is a WINDOWPLACEMENT structure, and the normal rectangle field is the rcNormalPosition field. The third type is the first window rectangle cached in the electronic device's window state cache module, i.e., the window rectangle written to the cache after successful verification. When the first window is fully restored, all three types of window rectangles are consistent. When the state field and window rectangle of the first window are inconsistent, the current window rectangle may differ from the window rectangle recorded in the window layout record. The current window rectangle may remain in the coordinate area corresponding to the minimized display state, while the window layout record points to the position and size of the normal display state.
[0146] It should also be noted that during the period of abnormality, the second window remains displayed, and the image displayed on the screen is from the second window. If the electronic device does not validate the current window rectangle, and the second window is hidden before the window rectangle is modified, the first window's display area will be outside the display area. Even if the application corresponding to the first window subsequently modifies the window rectangle, the display interruption during the window restoration process will have already occurred before the modification is complete. Therefore, the electronic device needs to validate the current window rectangle before hiding the second window, and if the current window rectangle is abnormal, it should be repaired before hiding the second window.
[0147] See Figure 9 , Figure 9 This is a schematic diagram illustrating the window rectangle anomaly detection and repair process involved in a window control method provided in an embodiment of this application. Figure 9 As shown, the process may include S901 to S907.
[0148] S901, the electronic device acquires the rectangle of the first window before switching the first window to the second display state.
[0149] The first window rectangle is the window rectangle when the first window is in its normal display state. In this embodiment, the first display state is the normal display state, and the second display state is the minimized display state. The electronic device acquires the first window rectangle before the first window switches to the second display state, at which time the first window is still in its normal display state. The window rectangle of the first window can reflect the actual position and size of the first window in its normal display state. It can be understood that the window rectangle read when the first window is in its normal display state is more accurate than the window rectangle read when the first window is switching or after it has resumed display.
[0150] There are several ways for an electronic device to obtain the rectangle of the first window. In one embodiment, the electronic device can read the window display area currently occupied by the first window to obtain the rectangle of the first window. In another embodiment, the electronic device can read the rectangle of the first window from the window layout record of the operating system. For an explanation of the window layout record, please refer to the description corresponding to S405 above.
[0151] S902, the electronic device determines whether the first window rectangle is abnormal. If the first window rectangle is determined to be normal, the electronic device executes S903. If the first window rectangle is determined to be abnormal, the electronic device does not execute S903 and directly executes S904.
[0152] It should be noted that the first window rectangle is read before the first window switches to the second display state, and is used as a reference for fixing the position and size of the first window after the first window resumes its display state. If the first window rectangle is read from the normal rectangle field recorded in the window layout, and the first window has previously been minimized, the operating system may write the coordinate area corresponding to the minimized display state into the normal rectangle field, resulting in an abnormal first window rectangle that cannot be directly used as a repair reference. Therefore, the electronic device determines whether the first window rectangle is abnormal before caching it. If the first window rectangle is determined to be abnormal, the electronic device does not write the currently read first window rectangle into the window state cache module and clears the valid marker for the first window rectangle, ensuring that the abnormal value does not overwrite the reliable first window rectangle already stored in the window state cache module. The window image is acquired when the first window is in the normal display state and is stored independently of the first window rectangle; determining that the first window rectangle is abnormal does not affect the acquisition of the window image.
[0153] Determining window rectangle anomalies can include one or more of the following.
[0154] The first scenario is that the window rectangle's coordinates are outside the preset coordinate range. The preset coordinate range is determined based on the coordinate range of the display screen. In a multi-screen scenario, the preset coordinate range can be the coordinate range covered by all the display screens. It should be noted that in a multi-screen scenario, some display screens may be located to the left or above the main display screen, and the coordinates of a window in normal display mode may also be negative. Negative coordinates themselves do not necessarily indicate an abnormal window rectangle. Therefore, the preset coordinate range cannot be simply set to a range of positive coordinates; it should cover the coordinate range covered by all display screens and be combined with the distance between the window rectangle and the coordinate area corresponding to the minimized display state for judgment. If the window rectangle's coordinates are outside the preset coordinate range—for example, if the window rectangle's coordinates are within the coordinate range of the coordinate area corresponding to the minimized display state—it indicates that the window rectangle may be the rectangle recorded by the operating system when the window is in the minimized display state, rather than the actual rectangle when the window is in the normal display state.
[0155] The second scenario involves a window rectangle whose width is less than a first threshold and / or whose height is less than a second threshold. When a window is in normal display mode, its width and height are typically not less than a recognizable size. If the width of the window rectangle is less than the first threshold, or the height is less than the second threshold, it indicates that the window rectangle's size is abnormal and it is not a true rectangle in normal display mode. The specific values of the first and second thresholds can be set according to actual needs, and are not limited in this embodiment.
[0156] The third type is where the window rectangle does not intersect with the preset display area. The preset display area can be the display area of the screen or the working area of the screen. In normal display mode, a window is allowed to partially lie outside the display screen, but the window rectangle usually intersects with the screen, meaning the window has a viewable area on the screen. When the window rectangle does not intersect with the preset display area, it indicates that the entire window is outside the display screen, and the window rectangle is not a true rectangle in normal display mode.
[0157] Fourth, the difference between the size of the window rectangle and the size of the window image is greater than the third threshold. The window image is an image acquired when the first window is in normal display mode, and the size of the window image is consistent with the window size when the first window is in normal display mode. If the difference between the size of the window rectangle and the size of the window image is greater than the third threshold, it indicates that the window rectangle does not match the window size when the window image was acquired, and the window rectangle may have deviated from the normal display state. It should be noted that when the coordinate spaces of the window image size and the window rectangle size are different, for example, the window image size returned by the graphics interface is in pixel size, while the window rectangle size is in logical coordinates, the electronic device normalizes the two sizes to the same coordinate space before comparison to avoid incorrectly judging a normal window rectangle as abnormal. The specific value of the third threshold can be set according to actual needs, and this application embodiment does not limit it. It should be noted that this determination method is applicable to scenarios where the window image is acquired when the first window is in normal display mode. In the scenario where the window image is acquired when the first window is in the maximized display state, the size of the window image is the size of the display area corresponding to the maximized display state, which is naturally different from the size of the first window rectangle. The electronic device does not determine the window rectangle is abnormal by the difference between the size of the window rectangle and the size of the window image, but can use the other methods mentioned above to determine it.
[0158] If the first window rectangle is determined to be abnormal, the electronic device will not write the abnormal window rectangle to the window state cache module. In one embodiment, the electronic device can also clear the valid marker of the first window rectangle corresponding to the first window from the window state cache module. The valid marker of the first window rectangle is used to indicate whether the cached first window rectangle is available. After the valid marker is cleared, the subsequent recovery process determines that the cached first window rectangle is unavailable. In this way, the abnormal window rectangle will not be used as the basis for repair in the subsequent recovery process, avoiding the abnormal window rectangle from polluting the window rectangles already stored in the window state cache module.
[0159] S903, the electronic device will cache the first window rectangle.
[0160] If the first window rectangle is determined to be normal, the electronic device can write the first window rectangle into the window state cache module as a trusted window rectangle. The first window rectangle written into the cache is used to correct the position and size of the first window in the event of a window rectangle anomaly after the first window resumes its display state.
[0161] S904, after the electronic device controls the first window to return to the first display state, it obtains the current window rectangle of the first window.
[0162] In this embodiment, the first display state is the normal display state. After the electronic device controls the first window to return to the normal display state, it reads the current window rectangle of the first window. The current window rectangle is the rectangle corresponding to the window display area actually occupied by the first window after the display state is restored.
[0163] S905, the electronic device determines whether the current window rectangle is abnormal. If the current window rectangle is determined to be abnormal, the electronic device executes S906. If the current window rectangle is determined not to be abnormal, the electronic device executes S907.
[0164] The electronic device determines whether the current window rectangle is abnormal in the same way as S902, that is, whether the coordinates of the current window rectangle are outside the preset coordinate range, whether the width of the current window rectangle is less than the first threshold, whether the height of the current window rectangle is less than the second threshold, whether the current window rectangle intersects with the preset display area, and whether the difference between the size of the current window rectangle and the size of the window image is greater than the third threshold.
[0165] If it is determined that the current window rectangle is not abnormal, it means that the first window has been completely restored and the window rectangle of the first window is within the normal range. The electronic device will not perform a repair operation and will hide the second window.
[0166] S906, the electronic device adjusts the position and size of the first window according to the first window rectangle of the cache.
[0167] If the current window rectangle is determined to be abnormal, it means that although the first window has resumed its display state, its window rectangle is still stuck in the coordinate area corresponding to the minimized display state, and the state field of the first window is inconsistent with the window rectangle. In this case, if the first window rectangle is cached in the window state cache module, the electronic device retrieves the cached first window rectangle and, before using it, checks again whether the cached first window rectangle is abnormal, following the same procedure as in S902. If the cached first window rectangle is not abnormal, the electronic device adjusts the position and size of the first window according to the cached first window rectangle. If the first window rectangle is not cached, or if the cached first window rectangle is abnormal, the electronic device does not use the cached first window rectangle as a basis for repair. Instead, it controls the first window to exit the minimized display state through the display state setting interface, or adjusts the first window according to the position and size corresponding to the maximized display state. The specific adjustment method can be to use the window position setting interface provided by the operating system to set the window rectangle of the first window to the cached first window rectangle, that is, to set the coordinate position, width, and height of the first window according to the first window rectangle. The window position setting interface can be the SetWindowPos interface, which the electronic device calls with the window handle of the first window as a parameter to set the position and size of the first window according to the cached first window rectangle. In another implementation, the electronic device can first control the first window to exit the minimized display state through a display state setting interface, such as the ShowWindow interface, with call parameters such as SW_RESTORE or SW_SHOWNORMAL. Then, the electronic device calls the SetWindowPos interface to set the window rectangle of the first window to the cached first window rectangle. In yet another implementation, the electronic device can write the cached first window rectangle into the normal rectangle field of the window position structure, and adjust the position and size of the first window according to the window position structure through a window layout setting interface, such as the SetWindowPlacement interface. After adjustment, the window display area of the first window returns to its reliable position and size in the normal display state, and the first window is displayed normally on the screen.
[0168] After the repair is complete, the electronic device can reread the current window rectangle of the first window to confirm the repair result. If the repaired current window rectangle matches the cached first window rectangle, it means that the first window has been restored to its normal display state.
[0169] S907, electronic devices hide the second window.
[0170] By combining cache verification and post-restore verification, a closed-loop process is formed for the first window rectangle. The verification before switching display states ensures the first window rectangle stored in the window state cache module is reliable. The verification after restoring the display state detects inconsistencies between the first window's state field and the window rectangle, and repairs it using the reliable first window rectangle. Without the pre-switch verification, the inconsistency between the first window's state field and the window rectangle would not be corrected. Without the post-restore verification, the window rectangle used for repair might itself be unreliable. Combining the two verifications ensures both the reliability of the repair basis and the successful correction of the anomaly.
[0171] In another implementation, the first display state is a maximized display state, and the second display state is a minimized display state. In this implementation, the first window is in a maximized display state before switching to the minimized display state. After the electronic device controls the first window to return to the maximized display state, it obtains the current window rectangle of the first window and determines whether the current window rectangle is abnormal. If the current window rectangle is determined to be abnormal, the electronic device adjusts the first window to the position and size corresponding to the maximized display state. The position and size corresponding to the maximized display state is the display area occupied by the first window when it is in the maximized display state, such as the display area of the screen or the working area of the screen. The position and size corresponding to the maximized display state are determined by the operating system in real time according to the display screen, so the position and size corresponding to the maximized display state are reliable. In this implementation, the electronic device does not need to rely on the cached first window rectangle and directly repairs the first window according to the position and size corresponding to the maximized display state. After repair, the window display area of the first window occupies the display area corresponding to the maximized display state.
[0172] It should be noted that for the first window, which was in maximized display mode before the switch, the window rectangle saved in the operating system's window layout record is the window rectangle in normal display mode, not the window rectangle in maximized display mode. Therefore, in the implementation method of repairing according to the cached first window rectangle, the cached first window rectangle is the window rectangle in normal display mode, which is different from the window rectangle corresponding to the maximized display mode. If the window rectangle in maximized display mode is directly compared with the cached first window rectangle, an incorrect conclusion of size mismatch will be obtained. Therefore, verification and repair need to be handled differently according to the display state before the first window switch. When the first window was in normal display mode before the switch, the electronic device repairs according to the cached first window rectangle. When the first window was in maximized display mode before the switch, the electronic device repairs according to the position and size corresponding to the maximized display mode.
[0173] The same first window rectangle is reused in multiple stages of window state switching, serving as the rendering position reference for transition animations and the basis for anomaly repair. The first window rectangle is the rectangle of the first window when it is in normal display state. For the complete process of the first window switching from normal display state to minimized display state and then back to normal display state, the electronic device reads and caches the first window rectangle before the switch. Since the first window is in normal display state before the switch, the first frame image is rendered at the position corresponding to the first window rectangle before the switch. When playing the transition animation in reverse, the first frame image also determines its display position according to the first window rectangle. After the first window resumes display state, the electronic device detects and repairs the window rectangle according to the first window rectangle. By reusing the same first window rectangle in multiple stages, each stage has a consistent understanding of the position and size of the first window in normal display state.
[0174] The above embodiments illustrate the specific implementation process of the window control method from the perspective of an electronic device. The following describes the inter-module interaction sequence during a complete window state switching process from the perspective of the interaction between modules in the window control system. (See also...) Figure 10 , Figure 10 This is a timing diagram illustrating a window state switching according to an embodiment of this application. Taking the complete process of a first window switching from a normal display state to a minimized display state and being requested to restore its display state during the transition animation playback as an example, as follows... Figure 3 and Figure 10 As shown, the main steps include: S1001, the message broker module receives a first state transition request triggered by a click on the application icon and passes the first state transition request to the display continuity control module. The first state transition request is used to request that the first window be switched to a minimized display state.
[0175] S1002, The continuity control module indicates that the image acquisition module acquires the window image of the first window.
[0176] S1003, the image acquisition module acquires the window image of the first window and stores the window image in the cache, i.e., the window state cache module.
[0177] S1004, The display continuity control module displays a second window, renders the first frame image of the transition animation at the position corresponding to the current window rectangle of the first window in the second window, and maintains the display state of the first window until it is determined that the rendering of the first frame image is complete.
[0178] S1005, After determining that the first frame image has been rendered, the display continuity control module controls the first window to switch to the minimized display state.
[0179] S1006, Display continuity control module plays each frame of the transition animation through the second window.
[0180] S1007, the message broker module receives a second state transition request triggered by a click on the application icon and passes the second state transition request to the display continuity control module. The second state transition request is used to request that the first window be restored to its normal display state.
[0181] S1008, the display continuity control module reads the window image and the first window rectangle from the window state cache module, displays the second window, and plays the frames of the transition animation in the order from the last frame image to the first frame image.
[0182] S1009, After the continuity control module displays the first frame image in the second window, it controls the first window to return to the normal display state and keeps the second window displayed.
[0183] S1010, after the display continuity control module restores the first window to the normal display state, the anomaly detection module determines whether the current window rectangle of the first window is abnormal. If the current window rectangle is abnormal, the anomaly detection module repairs the position and size of the first window according to the first window rectangle cached in the window state cache module; if the current window rectangle is not abnormal, the anomaly detection module does not repair the position and size of the first window.
[0184] S1011, the continuity control module determines that the first window meets the preset conditions and hides the second window.
[0185] For specific implementation methods of the above steps, please refer to the foregoing combination. Figures 4 to 9 The described embodiments will not be repeated here.
[0186] The above embodiment is illustrated using the example of the second display state being minimized. In another embodiment, the second display state is not minimized.
[0187] In this embodiment, the second display state can be a maximized display state, that is, the first window switches from a normal display state to a maximized display state. In response to the first state switching request, the electronic device acquires the window image of the first window, displays the second window, renders the first frame of the transition animation at the position corresponding to the rectangle of the first window in the second window, and after determining that the first frame has been rendered, controls the first window to switch to the maximized display state. The process is similar to... Figure 4 The window control methods shown are the same, so they will not be repeated here.
[0188] However, if the second display state is not minimized, the first window will still be displayed on the screen after switching display states. After the first window switches to maximized display state, its window display area occupies the entire display area or working area of the screen. During the process of the first window rearranging and drawing the application interface content according to the maximized display state, its window display area may not yet be fully drawn. Therefore, after the second window plays the last frame of the transition animation, the electronic device continues to display the second window until it determines that the first window meets the preset conditions. The preset conditions include: the first window's display state matching the display state requested in the state switching request means the first window is already in maximized display state; and the first window's current window rectangle being valid means the current window rectangle matches the display area corresponding to the maximized display state. Multiple conditions in the preset conditions can be combined for judgment. The electronic device can also detect according to a preset cycle and hide the second window only after the preset conditions are met a preset number of times consecutively, or set a preset waiting time as the upper limit for the second window's display time. The specific methods are combined with the above. Figure 7 The implementation methods described are the same, and will not be repeated here.
[0189] In the above manner, when the first window is switched to the maximized display state, the second window also takes over the display first. The first window completes the state switching and content drawing below the second window located above it. The second window exits the display only after the first window meets the preset conditions. The screen always has a screen carrying the application interface content, thus avoiding the phenomenon of blank windows or screen flickering in this scenario.
[0190] In another embodiment, the second display state can be a normal display state, that is, the first window switches from the maximized display state to the normal display state. The process of this embodiment is similar to the embodiment in the maximized direction described above, except that the transition animation image changes from the display area corresponding to the maximized display state to the position corresponding to the rectangle of the first window. The first window's display state in the preset condition being consistent with the display state requested by the state switching request means that the first window is already in the normal display state.
[0191] Furthermore, embodiments of this application also provide an electronic device, including a display screen, a memory, and a processor; The memory stores instructions that the computer executes; The processor executes computer execution instructions stored in memory, causing the electronic device to perform the window control method provided in the above embodiments. In addition to these main components, the electronic device also includes components for implementing basic functions, which will be discussed below. Figure 11 Please provide a detailed explanation.
[0192] like Figure 11 As shown, Figure 11This is a schematic diagram of the structure of an electronic device 1100 provided in an embodiment of this application. The electronic device 1100 may include a processor 1110, an external memory interface 1120, an internal memory 1121, a Universal Serial Bus (USB) interface 1130, a charging management module 1140, a power management module 1141, a battery chip 1142, a first antenna 1, a second antenna 2, a mobile communication module 1150, a wireless communication module 1160, an audio module 1170, a speaker 1170A, a receiver 1170B, a microphone 1170C, a headphone jack 1170D, a sensor module 1180, buttons 1190, a motor 1191, an indicator 1192, a camera 1193, a display screen 100, and a SIM card module 1195, etc.
[0193] The structure illustrated in this embodiment of the invention does not constitute a limitation on the electronic device 1100. It may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of both.
[0194] Processor 1110 may include one or more processing units. For example, processor 1110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.
[0195] The aforementioned controller can be the decision-maker that directs the various components of the electronic device 1100 to work in a coordinated manner according to instructions. It is the nerve center and command center of the electronic device 1100. The controller generates operation control signals based on the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0196] The processor 1110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 1110 is a cache memory, which can store instructions or data that the processor 1110 has just used or that are used repeatedly. If the processor 1110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 1110, and thus improves the efficiency of the system.
[0197] In some embodiments, the processor 1110 may include interfaces. These interfaces may include inter-integrated circuit (I2C) interfaces, inter-integrated circuit sound (I2S) interfaces, pulse code modulation (PCM) interfaces, universal asynchronous receiver / transmitter (UART) interfaces, mobile industry processor interfaces (MIPI), general-purpose input / output (GPIO) interfaces, SIM interfaces, and / or USB interfaces, etc.
[0198] The interface connection relationships between the modules illustrated in this embodiment of the invention are merely illustrative and do not constitute a structural limitation on the electronic device 1100. The electronic device 1100 may employ different interface connection methods or a combination of multiple interface connection methods as described in this embodiment of the invention.
[0199] The charging management module 1140 can be a rechargeable battery or a disposable rechargeable battery. If it's a rechargeable battery, it can receive charging input via a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 1140 can receive charging input from the wired charger via the USB interface 1130. In some wireless charging embodiments, the charging management module 1140 can receive wireless charging input via the wireless charging coil of the electronic device 1100. While charging the battery chip 1142, the charging management module 1140 can also supply power to the electronic device 1100 via the power management module 1141.
[0200] The power management module 1141 connects the battery chip 1142, the charging management module 1140, and the processor 1110. The power management module 1141 receives input from the battery chip 1142 and / or the charging management module 1140, providing power to the processor 1110, internal memory 1121, external memory interface 1120, display screen 100, camera 1193, and wireless communication module 1160, etc. The power management module 1141 can also monitor parameters such as the charging management module capacity, charging management module cycle count, and charging management module health status (leakage current, impedance), etc. In some embodiments, the power management module 1141 can also be located within the processor 1110. In some embodiments, the power management module 1141 and the battery chip 1142 can also be located in the same device.
[0201] The wireless communication function of electronic device 1100 can be implemented through a first antenna 1, a second antenna 2, a mobile communication module 1150, a wireless communication module 1160, a modem, and a baseband processor.
[0202] Electronic device 1100 implements display functions through a GPU, display screen 100, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 100 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering, such as the rendering of the aforementioned transition animations. Processor 1110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0203] The display screen 100 is used to display images, videos, etc. The display screen 100 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), an LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 1100 may include one or N display screens 100, where N is a positive integer greater than 1.
[0204] Electronic device 1100 can achieve shooting function through ISP, camera 1193, video codec, GPU, display and application processor.
[0205] The ISP (Image Signal Processor) is used to process data fed back from the camera 1193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 1193.
[0206] Camera 1193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, electronic device 1100 may include one or N cameras 1193, where N is a positive integer greater than 1.
[0207] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when electronic device 1100 selects a frequency point, the DSP is used to perform Fourier transforms on the frequency energy.
[0208] Video codecs are used to compress or decompress digital video. Electronic device 1100 may support one or more video codecs. Thus, electronic device 1100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0209] An NPU (Neural Processing Unit) is a neural network (NN) computing processor that, by borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, rapidly processes input information and can continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0210] The external storage interface 1120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 1100. The external memory card communicates with the processor 1110 through the external storage interface 1120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0211] Internal memory 1121 can be used to store computer executable program code, which includes instructions. Processor 1110 executes various functional applications and data processing of electronic device 1100 by running the instructions stored in internal memory 1121. Internal memory 1121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 1100 (such as audio data, phonebook, etc.). Furthermore, internal memory 1121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, other volatile solid-state storage devices, universal flash storage (UFS), etc.
[0212] Electronic device 1100 can implement audio functions such as music playback and recording through audio module 1170, speaker 1170A, receiver 1170B, microphone 1170C, headphone jack 1170D, and application processor.
[0213] The audio module 1170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 1170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 1170 may be located in the processor 1110, or some functional modules of the audio module 1170 may be located in the processor 1110.
[0214] The speaker 1170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. Electronic device 1100 can listen to music or make hands-free calls through the speaker 1170A.
[0215] The receiver 1170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 1100 answers a telephone call or voice message, the receiver 1170B can be brought close to the ear to listen to the voice.
[0216] Microphone 1170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into audio electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 1170C, inputting the sound signal into microphone 1170C. Electronic device 1100 may have at least one microphone 1170C. In some embodiments, electronic device 1100 may have two microphones 1170C, which, in addition to collecting sound signals, can also perform noise reduction. In some embodiments, electronic device 1100 may also have three, four, or more microphones 1170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0217] The 1170D headphone jack is used to connect wired headphones. The 1170D headphone jack can be a USB interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0218] Buttons 1190 include a power button, volume buttons, etc. Buttons 1190 can be mechanical buttons or touch-sensitive buttons. Electronic device 1100 receives input from buttons 1190 and generates key signal inputs related to user settings and function control of electronic device 1100.
[0219] Motor 1191 can generate vibration alerts. Motor 1191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, touch operations applied to different applications (such as taking photos, playing audio, etc.) can correspond to different vibration feedback effects. Touch operations applied to different areas of the display screen 100 can also correspond to different vibration feedback effects. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0220] Indicator 1192 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0221] The window control methods described in the foregoing embodiments can all be implemented in the electronic device 1100 with the above-described hardware structure.
[0222] Based on the above embodiments, this application also provides a window control device, which includes a processor for executing the window control method provided in the above embodiments.
[0223] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to execute the window control method provided in the above embodiments.
[0224] This application also provides a computer program product containing instructions that, when run on a computer, enable the computer to execute the window control method provided in the above embodiments.
[0225] The specific implementation methods and technical effects of the electronic devices, window control devices, computer-readable storage media, and computer program products containing instructions provided in this application can be found in the specific implementation process and technical effects of the window control method provided in the foregoing embodiments, which will not be repeated here.
[0226] In some embodiments, as described above, those skilled in the art will clearly understand that, for the sake of convenience and brevity, the division of the functional modules described above is merely an example. In practical applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0227] In the embodiments of this application, the functional units 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. The integrated unit can be implemented in hardware or as a software functional unit.
[0228] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, 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.) or processor 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 flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.
[0229] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.
Claims
1. A window control method, characterized in that, include: The first window is displayed, and the first window is in a first display state; In response to a first state switching request for the first window, a second window is displayed; wherein the first state switching request is used to request the first window to switch to a second display state, the second window is used to play a transition animation corresponding to the display state switching process of the first window, the second window is located on top of the first window, and the transition animation is an animation generated based on the window image of the first window; After determining that the first frame of the transition animation has been rendered, control the first window to switch to the second display state.
2. The window control method according to claim 1, characterized in that, The method further includes: In response to a second state switching request for the first window, the second window is displayed; the second state switching request is used to request that the first window be restored to the first display state, and the second window is also used to play the frames of the transition animation in the order from the last frame of the transition animation to the first frame; After the first frame image is played in the second window, the first window is controlled to return to the first display state, and the second window is kept displayed until it is determined that the first window meets the preset conditions, after which the second window is hidden.
3. The window control method according to claim 2, characterized in that, The preset conditions include one or more of the following: the window handle of the first window is valid, the first window is not minimized, the first window is visible, the display state of the first window is normal, the first window is not hidden, and the current window rectangle of the first window is valid.
4. The window control method according to claim 2 or 3, characterized in that, The method further includes: Determine whether the first window meets the preset conditions according to a preset cycle; The step of hiding the second window after determining that the first window meets the preset conditions includes: After determining that the first window meets the preset conditions a preset number of times, the second window is hidden.
5. The window control method according to claim 2 or 3, characterized in that, The method further includes: If it is determined within the preset waiting time that the first window does not meet the preset conditions, then the second window is hidden.
6. The window control method according to claim 2, characterized in that, The first display state is the normal display state, and the second display state is the minimized display state. The normal display state is the display state in which the first window is neither in the maximized display state nor in the minimized display state. After the first window is restored to the first display state, the method further includes: Get the current window rectangle of the first window; In the event of an abnormal current window rectangle, the position and size of the first window are adjusted according to a first window rectangle; the first window rectangle is the window rectangle when the first window is in the normal display state.
7. The window control method according to claim 6, characterized in that, Before the first window switches to the second display state, the method further includes: Get and cache the rectangle of the first window; The step of adjusting the position and size of the first window according to the first window rectangle includes: Obtain the cached rectangle of the first window, and adjust the position and size of the first window according to the cached rectangle.
8. The window control method according to claim 2, characterized in that, The first display state is a maximized display state, and the second display state is a minimized display state; after controlling the first window to return to the first display state, the method further includes: Get the current window rectangle of the first window; In the event of an abnormal current window rectangle, the first window will be adjusted to the position and size corresponding to the maximized display state.
9. The window control method according to any one of claims 6-8, characterized in that, The current window rectangle is abnormal, including one or more of the following: The coordinates of the current window rectangle are outside the preset coordinate range; The width of the current window rectangle is less than a first threshold and / or the height of the current window rectangle is less than a second threshold; The current window rectangle does not intersect with the preset display area; The difference between the size of the current window rectangle and the size of the current window image is greater than the third threshold.
10. The window control method according to claim 1, characterized in that, The second display state is the minimized display state; The method further includes: After the last frame of the transition animation is played in the second window, the second window is hidden.
11. The window control method according to claim 1, characterized in that, The second display state is not the minimized display state; The method further includes: After the last frame of the transition animation is played in the second window, the second window remains displayed until it is determined that the first window meets the preset conditions.
12. The window control method according to claim 1, characterized in that, The method further includes: Obtain the first window rectangle, which is the window rectangle when the first window is in the normal display state, and the normal display state is the display state in which the first window is neither in the maximized display state nor in the minimized display state; The first frame of the transition animation is rendered in the second window at the position corresponding to the rectangle of the first window.
13. The window control method according to claim 1, characterized in that, The method further includes: In response to a second state switching request for the first window, the second window is displayed, and the first window is controlled to return to the first display state; the second state switching request is used to request the first window to return to the first display state, and the second window is also used to play the frames of the transition animation in the order from the last frame of the transition animation to the first frame; After the first frame image is played in the second window, the second window is displayed for a first duration, and then the second window is hidden; the first duration is a preset duration or a duration determined according to the window information of the first window, and the window information is used to indicate the duration required for rendering the first window.
14. An electronic device, characterized in that, The electronic device includes a display, a memory, and a processor, wherein the display and the memory are both coupled to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the electronic device to perform the window control method as described in any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the window control method as described in any one of claims 1 to 13.
16. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, implements the window control method as described in any one of claims 1 to 13.