Skip to content

DeviceEvent should be optional, causes unneccessary CPU usage #1634

@Ciantic

Description

@Ciantic

I use winit for background application for Windows 10.

Even though not a single window is visible or activated it eats CPU if I move the mouse: Process Explorer shows 0.33% of CPU usage when moving a mouse, but when I stop the mouse it goes to 0%.

This indicates that it just keeps on listening the device events, even though I don't even need them. It's not ideal for a background application to eat CPU when mouse is moved outside the application's own window.

I don't know is background applications (that occasionally show a Window) even a target for winit, but I surely would want it to be.

Thanks.


There is multiple ways to fix this, easiest but not so great is to make an emit_device_events(bool) for the EventLoop builder. Another way would be to make them toggleable at runtime, so one could toggle DeviceEvents on when necessary (e.g. when the window is activated).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C - needs discussionDirection must be ironed outDS - win32Affects the Win32/Windows backendS - enhancementWouldn't this be the coolest?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions