2022-10-17 19:57 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

82 views
Skip to first unread message

Przemyslaw Czerpak

unread,
Oct 17, 2022, 1:57:28 PM10/17/22
to harbou...@googlegroups.com
2022-10-17 19:57 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbvm.h
* include/harbour.hbx
* src/harbour.def
* src/vm/hvm.c
+ added new C function:
extern HB_EXPORT HB_BOOL hb_vmSetKeyPool( HB_BOOL fEnable );
It allows to disable keyboard pooling by GT driver in main HVM loop.
It's important in programs which mix GT terminal with GUI library
which use common event loop. Many GUI objects are not reentrant
safe and activating event loop during big changes may cause crash.
Such things can happen in applications which try to mix HBQT
and GTQTC. To avoid such problems before PRG code is called it's
enough to disable keyboard pooling in main HVM loop, eg.
if( hb_vmRequestReenter() )
{
HB_BOOL fKeyPool = hb_vmSetKeyPool( HB_FALSE );
hb_vmPushEvalSym();
hb_vmPush( pBlockItm );
hb_vmSend( 0 );
hb_vmSetKeyPool( fKeyPool );
hb_vmRequestRestore();
}
+ added new PRG function:
__vmKeyPool( [<fEnable>] ) -> <fPrevState>
It's PRG interface to above C function. If application uses GT driver
and GUI library using the same event loop and such GUI library does not
disable keyboard pooling in main HVM loop before PRG code is activated
then it's enough to call this function at the beginning of application,
eg.
PROCEDURE INIT Clip()
__vmKeyPool( .f. )
RETURN
With above peace of code you can mix HBQT or other QT wrapper with GTQTC.

best regards
Przemek

Pritpal Bedi

unread,
Oct 17, 2022, 2:32:52 PM10/17/22
to Harbour Developers
Thanks Pezemek

This commit will be extremely beneficial for HbQt applications. It will enhance smoothness of GUI and Inkey loops considerably.

Regards
Pritpal Bedi

Reply all
Reply to author
Forward
0 new messages