-
Notifications
You must be signed in to change notification settings - Fork 71
Input focus
This page is dedicated to description of input focus management problems and my solutions.
- actions.c: wSetFocusTo() - set focus to particular window;
- event.c: handleMapRequest(), handleMapNotify(), handleUnmapNotify(), handleDestroyNotify()
- application.c
- Sources/x11/XGServerEvent.m:
Every running application has WApplication instance. Normal X11 application exists only if at least one window was mapped.
WApplication instance for registered application should contain defined:
- app_icon - appplication icon
- windows - list of windows (at least one) which belongs to application
- menu_win for GNUstep application
GNUstep application minimal appearance is appicon and menu. For focus handling/switching tasks menu_win
must be set to make correct focus switching.
main_window
- this is the invisible window that identifies application as a group of windows. Also it's called as "group leader". Every WWindow and WAppIcon contains field Window main_window
. That's how application icon, menu and windows/panels can be identified as single application.
main_window_desc
- generated WWindow structure for main_window
. So main_window
can be used as managed WWindow.
last_focused
- should be set to last window of application that has focus before FocusOut, hide, workspace switch events. Set in wSetFocusTo()
.
last_workspace
- contains workspace number of last_focused window workspace. If, for exmaple, application has 2 windows on different workspaces, double-click on appicon should: switch to workspace where last_focused window resides, set focus to that window (activate application). Set in wSetFocusTo()
.
On application start wApplicationCreate() is called:
- creates wapp->windows array
- adds
wwin
to this array - saved
wwin
towapp->menu_win
if it's main menu (normally it is)
When new window opens (MapRequest/MapNotify, event.c) wApplicationAdd() is called:
- adds
wwin
intowapp->windows
array wapp->refcount++
When window is closed (UnmapNotify, event.c) and window is not main menu wApplicationRemoveWindow()
is called:
- removes
wwin
fromwapp->windows
array wapp->refcount--
When application quits (DestroyNotify, event.c):
- several calls to
wApplicationRemoveWindow()
is performed -
wApplicationDestroy()
is called:-
wUnmanageWindow()
forwapp->menu_win
is called -
wapp->windows
array destroyed wapp->refcount--
-
wapp
is freed
-
Copyright (c) Sergii Stoian