Skip to content

Refactor Cursor to lazy load Cursor handle #388

@ShahzaibIbrahim

Description

@ShahzaibIbrahim

Problem

Currently, we have a logic to always initialize the first handle in a handle field. Instead of using it, we could switch to lazy loading via using zoomLevelToHandle map. The handle will only created when win32_getHandle is called.


Proposed Solution

To fix this, the Cursor class should be refactored to manage zoom-level-specific handles more robustly and safely. The following changes are needed:

  1. Remove handle Field
    Eliminate the dedicated handle field from the class. All handle accesses should go through the zoomLevelToHandle map, which now acts as the single source of truth for all zoom levels.

  2. Update All Related Methods
    Refactor all methods that previously relied on the handle field to instead use zoomLevelToHandle. This includes:

    • hashCode()
    • equals(Object obj)
    • isDisposed()
    • destroy()

Metadata

Metadata

Assignees

No one assigned

    Labels

    HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions