Window Focus refers to the state of a window within a screen group that is currently capable of receiving keyboard events. The system uses the focus mechanism to ensure that user input is correctly routed to the target UI component.
Within a screen group, there is one and only one window in the focus state, which is called the Focus Window. The focus window can not only respond to keyboard input but also enjoy higher priority in resource scheduling, such as receiving system preference in rendering and task execution. The system can only bring up the input method for text entry after the window successfully gains focus.
A screen group is a set of logically associated display areas in the system, with each screen group independently maintaining its window stack and focus state. Each screen group has one and only one focus window, and the focus states of different screen groups do not affect each other.
Window focus state indicates whether the current window can receive user input events (such as click and key press).
The main states are as follows:
WINDOW_ACTIVE: The window has gained focus and can respond to user operations.
WINDOW_INACTIVE: The window has lost focus and cannot receive input.
Typical scenario: The window automatically gains focus after the app starts; the original window loses focus when switching to another app.
You can listen for changes in window focus state through the on('windowEvent') API.
Window Highlight State indicates whether the current window is in a visual highlight state. Visual highlight is a UI feedback mechanism that communicates to the user that this window is currently active, interactive, or being emphasized by the system by changing the window's appearance (such as title bar color, border style, transparency, and shadow).
Window highlight state supports app windows (including main windows and subwindows), but does not support system windows.
A window being in the highlight state does not mean it has gained focus; however, a focus window is always in the highlight state.
There are two highlight modes: exclusive highlight and non-exclusive highlight.
Exclusive highlight mode: Only one window is highlighted, and other windows of the app automatically lose highlighting.
Non-exclusive highlight mode: Multiple windows within the app (such as parent and child windows) are highlighted simultaneously.
Typical scenario for exclusive highlight: In a multi-subwindow app, only the title bar of the currently operated subwindow is highlighted.
Typical scenario for non-exclusive highlight: In a professional design tool, the user operates the main view and the parameter settings panel simultaneously, and the system allows both windows to be highlighted at the same time to indicate that they are both in an active state.
You can listen for window highlight state changes through the on('windowHighlightChange') API.