Skip to content

Setting Cursor Position Inaccurate #62

Closed

Description

@tomaka

Activity

  1. added
    DS - win32
    on Nov 3, 2016
  2. paulirotta commented on Dec 13, 2016

    @paulirotta
    Contributor

    This may be the same issue I'm seeing with Windows 10 DPI awareness settings. I think the solution is something along the lines of SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE) to get Windows to give 1:1 on virtual pixels and real pixels. Some APIs use scaled pixels, some not...
    https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx
    https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122(v=vs.85).aspx

    (Related?) app-level hack, Vulkano on Windows with 250% scaling (high DPI laptop):
    // Hack to make Vulkano window the same size as the screen when scaling is 250%
    let monitor_id: winit::MonitorId = {
    //TODO Find the most appropriate monitor, for example the one selected last time
    for (num, monitor) in winit::get_available_monitors().enumerate() {
    println!("Monitor #{}: {:?} {:?}", num, monitor.get_name(), monitor.get_dimensions());
    }
    let num = 0;
    let monitor = winit::get_available_monitors().nth(num).expect("Invalid monitor ID");
    monitor
    };
    let monitor_dimensions = monitor_id.get_dimensions();
    let k = (10, 25); // 2.5 safe integer division
    *** let window_dimensions = (monitor_dimensions.0 k.0/k.1, monitor_dimensions.1k.0/k.1); ***
    let window = winit::WindowBuilder::new()
    .with_title("Slice")
    .with_multitouch()
    .with_dimensions(window_dimensions.0, window_dimensions.1)
    .with_decorations(true)
    .build_vk_surface(&instance)
    .expect("Could not build Vulkan window");

  3. added a commit that references this issue on Mar 29, 2017
  4. LPGhatguy commented on May 22, 2017

    @LPGhatguy
    Contributor

    I'm going to give this issue a try, as I hit the hidpi inaccuracy the other day.

    To be backwards compatible with Windows Vista and 7, you can pass TRUE to SetProcessDpiAwareness to be per-monitor DPI aware on 8.1+ and system API aware on 8-. EDIT: Shcore.dll isn't present on Windows 8 and older, need to dynamically link against it

  5. added
    B - bug
    C - in progress
    D - hard
    P - high
    on May 6, 2018
  6. added this to the HiDPI Support milestone on May 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugC - in progressD - hardDS - win32P - high

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions