Browse Source

Fixes for linux support

Sean Taylor 4 years ago
parent
commit
fdb84a3097

+ 2 - 1
.vscode/settings.json

@@ -128,7 +128,7 @@
 
     
     // For intellisense to work you need python 3.6 available on your system:
-    "python.pythonPath": "${workspaceFolder}/_build/host-deps/python", 
+    "python.pythonPath": "/usr/bin/python3", 
 
     // This enables python language server. Seems to work slightly better than jedi:
     "python.jediEnabled": false, 
@@ -144,4 +144,5 @@
     // Use flake8 for linting
     "python.linting.pylintEnabled": false,
     "python.linting.flake8Enabled": true,
+    "python.languageServer": "Microsoft",
 }

+ 17 - 8
build.py

@@ -75,23 +75,32 @@ if argc > 1:
 
 # generate/premake
 current_dir = os.getcwd()
-compiler_args = ""
 if sys.platform == "win32":
     compiler_args = "vs2019"
+elif sys.platform == "darwin":
+    compiler_args = "xcode4"
+else:
+    compiler_args = "gmake"
 tools_dir = os.path.join(current_dir, TOOLS_FOLDER)
-premake_proc = subprocess.Popen(f"{tools_dir}/premake/premake5 --file=premake5.lua {compiler_args}", cwd=current_dir)
+premake_proc = subprocess.Popen(f"{tools_dir}/premake/premake5 --file=premake5.lua {compiler_args}", cwd=current_dir, shell=True)
 premake_proc.wait()
 
-# compile/link
+# build
 if not generate_only:
     compiler_dir =  os.path.join(current_dir, COMPILER_FOLDER)
     if sys.platform == "win32":
         compiler_dir = os.path.join(compiler_dir, "vs2019")
         init_vsvars()
         os.chdir(compiler_dir)
-        build_cmd = f"msbuild gameplay.sln /property:Configuration=Debug"
-        subprocess.run(build_cmd)
-        build_cmd = f"msbuild gameplay.sln /property:Configuration=Release"
-        subprocess.run(build_cmd)
+        subprocess.run("msbuild gameplay.sln /property:Configuration=Debug")
+        subprocess.run("msbuild gameplay.sln /property:Configuration=Release")
+    elif sys.platform == "darwin":
+        compiler_dir = os.path.join(compiler_dir, "xcode4")
+        os.chdir(compiler_dir)
+        subprocess.run("xcodebuild -workspace gameplay.xcworkspace -configuration Debug build")
+        subprocess.run("xcodebuild -workspace gameplay.xcworkspace -configuration Release build")
     else:
-        pass
+        compiler_dir = os.path.join(compiler_dir, "gmake")
+        os.chdir(compiler_dir)
+        subprocess.run("make config=debug_x86_64", shell=True)
+        subprocess.run("make config=release_x86_64", shell=True)

+ 1 - 1
build.sh

@@ -1,4 +1,4 @@
 #!/bin/bash
 set -e
-exec /usr/bin/python build.py
+exec /usr/bin/python3 build.py
 read  -n 1 -p "Press any key to continue . . ." mainmenuinput

+ 1 - 1
include/gameplay/App.h

@@ -33,7 +33,7 @@ public:
 	/**
 	 * Gets the application instance.
      *
-     * @return the application instance
+     * @return The application instance
 	 */
 	static App* get_app();
 

+ 4 - 7
include/gameplay/Defines.h

@@ -126,16 +126,13 @@
 #   error Unsupported compiler
 #endif
 
-#if GP_PLATFORM_WINDOWS
-#   ifdef GP_EXPORT
-#       define GP_API GP_DECLSPEC(dllexport)
-#   else
-#       define GP_API GP_DECLSPEC(dllimport)
-#   endif
+#ifdef GP_EXPORT
+#   define GP_API GP_DECLSPEC(dllexport) GP_ATTRIBUTE(visibility("default"))
 #else
-#   define GP_API
+#   define GP_API GP_DECLSPEC(dllimport)
 #endif
 
+
 #define GP_NOINLINE GP_ATTRIBUTE(noinline) GP_DECLSPEC(noinline)
 #define GP_DEPRECATED(msg) GP_ATTRIBUTE(deprecated(msg)) GP_DECLSPEC(deprecated(msg))
 

+ 0 - 10
include/gameplay/Input.h

@@ -16,16 +16,6 @@ enum class CursorMode : uint32_t
     DISABLED
 };
 
-enum class CursorShape : uint32_t
-{
-    ARROW,
-    IBEAM,
-    CROSSHAIR,
-    HAND,
-    HRESIZE,
-    VRESIZE
-};
-
 enum class Key : uint32_t
 {
     KEY_UNKNOWN,

+ 2 - 1
include/gameplay/Logging.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include "App.h"
+#define SPDLOG_HEADER_ONLY
 #include <spdlog/spdlog.h>
 
 #define GP_LOG_TRACE SPDLOG_TRACE
@@ -36,7 +37,7 @@ class GP_API Logging
     friend class App;
 public:
 
-    enum class Level
+    enum class Level : uint32_t
     {
         LEVEL_TRACE,
         LEVEL_DEBUG,

+ 11 - 3
include/gameplay/Windowing.h

@@ -41,7 +41,15 @@ struct WindowDesc
     WindowHints hints;
 };
 
-
+enum class CursorStandardShape : uint32_t
+{
+    ARROW,
+    IBEAM,
+    CROSSHAIR,
+    HAND,
+    HRESIZE,
+    VRESIZE
+};
 /**
  * Defines the windowing system for window management.
  */
@@ -105,12 +113,12 @@ public:
     Signal<Monitor*, MonitorChangeEvent> on_monitor_change;
 
     /**
-     * Creates a cursor for the specified (standard) cursor shape.
+     * Creates a cursor for the standard cursor shape.
      *
      * @param shape The (standard) cursor shape.
      * @return The cursor created.
      */
-    Cursor* create_cursor(CursorShape shape);
+    Cursor* create_cursor(CursorStandardShape shape);
 
     /**
      * Creates a cursor for an pixmap image data.

+ 4 - 0
prebuild.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+set -e
+exec /usr/bin/python3 build.py -g
+read  -n 1 -p "Press any key to continue . . ." mainmenuinput

+ 30 - 23
premake5.lua

@@ -1,18 +1,22 @@
 workspace "gameplay"
 
+    local project_action = "UNDEFINED"
+    if _ACTION ~= nill then project_action = _ACTION end
+    
     local platform = "%{cfg.system}-%{cfg.platform}"
-    local target_dir = "_build/"..platform.."/%{cfg.buildcfg}"
-    local workspace_dir = "_compiler/".._ACTION
-    local deps_dir = "_deps"
-    local vulkan_sdk_dir = os.getenv("VULKAN_SDK")
 
+    local target_dir = path.join(os.getcwd(), "_build/"..platform.."/%{cfg.buildcfg}")
+    local workspace_dir = path.join(os.getcwd(), "_compiler/"..project_action)
+    local deps_dir = path.join(os.getcwd(), "_deps")
+    local vulkan_sdk_dir = os.getenv("VULKAN_SDK")
+   
     configurations { "debug", "release" }
     startproject "gameplay.editor"
     location (workspace_dir)
     targetdir (target_dir)
     objdir("_build/tmp/%{cfg.system}/%{prj.name}")
     symbols "On"
-    exceptionhandling "Off"
+    exceptionhandling "On"
     rtti "On"
     staticruntime "On"
     flags { "FatalCompileWarnings", "MultiProcessorCompile", "NoPCH", "UndefinedIdentifiers", "NoIncrementalLink" }
@@ -31,8 +35,7 @@ workspace "gameplay"
     filter { "system:linux" }
         platforms { "x86_64" }
         defaultplatform "x86_64"
-        buildoptions { "-fvisibility=hidden -D_FILE_OFFSET_BITS=64" }
-        linkoptions { "-Wl,-rpath, '$$ORIGIN' -Wl, --export-dynamic" }
+        buildoptions { "-fvisibility=hidden -D_FILE_OFFSET_BITS=64 -fPIC" }
         enablewarnings { "all", "vla" }
         disablewarnings { "error=unused-variable" }
     filter { "system:linux", "configurations:debug" }
@@ -58,29 +61,34 @@ workspace "gameplay"
         includedirs {
             "include/gameplay",
             "source/gameplay",
-            vulkan_sdk_dir.."/Include",
+            vulkan_sdk_dir.."/include",
             deps_dir.."/imgui", 
             deps_dir.."/freetype/include",
             deps_dir.."/spdlog/include",
-            deps_dir.."/glfw/include",
-            deps_dir.."/glm/include",
             deps_dir.."/cpptoml/include",
             deps_dir.."/stb/include",
+            deps_dir.."/glfw/include",
+            deps_dir.."/glm/include",
         }
-        libdirs { 
-            target_dir,
+        libdirs {
             vulkan_sdk_dir.."/lib",
-            deps_dir.."/freetype/bin/"..platform.."/%{cfg.buildcfg}",
-            deps_dir.."/glfw/bin/"..platform.."/%{cfg.buildcfg}",
-            
         }
-        links { "vulkan-1", "freetype", "glfw3" }
-        filter { "system:windows", "platforms:x86_64" }
-            links { "opengl32", "user32", "gdi32", "shell32", "kernel32", "pathcch" }
+        links { "freetype", "glfw3" }
+        linkoptions { "-export-dynamic" }
+        filter { "system:windows" }
+            libdirs {
+                deps_dir.."/freetype/bin/"..platform.."/%{cfg.buildcfg}",
+                deps_dir.."/glfw/bin/"..platform.."/%{cfg.buildcfg}",
+            }
+            links { "vulkan-1", "opengl32", "user32", "gdi32", "shell32", "kernel32", "pathcch" }
         filter { "system:linux" }
+            libdirs {
+                deps_dir.."/freetype/bin/"..platform,
+                deps_dir.."/glfw/bin/"..platform,
+            }
+            links { "vulkan", "dl", "pthread", "X11", "z"}
             buildoptions { "-pthread" }
-            links { "dl", "pthread" }
-            disablewarnings { "error=unused-function" }
+            disablewarnings { "unused-function", "unused-value", "unused-but-set-variable" }
         filter {}
         files {
             "include/gameplay/*.*", 
@@ -102,15 +110,14 @@ workspace "gameplay"
         }
 
     project "gameplay.editor"
+        dependson( "gameplay" )
         kind "ConsoleApp"
         location (workspace_dir.."/%{prj.name}")
         includedirs("include")
         libdirs { target_dir }
         links { "gameplay" }
         filter { "system:linux" }
-            buildoptions { "-pthread" }
             links { "dl", "pthread" }
-            disablewarnings { "error=unused-function" }
+            buildoptions { "-pthread" }
         filter {}
         files { "source/gameplay.editor/*.cpp" }
-

+ 1 - 4
setup.bat

@@ -2,7 +2,6 @@
 rem
 rem setup.bat 
 rem
-
 rem Tools
 set install_path=%cd%\_tools
 set package_url=https://github.com/gameplay3d/gameplay-deps/releases/download/v4.0.0/
@@ -15,7 +14,6 @@ powershell -Command "([Net.ServicePointManager]::SecurityProtocol=\"tls12, tls11
 echo Extracting %filename%.zip... please standby...
 powershell -Command "Expand-Archive %filename%.zip -Force -DestinationPath %install_path%" 
 powershell -Command "Remove-Item %filename%.zip -Force"
-
 rem Dependencies
 set install_path=%cd%\\_deps
 set package_url=https://github.com/gameplay3d/gameplay/releases/download/v4.0.0/
@@ -27,5 +25,4 @@ powershell -Command "([Net.ServicePointManager]::SecurityProtocol=\"tls12, tls11
 echo Extracting %filename%.zip... please standby...
 powershell -Command "Expand-Archive %filename%.zip -Force -DestinationPath %install_path%" 
 powershell -Command "Remove-Item %filename%.zip -Force"
-
-rem Done.
+echo Done.

+ 23 - 19
setup.sh

@@ -1,28 +1,32 @@
 #!/bin/bash
 #
-# ./install.sh
+# ./setup.sh
 #
-# Download GamePlay dependencies and binaries from github releases and extracts from ZIP
-#
-# Helps prevent repo bloat due to large binary files
-#
-
-prefix=https://github.com/gameplay3d/GamePlay/releases/download/v4.0.0
-
-filename=gameplay-deps
-
 if [ "$(uname)" == "Darwin" ]; then
-    filename+=-macos
+    platform=macos
 elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
-    filename+=-linux
+    platform=linux
 else
-    filename+=-windows
+    platform=windows
 fi
-
-echo Downloading $filename.zip from $prefix...
-curl -# -LO $prefix/$filename.zip
-echo Extracting $filename.zip... please standby...
-unzip -q $filename.zip
+# _tools
+mkdir -p _tools
+package_url=https://github.com/gameplay3d/gameplay-deps/releases/download/v4.0.0
+filename=premake-5.0.0-$platform.zip
+echo Downloading $filename from $package_url...
+curl -# -LO $package_url/$filename
+echo Extracting $filename... please standby...
+unzip -q $filename -d _tools
+echo Cleaning up...
+rm $filename
+# _deps
+mkdir -p _deps
+package_url=https://github.com/gameplay3d/gameplay/releases/download/v4.0.0
+filename=gameplay-deps-$platform.zip
+echo Downloading $filename from $prefix...
+curl -# -LO $package_url/$filename
+echo Extracting $filename... please standby...
+unzip -q $filename -d _deps
 echo Cleaning up...
-rm $filename.zip
+rm $filename
 echo Done.

+ 57 - 50
source/gameplay/FileSystem.cpp

@@ -60,6 +60,14 @@ struct File
     FileOp lastOp;
 };
 
+struct FileSystem::Impl
+{
+    std::string appExecutablePath = "";
+    std::string appDirectoryPath = "";
+    void update_cwd(const char* cwd);
+    char* cwd = nullptr;
+};
+
 typedef uint32_t WalkFlags;
 constexpr WalkFlags WALK_FLAGS_RECURSIVE = (1 << 0);
 constexpr WalkFlags WALK_FLAGS_SYMLINKS_ARE_FILES = (1 << 1);
@@ -76,20 +84,12 @@ static VisitAction __walk_directory_windows(const std::wstring& pathAbsW, const
 #elif GP_PLATFORM_LINUX
 static const size_t PATH_BUFFER_LEN = PATH_MAX + 1;;
 std::vector<std::string> __split_and_fix_linux_path(const std::string& path);
-static WalkAction __walk_directory_linux(const std::string& pathAbs, const std::string& parent, OnDirectoryItemFn fn , void* userPtr,
+static VisitAction __walk_directory_linux(const std::string& pathAbs, const std::string& parent, FileSystem::OnVisitDirectoryItemFn fn , void* userPtr,
                                           WalkFlags flags, std::list<std::string>* files, std::list<std::string>* directories);
 #endif
 static std::string __resolve_path(FileSystem* fileSystem, const char* relativeOrAbsolutePath, const char* base);
 static void __remove_duplicated_slashes(std::string& path);
 
-struct FileSystem::Impl
-{
-    std::string appExecutablePath = "";
-    std::string appDirectoryPath = "";
-    void update_cwd(const char* cwd);
-    char* cwd = nullptr;
-};
-
 //////////////////////////////////////////////////////////////////////////////
 // impl.
 
@@ -155,7 +155,7 @@ bool FileSystem::set_current_directory_path(const char* path)
     result = chdir(path);
     if (result == 0)
     {
-        _update_cwd(path);
+        _impl->update_cwd(path);
     }
     else
     {
@@ -194,8 +194,8 @@ const char* FileSystem::get_current_directory_path()
         GP_LOG_ERROR("Failed to retrieve the working directory.");
         return nullptr;
     }
-    _update_cwd(pathBuffer);
-    return _cwd;
+    _impl->update_cwd(pathBuffer);
+    return _impl->cwd;
 #endif
 }
 
@@ -421,7 +421,7 @@ time_t FileSystem::get_mod_time(const char* path)
     return std::mktime(&tm);
 #elif GP_PLATFORM_LINUX
     struct stat info;
-    stat(path.c_str(), &info);
+    stat(pathAbs.c_str(), &info);
     return info.st_mtime;
 #endif
 }
@@ -444,7 +444,7 @@ std::string FileSystem::get_canonical_path(const char* path, const char* base)
     }
 #else
     char buffer[PATH_MAX];
-    if (::realpath(path.c_str(), buffer) != nullptr)
+    if (::realpath(resolvedPath.c_str(), buffer) != nullptr)
     {
         canonicalPath = buffer;
     }
@@ -601,7 +601,7 @@ bool FileSystem::remove_directory(const char* path)
     std::list<std::string> files;
     std::list<std::string> directories;
     __walk_directory_linux(
-        path, path, nullptr, nullptr, WALK_FLAGS_RECURSIVE | WALK_FLAGS_SYMLINKS_ARE_FILES, &files, &directories);
+        path, path, nullptr, _impl, WALK_FLAGS_RECURSIVE | WALK_FLAGS_SYMLINKS_ARE_FILES, &files, &directories);
 
     for (std::string& file : files)
     {
@@ -731,6 +731,31 @@ bool FileSystem::copy(const char* src, const char* dst)
 #endif
 }
 
+#if GP_PLATFORM_LINUX
+static bool __get_file_info_linux(const char* path, FileInfo* info)
+{
+    struct stat buf;
+    if (stat(path, &buf) != 0)
+    {
+        return false;
+    }
+    info->type = !S_ISDIR(buf.st_mode) ? DirectoryItemType::FILE : DirectoryItemType::DIRECTORY;
+    info->modTime = buf.st_mtime;
+    info->createTime = buf.st_ctime;
+    info->size = size_t(buf.st_size);
+    // Use lstat to determine if it's a link
+    if (lstat(path, &buf) != 0)
+    {
+        info->symlink = false;
+    }
+    else
+    {
+        info->symlink = !!S_ISLNK(buf.st_mode);
+    }
+    return true;
+}
+#endif
+
 bool FileSystem::get_file_info(const char* path, FileInfo* info)
 {
     std::string pathAbs = __resolve_path(this, path, nullptr);
@@ -749,25 +774,7 @@ bool FileSystem::get_file_info(const char* path, FileInfo* info)
     info->symlink = !!(winInfo.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT);
     return true;
 #elif GP_PLATFORM_LINUX
-    struct stat buf;
-    if (stat(path, &buf) != 0)
-    {
-        return false;
-    }
-    info->type = !S_ISDIR(buf.st_mode) ? DirectoryItemType::eFile : DirectoryItemType::eDirectory;
-    info->modifiedTimestamp = buf.st_mtime;
-    info->createdTimestamp = buf.st_ctime;
-    info->size = size_t(buf.st_size);
-    // Use lstat to determine if it's a link
-    if (lstat(path, &buf) != 0)
-    {
-        info->isSymlink = false;
-    }
-    else
-    {
-        info->isSymlink = !!S_ISLNK(buf.st_mode);
-    }
-    return true;
+    return __get_file_info_linux(path, info);
 #endif
 }
 
@@ -1299,13 +1306,13 @@ std::vector<std::string> __split_and_fix_linux_path(const std::string& path)
     return components;
 }
 
-WalkAction __walk_directory_linux(const std::string& pathAbs,
-                                     const std::string& parent,
-                                     OnDirectoryItemFn fn,
-                                     void* userPtr,
-                                     WalkFlags flags,
-                                     std::list<std::string>* files = nullptr,
-                                     std::list<std::string>* directories = nullptr)
+VisitAction __walk_directory_linux(const std::string& pathAbs,
+                                   const std::string& parent,
+                                   FileSystem::OnVisitDirectoryItemFn fn,
+                                   void* userPtr,
+                                   WalkFlags flags,
+                                   std::list<std::string>* files = nullptr,
+                                   std::list<std::string>* directories = nullptr)
 {
     struct dirent* entry;
     DirectoryInfo info;
@@ -1325,9 +1332,9 @@ WalkAction __walk_directory_linux(const std::string& pathAbs,
             GP_LOG_ERROR("Failed to opendir() on '{}'. errno = {}", pathAbs.c_str(), errno);
             break;
         }
-        return WalkAction::CONTINUE;
+        return VisitAction::CONTINUE;
     }
-    WalkAction action = WalkAction::CONTINUE;
+    VisitAction action = VisitAction::CONTINUE;
     while ((entry = readdir(dir)) != nullptr)
     {
         std::string fileName = entry->d_name;
@@ -1371,28 +1378,28 @@ WalkAction __walk_directory_linux(const std::string& pathAbs,
                 {
                     directories->emplace_back(path);
                 }
-                action = WalkAction::CONTINIUE;
+                action = VisitAction::CONTINUE;
                 if (fn != nullptr)
                 {
                     // retrieve the directory's info.
-                    if (!get_file_info(&info, path))
+                    if (!__get_file_info_linux(path.c_str(), &info))
                     {
                         continue;
                     }
                     info.symlink = isSymlink;
 
                     // perform the callback for the directory.
-                    if ((action = fn(&info, userData)) == WalkAction::STOP)
+                    if ((action = fn(&info, userPtr)) == VisitAction::STOP)
                     {
                         break;
                     }
                 }
-                if ((flags & WALK_FLAGS_RECURSIVE) != 0 && action == WalkAction::CONTINUE)
+                if ((flags & WALK_FLAGS_RECURSIVE) != 0 && action == VisitAction::CONTINUE)
                 {
                     std::string childPathAbs = pathAbs;
                     childPathAbs.append("/");
                     childPathAbs.append(fileName);
-                    if ((action = __walk_directory_linux(childPathAbs, path, fn, userData, flags, files, directories)) == WalkAction::STOP)
+                    if ((action = __walk_directory_linux(childPathAbs, path, fn, userPtr, flags, files, directories)) == VisitAction::STOP)
                     {
                         break;
                     }
@@ -1408,13 +1415,13 @@ WalkAction __walk_directory_linux(const std::string& pathAbs,
             if (fn != nullptr)
             {
                 // retrieve the file's info.
-                if (!get_file_info(&info, path))
+                if (!__get_file_info_linux(path.c_str(), &info))
                     continue;
 
                 info.symlink = isSymlink;
 
                 // perform the callback for the file.
-                if ((action = fn(&info, userData)) != WalkAction::CONTINUE)
+                if ((action = fn(&info, userPtr)) != VisitAction::CONTINUE)
                 {
                     break;
                 }

+ 2 - 1
source/gameplay/Logging.cpp

@@ -138,8 +138,9 @@ Logging::Level Logging::get_level() const
         return Logging::Level::LEVEL_CRITICAL;
     case spdlog::level::off:
         return Logging::Level::LEVEL_OFF;
+    default:
+        return Logging::Level::LEVEL_INFO;
     }
-    return Logging::Level::LEVEL_INFO;
 }
 
 }

+ 1 - 1
source/gameplay/Path.cpp

@@ -1,7 +1,7 @@
 #include "Path.h"
 #include "Logging.h"
 #include "Unicode.h"
-#ifdef GP_PLATFORM_WINDOWS
+#if GP_PLATFORM_WINDOWS
 #   include <pathcch.h>
 #endif
 #include <functional>

+ 2 - 1
source/gameplay/Renderer.cpp

@@ -14,13 +14,14 @@ Renderer::~Renderer()
 
 void Renderer::startup()
 {
-    if (!glfwVulkanSupported())
+    /*if (!glfwVulkanSupported())
     {
         printf("GLFW: Vulkan not supported\n");
         return;
     }
     uint32_t extensionsCount = 0;
     const char** extensions = glfwGetRequiredInstanceExtensions(&extensionsCount);
+    */
 }
 
 void Renderer::shutdown()

+ 3 - 2
source/gameplay/Unicode.cpp

@@ -8,7 +8,7 @@
 
 namespace gameplay
 {
-
+#if GP_PLATFORM_WINDOWS
 class Locale
 {
 public:
@@ -107,8 +107,9 @@ void Unicode::convert_wide_string_to_cowercase_in_place(std::wstring& string)
 {
     _wcslwr_s_l(&string[0], string.size() + 1, _get_system_default_locale());
 }
+#endif
 
-inline std::string Unicode::convert_utf32_to_utf8(uint32_t codepoint)
+std::string Unicode::convert_utf32_to_utf8(uint32_t codepoint)
 {
     std::string u8str;
 #if GP_PLATFORM_WINDOWS

+ 10 - 10
source/gameplay/Windowing.cpp

@@ -330,7 +330,7 @@ Window* Windowing::create_window(const WindowDesc& desc)
 #if GP_PLATFORM_WINDOWS
     window->handle->platformWindow = glfwGetWin32Window(window->handle->glfwWindow);
  #elif GP_PLATFORM_LINUX
-    window->handle->platformWindow = glfwGetX11Window(window->handle);
+    window->handle->platformWindow = (void*)glfwGetX11Window(window->handle->glfwWindow);
     window->handle->platformDisplay = glfwGetX11Display();
 #endif
     // set fullscreen if enabled
@@ -399,7 +399,7 @@ Monitor* Windowing::get_monitor(Window* window)
     Int2 windowPos = window->get_pos();
     Int2 windowSize = window->get_size();
     int mostOverlap = 0;
-    for (int i = 0; i < _impl->monitors.size(); i++)
+    for (size_t i = 0; i < _impl->monitors.size(); i++)
     {
         Monitor* monitor = _impl->monitors[i];
         Int2 monitorPos = monitor->get_pos();
@@ -407,7 +407,7 @@ Monitor* Windowing::get_monitor(Window* window)
         Int2 windowPosSize;
         windowPosSize.x = windowPos.x + windowSize.x;
         windowPosSize.y = windowPos.y + windowSize.y;
-        int overlap = __get_rect_overlap(windowPos, windowSize, monitorPos, monitorSize);
+        int overlap = __get_rect_overlap(windowPosSize, windowSize, monitorPos, monitorSize);
         if (mostOverlap < overlap)
         {
             mostOverlap = overlap;
@@ -430,28 +430,28 @@ Monitor** Windowing::get_monitors(size_t* monitorCount)
     return _impl->monitors.data();
 }
 
-Cursor* Windowing::create_cursor(CursorShape shape)
+Cursor* Windowing::create_cursor(CursorStandardShape shape)
 {
     Cursor* cursor = nullptr;
     GLFWcursor* glfwCursor = nullptr;
     switch (shape)
     {
-    case CursorShape::ARROW:
+    case CursorStandardShape::ARROW:
         glfwCursor = glfwCreateStandardCursor(GLFW_ARROW_CURSOR);
         break;
-    case CursorShape::IBEAM:
+    case CursorStandardShape::IBEAM:
         glfwCursor = glfwCreateStandardCursor(GLFW_IBEAM_CURSOR);
         break;
-    case CursorShape::CROSSHAIR:
+    case CursorStandardShape::CROSSHAIR:
         glfwCursor = glfwCreateStandardCursor(GLFW_CROSSHAIR_CURSOR);
         break;
-    case CursorShape::HAND:
+    case CursorStandardShape::HAND:
         glfwCursor = glfwCreateStandardCursor(GLFW_HAND_CURSOR);
         break;
-    case CursorShape::HRESIZE:
+    case CursorStandardShape::HRESIZE:
         glfwCursor = glfwCreateStandardCursor(GLFW_HRESIZE_CURSOR);
         break;
-    case CursorShape::VRESIZE:
+    case CursorStandardShape::VRESIZE:
         glfwCursor = glfwCreateStandardCursor(GLFW_VRESIZE_CURSOR);
         break;
     default: