Skip to content

Commit

Permalink
simple-egl working
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Winarske <[email protected]>
  • Loading branch information
jwinarske committed Apr 25, 2024
1 parent 9c73f22 commit c2d01bb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 deletions.
18 changes: 8 additions & 10 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@ pkg_check_modules(GLESv2 IMPORTED_TARGET glesv2)
#
# simple-egl
#
if (OFF)
add_executable(simple-egl simple-egl.cc)
target_include_directories(simple-egl PRIVATE ${CMAKE_SOURCE_DIR}/include)
add_executable(simple-egl simple-egl.cc)
target_include_directories(simple-egl PRIVATE ${CMAKE_SOURCE_DIR}/include)

target_compile_definitions(simple-egl PRIVATE EGL_NO_X11 MESA_EGL_NO_X11_HEADERS)
target_compile_definitions(simple-egl PRIVATE EGL_NO_X11 MESA_EGL_NO_X11_HEADERS)

target_link_libraries(simple-egl PRIVATE waypp PkgConfig::GLESv2 cxxopts::cxxopts)
target_link_libraries(simple-egl PRIVATE waypp PkgConfig::GLESv2 cxxopts::cxxopts)

if (IPO_SUPPORT_RESULT)
set_property(TARGET simple-egl PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()

add_sanitizers(simple-egl)
if (IPO_SUPPORT_RESULT)
set_property(TARGET simple-egl PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()

add_sanitizers(simple-egl)

#
# simple-shm
#
Expand Down
38 changes: 21 additions & 17 deletions examples/simple-egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@
#include <cxxopts.hpp>
#include <sys/time.h>

#include <glm/ext/matrix_transform.hpp>
#include "window/xdg_toplevel.h"

#include "window_manager/registrar.h"
#include "window_manager/xdg_window_manager.h"
#include "window/window.h"

#include "config.h"
#include "logging.h"

static volatile bool running = true;
Expand Down Expand Up @@ -455,17 +450,26 @@ int main(int argc, char **argv) {
spdlog::info("vertical_bar: {}", config.vertical_bar);

XdgWindowManager wm;
auto window = wm.CreateTopLevel("simple-egl", config.width, config.height, WL_OUTPUT_TRANSFORM_NORMAL,
config.fullscreen,
config.maximized,
config.fullscreen_ratio, config.tearing, draw_frame,
kEglContextAttribs.data(), kEglContextAttribs.size(),
kEglConfigAttribs.data(), kEglConfigAttribs.size(),
config.buffer_bpp, config.interval);

while (running && wm.dispatch_pending() != -1) {
draw_frame(window, 0);
}
auto top_level = wm.CreateTopLevel("simple-egl",
config.width,
config.height,
0,
0,
config.fullscreen,
config.maximized,
config.fullscreen_ratio,
config.tearing,
draw_frame,
kEglContextAttribs.data(), kEglContextAttribs.size(),
kEglConfigAttribs.data(), kEglConfigAttribs.size(),
config.buffer_bpp, config.interval);

top_level->update_buffer_geometry();
top_level->start_frame_callbacks();

while (running && top_level->is_valid() && wm.display_dispatch() != -1) {}

top_level->stop_frame_callbacks();

return EXIT_SUCCESS;
}
7 changes: 1 addition & 6 deletions examples/simple-shm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

#include <cxxopts.hpp>

#include "window_manager/registrar.h"
#include "window_manager/xdg_window_manager.h"
#include "window/xdg_toplevel.h"

#include "config.h"
#include "logging.h"

typedef struct {
Expand All @@ -18,8 +15,6 @@ typedef struct {
bool tearing;
} CONFIGURATION_T;

std::unique_ptr<Logging> gLogging;

static volatile bool running = true;


Expand Down Expand Up @@ -106,7 +101,7 @@ void draw_frame(void *data, const uint32_t time) {

int main(int argc, char **argv) {

gLogging = std::make_unique<Logging>();
auto gLogging = std::make_unique<Logging>();

std::signal(SIGINT, handle_signal);

Expand Down

0 comments on commit c2d01bb

Please sign in to comment.