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

Bad warning on the windows implementation of druid-shell for window builder #1855

Closed
JAicewizard opened this issue Jul 4, 2021 · 6 comments

Comments

@JAicewizard
Copy link
Contributor

This gives a warning for unimplemented windowlevels:

    pub fn set_level(&mut self, level: WindowLevel) {
        match level {
            WindowLevel::AppWindow | WindowLevel::Tooltip => self.level = Some(level),
            _ => {
                warn!("WindowBuilder::set_level({:?}) is currently unimplemented for Windows platforms.", level);
            }
        }
    }

But looking at the code to hangle self.level:

            if let Some(level) = self.level {
                match level {
                    WindowLevel::AppWindow => (),
                    WindowLevel::Tooltip => {
                        dwStyle = WS_POPUP;
                        dwExStyle = WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW;
                        focusable = false;
                    }
                    WindowLevel::DropDown => {
                        dwStyle = WS_CHILD;
                        dwExStyle = 0;
                    }
                    WindowLevel::Modal => {
                        dwStyle = WS_OVERLAPPED;
                        dwExStyle = WS_EX_TOPMOST;
                    }
                }
            }

This all seems to be implemented.

@cmyr
Copy link
Member

cmyr commented Jul 5, 2021

Is this related to #1824?

@JAicewizard
Copy link
Contributor Author

related as in I found this while looking into that. This is in the WindowBuilder so not related to changing the window level after creating it.

@sjoshid
Copy link
Contributor

sjoshid commented Aug 4, 2021

I had the same question. It looks like WindowLevel::DropDown is implemented but it's not actually there yet. If you handle the WindowLevel::DropDown (instead of showing warning) it'll throw error. That's because creating a child window requires parent's HWND which shell doesnt have yet.

Even after somehow supplying the HWND it still wont work because as soon as any widget in parent's window calls a paint refresh (like a cursor in textbox), the child window gets "hidden"

And even if you get that working, it still wont work because there seems be a scaling bug at least on Windows which places child windows at some weird places.

I would be happy to provide more details if anyone is interested.

@JAicewizard
Copy link
Contributor Author

Huh, might be worth adding that as a comment explaining, but anyways, thanks for explaining!

@sjoshid
Copy link
Contributor

sjoshid commented Aug 5, 2021

haha. I tried my best explaining. Sorry.
I'll open a PR and let the code do the talking/explaining.

Thanks.

@JAicewizard
Copy link
Contributor Author

no your explaining was fine, just having a comment linking to it might be nice for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants