Giter Site home page Giter Site logo

Comments (9)

Oldes avatar Oldes commented on August 17, 2024 1

Ok... I have it running if you would want it. Btw... I have related question... so far when you drag window or resize it, it halts the main thread. It would be better if content inside was not halted. Do you want to change it too? Thanks.

from sokol.

Oldes avatar Oldes commented on August 17, 2024 1

Maybe this helps: https://stackoverflow.com/a/18043461/494472

from sokol.

Oldes avatar Oldes commented on August 17, 2024 1

If separate thread is out of question, than there is only option described in:

Windows runs this moving/sizing loop as long as the user is interactively moving/sizing the window. It does this so that it can intercept mouse messages and process them accordingly. When the moving/sizing operation completes (e.g., when the user releases the mouse button or presses the Esc key), control will return to your application code.

It is worth pointing out that you are notified that this mode change has occurred via the WM_ENTERSIZEMOVE message; the corresponding WM_EXITSIZEMOVE message indicates that the modal event-processing loop has exited. That allows you to create a timer that will continue to generate WM_TIMER messages that your application can process. The actual details of how this is implemented are relatively unimportant, but the quick explanation is that DefWindowProc continues to dispatch WM_TIMER messages to your application inside of its own modal event processing loop. Use the SetTimer function to create a timer in response to the WM_ENTERSIZEMOVE message, and the KillTimer function to destroy it in response to the WM_EXITSIZEMOVE message.

As there is small delay before WM_ENTERSIZEMOVE is received, I guess that same method is used in Adobe AIR, where is also noticeable halt before the content is again updating. It is not perfect, but at least it is not halted when you drag a window.

from sokol.

floooh avatar floooh commented on August 17, 2024

Yes, I've been planning to add stuff like this "as needed".

Also things like minimized/maximized/restored and 'quit-requested' events.

Please don't bother with a PR though, sokol_app.h is still quite a bit in flux. It'll go in within the next few days I think.

from sokol.

floooh avatar floooh commented on August 17, 2024

The 'halt-the-main-thread' thing only happens on Windows, I guess because moving/resizing is "modal" there. It would be good to fix this, do you know what the recommend fix for this is (I guess calling the frame callback during a WM_* message?).

from sokol.

Oldes avatar Oldes commented on August 17, 2024

I think that the only proper way is to use separate thread. GLFW examples are working the same way.. only the GLFW's threads test (using tinycthread) is not blocking.

from sokol.

floooh avatar floooh commented on August 17, 2024

Hmm, no IMHO a separate thread is out of question. I'd rather have no updates during moving/resizing. I'll play around with it a bit, I think a lot can be achieved by calling the frame callback from within the WinProc.

from sokol.

floooh avatar floooh commented on August 17, 2024

FYI I have started to implement resize, iconified and restored (un-iconified) events. This is basically a subset of what GLFW is doing (and also implemented in the same way). If it makes sense I'll also add a focused/unfocused event later.

I left out the position-changed event, do you know of a scenario where this is required? IMHO size changes is the most important (I also removed the per-frame check for size changes on the platforms where those events are implemented, currently only MacOS and Win32).

from sokol.

floooh avatar floooh commented on August 17, 2024

Similar sokol-app events have been implemented now, closing this...

from sokol.

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.