Display adjustment method, device, terminal and medium based on modal window
By creating a display adjustment node in the Wayland compositor, the problem of modal windows not being able to achieve overlay effects in the Linux system is solved, improving user operation efficiency and experience.
Patent Information
- Application Number
- CN202510724207.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-06-03
AI Technical Summary
Using Wayland to draw modal windows in Linux systems cannot achieve an overlay effect, affecting user efficiency.
By obtaining the parent window of the modal window, checking whether the criteria for creating a modal window effect are met, using the Wayland compositor to create a display adjustment node, setting the size, rounded corner status and color of the rectangular box, and adjusting the node level to the highest level to achieve an overlay effect.
Ensure that the parent window of the modal window is visually covered to reduce user operations and improve user operation efficiency and experience.
Smart Images

Figure CN120234087B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of window display technology, and in particular to a display adjustment method, device, terminal and medium based on a modal window. Background Art
[0002] A modal window is a special type of conversational window. After a modal window is launched, the user must complete the current action, such as confirmation, input, or selection, before continuing with the main interface. During this time, the main interface and other windows are disabled for interaction. Modal windows typically employ a visual hierarchy design, employing an overlay design (such as a shadow or translucent background) to place the modal window at the top of the page, creating a visual separation and enhancing user focus.
[0003] Linux systems usually use the Wayland display server protocol to implement window drawing. Therefore, it is impossible to directly use background code to achieve a display effect similar to a mask, nor can it use Unity to achieve a drawing overlay effect. There is no corresponding drawing function to implement similar functions. The Wayland compositor does not do much processing for modal windows. It just treats it as an ordinary child window and moves it along the hierarchy of its parent window like other child windows. In the compositor, you can still move its parent window with the mouse, but you cannot operate the content in the parent window. However, this drawing method will confuse users. Users cannot clearly know that this is a modal window and often directly operate its parent window, which in turn affects the user's efficiency and experience. Summary of the Invention
[0004] The embodiments of the present invention provide a display adjustment method, device, terminal and medium based on a modal window to solve the technical problem in the prior art that a Linux system using Wayland to draw a modal window cannot achieve an overlay effect, thereby affecting user efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a display adjustment method based on a modal window, comprising:
[0006] When it is determined to be a modal window, obtaining the parent window of the modal window and detecting whether the modal window meets the requirements of the standard for creating a modal window effect;
[0007] When the requirements are met, in the Wayland compositor, taking the surface hierarchy tree of the parent window as the parent, create a display adjustment node in the surface hierarchy tree;
[0008] Get the size and location of the parent window;
[0009] In the display adjustment node, a rectangular frame is set according to the size and location of the parent window;
[0010] Get the rounded corner status information of the parent window;
[0011] In the display adjustment node, the rounded corner state of the rectangular frame is set according to the rounded corner state information;
[0012] In the display adjustment node, the color of the rectangular frame is set to an inactive color, and the state of the rectangular frame is set to an inactive display state;
[0013] The level of the display adjustment node is adjusted to the highest level.
[0014] In a second aspect, an embodiment of the present invention further provides a display adjustment device based on a modal window, comprising:
[0015] A detection module, configured to, when determining that the window is a modal window, obtain the parent window of the modal window and detect whether the modal window meets the requirements of the standard for creating a modal window effect;
[0016] A creation module is used to create a display adjustment node in the surface hierarchy tree of the parent window in the Wayland compositor when the requirements are met;
[0017] A first acquisition module is used to obtain the size and location of the parent window;
[0018] A first setting module, configured to set a rectangular frame in the display adjustment node according to the size and position of the parent window;
[0019] A second acquisition module is used to obtain the rounded corner status information of the parent window;
[0020] A second setting module is configured to set the rounded corner state of the rectangular frame according to the rounded corner state information in the display adjustment node;
[0021] a setting module, configured to set the color of the rectangular frame in the display adjustment node to an inactive color, and to set the state of the rectangular frame to an inactive display state;
[0022] The adjustment module is used to adjust the level of the display adjustment node to the highest level.
[0023] In a third aspect, an embodiment of the present invention further provides a terminal, including:
[0024] one or more processors;
[0025] a storage device for storing one or more programs,
[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the display adjustment method based on the modal window provided in the above embodiment.
[0027] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to perform the display adjustment method based on a modal window as provided in the above embodiment.
[0028] The display adjustment method, device, terminal, and medium based on a modal window provided by an embodiment of the present invention detect whether the modal window meets the requirements of the standard for creating a modal window effect by obtaining the parent window of the modal window when it is determined to be a modal window, thereby avoiding display adjustment errors. When the requirements are met, a display adjustment node is created in the surface hierarchy tree of the parent window in the Wayland compositor; the size and location of the parent window are obtained; a rectangular frame is set in the display adjustment node according to the size and location of the parent window; the rounded corner status information of the parent window is obtained; the rounded corner status of the rectangular frame is set in the display adjustment node according to the rounded corner status information; the color of the rectangular frame is set to an inactive color in the display adjustment node, and the status of the rectangular frame is set to an inactive display status; and the level of the display adjustment node is adjusted to the highest level. Based on the correspondence between the modal window and the parent window, it can be determined whether the modal window meets the requirements for display effect optimization. When the requirements are met, the Wayland compositor can be used to create a corresponding display adjustment node with the surface hierarchy tree of the parent window, and the properties of the display adjustment node can be set according to the characteristics of the parent window, so that the surface layer corresponding to the adjustment node can achieve an overlay effect, and by adjusting the hierarchy of the display adjustment node to the highest level, it is not affected by other layers, ensuring that when a modal window exists, the parent window can have an overlay effect, so that the user can intuitively observe that the parent window is in an overlay state, reducing various operations on it, improving the user's operating efficiency, and improving the user's usage experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0030] Figure 1 1 is a flow chart of a display adjustment method based on a modal window provided in the first embodiment of the present invention;
[0031] Figure 2 1 is a flow chart of a display adjustment method based on a modal window provided in the second embodiment of the present invention;
[0032] Figure 3 2 is a schematic structural diagram of a display adjustment device based on a modal window provided in a third embodiment of the present invention;
[0033] Figure 4 It is a structural diagram of a terminal provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0034] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.
[0035] Example 1
[0036] Figure 1 1 is a flowchart of a display adjustment method based on a modal window provided in a first embodiment of the present invention. This embodiment adjusts and optimizes the display of a modal window based on Wayland in a Linux system. The method can be performed by a display adjustment device based on a modal window, and specifically includes the following steps:
[0037] Step 110: When it is determined to be a modal window, the parent window of the modal window is obtained, and it is detected whether the modal window meets the requirements of the standard for creating a modal window effect.
[0038] Wayland is a protocol that defines how Wayland clients communicate with the Wayland compositor. Given Wayland's advantages over X11, particularly its improved support for high resolutions and high refresh rates, the open source community has fully transitioned to Wayland for development, and major Linux distributions have also begun using Wayland as the default graphics display protocol.
[0039] After a modal window is started, it will have a modal attribute flag. In the Wayland compositor, this flag can be used to determine whether the window is a modal window. Therefore, this flag can be used to determine whether it is a modal window.
[0040] For example, the parent window of the modal window can be found through the set_parent method of the xdg_toplevel interface, or the global window tree structure maintained inside the compositor can be queried to determine the parent window of the modal window in the parent field of the wlr_xdg_surface structure.
[0041] Typically, after determining the parent window, the corresponding display adjustment optimization method can be executed. However, in this embodiment, the inventors discovered that incorrect settings of the parent window or modal window can cause subsequent display adjustment errors. Therefore, in this embodiment, it is necessary to first detect whether the modal window meets the requirements for creating a modal window effect to avoid subsequent display adjustment errors.
[0042] Exemplarily, the detection of whether the modal window meets the requirements of the standard for creating a modal window effect may include: checking whether the modal window exists in the Wayland synthesizer; checking whether the parent window of the modal window exists; and checking whether the physical surface of the parent window exists in the Wayland synthesizer. Optionally, the above three conditions may exist in parallel, corresponding to different setting error situations. The first situation can avoid the situation where the original modal window is modified later due to an error in the property setting. Since Wayland is set by the client and may be changed at any time, it is necessary to check again whether the modal window exists.
[0043] Furthermore, the parent-child inheritance relationship of windows can also be changed by Wayland client settings, so it is also necessary to determine again whether the parent window exists.
[0044] When determining the existence of a parent window, it's necessary to further check whether the parent window's physical entity exists. In some cases, due to incorrect settings, the parent window attribute may still exist, but in reality, the corresponding physical entity of the parent window does not exist. Therefore, it is necessary to check the physical surface of the parent window in the Wayland compositor. Only when the physical surface exists can the parent window be confirmed to exist. By checking at least these three conditions, it can be determined that the modal window and the corresponding parent window actually exist.
[0045] Step 120 : When the requirements are met, in the Wayland compositor, the surface hierarchy tree of the parent window is used as the parent, and a display adjustment node is created in the surface hierarchy tree.
[0046] When the requirements are met, the Wayland compositor creates a display adjustment node, using the parent window's surface hierarchy tree as the parent. By leveraging the property inheritance of child nodes, this node can adapt to changes in the surface hierarchy tree, such as changes in motion position, to form a rendering system with different levels.
[0047] Step 130: Obtain the size and location of the parent window, and set a rectangular frame in the display adjustment node according to the size and location of the parent window.
[0048] Exemplarily, by looking up the geometric properties of the parent window's surface hierarchy tree, the size and location of the parent window in the surface hierarchy tree are determined. Accordingly, in the display adjustment node, a rectangular frame that is adapted to the parent window is set accordingly. Exemplarily, corresponding settings can be made in the properties of the node. Furthermore, the parent window size change event can be monitored in the Wayland compositor; when the parent window size change event is triggered, the changed parent window size is obtained; and the rectangular frame is reset synchronously according to the changed parent window size. The Wayland compositor can be used to monitor the size changes of the parent window at any time, and based on this, the rectangular frame can be dynamically adjusted at any time to avoid the situation where the display adjustment effect is reduced due to the change in the parent window size.
[0049] Step 140: Obtain the parent window's corner rounding status information. In the display adjustment node, the corner rounding status of the rectangular frame is set based on this information. Since the parent window typically has rounded corners, the Wayland compositor uses the wlr_surface geometry data to insert rounded polygons at the window edge by modifying the vertex buffer. Therefore, ensuring that the rectangular frame has the same rounded corners ensures visual consistency when windows overlap or resize, preventing flickering or broken edges.
[0050] Optionally, in the adjustment node, you can configure parameters such as the rounded corner radius and the number of segments to achieve an adjustment rendering effect in which the rectangular frame has the same rounded corners as the parent window.
[0051] Step 150: Set the color of the rectangular frame to an inactive color in the display adjustment node, and set the state of the rectangular frame to an inactive display state.
[0052] For example, the composite performance properties in the adjustment node can be adjusted to an inactive color, which corresponds to a color, such as gray, that allows users to identify the window as inactive. The rectangular frame can also be set to an inactive display state, which can be semi-transparent, so that users can accurately identify that the current window is inactive and cannot be operated.
[0053] Step 160: Adjust the level of the display adjustment node to the highest level.
[0054] Since the adjustment node may be at a lower level, the above effects may not be intuitively visible. Therefore, it is necessary to set the level of the display adjustment node to the highest level, that is, the first layer visually, so that the setting display effect of the rectangular box corresponding to the display adjustment node can be highlighted, providing intuitive visual guidance for users.
[0055] This embodiment, when determining that a modal window is a modal window, obtains the parent window of the modal window to detect whether the modal window meets the requirements of the standard for creating a modal window effect, thereby avoiding display adjustment errors. When the requirements are met, a display adjustment node is created in the surface hierarchy tree of the parent window in the Wayland compositor; the size and location of the parent window are obtained; a rectangular frame is set in the display adjustment node according to the size and location of the parent window; rounded corner status information of the parent window is obtained; in the display adjustment node, the rounded corner status of the rectangular frame is set according to the rounded corner status information; the color of the rectangular frame is set to an inactive color in the display adjustment node, and the status of the rectangular frame is set to an inactive display status; and the level of the display adjustment node is adjusted to the highest level. Based on the correspondence between the modal window and the parent window, it can be determined whether the modal window meets the requirements for display effect optimization. When the requirements are met, the Wayland compositor can be used to create a corresponding display adjustment node with the surface hierarchy tree of the parent window, and the properties of the display adjustment node can be set according to the characteristics of the parent window, so that the surface layer corresponding to the adjustment node can achieve an overlay effect, and by adjusting the hierarchy of the display adjustment node to the highest level, it is not affected by other layers, ensuring that when a modal window exists, the parent window can have an overlay effect, so that the user can intuitively observe that the parent window is in an overlay state, reducing various operations on it, improving the user's operating efficiency, and improving the user's usage experience.
[0056] In a preferred implementation of this embodiment, the method may further include the following steps: upon window startup, determining whether a window is modal using the attributes entered during the window mapping process; or, after the window is displayed, determining whether a window is modal using the attributes entered via the protocol. Common methods determine whether a window is modal by querying its attributes, but the timing of the query requires specific settings. Typically, a timed polling method is used to query the attributes sequentially. However, this method exhibits a certain lag, preventing timely adjustment of the display effect. Therefore, in this embodiment, upon window startup, determining whether a window is modal using the attributes entered during the window mapping process. This can be done immediately upon window startup, or directly after the window is displayed, i.e., immediately after the Wayland compositor completes drawing, by directly obtaining the window attributes via the input protocol. Both of these methods allow for obtaining the attributes immediately after the window is drawn, allowing for a timely determination of whether the window is modal, providing a basis for subsequent display adjustments.
[0057] In another preferred implementation manner of this embodiment, the surface hierarchy tree of the parent window in the Wayland compositor can be used as the parent, and a display adjustment node can be created in the surface hierarchy tree; the size and location of the parent window can be obtained; in the display adjustment node, a rectangular frame can be set according to the size and location of the parent window; the rounded corner status information of the parent window can be obtained; in the display adjustment node, the rounded corner status of the rectangular frame can be set according to the rounded corner status information; in the display adjustment node, the color of the rectangular frame can be set to an inactive color, and the status of the rectangular frame can be set to an inactive display status; and the level of the display adjustment node can be adjusted to the highest level. The specific optimization is as follows: calling the modal window effect creation interface to implement the surface hierarchy tree of the parent window in the Wayland compositor as the parent, creating a display adjustment node in the surface hierarchy tree; obtaining the size and location of the parent window; setting a rectangular frame in the display adjustment node according to the size and location of the parent window; obtaining the rounded corner status information of the parent window; setting the rounded corner status of the rectangular frame in the display adjustment node according to the rounded corner status information; setting the color of the rectangular frame to an inactive color and the status of the rectangular frame to an inactive display state in the display adjustment node; and adjusting the level of the display adjustment node to the highest level. In this embodiment, the specific display adjustment process can be encapsulated as a whole, and only the interface is exposed to the outside. Users do not need to understand more implementation logic and can use this interface to dynamically adjust whether to enable this function as needed, or select the appropriate inactive color and inactive display state according to the interface, which is convenient for adapting to the user's personalized needs and can improve the user's usage efficiency and experience.
[0058] Furthermore, the method may further include the following: monitoring the exit signal of the modal window, monitoring the signal for canceling the modal attribute set via a protocol, and monitoring the exit signal of the parent window; and upon the occurrence of the exit signal of the modal window, the signal for canceling the modal attribute, or the exit signal of the parent window, closing the modal window effect creation interface to close all display adjustment results based on the modal window. Upon the occurrence of one of the three signals, the modal window effect creation interface may be directly used to close all display adjustment results based on the modal window.
[0059] Example 2
[0060] Figure 2This is a flow chart of the display adjustment method based on the modal window provided in the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and the following steps can be added: registering a mouse input event in the display adjustment node; when monitoring the mouse input event, reading the duration information from the timer; using the Wayland synthesizer to periodically redraw and refresh the modal window according to the set correspondence between the displacement information and the duration information.
[0061] See also Figure 2 The display adjustment method based on the modal window includes:
[0062] Step 210: When it is determined to be a modal window, the parent window of the modal window is obtained, and whether the modal window meets the requirements of the standard for creating a modal window effect is detected.
[0063] Step 220 : When the requirements are met, in the Wayland compositor, the surface hierarchy tree of the parent window is used as the parent, and a display adjustment node is created in the surface hierarchy tree.
[0064] Step 230: Obtain the size and location of the parent window, and set a rectangular frame in the display adjustment node according to the size and location of the parent window.
[0065] The function index value and the relative address value can be bound and stored in the dynamic link library mapping allocator as a key-value pair structure, so that the relative address value, ie, the first value, can be found by using the index value later.
[0066] Step 240: Acquire the rounded corner status information of the parent window, and set the rounded corner status of the rectangular frame in the display adjustment node according to the rounded corner status information.
[0067] Step 250: setting the color of the rectangular frame to an inactive color in the display adjustment node, and setting the state of the rectangular frame to an inactive display state.
[0068] Step 260: Adjust the level of the display adjustment node to the highest level.
[0069] Step 270: register a mouse input event in the display adjustment node, and read duration information from a timer when the mouse input event is monitored.
[0070] Although the display result of the parent window is adjusted and an overlay effect is applied to it to visually inform the user that the parent window is currently inoperable, the overlay effect can be set by the user according to his or her usage habits. When other users use the window, they may not be able to intuitively determine that the parent window is inoperable and then use peripherals to operate the parent window.
[0071] Therefore, in this embodiment, when the user operates on the parent window, the modal window display can be further adjusted to provide different visual prompts for the user.
[0072] First, mouse input events need to be registered on the display adjustment node. Since the rectangular box drawn in the adjustment node is the same size as the parent window, mouse input events can be registered on the display adjustment node. This eliminates the need to optimize and adjust the complex parent window, thus preventing impacts on other parent window functions. Exemplarily, the mouse input events may include events such as the mouse entering the rectangular box, clicking the box, and moving the mouse out of the box.
[0073] You can use registered events to monitor mouse input events and perform different processing on different mouse input events.
[0074] Optionally, in this embodiment, a timer set in the system can be used to read duration information from the timer when an event occurs.
[0075] Step 280: Using the Wayland synthesizer, the modal window is periodically redrawn and refreshed according to the set correspondence between the displacement information and the duration information.
[0076] Exemplarily, after monitoring the occurrence of a mouse moving into the rectangular frame event and a mouse clicking event within the rectangular frame, duration information can be read from a timer. Typically, in the prior art, only mouse click events are considered. However, the inventors have discovered that if the mouse has already been placed within the rectangular frame, the user may have clicked unintentionally, with the user's intention not to operate the parent window. In this case, performing display adjustments on the modal window will not only fail to provide a prompt, but will instead affect the user's normal operations. Therefore, in this embodiment, the user first monitors whether the mouse has moved into the rectangular frame event, and then continues to monitor whether the mouse has clicked the rectangular frame event. Only in this case can it be determined that the user's current intention is to operate the parent window. In this case, a timer can be started, duration information can be read from the timer, and the modal window can be periodically redrawn and refreshed at the new position according to the set correspondence between the displacement information and the duration information. Exemplarily, the duration can be set to a small value to achieve a display effect in which the modal window jitters within a certain range. This then indicates that the parent window currently being operated has a modal window.
[0077] In addition, since the parent window has multiple levels of modal windows, it is necessary to traverse the top modal window according to the properties of the parent window, and only generate a jitter display effect within a certain range for the top modal window.
[0078] Correspondingly, when it is detected that the mouse moves out of the range of the rectangular frame, the timer is terminated. Since the timer is no longer working, the duration changes to 0, and thus the shaking effect of the modal window can be terminated.
[0079] Using this method, when a user operates a parent window, the corresponding modal window can be shaken to remind the user that they must first close the modal window corresponding to the current parent window before they can operate the main window, further improving the user's efficiency in using modal windows.
[0080] This embodiment adds the following steps: registering mouse input events on the display adjustment node; reading duration information from a timer upon detecting the mouse input event; and periodically redrawing and refreshing the modal window using the Wayland compositor according to the set correspondence between displacement information and duration information. When a user operates on a parent window, the corresponding modal window can be animated to remind the user that they must first close the modal window corresponding to the current parent window before operating the main window. This further improves the user's efficiency in using modal windows.
[0081] Example 3
[0082] Figure 3 This is a structural diagram of a display adjustment device based on a modal window provided in the third embodiment of the present invention. Figure 3 The display adjustment device based on the modal window includes:
[0083] The detection module 310 is configured to, when determining that the window is a modal window, obtain the parent window of the modal window and detect whether the modal window meets the requirements of the standard for creating a modal window effect;
[0084] A creation module 320 is configured to create a display adjustment node in the surface hierarchy tree of the parent window in the Wayland compositor when the requirements are met;
[0085] A first acquisition module 330 is used to obtain the size and location of the parent window;
[0086] A first setting module 340 is configured to set a rectangular frame in the display adjustment node according to the size and location of the parent window;
[0087] The second acquisition module 350 is used to obtain the rounded corner status information of the parent window;
[0088] A second setting module 360 is configured to set the rounded corner state of the rectangular frame according to the rounded corner state information in the display adjustment node;
[0089] A setting module 370 is configured to set the color of the rectangular frame in the display adjustment node to an inactive color and to set the state of the rectangular frame to an inactive display state;
[0090] The adjustment module 380 is configured to adjust the level of the display adjustment node to the highest level.
[0091] The display adjustment device based on a modal window provided in this embodiment detects whether the modal window meets the requirements for creating a modal window effect standard by obtaining the parent window of the modal window when the modal window is determined to be a modal window, thereby avoiding display adjustment errors. If the requirements are met, a display adjustment node is created in the surface hierarchy tree of the parent window in the Wayland compositor; the size and location of the parent window are obtained; a rectangular frame is set in the display adjustment node according to the size and location of the parent window; rounded corner status information of the parent window is obtained; the rounded corner status of the rectangular frame is set in the display adjustment node according to the rounded corner status information; the color of the rectangular frame is set to an inactive color in the display adjustment node, and the status of the rectangular frame is set to an inactive display state; and the level of the display adjustment node is adjusted to the highest level. Based on the correspondence between the modal window and the parent window, it can be determined whether the modal window meets the requirements for display effect optimization. When the requirements are met, the Wayland compositor can be used to create a corresponding display adjustment node with the surface hierarchy tree of the parent window, and the properties of the display adjustment node can be set according to the characteristics of the parent window, so that the surface layer corresponding to the adjustment node can achieve an overlay effect, and by adjusting the hierarchy of the display adjustment node to the highest level, it is not affected by other layers, ensuring that when a modal window exists, the parent window can have an overlay effect, so that the user can intuitively observe that the parent window is in an overlay state, reducing various operations on it, improving the user's operating efficiency, and improving the user's usage experience.
[0092] Based on the above embodiments, the device further includes:
[0093] A registration module, configured to register mouse input events in the display adjustment node;
[0094] A reading module, configured to read duration information from a timer when monitoring the mouse input event;
[0095] The drawing module is used to use the Wayland synthesizer to regularly redraw and refresh the modal window according to the set correspondence between displacement information and duration information.
[0096] Based on the above embodiments, the mouse input event includes:
[0097] Events of the mouse moving into the rectangular frame, clicking, and moving out of the rectangular frame;
[0098] Accordingly, the reading module includes:
[0099] A reading unit, configured to read duration information from a timer after monitoring an event of a mouse moving into the rectangular frame and an event of a mouse clicking within the rectangular frame;
[0100] Correspondingly, the reading module further includes:
[0101] The terminating unit is used to terminate the timer when monitoring the event of the mouse moving out of the rectangular frame.
[0102] Based on the above embodiments, the device further includes:
[0103] The first judgment module is used to determine whether it is a modal window by using the input attributes set during the window map process when the window is started;
[0104] or
[0105] The second judgment module is used to judge whether it is a modal window by using the attributes input through the protocol after the window is displayed.
[0106] Based on the above embodiments, the detection module includes: a detection unit configured to:
[0107] Check in the Wayland compositor whether the modal window exists.
[0108] Checking whether the parent window of the modal window exists; and
[0109] Checks in the Wayland compositor whether a solid surface exists for said parent window.
[0110] Based on the above embodiments, the device further includes:
[0111] Listener module, used to listen to parent window size change events in the Wayland compositor;
[0112] The size acquisition module is used to obtain the changed parent window size when the parent window size change event is triggered;
[0113] The resetting module is used to synchronously reset the rectangular frame according to the changed size of the parent window.
[0114] Based on the above embodiments, the device further includes:
[0115] An interface calling module calls a modal window effect creation interface to implement the creation of a display adjustment node in the surface hierarchy tree of a parent window in a Wayland compositor; obtains the size and location of the parent window; sets a rectangular frame in the display adjustment node according to the size and location of the parent window; obtains rounded corner status information of the parent window; sets the rounded corner status of the rectangular frame in the display adjustment node according to the rounded corner status information; sets the color of the rectangular frame to an inactive color and the status of the rectangular frame to an inactive display status in the display adjustment node; and adjusts the level of the display adjustment node to the highest level;
[0116] Correspondingly, it also includes:
[0117] An exit signal monitoring module, configured to monitor the exit signal of the modal window, the signal for canceling the modal attribute set by the protocol, and the exit signal of the parent window;
[0118] The closing module is used to use the modal window effect creation interface to close all display adjustment results based on the modal window when the exit signal of the modal window, the signal for canceling the modal attribute or the exit signal of the parent window occurs.
[0119] The display adjustment device based on a modal window provided in an embodiment of the present invention can execute the display adjustment method based on a modal window provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0120] Example 4
[0121] Figure 4 A schematic diagram of the structure of a terminal provided in embodiment 4 of the present invention. Figure 4 A block diagram of an exemplary terminal 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The terminal 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0122] like Figure 4 As shown, terminal 12 is implemented as a general-purpose computing device. Components of terminal 12 may include, but are not limited to, one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including system memory 28 and processing unit 16).
[0123] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0124] The terminal 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the terminal 12, including volatile and non-volatile media, removable and non-removable media.
[0125] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Terminal 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 4 Not shown, usually called a "hard drive"). Although Figure 4 Although not shown, a magnetic disk drive for reading and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), as well as an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.
[0126] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally implement the functions and / or methodologies of the embodiments described herein.
[0127] The terminal 12 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, etc.), one or more terminals that enable a user to interact with the terminal 12, and / or any device that enables the terminal 12 to communicate with one or more other computing terminals (e.g., a network card, a modem, etc.). Such communication may occur through an input / output (I / O) interface 22. Furthermore, the terminal 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 20. Figure 4 As shown, network adapter 20 communicates with other modules of terminal 12 via bus 18. It should be understood that, although not shown, other hardware and / or software modules may be used in conjunction with terminal 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0128] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the display adjustment method based on the modal window provided in the embodiment of the present invention.
[0129] Example 5
[0130] The fifth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform any of the display adjustment methods based on modal windows provided in the above embodiments.
[0131] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0132] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0133] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0134] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or device. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0135] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.
Claims
1. A display adjustment method based on a modal window, characterized in that: include: When it is determined to be a modal window, the parent window of the modal window is obtained, and whether the modal window meets the requirements of the standard for creating a modal window effect is detected. The obtaining of the parent window of the modal window includes: searching for the parent window of the modal window through the set_parent method of the xdg_toplevel interface, or querying the global window tree structure maintained internally by the compositor, and determining the parent window of the modal window in the parent field of the wlr_xdg_surface structure; When the requirements are met, in the Wayland compositor, taking the surface hierarchy tree of the parent window as the parent, create a display adjustment node in the surface hierarchy tree; Get the size and location of the parent window; In the display adjustment node, a rectangular frame is set according to the size and location of the parent window; Get the rounded corner status information of the parent window; In the display adjustment node, the rounded corner state of the rectangular frame is set according to the rounded corner state information; In the display adjustment node, the color of the rectangular frame is set to an inactive color, and the state of the rectangular frame is set to an inactive display state; The level of the display adjustment node is adjusted to the highest level.
2. The method according to claim 1, characterized in that The method further comprises: Registering mouse input events in the display adjustment node; When the mouse input event is monitored, the duration information is read from the timer; The modal window is periodically redrawn and refreshed using the Wayland synthesizer according to the set correspondence between the displacement information and the duration information.
3. The method according to claim 2, characterized in that The mouse input event includes: Events of the mouse moving into the rectangular frame, clicking, and moving out of the rectangular frame; Correspondingly, when the mouse input event is monitored, the duration information is read from the timer, including: After monitoring the occurrence of the mouse moving into the rectangular frame event and the occurrence of the click event within the rectangular frame range, read the duration information from the timer; Accordingly, the method further includes: When the event of the mouse moving out of the rectangular frame is detected, the timer is terminated.
4. The method according to claim 1, wherein The method further comprises: When the window starts, use the input properties set during the window map process to determine whether it is a modal window; or After the window is displayed, the attributes input through the protocol are used to determine whether it is a modal window.
5. The method according to claim 4, characterized in that The detecting whether the modal window meets the requirements of the standard for creating a modal window effect includes: Check in the Wayland compositor whether the modal window exists. Checking whether the parent window of the modal window exists; and Checks in the Wayland compositor whether a solid surface exists for said parent window.
6. The method according to claim 1, wherein The method further comprises: Listen for parent window size change events in the Wayland compositor; When the parent window size change event is triggered, get the changed parent window size; The rectangular frame is synchronously reset according to the changed size of the parent window.
7. The method according to claim 1, characterized in that The method comprises: taking the surface hierarchy tree of the parent window as the parent in the Wayland compositor, creating a display adjustment node in the surface hierarchy tree; obtaining the size and location of the parent window; setting a rectangular frame in the display adjustment node according to the size and location of the parent window; obtaining rounded corner status information of the parent window; setting the rounded corner status of the rectangular frame in the display adjustment node according to the rounded corner status information; setting the color of the rectangular frame to an inactive color and setting the status of the rectangular frame to an inactive display status in the display adjustment node; Adjust the level of the display adjustment node to the highest level, including: Calling a modal window effect creation interface to implement the creation of a display adjustment node in the Wayland compositor using the surface hierarchy tree of the parent window as the parent; obtaining the size and location of the parent window; setting a rectangular frame in the display adjustment node according to the size and location of the parent window; obtaining corner fillet status information of the parent window; setting the corner fillet status of the rectangular frame in the display adjustment node according to the corner fillet status information; setting the color of the rectangular frame to an inactive color and the status of the rectangular frame to an inactive display status in the display adjustment node; and adjusting the level of the display adjustment node to the highest level; Accordingly, the method further includes: Monitor the exit signal of the modal window, monitor the signal of canceling the modal attribute set by the protocol; and monitor the exit signal of the parent window; When an exit signal of the modal window, a signal for canceling the modal attribute, or an exit signal of the parent window occurs, all display adjustment results based on the modal window are closed using the modal window effect creation interface.
8. A display adjustment device based on a modal window, characterized in that: include: a detection module configured to, when determining that a modal window is a modal window, obtain the parent window of the modal window and detect whether the modal window meets the requirements of the standard for creating a modal window effect, wherein obtaining the parent window of the modal window comprises: searching for the parent window of the modal window through the set_parent method of the xdg_toplevel interface, or querying the global window tree structure maintained internally by the compositor and determining the parent window of the modal window in the parent field of the wlr_xdg_surface structure; A creation module is used to create a display adjustment node in the surface hierarchy tree of the parent window in the Wayland compositor when the requirements are met; A first acquisition module is used to obtain the size and location of the parent window; A first setting module, configured to set a rectangular frame in the display adjustment node according to the size and position of the parent window; A second acquisition module is used to obtain the rounded corner status information of the parent window; A second setting module is configured to set the rounded corner state of the rectangular frame according to the rounded corner state information in the display adjustment node; a setting module, configured to set the color of the rectangular frame in the display adjustment node to an inactive color, and to set the state of the rectangular frame to an inactive display state; The adjustment module is used to adjust the level of the display adjustment node to the highest level.
9. A terminal, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the display adjustment method based on a modal window according to any one of claims 1 to 7.
10. A storage medium containing computer-executable instructions, characterized in that: When executed by a computer processor, the computer executable instructions are used to perform the display adjustment method based on a modal window according to any one of claims 1 to 7.
Citation Information
Patent Citations
Application window interface changing method and apparatus
CN105404512A
Dialog box display method and device, computer equipment and storage medium
CN111078335A
Wayland synthesizer
CN115809047A