diff options
| author | Eleni Maria Stea <elene.mst@gmail.com> | 2013-02-26 23:07:30 +0200 |
|---|---|---|
| committer | Eleni Maria Stea <elene.mst@gmail.com> | 2013-02-26 23:07:30 +0200 |
| commit | 906b341b177e5947710107eceb9ab2e4ee09528c (patch) | |
| tree | d3c6c2a1f1458d049c08c8d2ec353fc271b5e109 | |
| parent | d02747c88b1df856c5531cdc4b7af5b3ac8a0dc3 (diff) | |
fixed focus: get_window_at_pos now searches back to front in root_window
children
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | src/window.cc | 1 | ||||
| -rw-r--r-- | src/wm.cc | 17 | ||||
| -rw-r--r-- | src/wm.h | 1 |
4 files changed, 14 insertions, 9 deletions
@@ -17,8 +17,8 @@ else endif CXX = g++ -CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(inc) $(def) -LDFLAGS = $(libs) +CXXFLAGS = -pedantic -Wall $(dbg) $(opt) $(inc) $(def) `freetype-config --cflags` +LDFLAGS = $(libs) `freetype-config --libs` $(bin): $(obj) $(CXX) -o $@ $(obj) $(LDFLAGS) diff --git a/src/window.cc b/src/window.cc index ab1e3e7..768c2ea 100644 --- a/src/window.cc +++ b/src/window.cc @@ -102,6 +102,7 @@ void Window::draw(Rect *dirty_region) dirty = false; draw_children(abs_rect); + *dirty_region = rect_union(*dirty_region, abs_rect); } } @@ -221,19 +221,22 @@ Window *WindowManager::get_focused_window() Window *WindowManager::get_window_at_pos(int pointer_x, int pointer_y) { - std::list<Window*>::reverse_iterator rit = windows.rbegin(); - while(rit != windows.rend()) { - Window *w = *rit++; - Window *parent = w->get_parent(); - - if(parent == root_win && w->contains_point(pointer_x, pointer_y)) { - return w; + Window *root_win = wm->get_root_window(); + Window **children = root_win->get_children(); + for(int i=root_win->get_children_count() - 1; i>=0; i--) { + if(children[i]->contains_point(pointer_x, pointer_y)) { + return children[i]; } } return 0; } +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; @@ -44,6 +44,7 @@ public: Window *get_focused_window(); Window *get_window_at_pos(int pointer_x, int pointer_y); + Window *get_root_window() const; void set_focused_frame_color(int r, int g, int b); void get_focused_frame_color(int *r, int *g, int *b); |
