- testing for current threading structures
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <fennec/containers/dynarray.h>
|
||||
#include <fennec/containers/set.h>
|
||||
#include <fennec/core/event.h>
|
||||
#include <fennec/threading/mpscq.h>
|
||||
|
||||
namespace fennec
|
||||
{
|
||||
@@ -38,10 +39,4 @@ void event::remove_listener(event_listener* listener) {
|
||||
}
|
||||
}
|
||||
|
||||
void event::dispatch(event* event) {
|
||||
for (auto& it : listeners[event->get_type().id()]) {
|
||||
it->handle_event(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <fennec/platform/interface/platform.h>
|
||||
#include <fennec/platform/interface/display_server.h>
|
||||
#include <fennec/platform/interface/window.h>
|
||||
#include <fennec/threading/lock_guard.h>
|
||||
|
||||
namespace fennec {
|
||||
|
||||
@@ -85,7 +86,29 @@ void window_manager::shutdown() {
|
||||
void window_manager::dispatch() {
|
||||
assertf(_thread == thread::current(), "Attempted to dispatch Window Manager on a different thread!");
|
||||
|
||||
lock_guard guard(_lock);
|
||||
_display->dispatch();
|
||||
}
|
||||
|
||||
window_manager::window_id window_manager::create_window(const window::config& config, window_id parent) {
|
||||
assertf(_thread == thread::current(), "Attempted to create a window on a different thread!");
|
||||
|
||||
lock_guard guard(_lock);
|
||||
window* p = parent == nullid ? nullptr : _windows[parent].get();
|
||||
return _windows.emplace(_display->create_window(config, p));
|
||||
}
|
||||
|
||||
void window_manager::begin(window_id window) {
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
|
||||
lock_guard guard(_lock);
|
||||
_windows[window]->begin_frame();
|
||||
}
|
||||
|
||||
void window_manager::end(window_id window) {
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
|
||||
lock_guard guard(_lock);
|
||||
_windows[window]->end_frame();
|
||||
}
|
||||
} // fennec
|
||||
Reference in New Issue
Block a user