+Window *WindowManager::get_root_window() const
+{
+ return root_win;
+}
+
+void WindowManager::set_focused_frame_color(int r, int g, int b)
+{
+ frame_fcolor[0] = r;
+ frame_fcolor[1] = g;
+ frame_fcolor[2] = b;
+}
+
+void WindowManager::get_focused_frame_color(int *r, int *g, int *b) const
+{
+ *r = frame_fcolor[0];
+ *g = frame_fcolor[1];
+ *b = frame_fcolor[2];
+}
+
+void WindowManager::set_unfocused_frame_color(int r, int g, int b)
+{
+ frame_ucolor[0] = r;
+ frame_ucolor[1] = g;
+ frame_ucolor[2] = b;
+}
+
+void WindowManager::get_unfocused_frame_color(int *r, int *g, int *b) const
+{
+ *r = frame_ucolor[0];
+ *g = frame_ucolor[1];
+ *b = frame_ucolor[2];
+}
+
+Window *WindowManager::get_grab_window() const
+{
+ return grab_win;
+}
+
+void WindowManager::grab_mouse(Window *win)
+{
+ grab_win = win;
+}
+
+void WindowManager::release_mouse()
+{
+ grab_win = 0;
+}
+
+void WindowManager::raise_window(Window *win)
+{
+ if(!win) {
+ return;
+ }
+
+ Window *parent = win->get_parent();
+ if(parent != root_win) {
+ if(parent->get_parent() == root_win) {
+ win = parent;
+ }
+ else {
+ return;
+ }
+ }
+
+ 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);
+ }
+}
+