aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMathias Gumz <akira@fluxbox.org>2015-02-07 08:38:22 (GMT)
committerMathias Gumz <akira@fluxbox.org>2015-02-07 08:38:22 (GMT)
commit046092d16690c399758e04aa6e174d68dcc15cc6 (patch)
tree6e6f976ebc8702538219c8fd5204a0d5254bcece /src/FbTk
parent8834435bd0b2089875e1db9f1e74c3ef991012b1 (diff)
downloadfluxbox-046092d16690c399758e04aa6e174d68dcc15cc6.zip
fluxbox-046092d16690c399758e04aa6e174d68dcc15cc6.tar.bz2
Fix cleaning exposed menu items
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc54
1 files changed, 24 insertions, 30 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index c9220af..333da7b 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -1024,36 +1024,30 @@ void Menu::exposeEvent(XExposeEvent &ee) {
1024 m_title.win.clearArea(ee.x, ee.y, ee.width, ee.height); 1024 m_title.win.clearArea(ee.x, ee.y, ee.width, ee.height);
1025 } else if (ee.window == m_frame.win) { 1025 } else if (ee.window == m_frame.win) {
1026 1026
1027 // find where to clear 1027 // the menu has a list of items. the expose-event spans
1028 // this is a compilicated algorithm... lets do it step by step... 1028 // a number of columns across a number of rows
1029 // first... we see in which column the expose starts... and how many 1029 //
1030 // items down in that column 1030 // |item1|item4|item7| * - exposed items
1031 int column = (ee.x / m_item_w); 1031 // |item2|*tem5|*tem8| i
1032 int id = (ee.y / theme()->itemHeight()); 1032 // |item3|*tem6|*tem9| |
1033 1033 // j -> ts
1034 // next... figure out how many sublevels over the redrawspans 1034 //
1035 int column_d = ((ee.x + ee.width) / m_item_w); 1035
1036 1036 size_t item_h = theme()->itemHeight();
1037 // then we see how many items down to redraw 1037 size_t t = ((ee.x + ee.width) / m_item_w) + 1;
1038 int id_d = ((ee.y + ee.height) / theme()->itemHeight()); 1038 size_t row = ee.y / item_h;
1039 1039 size_t end_row = ((ee.y + ee.height) / item_h);
1040 if (id_d > m_rows_per_column) 1040
1041 id_d = m_rows_per_column; 1041 if (end_row > m_rows_per_column)
1042 1042 end_row = m_rows_per_column;
1043 // draw the columns and the number of items the exposure spans 1043
1044 int i, ii; 1044 for (size_t j = (ee.x / m_item_w); j < t; j++) {
1045 for (i = column; i <= column_d; i++) { 1045
1046 // set the iterator to the first item in the column needing redrawing 1046 size_t offset = j * m_rows_per_column;
1047 int index = id + i * m_rows_per_column; 1047 size_t s = end_row + offset;
1048 1048 s = std::min(m_items.size(), s);
1049 if (index < static_cast<int>(m_items.size()) && index >= 0) { 1049 for (size_t i = row + offset; i < s; i++ ) {
1050 size_t l = m_items.size(); 1050 clearItem(i);
1051 size_t j;
1052 for (j = 0, ii = id; ii <= id_d && j < l; i++, ii++) {
1053 int index = ii + (i * m_rows_per_column);
1054 // redraw the item
1055 clearItem(index);
1056 }
1057 } 1051 }
1058 } 1052 }
1059 } 1053 }