Skip to content

Commit

Permalink
Merge pull request #240 from clangen/clangen/upstream-master-plus-fixes
Browse files Browse the repository at this point in the history
Fix resizing issues, remove multi-threaded message handling from `WinGUI` variant
  • Loading branch information
Bill-Gray committed Jul 30, 2022
2 parents 3cc99c1 + fb8e990 commit 6962ab6
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 281 deletions.
2 changes: 2 additions & 0 deletions curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -1780,6 +1780,8 @@ PDCEX int PDC_set_function_key( const unsigned function,
const int new_key);
PDCEX int PDC_get_function_key( const unsigned function);

PDCEX void PDC_set_window_resized_callback(void (*callback)());

PDCEX WINDOW *Xinitscr(int, char **);
#ifdef XCURSES
PDCEX void XCursesExit(void);
Expand Down
3 changes: 0 additions & 3 deletions wingui/pdcdisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ int PDC_choose_a_new_font( void)
CHOOSEFONT cf;
int rval;
extern HWND PDC_hWnd;
extern CRITICAL_SECTION PDC_cs;

lf.lfHeight = -PDC_font_size;
debug_printf( "In PDC_choose_a_new_font: %d\n", lf.lfHeight);
Expand All @@ -252,9 +251,7 @@ int PDC_choose_a_new_font( void)
cf.Flags = CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_FIXEDPITCHONLY | CF_SELECTSCRIPT;
cf.hwndOwner = PDC_hWnd;
cf.lpLogFont = &lf;
LeaveCriticalSection(&PDC_cs);
rval = ChooseFont( &cf);
EnterCriticalSection(&PDC_cs);
if( rval) {
#ifdef PDC_WIDE
wcscpy( PDC_font_name, lf.lfFaceName);
Expand Down
11 changes: 6 additions & 5 deletions wingui/pdckbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ void PDC_set_keyboard_binary(bool on)
extern int PDC_key_queue_low, PDC_key_queue_high;
extern int PDC_key_queue[KEY_QUEUE_SIZE];

/* PDCurses message/event callback */
/* Calling PDC_napms for one millisecond ensures that the message loop */
/* is called and messages in general, and keyboard events in particular, */
/* get processed. */

bool PDC_check_key(void)
{
extern CRITICAL_SECTION PDC_cs;

LeaveCriticalSection(&PDC_cs);
SwitchToThread( );
EnterCriticalSection(&PDC_cs);
PDC_napms( 1);
if( PDC_key_queue_low != PDC_key_queue_high)
return TRUE;
return FALSE;
Expand Down
Loading

0 comments on commit 6962ab6

Please sign in to comment.