Focus stealing
Encyclopedia
In computing
, focus stealing is a mode error produced when a program not in focus
(e.g. minimised or operating in background) places a window in the foreground and redirects all keyboard input to that window. This is considered to be an annoyance or hazard to some users because the program may steal the focus while their attention is not on the computer screen, such as when typing while reading copy to the side. This will cause everything typed after the window appeared to be lost — or worse, the typed input may cause an unintended effect in the newly focussed window. On slow computers, users are sometimes not even alerted to this behaviour in time, because the associated window is only actually displayed several seconds after the actual focus change happened.
(X11) or calc (Microsoft Windows). The terminal window should remain in focus and continue to receive keypresses; press a number key to test this. If the application has gained focus so that keypresses are now being directed to the application, then the window manager allows focus stealing.
facility, the browser window will regain focus :
systems allow focus stealing:
-based systems use pop-up dialogue boxes, which can steal focus from the current application. On modern versions of Microsoft Windows, there is a system-wide setting that will by default prevent a cooperative application from stealing focus when launching another program or popping up a new window or dialogue box. http://technet.microsoft.com/en-us/library/cc957208.aspx It is not possible to prevent an uncooperative or malicious application from either changing the setting, or bypassing it.
facility:
Computing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, focus stealing is a mode error produced when a program not in focus
Focus (computing)
In computing, the focus indicates the component of the graphical user interface which is currently selected to receive input. Text entered at the keyboard or pasted from a clipboard is sent to the component which currently has the focus. Moving the focus away from a specific user interface element...
(e.g. minimised or operating in background) places a window in the foreground and redirects all keyboard input to that window. This is considered to be an annoyance or hazard to some users because the program may steal the focus while their attention is not on the computer screen, such as when typing while reading copy to the side. This will cause everything typed after the window appeared to be lost — or worse, the typed input may cause an unintended effect in the newly focussed window. On slow computers, users are sometimes not even alerted to this behaviour in time, because the associated window is only actually displayed several seconds after the actual focus change happened.
Security issues
Focus stealing can also be damaging as the user may, while typing when their attention is away from the screen, inadvertently agree to a program doing something that causes damage. An example is when Windows pops-up the Disk Cleanup wizard and the user agrees to deleting files without realizing that the wizard was waiting for input. Focus stealing can also be treated as a security risk. For example, when a password is being typed and the typed password appears instead in a new window in an unmasked input field.Alternatives to focus stealing
These are alternative methods for grabbing the attention of the user that could be used instead of focus stealing:- Pulse the application's icon in the taskbar, leaving the application in the background
- Output a message to the notification area
- Pulsate the display overscan area
- Use an audible alerting framework
The launch test
Open a command-line terminal window. From within the window, run a GUI application, such as xcalcXcalc
xcalc is an on-screen calculator program for the X Window System. It can be used in algebraic mode or in reverse polish notation. Early versions also featured a slide rule mode, but this was removed for X11R4, which was released in 1989. The sliderule program for the BSD operating systems is based...
(X11) or calc (Microsoft Windows). The terminal window should remain in focus and continue to receive keypresses; press a number key to test this. If the application has gained focus so that keypresses are now being directed to the application, then the window manager allows focus stealing.
The JavaScript test
On a window manager that allows focus stealing, by pointing the browser at an internet page that contains a this.focus JavaScriptJavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
facility, the browser window will regain focus :
X Window Managers
The following window managerWindow manager
A window manager is system software that controls the placement and appearance of windows within a windowing system in a graphical user interface. Most window managers are designed to help provide a desktop environment...
systems allow focus stealing:
- 9wm9wm9wm is an Open Source stacking window manager for X11, written by David Hogan in 1994 to emulate the Plan 9 SecondEdition window manager, 8½...
- fails the launch test, giving focus to window placement facility - compizCompizCompiz is one of the first compositing window managers for the X Window System that uses 3D graphics hardware to create fast compositing desktop effects for window management. The effects, such as a minimization effect and a cube workspace are implemented as loadable plugins...
- configurable, and capable of passing both the launch test and the JavascriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
test - fvwmFVWMThe F Virtual Window Manager is a virtual window manager for the X Window System. Originally a twm derivative, FVWM has evolved into a powerful and highly configurable environment for Unix-like systems.- History:...
- configurable, and capable of passing or failing both the launch test and the JavascriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
test - icewmIceWMIceWM is a stacking window manager for the X Window System graphical infrastructure, written by Marko Maček. It was coded from scratch in C++ and is released under the terms of the GNU Lesser General Public License...
- fails the launch test, giving focus to newly started applications - oroborus - fails the launch test, giving focus to newly started applications
Microsoft Windows
Microsoft WindowsMicrosoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
-based systems use pop-up dialogue boxes, which can steal focus from the current application. On modern versions of Microsoft Windows, there is a system-wide setting that will by default prevent a cooperative application from stealing focus when launching another program or popping up a new window or dialogue box. http://technet.microsoft.com/en-us/library/cc957208.aspx It is not possible to prevent an uncooperative or malicious application from either changing the setting, or bypassing it.
Web Browsers
The following web browsers allow focus stealing via a this.focus JavascriptJavaScript
JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
facility:
- Mozilla FirefoxMozilla FirefoxMozilla Firefox is a free and open source web browser descended from the Mozilla Application Suite and managed by Mozilla Corporation. , Firefox is the second most widely used browser, with approximately 25% of worldwide usage share of web browsers...
- Debian IceweaselIceweaselIn 2006, a branding issue developed when Mike Connor, representing the Mozilla Corporation, requested that the Debian Project comply with Mozilla standards for use of the Thunderbird trademark when redistributing the Thunderbird software...
- Debian Iceape
See also
- FocusFocus (computing)In computing, the focus indicates the component of the graphical user interface which is currently selected to receive input. Text entered at the keyboard or pasted from a clipboard is sent to the component which currently has the focus. Moving the focus away from a specific user interface element...
- Mode (computer interface)Mode (computer interface)In user interface design, a mode is a distinct setting within a computer program or any physical machine interface, in which the same user input will produce perceived different results than it would in other settings....
- WindowWindow (computing)In computing, a window is a visual area containing some kind of user interface. It usually has a rectangular shape that can overlap with the area of other windows...
External links
- Microsoft's PowerToys for Windows XP The TweakUI utility has a setting to prevent programs from stealing the focus.