Menu

#2382 Reverse arrow cursor is too small when GDI scaling is active

Bug
closed-fixed
5
2023-07-26
2023-03-14
No

The reverse arrow cursor is too small when GDI scaling is active.

Merge request 37 addresses this issue.

Discussion

  • Markus Nißl

    Markus Nißl - 2023-03-14

    Explanation of the patch:

    While GDI scaling works with the first integral multiple of the device scale factor, the cursor has to be requested with the correct scale factor (i.e. with 1.5 instead of 2 in case of 150 % scaling). In commit [85fe64] the device scale factor of ScintillaWin is stored as a float instead of an int. Existing references then use GetFirstIntegralMultipleDeviceScaleFactor() instead.

    In commit [d5cdd6] reversArrowCursor.Load() is passed the correct dpi (dpi * deviceScaleFactor, ScintillaWin.cxx, line 735 ).

    In PlatWin.cxx, LoadReversArrowCursor() now first features a local helper class CursorHelper which performs RAII and incorporates existing code to flip the bitmap.

    The remainder of the function has the following changes:

    1. Instead of using LoadCursor() that accepts no size, the cursor is loaded via LoadImage() and the desired width and height.
    2. For step 1 to work correctly, the DPI awareness of the thread has to be changed to DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2.
    3. If the returned cursor does not match the requested width and height, the cursor is copied as before.
    4. If a bitmap could be retrieved, the new cursor is created from the flipped bitmap (reverseArrowCursor = cursorHelper.CreateFlippedCursor()).
    5. The DPI awareness of the thread is reset to its original value.
     
  • Zufu Liu

    Zufu Liu - 2023-03-16
    • labels: --> scintilla, win32
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2023-06-22
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2023-06-22

    Committed as [7267f2].

     

    Related

    Commit: [7267f2]

  • Neil Hodgson

    Neil Hodgson - 2023-07-26
    • status: open-fixed --> closed-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2023-07-26

    Committed as [7267f2].

     

    Related

    Commit: [7267f2]


Log in to post a comment.

MongoDB Logo MongoDB