NAME

TUI::Drivers::EventQueue - internal mouse event queue and dispatcher

HIERARCHY

TEventQueue (internal manager)
  used by TEvent and the event system

SYNOPSIS

use TUI::Drivers::EventQueue;
use TUI::Drivers::Event;

my $event = TEvent->new;
TEventQueue->getMouseEvent($event);

DESCRIPTION

TEventQueue implements the low-level event queue responsible for collecting and dispatching mouse events within the Turbo Vision framework.

This module manages mouse state, button transitions, double-click detection, auto-repeat handling, and movement tracking. It serves as the bridge between hardware input and the higher-level TEvent abstraction.

TEventQueue is an internal framework component. Application code normally interacts with events through TEvent and should not depend directly on this module.

Commonly Used Features

In typical runtime flow, TEventQueue is started and stopped automatically via resume() and suspend() during driver/application lifecycle handling. The most frequently used operation is getMouseEvent($event), which updates a provided TEvent instance in-place and sets $event->{what} to one of evMouseDown, evMouseUp, evMouseMove, evMouseAuto, or evNothing.

Configuration usually centers on timing and behavior globals such as $doubleDelay, $repeatDelay, and $mouseReverse. These values influence double-click recognition, mouse auto-repeat generation, and button mapping, and are primarily relevant for driver-level customization rather than application-level dialog/view code.

VARIABLES

The following global variables control event timing and mouse state handling in TEventQueue.

$downTicks

Counts the number of ticks since the last mouse button press.

$mouseEvents

Indicates whether mouse events are currently enabled.

$mouseReverse

Indicates whether mouse button order is reversed.

$doubleDelay

Defines the delay (in ticks) used to detect double-click events.

$repeatDelay

Defines the delay (in ticks) before auto-repeat events are generated.

$autoTicks

Counts ticks used for auto-repeat handling.

$autoDelay

Defines the delay before auto-repeat processing starts.

$mouse

Holds the current TMouse driver instance.

$lastMouse

Stores the previous mouse event state.

$curMouse

Stores the current mouse event state.

$downMouse

Stores the mouse event state at the time the button was pressed.

METHODS

resume

TEventQueue->resume();

Initializes mouse handling and enables mouse event processing.

This method is called automatically during program startup.

suspend

TEventQueue->suspend();

Suspends mouse handling and releases related resources.

This method is called automatically during program shutdown.

getMouseEvent

TEventQueue->getMouseEvent($event);

Retrieves the next mouse event and populates the provided TEvent object.

If no mouse event is available, the event's what field is set to evNothing.

This method is a low-level helper used internally by TEvent. Application code should normally call TEvent->getMouseEvent instead.

IMPLEMENTATION DETAILS

Following the original Turbo Vision design, TEventQueue is implemented as a singleton class with class methods and global state.

Scope and limitations

TEventQueue processes mouse events only.

Keyboard events are handled separately through TEvent->getKeyEvent and are not part of this queue.

Lifecycle

The event queue is automatically activated when the module is loaded and suspended when the program terminates.

This behavior is managed internally and does not require explicit setup by application code.

Event generation

TEventQueue generates the following mouse-related event types:

  • evMouseDown

  • evMouseUp

  • evMouseMove

  • evMouseAuto

Additional mouse flags such as double-click detection and movement indicators are encoded in the mouse event data.

Internal state

TEventQueue maintains internal state for tracking mouse position, button state transitions, and timing information required for double-click and auto-repeat detection.

These details are considered implementation-specific and are not part of the public API.

SEE ALSO

TUI::Drivers::Event, TUI::Drivers::Const, TUI::Drivers::HardwareInfo, TUI::Drivers::Mouse

AUTHORS

Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2021-2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution). This documentation is provided under the same terms as the Turbo Vision library itself.