Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ else()
endif()

add_custom_target(CopyHeader
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/olcPixelGameEngine3.h ${REPO_ROOT_DIR}/olcPixelGameEngine3.h
BYPRODUCTS ${REPO_ROOT_DIR}/olcPixelGameEngine3.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/olcPixelGameEngine3.h ${REPO_ROOT_DIR}/olcPixelGameEngine3.h
DEPENDS olcPixelGameEngine3.h
)

Expand Down
7 changes: 7 additions & 0 deletions dev/src/host_lin_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ namespace olc::host
return nullptr;
};

// Create a pollfd that we will use later to wait for events to appear on the queue
// preventing the event loop from becoming a busy loop
pollfd x11_connection_fd {.fd = ConnectionNumber(olc_Display), .events = POLLIN};

X11::XEvent xev;
while(systemActive){
while (XPending(olc_Display))
Expand Down Expand Up @@ -297,6 +301,9 @@ namespace olc::host
}
}
}

// Wait until an event appears on the x11 event queue file descriptor
poll(&x11_connection_fd, 1, -1);
}

systemActive = false;
Expand Down
1 change: 1 addition & 0 deletions dev/src/host_lin_x11.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

//! START DECLARATION
#include <GL/gl.h>
#include <poll.h>
namespace X11
{
#include <X11/X.h>
Expand Down
8 changes: 8 additions & 0 deletions olcPixelGameEngine3.h
Original file line number Diff line number Diff line change
Expand Up @@ -5965,6 +5965,7 @@ namespace olc
#if OLC_HOST == OLC_HOST_LINUX_X11

#include <GL/gl.h>
#include <poll.h>
namespace X11
{
#include <X11/X.h>
Expand Down Expand Up @@ -12365,6 +12366,10 @@ namespace olc::host
return nullptr;
};

// Create a pollfd that we will use later to wait for events to appear on the queue
// preventing the event loop from becoming a busy loop
pollfd x11_connection_fd {.fd = ConnectionNumber(olc_Display), .events = POLLIN};

X11::XEvent xev;
while(systemActive){
while (XPending(olc_Display))
Expand Down Expand Up @@ -12531,6 +12536,9 @@ namespace olc::host
}
}
}

// Wait until an event appears on the x11 event queue file descriptor
poll(&x11_connection_fd, 1, -1);
}

systemActive = false;
Expand Down
Loading