Skip to content

v0.24.0

Choose a tag to compare

@buggins buggins released this 27 Nov 17:22
· 96 commits to master since this release
994713a

DlangUI v0.24.0

OpenGL fixes for apps with several windows: X11 windows share their GL objects like SDL windows, GL objects of widgets are deleted with their context current, and the global GL objects are created again when a window opens after the last one was closed. Win32 window icons follow the monitor's DPI and the theme. Menu hotkeys skip disabled items and prefer the character of a non-Latin keyboard layout. Saved window sizes and positions are kept when a window is shown.

Behavior changes worth noting

  • UIAppMain through a pointer (#270, #1249): mixin APP_ENTRY_POINT passes the application's UIAppMain to the backend (uiAppMainFunction), and the backends call it through callUIAppMain(). dub test --coverage with DMD links when a module other than the main one imports dlangui. An app with its own main that calls DLANGUImain directly must set uiAppMainFunction = &UIAppMain; first, otherwise it logs "UIAppMain is not set" and exits with 1.
  • Window teardown (#1250, #1253): the widget teardown of the Window destructor moved into destroyWidgets() (with callOnClose()). On SDL and X11 the window destructor calls onClose, then destroys the widgets with the window's own GL context current, a few statements earlier than before.
  • KeyEvent.text on KeyDown (#1245, #1256): a KeyDown may carry the character the key types in the current keyboard layout. Win32 gives it for Alt + a letter key whose letter isn't Latin.
  • Menu hotkeys (#1245, #1255, #1256, #1258): MainMenu tries a top-level item first, then a submenu item; at each level the layout's character before the key code's Latin letter. Disabled items, separators and the submenus of disabled items are skipped, and the items' action states are updated before an Alt hotkey is matched.
  • MeasureSize windows keep a restored size (#1206, #1261): after restoreWindowState(), the first show() keeps the restored size, grown to the content if that needs more (all backends; new Window.sizeWindowToContentOnShow()).

Fixes

  • OpenGL:
    • GL objects of widgets (GLObject, GLVertexBuffer) are deleted with their context current; Win32 queues the ones deleted outside painting and deletes them after the next frame (#1250, #1253: example1 6 → 0 GL errors at exit, d3d 15 → 0).
    • X11: the windows' GL contexts share their objects; a second OpenGL window such as the file dialog got invalid program and texture names (#1252, #1266: about 244,000 GL errors with example1's file dialog). The cache of the bound GL program is reset each frame (one GL error in another window's first frame, X11 and SDL).
    • X11, SDL: the global GL objects (GL caches, shader programs, GL texture and 3D effect caches) are created again for a window opened after the last OpenGL window was closed; SDL sets context sharing for each context, as it resets its GL attributes when the last GL window is gone (#1265, #1270).
  • Win32:
    • Alt+letter with a non-Latin layout opens the menu item of the typed character (Alt+Ф: "&Файл") before a Latin hotkey of the key code ("Save &As") (#1245, #1256).
    • Window icons are sized for the DPI of the window's monitor and created again when the DPI changes (#1185, #1260), and again on a theme change: SVG icons with currentColor follow the theme, and the theme's drawable mapping applies (#1259, #1269).
  • X11: a position requested before a window is shown (restoreWindowState(), moveWindow()) is kept by window managers that place new windows themselves (#1262, #1267).
  • SDL: a window minimized while maximized comes back maximized with its modal dialog (#1217, #1264).
  • Menus: hotkeys skip disabled items (#1255, #1258).
  • example1: the legacy OpenGL example (glxGears) draws again, and is disabled on core profile contexts (SDL) instead of logging GL errors (#620, #1251).

Compatibility

Minor release. New API: uiAppMainFunction, callUIAppMain(), Window.destroyWidgets(), Window.callOnClose(), Window.sizeWindowToContentOnShow(), glContextIsCurrentFunc, deleteGLObject(), deletePendingGLObjects(), releaseGLObjectsOfLastContext(), uninitGLSupport(), EffectCache.forgetAll(). See "Behavior changes worth noting" for DLANGUImain callers.