+ root_win->remove_child(win);
+ root_win->add_child(win);
+}
+
+void WindowManager::sink_window(Window *win)
+{
+ if(!win) {
+ return;
+ }
+
+ std::list<Window*>::iterator it;
+ it = std::find(windows.begin(), windows.end(), win);
+ if(it != windows.end()) {
+ windows.erase(it);
+ windows.push_front(win);
+ }
+}
+
+static void display(Window *win)
+{
+ //frame display:
+ Window *child = win->get_children()[0];
+ int r, g, b;
+ Rect abs_rect = win->get_absolute_rect();
+
+ //TODO 5 not hardcoded
+ set_text_position(abs_rect.x + 5, abs_rect.y + 15);
+ set_text_color(255, 255, 255);
+
+ if(child == wm->get_focused_window()) {
+ wm->get_focused_frame_color(&r, &g, &b);
+ fill_rect(abs_rect, r, g, b);
+ }
+ else {
+ wm->get_unfocused_frame_color(&r, &g, &b);
+ fill_rect(win->get_absolute_rect(), r, g, b);
+ }
+
+ draw_text(child->get_title());