diff options
author | Benji Dial <benji@benjidial.net> | 2024-07-29 23:03:57 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-07-29 23:03:57 -0400 |
commit | 6cf7cd267b50fa68d7531655911620f17dde4a63 (patch) | |
tree | e936ab19c3176d1c5eced6e17847550ed1f420e3 /applications/goldman/source/renderer.cpp | |
parent | c34b9191f258ddc15c5b45c000cd0266aed9dead (diff) | |
download | hilbert-os-6cf7cd267b50fa68d7531655911620f17dde4a63.tar.gz |
window moving and focusing
Diffstat (limited to 'applications/goldman/source/renderer.cpp')
-rw-r--r-- | applications/goldman/source/renderer.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/applications/goldman/source/renderer.cpp b/applications/goldman/source/renderer.cpp index 7a5e6b5..4d9beda 100644 --- a/applications/goldman/source/renderer.cpp +++ b/applications/goldman/source/renderer.cpp @@ -49,14 +49,15 @@ void renderer::do_render() { double_buffer.copy_from(background, 0, 0); - for (auto it = windows.begin(); it != windows.end(); ++it) - + for (auto it = windows.begin(); it != windows.end(); ++it) { + int tx = (*it)->x, ty = (*it)->y, fx = 0, fy = 0; + int w = (*it)->contents_with_decorations.width; + int h = (*it)->contents_with_decorations.height; + daguerre::make_safe(tx, fx, w, 0, double_buffer.width); + daguerre::make_safe(ty, fy, h, 0, double_buffer.height); double_buffer.copy_from( - (*it)->contents_with_decorations, (*it)->x, (*it)->y, 0, 0, - std::min((*it)->contents_with_decorations.width, - double_buffer.width - (*it)->x), - std::min((*it)->contents_with_decorations.height, - double_buffer.height - (*it)->y)); + (*it)->contents_with_decorations, tx, ty, fx, fy, w, h); + } double_buffer.convert_from( cursor_background, cursor, cursor_x, cursor_y, 0, 0, @@ -79,6 +80,11 @@ void renderer::do_render() { } } +void renderer::get_cursor(int &x_out, int &y_out) { + x_out = cursor_x; + y_out = cursor_y; +} + void renderer::bump_cursor(int x_offset, int y_offset) { cursor_x += x_offset; @@ -95,6 +101,15 @@ void renderer::bump_cursor(int x_offset, int y_offset) { } +void renderer::move_window_to_front(std::list<window *>::iterator w) { + window *wp = *w; + windows.erase(w); + if (windows.size() != 0) + windows.back()->draw_decorations(false); + windows.push_back(wp); + wp->draw_decorations(true); +} + void renderer::add_window(window *w) { if (windows.size() != 0) windows.back()->draw_decorations(false); |