Atualização Hwgui 23-08-2026
Enviado: 23 Ago 2026 20:49
Olá!
Código: Selecionar todos
2026-08-23 17:01 UTC+0200 Itamar Lins <itamarlins at gmail.com>
* source/winapi/dialog.c
- s_DlgProc(), s_PSPProc(): fixed WM_DESTROY handler unconditionally
decrementing iDialogs/shifting aDialogs[] even when the closing
hWnd was not found in the array, silently corrupting the modeless
dialog/property-sheet-page tracking array; the array is now only
touched when the handle is actually located.
- s_DlgProc(), s_PSPProc(): the PHB_ITEM duplicate created by
SetWindowObject() at WM_INITDIALOG was never released, leaking
one Harbour item per created/destroyed dialog; it is now released
via hb_itemRelease() right after the WM_DESTROY event has been
dispatched to the .prg ONEVENT handler.
- HWG_DLGBOXINDIRECT(): validate hWndParent with IsWindow() before
passing it to DialogBoxIndirectParam(); falls back to the main
window handle (aWindows[0]) when the received parent no longer
refers to an existing window, instead of silently failing to
create the dialog (DialogBoxIndirectParam returning 0/-1 with
ERROR_INVALID_WINDOW_HANDLE / no error code at all). Logs the
failure (GetLastError) via hwg_writelog() when creation still
fails after the fallback.
- s_CreateDlgTemplate(), new s_FixupLargeCaptions(): the Windows
DLGTEMPLATE is a native 16-bit (WORD-addressed) structure; a
control caption larger than HWG_MAX_INLINE_CAPTION (2000 wide
chars) could overflow/corrupt the template buffer and make
DialogBoxIndirectParam()/CreateDialogIndirectParam() silently
fail to create the window. Such captions are now left empty in
the template and applied afterwards via WM_SETTEXT, once the
dialog and its child controls already exist (called from
WM_INITDIALOG in both s_ModalDlgProc() and s_DlgProc()).
Fixes report/preview dialogs failing to open when the embedded
text (e.g. a large EDITBOX report) exceeds the template's
structural limit.
* source/winapi/hdialog.prg
- METHOD FindDialog(): was only searching ::aDialogs (modeless
dialogs), never ::aModalDialogs, making it unable to resolve a
dialog passed explicitly to hwg_EndDialog(handle) whenever it
wasn't also the current Atail(aModalDialogs); now searches both
arrays.
- METHOD Activate(): after Hwg_DlgBoxIndirect(), if ::handle is
still empty (dialog window failed to be created), the object is
now removed from its tracking array (::DelItem()) immediately
instead of being left as an orphaned entry at the top of
aModalDialogs/aDialogs - which previously caused a later,
unrelated Close()/hwg_EndDialog() call to receive an empty
handle and fail with a parameter error.
2026-08-20 02:58 UTC-0200 Itamar Lins <itamarlins at gmail.com>
Win64 Portability & Memory Alignment Fixes
* source/winapi/dialog.c:
- Fixed critical 32-bit pointer truncation in s_lpwAlign() by replacing
legacy ULONG/ULONGLONG compiler-conditional guards with ULONG_PTR,
preventing C0000005 ACCESS_VIOLATION crashes under Win64 Clang environments.
- Upgraded dialog callback procedure signatures (s_ModalDlgProc, s_DlgProc,
s_PSPProc, s_PSPProcRelease) from LRESULT to INT_PTR to maintain stack
frame integrity on 64-bit systems.
- Fixed variable truncation for Harbour engine event handling by migrating
from 'long int' / hb_parnl() to LONG_PTR / hb_parnll().
- Refactored dynamic template handling in HWG_DLGBOXINDIRECT to utilize
explicit 64-bit casting and direct instance binding via GetModuleHandle(NULL).
* source/winapi/animat.c, draw.c, freeimg.c, misc.c, nice.c, resource.c, richedit.c, shellapi.c, window.c, wprint.c:
- Fixed widespread -Wint-to-pointer-cast and -Wpointer-to-int-cast warnings.
- Migrated API pointer/handle extractions from hb_parnl() to hb_parptr() or
HB_PARHANDLE() macros.
- Updated Windows API data mappings (e.g., EDITSTREAM.dwCookie mapped to
DWORD_PTR instead of DWORD).
- Fixed return macros by substituting invalid HB_RETHANDLE() usages on
pure logical indicators (e.g., ReleaseDC, DeleteEnhMetaFile) with hb_retl().
2026-08-17 21:58 UTC-0200 Itamar Lins <itamarlins at gmail.com>
* source/gtk/window.c: Updated HB_FUNC( HWG_ACTIVATEDIALOG ) to
receive and process the parent window handle parameter. Fixed
native GTK2 window modal and transient stacking layout chain by
applying gtk_window_set_modal() and gtk_window_set_transient_for().
Deferred the application input lock (gtk_grab_add) to the high-priority
idle cycle callback (gtk_shared_force_center_on_idle) to secure full
GtkMenuBar / background menus lockout right AFTER the asynchronous
Browse geometry allocation (introduced in r3852) completes its
lifecycle layout mapping. Ensured proper input recovery by calling
gtk_grab_remove() immediately upon nested gtk_main() termination.
2026-08-16 16:58 UTC-0200 Itamar Lins <itamarlins at gmail.com>
* source/gtk/window.c:
(HWG_ACTIVATEDIALOG): Injected a high-priority idle callback via g_idle_add_full
to force exact screen centering when the modal loop initiates, overriding
asynchronous layout shifts caused by packed controls.
* source/gtk/control.c:
(HWG_CREATEBROWSE): Removed gtk_main_iteration loop to prevent premature
event flushes from breaking dialog window alignment.
(HWG_SETADJOPTIONS): Re-enabled native adjustment changed notification signals.
* source/gtk/hbrowse.prg:
Fixed duplicate DATA declarations and mapped properties to proper uppercase.
Adjusted signal return values (retValue = 0) in hbrowse event loop to allow
proper GtkScrollbar allocation and render tracks correctly.
* source/gtk/hdialog.prg:
(InitModalDlg): Changed return statement from 1 to 0 to prevent the underlying
C engine from overriding position layout bounds after Center() execution.
(onPAINT): Removed infinite invalidation loop inside background canvas.