Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raw.hovered_files doesn't work if runs as administrator #5722

Open
SEBROVATER opened this issue Feb 17, 2025 · 0 comments
Open

raw.hovered_files doesn't work if runs as administrator #5722

SEBROVATER opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something is broken

Comments

@SEBROVATER
Copy link

Looks like the Windows 11 system blocks using raw.hovered_files if an app runs as administrator.

To Reproduce

  1. Run this code sample:
use eframe::egui;
use egui::{Align2, Color32, Id, LayerId, Order, TextStyle};

fn main() -> eframe::Result {
    eframe::run_native(
        "MyApp",
        Default::default(),
        Box::new(|_cc| Ok(Box::new(MyApp::default()))),
    )
}

#[derive(Default)]
struct MyApp {}

impl eframe::App for MyApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        if !ctx.input(|i| i.raw.hovered_files.is_empty()) {
            let text = ctx.input(|i| format!("Dropping files: {}", i.raw.hovered_files.len()));

            let painter =
                ctx.layer_painter(LayerId::new(Order::Foreground, Id::new("file_drop_target")));

            let screen_rect = ctx.screen_rect();
            painter.rect_filled(screen_rect, 0.0, Color32::from_black_alpha(192));
            painter.text(
                screen_rect.center(),
                Align2::CENTER_CENTER,
                text,
                TextStyle::Heading.resolve(&ctx.style()),
                Color32::WHITE,
            );
        }
    }
}
  1. Try to hover some files over it, will see a count of hovered files.
  2. Run the same code sample as the administrator. For example from the admin PowerShell.
  3. Try to hover some files over it again, now will only see that the cursor changed to a red crossed sign.

Expected behavior
I can't find an explanation for this behavior in the docs, so it seems more like not intended.

Environment:

  • OS: Windows 11 Home
  • egui version: 0.31.0
  • eframe version: 0.31.0
  • build in dev mode
@SEBROVATER SEBROVATER added the bug Something is broken label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant