mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Merge upstream PDCurses changes.
This commit is contained in:
parent
74df004c9b
commit
89b7ee444f
13
src/3rdparty/win32_src/pdcurses/initscr.c
vendored
13
src/3rdparty/win32_src/pdcurses/initscr.c
vendored
@ -156,7 +156,7 @@ WINDOW *initscr(void)
|
||||
|
||||
if (SP && SP->alive)
|
||||
return NULL;
|
||||
SP = calloc(1, sizeof(SCREEN));
|
||||
SP = (SCREEN *)calloc(1, sizeof(SCREEN));
|
||||
assert( SP);
|
||||
if (!SP)
|
||||
return NULL;
|
||||
@ -274,13 +274,13 @@ WINDOW *initscr(void)
|
||||
|
||||
longname( );
|
||||
|
||||
SP->c_buffer = malloc(_INBUFSIZ * sizeof(int));
|
||||
SP->c_buffer = (int *)malloc(_INBUFSIZ * sizeof(int));
|
||||
if (!SP->c_buffer)
|
||||
return NULL;
|
||||
SP->c_pindex = 0;
|
||||
SP->c_gindex = 1;
|
||||
|
||||
SP->c_ungch = malloc(NUNGETCH * sizeof(int));
|
||||
SP->c_ungch = (int *)malloc(NUNGETCH * sizeof(int));
|
||||
if (!SP->c_ungch)
|
||||
return NULL;
|
||||
SP->c_ungind = 0;
|
||||
@ -334,13 +334,13 @@ SCREEN *newterm(const char *type, FILE *outfd, FILE *infd)
|
||||
return initscr() ? SP : NULL;
|
||||
}
|
||||
|
||||
SCREEN *set_term(SCREEN *new)
|
||||
SCREEN *set_term(SCREEN *new_scr)
|
||||
{
|
||||
PDC_LOG(("set_term() - called\n"));
|
||||
|
||||
/* We only support one screen */
|
||||
|
||||
return (new == SP) ? SP : NULL;
|
||||
return (new_scr == SP) ? SP : NULL;
|
||||
}
|
||||
|
||||
void delscreen(SCREEN *sp)
|
||||
@ -367,6 +367,9 @@ void delscreen(SCREEN *sp)
|
||||
optr->window_list[i]->_parent = NULL;
|
||||
while( optr->n_windows)
|
||||
delwin( optr->window_list[0]);
|
||||
/* With all windows deleted, the window */
|
||||
/* list should be empty. */
|
||||
assert( !optr->window_list);
|
||||
|
||||
PDC_free_atrtab( );
|
||||
stdscr = (WINDOW *)NULL;
|
||||
|
@ -1,8 +1,5 @@
|
||||
/* PDCurses */
|
||||
|
||||
#ifndef __PDC_WIN_H__
|
||||
#define __PDC_WIN_H__
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */
|
||||
#endif
|
||||
@ -36,5 +33,3 @@ extern short pdc_oldf, pdc_oldb, pdc_oldu;
|
||||
extern bool pdc_conemu, pdc_wt, pdc_ansi;
|
||||
|
||||
extern void PDC_blink_text(void);
|
||||
|
||||
#endif
|
@ -283,6 +283,11 @@ static LOGFONT PDC_get_logical_font( const int font_idx)
|
||||
|
||||
LOGFONT lf;
|
||||
|
||||
if ( PDC_font_size < 0)
|
||||
{
|
||||
PDC_font_size = scale_font_for_current_dpi( 12); /* default 12 points */
|
||||
}
|
||||
|
||||
memset(&lf, 0, sizeof(LOGFONT)); /* Clear out structure. */
|
||||
lf.lfHeight = -PDC_font_size;
|
||||
#ifdef PDC_WIDE
|
||||
|
16
src/3rdparty/win32_src/pdcurses/wingui/pdckbd.c
vendored
16
src/3rdparty/win32_src/pdcurses/wingui/pdckbd.c
vendored
@ -19,19 +19,15 @@ extern int PDC_key_queue[KEY_QUEUE_SIZE];
|
||||
|
||||
bool PDC_check_key(void)
|
||||
{
|
||||
MSG msg;
|
||||
extern HWND PDC_hWnd;
|
||||
|
||||
while( PeekMessage(&msg, PDC_hWnd, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE) )
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
PDC_napms(1);
|
||||
static int count;
|
||||
|
||||
if( PDC_key_queue_low != PDC_key_queue_high)
|
||||
return TRUE;
|
||||
if( count++ == 100)
|
||||
{
|
||||
count = 0;
|
||||
PDC_napms( 1);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
34
src/3rdparty/win32_src/pdcurses/wingui/pdcscrn.c
vendored
34
src/3rdparty/win32_src/pdcurses/wingui/pdcscrn.c
vendored
@ -1204,6 +1204,21 @@ void PDC_set_window_resized_callback(resize_callback_fnptr callback) {
|
||||
resize_callback = callback;
|
||||
}
|
||||
|
||||
/* Under Wine, it appears that the code to force the window size to be
|
||||
an integral number of columns and rows doesn't work. This is because
|
||||
WM_SIZING messages aren't sent. This appeared to be fixed as of Wine
|
||||
1.7.18, and Wine-specific code was removed at that point. The bug
|
||||
recrudesced in Wine 7.0.1.
|
||||
|
||||
Therefore, _in Wine only_, attempting to resize the window to be
|
||||
an exact number of rows/columns results in cascading resize attempts.
|
||||
So we check on initialization to see if we're in Wine; if we are,
|
||||
resizes are skipped. */
|
||||
|
||||
typedef const char *(CDECL *wine_version_func)(void);
|
||||
|
||||
static wine_version_func wine_version;
|
||||
|
||||
static void HandleSize( const WPARAM wParam, const LPARAM lParam)
|
||||
{
|
||||
static WPARAM prev_wParam = (WPARAM)-99;
|
||||
@ -1254,6 +1269,8 @@ static void HandleSize( const WPARAM wParam, const LPARAM lParam)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( wine_version)
|
||||
return;
|
||||
|
||||
add_resize_key = 1;
|
||||
if( wParam == SIZE_RESTORED &&
|
||||
@ -2235,7 +2252,24 @@ INLINE int set_up_window( void)
|
||||
|
||||
int PDC_scr_open(void)
|
||||
{
|
||||
const HMODULE hntdll = GetModuleHandle( _T("ntdll.dll"));
|
||||
const HMODULE shcoredll = GetModuleHandle(_T("Shcore.dll"));
|
||||
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
if( hntdll)
|
||||
wine_version = (wine_version_func)GetProcAddress(hntdll, "wine_get_version");
|
||||
|
||||
if ( shcoredll) {
|
||||
typedef HRESULT *(CDECL *set_process_dpi_awareness_t)(int);
|
||||
static set_process_dpi_awareness_t set_process_dpi_awareness_func;
|
||||
static int ADJUST_DPI_PER_MONITOR = 2;
|
||||
set_process_dpi_awareness_func = (set_process_dpi_awareness_t)GetProcAddress(shcoredll, "SetProcessDpiAwareness");
|
||||
if ( set_process_dpi_awareness_func) {
|
||||
set_process_dpi_awareness_func(ADJUST_DPI_PER_MONITOR);
|
||||
}
|
||||
}
|
||||
|
||||
COLORS = N_COLORS; /* should give this a try and see if it works! */
|
||||
if (!SP || PDC_init_palette( ))
|
||||
return ERR;
|
||||
|
@ -41,11 +41,7 @@
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(PDCURSES_WINCON) || defined(_CONSOLE)
|
||||
#define IDLE_TIMEOUT_MS 1
|
||||
#else
|
||||
#define IDLE_TIMEOUT_MS 0
|
||||
#endif
|
||||
#define IDLE_TIMEOUT_MS 1
|
||||
#define REDRAW_DEBOUNCE_MS 100
|
||||
#else
|
||||
#define IDLE_TIMEOUT_MS 75
|
||||
|
Loading…
Reference in New Issue
Block a user