Compare commits

...

2 Commits

Author SHA1 Message Date
maxbyte9p
7b149594fe Make window start as a floating window because fuck i3 2024-05-22 13:39:22 -04:00
Redacted
350b12aa6d Update CMakeLists.txt 2024-05-22 12:19:16 -04:00
2 changed files with 90 additions and 81 deletions

View File

@@ -1,81 +1,81 @@
cmake_minimum_required(VERSION 3.20)
project(ReWindowLibrary
VERSION 1.0
LANGUAGES CXX
)
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-Source builds are not allowed")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enable Package Managers
include(cmake/CPM.cmake)
CPMAddPackage(
NAME J3ML
URL https://git.redacted.cc/josh/j3ml/archive/Release-3.zip
)
CPMAddPackage(
NAME Event
URL https://git.redacted.cc/josh/Event/archive/Release-5.zip
)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
include_directories(${J3ML_SOURCE_DIR}/include)
file(GLOB_RECURSE HEADERS "include/*.h" "include/*.hpp")
if(UNIX AND NOT APPLE)
file(GLOB_RECURSE SOURCES "src/rewindow/*.cpp" "src/linux/*.cpp")
endif()
if(WIN32)
file(GLOB_RECURSE SOURCES "src/rewindow/*.cpp" "src/windows/*.cpp")
endif()
include_directories("include")
if(UNIX)
add_library(ReWindowLibrary SHARED ${SOURCES})
endif()
if(WIN32)
add_library(ReWindowLibrary STATIC ${SOURCES})
endif()
target_include_directories(ReWindowLibrary PUBLIC ${Event_SOURCE_DIR}/include)
# Why god???
set_target_properties(ReWindowLibrary PROPERTIES LINKER_LANGUAGE CXX)
if(UNIX AND NOT APPLE)
target_link_libraries(ReWindowLibrary PUBLIC X11)
target_link_libraries(ReWindowLibrary PUBLIC ${OPENGL_LIBRARIES})
target_link_libraries(ReWindowLibrary PUBLIC J3ML)
target_link_libraries(ReWindowLibrary PUBLIC Event)
add_executable(ReWindowLibraryDemo main.cpp)
#target_include_directories(ReWindowLibraryDemo PRIVATE ${JGL_SOURCE_DIR}/include)
target_link_libraries(ReWindowLibraryDemo PUBLIC ReWindowLibrary)
#target_link_libraries(ReWindowLibraryDemo PRIVATE JGL)
endif()
if(WIN32)
#target_compile_options(ReWindowLibrary PRIVATE -Wno-multichar)
target_link_libraries(ReWindowLibrary PUBLIC ${OPENGL_LIBRARIES})
target_link_libraries(ReWindowLibrary PUBLIC J3ML)
target_link_libraries(ReWindowLibrary PUBLIC Event)
add_executable(ReWindowLibraryDemo main.cpp)
#target_compile_options(ReWindowLibraryDemo PRIVATE)
target_link_libraries(ReWindowLibraryDemo PUBLIC ReWindowLibrary)
cmake_minimum_required(VERSION 3.20)
project(ReWindowLibrary
VERSION 1.0
LANGUAGES CXX
)
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "In-Source builds are not allowed")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enable Package Managers
include(cmake/CPM.cmake)
CPMAddPackage(
NAME J3ML
URL https://git.redacted.cc/josh/j3ml/archive/Release-4.zip
)
CPMAddPackage(
NAME Event
URL https://git.redacted.cc/josh/Event/archive/Release-5.zip
)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
include_directories(${J3ML_SOURCE_DIR}/include)
file(GLOB_RECURSE HEADERS "include/*.h" "include/*.hpp")
if(UNIX AND NOT APPLE)
file(GLOB_RECURSE SOURCES "src/rewindow/*.cpp" "src/linux/*.cpp")
endif()
if(WIN32)
file(GLOB_RECURSE SOURCES "src/rewindow/*.cpp" "src/windows/*.cpp")
endif()
include_directories("include")
if(UNIX)
add_library(ReWindowLibrary SHARED ${SOURCES})
endif()
if(WIN32)
add_library(ReWindowLibrary STATIC ${SOURCES})
endif()
target_include_directories(ReWindowLibrary PUBLIC ${Event_SOURCE_DIR}/include)
# Why god???
set_target_properties(ReWindowLibrary PROPERTIES LINKER_LANGUAGE CXX)
if(UNIX AND NOT APPLE)
target_link_libraries(ReWindowLibrary PUBLIC X11)
target_link_libraries(ReWindowLibrary PUBLIC ${OPENGL_LIBRARIES})
target_link_libraries(ReWindowLibrary PUBLIC J3ML)
target_link_libraries(ReWindowLibrary PUBLIC Event)
add_executable(ReWindowLibraryDemo main.cpp)
#target_include_directories(ReWindowLibraryDemo PRIVATE ${JGL_SOURCE_DIR}/include)
target_link_libraries(ReWindowLibraryDemo PUBLIC ReWindowLibrary)
#target_link_libraries(ReWindowLibraryDemo PRIVATE JGL)
endif()
if(WIN32)
#target_compile_options(ReWindowLibrary PRIVATE -Wno-multichar)
target_link_libraries(ReWindowLibrary PUBLIC ${OPENGL_LIBRARIES})
target_link_libraries(ReWindowLibrary PUBLIC J3ML)
target_link_libraries(ReWindowLibrary PUBLIC Event)
add_executable(ReWindowLibraryDemo main.cpp)
#target_compile_options(ReWindowLibraryDemo PRIVATE)
target_link_libraries(ReWindowLibraryDemo PUBLIC ReWindowLibrary)
endif()

View File

@@ -26,6 +26,9 @@ XVisualInfo* visual;
XSetWindowAttributes xSetWindowAttributes;
XWindowAttributes windowAttributes;
Atom wmDeleteWindow;
// Make it start as floating because fuck tiling WMs
Atom windowTypeAtom;
Atom windowTypeUtilityAtom;
XSizeHints hints;
GLXContext glContext;
@@ -351,6 +354,12 @@ namespace ReWindow {
window = XCreateWindow(display, RootWindow(display, defaultScreen), 0, 0, width, height, 0, visual->depth,
InputOutput, visual->visual, CWBackPixel | CWColormap | CWBorderPixel | NoEventMask,
&xSetWindowAttributes);
// Set window to floating because fucking tiling WMs
windowTypeAtom = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
windowTypeUtilityAtom = XInternAtom(display, "_NET_WM_WINDOW_TYPE_UTILITY", False);
XChangeProperty(display, window, windowTypeAtom, XA_ATOM, 32, PropModeReplace,
(unsigned char *)&windowTypeUtilityAtom, 1);
//
XSelectInput(display, window,
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask |
@@ -399,4 +408,4 @@ namespace ReWindow {
}
// TODO: Implement ControllerButton map
}
}