mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 04:31:34 +08:00
Use the correct macro check if we are compiling for windows
This commit is contained in:
parent
a4461f4196
commit
a55baa1e9c
@ -13,7 +13,8 @@
|
||||
#include "ftxui/screen/string.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
@ -39,7 +40,7 @@ void CharToEventStream(Receiver<char> receiver, Sender<Event> sender) {
|
||||
Event::Convert(receiver, sender, c);
|
||||
}
|
||||
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
|
||||
void Win32EventListener(std::atomic<bool>* quit,
|
||||
Sender<char> char_sender,
|
||||
@ -162,7 +163,7 @@ void ScreenInteractive::PostEvent(Event event) {
|
||||
|
||||
void ScreenInteractive::Loop(Component* component) {
|
||||
// Save the old terminal configuration and restore it on exit.
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
// Enable VT processing on stdout and stdin
|
||||
auto stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
auto stdin_handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
@ -217,7 +218,7 @@ void ScreenInteractive::Loop(Component* component) {
|
||||
CharToEventStream, std::move(char_receiver), std::move(event_sender_1));
|
||||
|
||||
// Depending on the OS, start a thread that will produce events and/or chars.
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
auto event_sender_2 = event_receiver_->MakeSender();
|
||||
auto event_listener =
|
||||
std::thread(&Win32EventListener, &quit_, std::move(char_sender),
|
||||
|
@ -7,7 +7,8 @@
|
||||
#include "ftxui/screen/string.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
@ -75,7 +76,7 @@ Screen::Screen(int dimx, int dimy)
|
||||
dimx_(dimx),
|
||||
dimy_(dimy),
|
||||
pixels_(dimy, std::vector<Pixel>(dimx)) {
|
||||
#if defined(WIN32)
|
||||
#if defined(_WIN32)
|
||||
// The placement of this call is a bit weird, however we can assume that
|
||||
// anybody who instantiates a Screen object eventually wants to output
|
||||
// something to the console.
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
@ -18,7 +19,7 @@ namespace ftxui {
|
||||
Terminal::Dimensions Terminal::Size() {
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
return Dimensions{80, 43};
|
||||
#elif defined(WIN32)
|
||||
#elif defined(_WIN32)
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
int columns, rows;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user