From 6cf7cd267b50fa68d7531655911620f17dde4a63 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 29 Jul 2024 23:03:57 -0400 Subject: window moving and focusing --- applications/goldman/source/renderer.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'applications/goldman/source/renderer.cpp') 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::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); -- cgit v1.2.3