How Windows 95 Processed Taskbar Docking
When Windows 95 introduced the Taskbar, one of its signature features was the ability to dock to any of the four edges of the screen: bottom, top, left, or right. This dynamic repositioning was made possible through a dedicated shell mechanism known as Application Desktop Toolbars (AppBars). By combining real-time mouse tracking, edge-proximity calculations, and dynamic desktop work area recalculations via the Windows API, Windows 95 seamlessly handled the taskbar's movement, orientation changes, and window reflow across the display.
The AppBar Architecture
Under the hood, the Windows 95 taskbar is implemented as an "AppBar"
(Application Desktop Toolbar). The shell provides the
SHAppBarMessage API to manage these specialized windows.
When the taskbar is initialized or moved, it registers itself with the
system using this interface. An AppBar is unique because it has the
authority to reserve dedicated screen real estate that other standard
windows cannot occupy by default.
Dragging and Edge Detection
When a user clicks on an unoccupied portion of the taskbar and begins dragging, the window enters a tracking loop:
- Mouse Coordinate Interception: The taskbar captures
mouse input using standard Win32 message handling
(
WM_MOUSEMOVEandWM_LBUTTONDOWN). - Screen Threshold Calculation: The shell evaluates the cursor's absolute screen coordinates against the bounding rectangle of the primary display. It divides the screen into four quadrants or calculates the shortest Euclidean distance to the screen borders (top, bottom, left, right).
- Threshold Snapping: Instead of moving freely across the screen like an arbitrary window, the taskbar checks if the cursor has crossed a predefined threshold near a screen edge. Once the cursor moves significantly toward a new perimeter, the system snaps an outline preview (or updates internal placement metrics) indicating the pending dock position.
Window Geometry and Layout Adaptation
Once the user releases the mouse button (WM_LBUTTONUP)
near a valid edge, the taskbar reconfigures its internal geometry:
- Orientation Shifting: If moved from a horizontal edge (top/bottom) to a vertical edge (left/right), the layout engine switches from a horizontal row layout to a vertical column layout.
- Component Resizing: The Start button, the task-switch buttons, and the system tray (notification area) are reordered and resized. On vertical alignments, buttons adapt to a fixed width matching the taskbar’s thickness, and text labels are truncated accordingly.
- Size Enforcement: The taskbar enforces a minimum dimension (height for horizontal docks, width for vertical docks) and limits how far into the screen a user can manually resize it.
Desktop Work Area Adjustment
After determining the new position, the taskbar calls
SHAppBarMessage with the ABM_SETPOS message to
negotiate its coordinates with the system. The shell then updates the
desktop's usable boundary:
- Setting the Work Area: The operating system uses
the
SystemParametersInfoAPI with theSPI_SETWORKAREAflag. This updates the global desktop work area rectangle, which represents the portion of the screen not obscured by docked toolbars. - Broadcasting Changes: The system broadcasts a
WM_SETTINGCHANGE(orWM_WININICHANGE) message to all top-level windows. Maximized applications process this notification to resize and reposition themselves immediately, preventing them from being obscured by or overlapping the newly positioned taskbar.