using 2 windows, focus works
[winnie] / src / wm.h
1 #ifndef WM_H_
2 #define WM_H_
3
4 #include <list>
5
6 #include "geom.h"
7 #include "pixmap.h"
8
9 class Window;
10
11 class WindowManager {
12 private:
13         std::list<Window*> windows;
14
15         std::list<Rect> dirty_rects;
16
17         int bg_color[3];
18         int frame_thickness;
19         int titlebar_thickness;
20         int frame_fcolor[3];
21         int frame_ucolor[3];
22
23         Window *root_win;
24         Window *focused_win;
25         Window *grab_win;
26
27         Pixmap mouse_cursor;
28
29         void create_frame(Window *win);
30         void destroy_frame(Window *win);
31
32 public:
33         WindowManager();
34         ~WindowManager();
35
36         void invalidate_region(const Rect &rect);
37         void process_windows();
38
39         void add_window(Window *win);
40         void remove_window(Window *win);
41
42         void set_focused_window(Window *win);
43         const Window *get_focused_window() const;
44         Window *get_focused_window();
45
46         Window *get_window_at_pos(int pointer_x, int pointer_y);
47
48         void set_focused_frame_color(int r, int g, int b);
49         void get_focused_frame_color(int *r, int *g, int *b);
50
51         void set_unfocused_frame_color(int r, int g, int b);
52
53         Window *get_grab_window() const;
54
55         void grab_mouse(Window *win);
56         void release_mouse();
57 };
58
59 extern WindowManager *wm;
60
61 #endif  // WM_H_