- fleshing out event system and window manager
- added tests back in for window management
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
namespace fennec {
|
||||
|
||||
window_manager::window_manager(platform* platform)
|
||||
: _platform(platform) {
|
||||
}
|
||||
: _platform(platform)
|
||||
, _commands(max_commands) {}
|
||||
|
||||
window_manager::~window_manager() {
|
||||
shutdown();
|
||||
@@ -95,7 +95,7 @@ void window_manager::dispatch() {
|
||||
_display->dispatch();
|
||||
}
|
||||
|
||||
window_manager::window_id window_manager::create_window(const window::config& config, window_id parent) {
|
||||
window_id window_manager::create_window(const window::config& config, window_id parent) {
|
||||
if (not _display) {
|
||||
return nullid;
|
||||
}
|
||||
@@ -104,7 +104,9 @@ window_manager::window_id window_manager::create_window(const window::config& co
|
||||
lock_guard guard(_lock);
|
||||
|
||||
window* p = parent == nullid ? nullptr : _windows[parent].get();
|
||||
return _windows.emplace(_display->create_window(config, p));
|
||||
window_id id = _windows.emplace(_display->create_window(config, p));
|
||||
_windows[id]->initialize();
|
||||
return id;
|
||||
}
|
||||
|
||||
void window_manager::begin(window_id window) {
|
||||
@@ -128,4 +130,52 @@ void window_manager::end(window_id window) {
|
||||
|
||||
_windows[window]->end_frame();
|
||||
}
|
||||
|
||||
void window_manager::close(window_id window) {
|
||||
if (not _display) {
|
||||
return;
|
||||
}
|
||||
|
||||
assertf(_thread == thread::current(), "Attempted to set window context on a different thread!");
|
||||
lock_guard guard(_lock);
|
||||
|
||||
_windows[window]->shutdown();
|
||||
_windows[window] = nullptr;
|
||||
_windows.erase(window);
|
||||
}
|
||||
|
||||
window_id window_manager::_parent(window_id) const {
|
||||
return nullid;
|
||||
}
|
||||
|
||||
window_id window_manager::_root(window_id) const {
|
||||
return nullid;
|
||||
}
|
||||
|
||||
ivec2 window_manager::_get_size(window_id id) const {
|
||||
return _windows[id]->get_size();
|
||||
}
|
||||
|
||||
ivec2 window_manager::_get_position(window_id id) const {
|
||||
return _windows[id]->get_position();
|
||||
}
|
||||
|
||||
bool window_manager::_check_state(window_id id, uint8_t state) const {
|
||||
switch (state) {
|
||||
case window::state_running: return _windows[id]->is_running();
|
||||
case window::state_child: return _windows[id]->is_child();
|
||||
case window::state_suspended: return _windows[id]->is_suspended();
|
||||
case window::state_visible: return _windows[id]->is_visible();
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool window_manager::_get_flag(window_id id, uint8_t flag) const {
|
||||
return _windows[id]->get_flag(flag);
|
||||
}
|
||||
|
||||
bool window_manager::_set_flag(window_id, uint8_t, bool) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // fennec
|
||||
Reference in New Issue
Block a user