Copies the window's current state into a TrueColorImage.
Returns the actual logical DPI for the window on its current display monitor. If the window straddles monitors, it will return the value of one or the other in a platform-defined manner.
Sent when the window is moved to a new DPI context, for example, when it is dragged between monitors or if the window is moved to a new remote connection or a monitor is hot-swapped.
Used iff WindowFlags.managesChildWindowFocus is set when the window is created. The delegate will be called when the window manager asks you to take focus.
Grabs exclusive input from the user until you release it with releaseInputGrab.
Sets the location for the IME (input method editor) to pop up when the user activates it.
Tells the IME whether or not an input field is currently focused in the window.
Returns the native window.
Releases the grab acquired by grabInput.
Sets the input focus to this window.
Requests attention from the user for this window.
This will be called when WM wants to close your window (i.e. user clicked "close" icon, for example). You'll have to call close() manually if you set this delegate.
This will be called when window visibility was changed.
Returns true if the window has been closed.
Returns true if the window is focused.
Returns true if the window is visible (mapped).
Closes the window. If there are no more open windows, the event loop will terminate.
close is one of the few methods that can be called from other threads. This shared overload reflects that.
not fully implemented but planned for a future release
Note: only implemented on Windows. No-op on other platforms. You may want to use hide instead.
Alias for hidden = false
Alias for hidden = true
Hide cursor when it enters the window.
Don't hide cursor when it enters the window.
"Warp" mouse pointer to coordinates relative to window top-left corner. Return "success" flag.
Send dummy window event to ping event loop. Required to process NotificationIcon on X11, for example.
Set window minimal size.
Set window maximal size.
Set window resize step (window size will be changed with the given granularity on supported platforms). Currently only supported on X11.
Move window.
Resize window.
Move and resize window (this can be faster and more visually pleasant than doing it separately).
Returns true if the window is hidden.
Shows or hides the window based on the bool argument.
Sets the window opacity. On X11 this requires a compositor to be running. On windows the WindowFlags.extraComposite must be set at window creation.
Sets your event handlers, without entering the event loop. Useful if you have multiple windows - set the handlers on each window, then only do eventLoop on your main window or call EventLoop.get.run();.
The event loop automatically returns when the window is closed pulseTimeout is given in milliseconds. If pulseTimeout == 0, no pulse timer is created. The event loop will block until an event arrives or the pulse timer goes off.
This is the function eventLoop forwards to. It, in turn, forwards to EventLoop.get.run.
This lets you draw on the window (or its backing buffer) using basic 2D primitives.
Width of the window's drawable client area, in pixels.
Height of the window's drawable client area, in pixels.
Returns the actual size of the window, bypassing the logical illusions of Resizability.automaticallyScaleIfPossible.
true if OpenGL was initialized for this window.
"Lock" this window handle, to do multithreaded synchronization. You probably won't need to call this, as it's not recommended to share window between threads.
"Unlock" this window handle, to do multithreaded synchronization. You probably won't need to call this, as it's not recommended to share window between threads.
Emit a beep to get user's attention.
Put your code in here that you want to be drawn automatically when your window is uncovered. Set a handler here *before* entering your event loop any time you pass OpenGlOptions.yes to the constructor. Ideally, you will set this delegate immediately after constructing the SimpleWindow.
This will allow you to change OpenGL vsync state.
Set this to false if you don't need to do glFinish() after swapOpenGlBuffers(). Note that at least NVidia proprietary driver may segfault if you will modify texture fast enough without waiting 'em to finish their frame business.
call this to invoke your delegate. It automatically sets up the context and flips the buffer. If you need to redraw the scene in response to an event, call this.
Queues an opengl redraw as soon as the other pending events are cleared.
Makes all gl* functions target this window until changed. This is only valid if you passed OpenGlOptions.yes to the constructor.
Makes all gl* functions target this window until changed. This is only valid if you passed OpenGlOptions.yes to the constructor. This doesn't throw, returning success flag instead.
Releases OpenGL context, so it can be reused in, for example, different thread. This is only valid if you passed OpenGlOptions.yes to the constructor. This doesn't throw, returning success flag instead.
simpledisplay always uses double buffering, usually automatically. This manually swaps the OpenGL buffers.
Set the window title, which is visible on the window manager title bar, operating system taskbar, etc.
Gets the title
Get the title as set by the window manager. May not match what you attempted to set.
Set the icon that is seen in the title bar or taskbar, etc., for the user. If passed null, does nothing.
Draws an image on the window. This is meant to provide quick look of a static image generated elsewhere.
Changes the cursor for the window. If the cursor is hidden via hideCursor, this has no effect.
What follows are the event handlers. These are set automatically by the eventLoop function, but are still public so you can change them later. wasPressed == true means key down. false == key up. Handles a low-level keyboard event. Settable through setEventHandlers.
Handles a higher level keyboard event - c is the character just pressed. Settable through setEventHandlers.
Handles a timer pulse. Settable through setEventHandlers.
Called when the focus changes, param is if we have it (true) or are losing it (false).
Called inside close() method. Our window is still alive, and we can free various resources. * Sometimes it is easier to setup the delegate instead of subclassing.
Called when we received destroy notification. At this stage we cannot do much with our window * (as it is already dead, and it's native handle cannot be used), but we still can do some * last minute cleanup.
Called when Expose event comes. See Xlib manual to understand the arguments. * Return false if you want Simpledisplay to copy backbuffer, or true if you did it yourself. * You will probably never need to setup this handler, it is for very low-level stuff. * * WARNING! Xlib is multithread-locked when this handles is called!
Mouse event handler. Settable through setEventHandlers.
use to redraw child widgets if you use system apis to add stuff
handle a resize, after it happens. You must construct the window with Resizability.allowResizing for this to ever happen.
Platform specific - handle any native message this window gets.
This is the same as handleNativeEvent, but static so it can hook ALL events in the loop. If you used to use handleNativeEvent depending on it being static, just change it to use this instead and it will work the same way.
The native implementation is available, but you shouldn't use it unless you are familiar with the underlying operating system, don't mind depending on it, and know simpledisplay.d's internals too. It is virtually private; you can hopefully do what you need to do with handleNativeEvent instead.
Is our custom event queue empty? Can be used in simple cases to prevent "spamming" window with events it can't cope with. It is safe to call this from non-UI threads.
Does our custom event queue contains at least one with the given type? Can be used in simple cases to prevent "spamming" window with events it can't cope with. It is safe to call this from non-UI threads.
Event listeners added with addEventListener have their exceptions swallowed by the event loop. This delegate can handle them again before it proceeds.
Add listener for custom event. Can be used like this:
Remove event listener. It is safe to pass invalid event id here.
Post event to queue. It is safe to call this from non-UI threads. If timeoutmsecs is greater than zero, the event will be delayed for at least timeoutmsecs milliseconds. if replace is true, replace all existing events typed ET with the new one (if evt is empty, remove 'em all) Returns true if event was queued. Always returns false if evt is null.
Post event to queue. It is safe to call this from non-UI threads. if replace is true, replace all existing events typed ET with the new one (if evt is empty, remove 'em all) Returns true if event was queued. Always returns false if evt is null.
When in opengl mode and automatically resizing, it will set the opengl viewport to stretch.
Style of the window's corners
A SimpleWindow subclass that encapsulates some nanovega defaults. You just set a redrawNVGScene delegate and, optionally, your normal event handlers for simpledisplay, and the rest is set up for you.