mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
get windows working once more
This commit is contained in:
parent
8f30a91d84
commit
bf2754cedb
@ -20,9 +20,7 @@ extern "C" {
|
||||
#include <libkern/OSByteOrder.h>
|
||||
#define htole(x) (OSSwapInt32(htonl(x)))
|
||||
#elif defined(__MINGW64__)
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#define htole(x) (_byteswap_ulong(htonl(x)))
|
||||
#define htole(x) (x) // FIXME
|
||||
// FIXME placeholders, need real solutions here
|
||||
#define wcwidth(w) 1
|
||||
#define wcswidth(w, s) (s)
|
||||
|
@ -24,6 +24,7 @@ int set_fd_nonblocking(int fd, unsigned state, unsigned* oldstate){ // FIXME
|
||||
(void)oldstate;
|
||||
return -1;
|
||||
}
|
||||
#define INFINITE 0xffffffff // FIXME
|
||||
pid_t waitpid(pid_t pid, int* state, int options){
|
||||
(void)options; // FIXME honor WNOHANG
|
||||
WaitForSingleObject(pid, INFINITE);
|
||||
|
@ -16,13 +16,13 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW64__
|
||||
#include <winsock2.h>
|
||||
#include <Lmcons.h>
|
||||
#define tcgetattr(x, y) -1
|
||||
#define tcsetattr(x, y, z) -1
|
||||
#define ECHO 0
|
||||
#define ICANON 0
|
||||
#define ICRNL 0
|
||||
#define INLCR 0
|
||||
#define ISIG 0
|
||||
#define TCSAFLUSH 0
|
||||
#define TCSANOW 0
|
||||
|
@ -13,6 +13,9 @@
|
||||
#elif !defined(__MINGW64__)
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <sysinfoapi.h>
|
||||
#endif
|
||||
#include <notcurses/direct.h>
|
||||
#include <notcurses/notcurses.h>
|
||||
|
@ -6,6 +6,9 @@
|
||||
#ifdef USING_PIDFD
|
||||
#error "USING_PIDFD was already defined; it should not be."
|
||||
#endif
|
||||
#ifdef __MINGW64__
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#if (defined(__linux__))
|
||||
#include <linux/wait.h>
|
||||
#include <asm/unistd.h>
|
||||
|
@ -1,3 +1,6 @@
|
||||
#ifdef __MINGW64__
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include "input.h"
|
||||
#include "internal.h"
|
||||
#include "notcurses/direct.h"
|
||||
@ -403,11 +406,19 @@ handle_getc(ncinputlayer* nc, int kpress, ncinput* ni, int leftmargin, int topma
|
||||
// (0 on timeout) or -1 on error/interruption.
|
||||
static int
|
||||
block_on_input(int fd, const struct timespec* ts){
|
||||
#ifndef __MINGW64__
|
||||
struct pollfd pfd = {
|
||||
.fd = fd,
|
||||
.events = POLLIN,
|
||||
.revents = 0,
|
||||
};
|
||||
#else
|
||||
WSAPOLLFD pfd = {
|
||||
.fd = fd,
|
||||
.events = POLLIN,
|
||||
.revents = 0,
|
||||
};
|
||||
#endif
|
||||
#ifdef POLLRDHUP
|
||||
pfd.events |= POLLRDHUP;
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
#include "internal.h"
|
||||
#include "windows.h"
|
||||
#include "input.h"
|
||||
#include "linux.h"
|
||||
|
||||
@ -264,6 +265,9 @@ static inline int
|
||||
init_terminfo_esc(tinfo* ti, const char* name, escape_e idx,
|
||||
size_t* tablelen, size_t* tableused){
|
||||
char* tstr;
|
||||
if(ti->escindices[idx]){
|
||||
return 0;
|
||||
}
|
||||
if(terminfostr(&tstr, name) == 0){
|
||||
if(grow_esc_table(ti, tstr, idx, tablelen, tableused)){
|
||||
return -1;
|
||||
@ -666,11 +670,13 @@ int interrogate_terminfo(tinfo* ti, int fd, unsigned utf8, unsigned noaltscreen,
|
||||
const char* tname = termname(); // longname() is also available
|
||||
queried_terminals_e qterm = TERMINAL_UNKNOWN;
|
||||
memset(ti, 0, sizeof(*ti));
|
||||
size_t tablelen = 0;
|
||||
size_t tableused = 0;
|
||||
#ifdef __APPLE__
|
||||
qterm = macos_early_matches(tname);
|
||||
(void)nonewfonts;
|
||||
#elif defined(__MINGW64__)
|
||||
if(prepare_windows_terminal(ti)){
|
||||
if(prepare_windows_terminal(ti, &tablelen, &tableused)){
|
||||
return -1;
|
||||
}
|
||||
qterm = TERMINAL_MSTERMINAL;
|
||||
@ -759,8 +765,6 @@ int interrogate_terminfo(tinfo* ti, int fd, unsigned utf8, unsigned noaltscreen,
|
||||
{ ESCAPE_U7, "u7", },
|
||||
{ ESCAPE_MAX, NULL, },
|
||||
};
|
||||
size_t tablelen = 0;
|
||||
size_t tableused = 0;
|
||||
for(typeof(*strtdescs)* strtdesc = strtdescs ; strtdesc->esc < ESCAPE_MAX ; ++strtdesc){
|
||||
if(init_terminfo_esc(ti, strtdesc->tinfo, strtdesc->esc, &tablelen, &tableused)){
|
||||
goto err;
|
||||
@ -789,11 +793,11 @@ int interrogate_terminfo(tinfo* ti, int fd, unsigned utf8, unsigned noaltscreen,
|
||||
ti->escindices[ESCAPE_SMCUP] = 0;
|
||||
ti->escindices[ESCAPE_RMCUP] = 0;
|
||||
}
|
||||
// ensure that the terminal provides automatic margins
|
||||
/* // ensure that the terminal provides automatic margins
|
||||
if(tigetflag("am") != 1){
|
||||
fprintf(stderr, "Required terminfo capability 'am' not defined\n");
|
||||
goto err;
|
||||
}
|
||||
} */
|
||||
if(get_escape(ti, ESCAPE_CIVIS) == NULL){
|
||||
char* chts;
|
||||
if(terminfostr(&chts, "chts") == 0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user