Git Product home page Git Product logo

Comments (3)

btzy avatar btzy commented on July 17, 2024

Yeah, I think this is an issue on both Windows and Linux. I didn't implement this because all the known solutions to determine the parent window are guesswork if NFD isn't given a handle to the main window (e.g. the find_main_window solution you've linked), but yet it would be quite simple for the caller to get the correct window handle and tell NFD about it (assuming the proper API is added to NFD).

The main concern with having the window handle passed explicitly is that it is platform-specific, which means that we need separate platform-specific APIs on each platform NFD supports. But even though it's a bit difficult to use, I think this is the more proper solution and should be preferred to the guesswork you're proposing. Since most users of NFD use a windowing library like SDL2 or GLFW, we could potentially add a way to accept a SDL2 or GLFW window handle (in a separate header, so the NFD library itself doesn't need to depend on those things) and get the platform-specific native handle from it.

from nativefiledialog-extended.

rcases avatar rcases commented on July 17, 2024

Yes, I understand that passing the handle to the window would break compatibility.
That is why I have made this proposal that in the worst case (the window handle is not found and find_main_window returns nullptr), it would be the current situation.

from nativefiledialog-extended.

btzy avatar btzy commented on July 17, 2024

Sorry, I think I wasn't very clear.

I don't think the logic of find_main_window should be part of NFD, since it is guesswork, and for multi-window applications it might bring the wrong window to the top. Instead, I think NFD ought to have a new interface that will allow the user to pass in a native window handle, and the user should implement their own find_main_window hack if they want to do so (or better, figure out the correct window handle through a more proper way and pass that to NFD).

This should be implementable after #92 is implemented.

from nativefiledialog-extended.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.