Use new laf flags to detect platform in main and App

This commit is contained in:
David Capello 2021-06-16 17:21:02 -03:00
parent 61952bc45f
commit 5d97aed5e9
4 changed files with 21 additions and 11 deletions

2
laf

@ -1 +1 @@
Subproject commit 12dea43b35daf92a6087f3a980aff767ac0b7043
Subproject commit 7fc27270d53933f0b0fe62d6acc2deed0f4540fb

View File

@ -73,7 +73,17 @@ In Debug mode (`_DEBUG`):
# Detect Platform
You can check the platform using the following checks:
You can check the platform using some `laf` macros:
#if LAF_WINDOWS
// ...
#elif LAF_MACOS
// ...
#elif LAF_LINUX
// ...
#endif
Or using platform-specific macros:
#ifdef _WIN32
#ifdef _WIN64

View File

@ -69,8 +69,8 @@
#include "ui/ui.h"
#include "ver/info.h"
#ifdef __APPLE__
#include "os/osx/system.h"
#if LAF_MACOS
#include "os/osx/system.h"
#endif
#include <iostream>
@ -231,7 +231,7 @@ int App::initialize(const AppOptions& options)
m_isShell = options.startShell();
m_coreModules = new CoreModules;
#ifdef _WIN32
#if LAF_WINDOWS
if (options.disableWintab() ||
!preferences().experimental.loadWintabDriver() ||
preferences().tablet.api() == "pointer") {
@ -243,7 +243,7 @@ int App::initialize(const AppOptions& options)
system->setTabletAPI(os::TabletAPI::Wintab);
#endif
#ifdef __APPLE__
#if LAF_MACOS
if (!preferences().general.osxAsyncView())
os::osx_set_async_view(false);
#endif
@ -356,14 +356,14 @@ void App::run()
#ifdef ENABLE_UI
// Run the GUI
if (isGui()) {
#ifdef _WIN32
#if LAF_WINDOWS
// How to interpret one finger on Windows tablets.
ui::Manager::getDefault()->getDisplay()
->setInterpretOneFingerGestureAsMouseMovement(
preferences().experimental.oneFingerAsMouseMovement());
#endif
#if !defined(_WIN32) && !defined(__APPLE__)
#if LAF_LINUX
// Setup app icon for Linux window managers
try {
os::Display* display = os::instance()->defaultDisplay();

View File

@ -27,7 +27,7 @@
#include <ctime>
#include <iostream>
#ifdef _WIN32
#if LAF_WINDOWS
#include <windows.h>
#endif
@ -44,7 +44,7 @@ namespace {
#endif
};
#ifdef _WIN32
#if LAF_WINDOWS
// Successful calls to CoInitialize() (S_OK or S_FALSE) must match
// the calls to CoUninitialize().
// From: https://docs.microsoft.com/en-us/windows/win32/api/combaseapi/nf-combaseapi-couninitialize#remarks
@ -74,7 +74,7 @@ int app_main(int argc, char* argv[])
// Initialize the random seed.
std::srand(static_cast<unsigned int>(std::time(nullptr)));
#ifdef _WIN32
#if LAF_WINDOWS
CoInit com; // To create COM objects
#endif