X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fwindow.cc;h=768c2eaeaf8db0f9fb3df685809e4f46c1e411c7;hb=906b341b177e5947710107eceb9ab2e4ee09528c;hp=b5635ed856cda6afe04c1c2f9c8e05be74866d5c;hpb=981f0eab2195d34f7c186a2e3e891810e14ce5b4;p=winnie diff --git a/src/window.cc b/src/window.cc index b5635ed..768c2ea 100644 --- a/src/window.cc +++ b/src/window.cc @@ -1,4 +1,5 @@ #include +#include //TODO #include #include "gfx.h" @@ -86,30 +87,31 @@ const char *Window::get_title() const void Window::invalidate() { dirty = true; - Rect abs_rect = get_absolute_rect(); + Rect abs_rect = get_absolute_rect(); wm->invalidate_region(abs_rect); } -void Window::draw(const Rect &dirty_region) +void Window::draw(Rect *dirty_region) { - //TODO - //titlebar, frame - - Rect intersect = rect_intersection(rect, dirty_region); + Rect abs_rect = get_absolute_rect(); + Rect intersect = rect_intersection(abs_rect, *dirty_region); if(intersect.width && intersect.height) { if(callbacks.display) { callbacks.display(this); } dirty = false; - draw_children(rect); + draw_children(abs_rect); + + *dirty_region = rect_union(*dirty_region, abs_rect); } } void Window::draw_children(const Rect &dirty_region) { + Rect drect = dirty_region; for(size_t i=0; idraw(dirty_region); + children[i]->draw(&drect); } } @@ -145,6 +147,11 @@ bool Window::get_focusable() const return focusable; } +bool Window::get_dirty() const +{ + return dirty; +} + void Window::set_display_callback(DisplayFuncType func) { callbacks.display = func;