summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEleni Maria Stea <elene.mst@gmail.com>2013-02-26 23:07:30 +0200
committerEleni Maria Stea <elene.mst@gmail.com>2013-02-26 23:07:30 +0200
commit906b341b177e5947710107eceb9ab2e4ee09528c (patch)
treed3c6c2a1f1458d049c08c8d2ec353fc271b5e109
parentd02747c88b1df856c5531cdc4b7af5b3ac8a0dc3 (diff)
fixed focus: get_window_at_pos now searches back to front in root_window
children
-rw-r--r--Makefile4
-rw-r--r--src/window.cc1
-rw-r--r--src/wm.cc17
-rw-r--r--src/wm.h1
4 files changed, 14 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index a894e52..4242187 100644
--- a/Makefile
+++ b/Makefile
@@ -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);
}
}
diff --git a/src/wm.cc b/src/wm.cc
index c9b8959..056c6e7 100644
--- a/src/wm.cc
+++ b/src/wm.cc
@@ -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;
diff --git a/src/wm.h b/src/wm.h
index b675539..7e677c2 100644
--- a/src/wm.h
+++ b/src/wm.h
@@ -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);