diff options
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/FbWindow.cc | 17 | ||||
-rw-r--r-- | src/FbTk/FbWindow.hh | 5 | ||||
-rw-r--r-- | src/FbTk/Menu.cc | 48 |
3 files changed, 42 insertions, 28 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc index 47e1399..5ebd9f2 100644 --- a/src/FbTk/FbWindow.cc +++ b/src/FbTk/FbWindow.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWindow.cc,v 1.32 2004/04/28 13:04:06 rathnor Exp $ | 22 | // $Id: FbWindow.cc,v 1.33 2004/05/17 15:01:32 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWindow.hh" | 24 | #include "FbWindow.hh" |
25 | 25 | ||
@@ -92,6 +92,7 @@ FbWindow::FbWindow(int screen_num, | |||
92 | unsigned int width, unsigned int height, | 92 | unsigned int width, unsigned int height, |
93 | long eventmask, | 93 | long eventmask, |
94 | bool override_redirect, | 94 | bool override_redirect, |
95 | bool save_unders, | ||
95 | int depth, | 96 | int depth, |
96 | int class_type): | 97 | int class_type): |
97 | m_parent(0), | 98 | m_parent(0), |
@@ -101,13 +102,14 @@ FbWindow::FbWindow(int screen_num, | |||
101 | 102 | ||
102 | create(RootWindow(FbTk::App::instance()->display(), screen_num), | 103 | create(RootWindow(FbTk::App::instance()->display(), screen_num), |
103 | x, y, width, height, eventmask, | 104 | x, y, width, height, eventmask, |
104 | override_redirect, depth, class_type); | 105 | override_redirect, save_unders, depth, class_type); |
105 | }; | 106 | }; |
106 | 107 | ||
107 | FbWindow::FbWindow(const FbWindow &parent, | 108 | FbWindow::FbWindow(const FbWindow &parent, |
108 | int x, int y, unsigned int width, unsigned int height, | 109 | int x, int y, unsigned int width, unsigned int height, |
109 | long eventmask, | 110 | long eventmask, |
110 | bool override_redirect, | 111 | bool override_redirect, |
112 | bool save_unders, | ||
111 | int depth, int class_type): | 113 | int depth, int class_type): |
112 | m_parent(&parent), | 114 | m_parent(&parent), |
113 | m_screen_num(parent.screenNumber()), | 115 | m_screen_num(parent.screenNumber()), |
@@ -115,7 +117,7 @@ FbWindow::FbWindow(const FbWindow &parent, | |||
115 | m_buffer_pm(0) { | 117 | m_buffer_pm(0) { |
116 | 118 | ||
117 | create(parent.window(), x, y, width, height, eventmask, | 119 | create(parent.window(), x, y, width, height, eventmask, |
118 | override_redirect, depth, class_type); | 120 | override_redirect, save_unders, depth, class_type); |
119 | 121 | ||
120 | 122 | ||
121 | }; | 123 | }; |
@@ -432,7 +434,7 @@ void FbWindow::updateGeometry() { | |||
432 | void FbWindow::create(Window parent, int x, int y, | 434 | void FbWindow::create(Window parent, int x, int y, |
433 | unsigned int width, unsigned int height, | 435 | unsigned int width, unsigned int height, |
434 | long eventmask, bool override_redirect, | 436 | long eventmask, bool override_redirect, |
435 | int depth, int class_type) { | 437 | bool save_unders, int depth, int class_type) { |
436 | 438 | ||
437 | 439 | ||
438 | if (s_display == 0) | 440 | if (s_display == 0) |
@@ -449,6 +451,11 @@ void FbWindow::create(Window parent, int x, int y, | |||
449 | values.override_redirect = True; | 451 | values.override_redirect = True; |
450 | } | 452 | } |
451 | 453 | ||
454 | if (save_unders) { | ||
455 | valmask |= CWSaveUnder; | ||
456 | values.save_under = True; | ||
457 | } | ||
458 | |||
452 | m_window = XCreateWindow(s_display, parent, x, y, width, height, | 459 | m_window = XCreateWindow(s_display, parent, x, y, width, height, |
453 | 0, // border width | 460 | 0, // border width |
454 | depth, // depth | 461 | depth, // depth |
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh index 045356f..3c5dabb 100644 --- a/src/FbTk/FbWindow.hh +++ b/src/FbTk/FbWindow.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWindow.hh,v 1.29 2004/04/28 13:04:06 rathnor Exp $ | 22 | // $Id: FbWindow.hh,v 1.30 2004/05/17 15:01:32 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef FBTK_FBWINDOW_HH | 24 | #ifndef FBTK_FBWINDOW_HH |
25 | #define FBTK_FBWINDOW_HH | 25 | #define FBTK_FBWINDOW_HH |
@@ -55,6 +55,7 @@ public: | |||
55 | FbWindow(int screen_num, | 55 | FbWindow(int screen_num, |
56 | int x, int y, unsigned int width, unsigned int height, long eventmask, | 56 | int x, int y, unsigned int width, unsigned int height, long eventmask, |
57 | bool overrride_redirect = false, | 57 | bool overrride_redirect = false, |
58 | bool save_unders = false, | ||
58 | int depth = CopyFromParent, | 59 | int depth = CopyFromParent, |
59 | int class_type = InputOutput); | 60 | int class_type = InputOutput); |
60 | 61 | ||
@@ -63,6 +64,7 @@ public: | |||
63 | unsigned int width, unsigned int height, | 64 | unsigned int width, unsigned int height, |
64 | long eventmask, | 65 | long eventmask, |
65 | bool overrride_redirect = false, | 66 | bool overrride_redirect = false, |
67 | bool save_unders = false, | ||
66 | int depth = CopyFromParent, | 68 | int depth = CopyFromParent, |
67 | int class_type = InputOutput); | 69 | int class_type = InputOutput); |
68 | 70 | ||
@@ -171,6 +173,7 @@ private: | |||
171 | void create(Window parent, int x, int y, unsigned int width, unsigned int height, | 173 | void create(Window parent, int x, int y, unsigned int width, unsigned int height, |
172 | long eventmask, | 174 | long eventmask, |
173 | bool override_redirect, | 175 | bool override_redirect, |
176 | bool save_unders, | ||
174 | int depth, | 177 | int depth, |
175 | int class_type); | 178 | int class_type); |
176 | static Display *s_display; ///< display connection | 179 | static Display *s_display; ///< display connection |
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index f6cbca4..60c40f8 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Menu.cc,v 1.59 2004/04/19 22:47:36 fluxgen Exp $ | 25 | // $Id: Menu.cc,v 1.60 2004/05/17 15:01:32 rathnor Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -122,7 +122,8 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
122 | menu.window = FbTk::FbWindow(tm.screenNum(), | 122 | menu.window = FbTk::FbWindow(tm.screenNum(), |
123 | 0, 0, 10, 10, | 123 | 0, 0, 10, 10, |
124 | event_mask, | 124 | event_mask, |
125 | true); // override redirect | 125 | true, // override redirect |
126 | true); // save_under | ||
126 | 127 | ||
127 | // strip focus change mask from attrib, since we should only use it with main window | 128 | // strip focus change mask from attrib, since we should only use it with main window |
128 | event_mask ^= FocusChangeMask; | 129 | event_mask ^= FocusChangeMask; |
@@ -143,7 +144,7 @@ Menu::Menu(MenuTheme &tm, ImageControl &imgctrl): | |||
143 | menu.frame = FbTk::FbWindow(menu.window, | 144 | menu.frame = FbTk::FbWindow(menu.window, |
144 | 0, menu.title_h, | 145 | 0, menu.title_h, |
145 | width(), menu.frame_h ? menu.frame_h : 1, | 146 | width(), menu.frame_h ? menu.frame_h : 1, |
146 | event_mask); | 147 | event_mask, false, true); |
147 | evm.add(*this, menu.frame); | 148 | evm.add(*this, menu.frame); |
148 | // update style | 149 | // update style |
149 | reconfigure(); | 150 | reconfigure(); |
@@ -1226,29 +1227,34 @@ void Menu::exposeEvent(XExposeEvent &ee) { | |||
1226 | // this is a compilicated algorithm... lets do it step by step... | 1227 | // this is a compilicated algorithm... lets do it step by step... |
1227 | // first... we see in which sub level the expose starts... and how many | 1228 | // first... we see in which sub level the expose starts... and how many |
1228 | // items down in that sublevel | 1229 | // items down in that sublevel |
1230 | |||
1231 | // Simon was here :-) I think this all makes much more sense when | ||
1232 | // we rename sbl to "start_col", sbl_d to "end_col", ditto id -> row | ||
1233 | // a "sublevel" is basically a column in a multi-column menu (e.g. placement) | ||
1234 | |||
1229 | if (menu.item_w == 0) | 1235 | if (menu.item_w == 0) |
1230 | menu.item_w = 1; | 1236 | menu.item_w = 1; |
1231 | if (menu.item_h == 0) | 1237 | if (menu.item_h == 0) |
1232 | menu.item_h = 1; | 1238 | menu.item_h = 1; |
1233 | unsigned int sbl = (ee.x / menu.item_w), id = (ee.y / menu.item_h), | 1239 | unsigned int |
1234 | // next... figure out how many sublevels over the redraw spans | 1240 | start_column = (ee.x / menu.item_w), |
1235 | sbl_d = ((ee.x + ee.width) / menu.item_w), | 1241 | end_column = ((ee.x + ee.width) / menu.item_w), |
1236 | // then we see how many items down to redraw | 1242 | start_row = (ee.y / menu.item_h), |
1237 | id_d = ((ee.y + ee.height) / menu.item_h); | 1243 | end_row = ((ee.y + ee.height) / menu.item_h); |
1238 | if (static_cast<signed>(id_d) > menu.persub) | 1244 | if (static_cast<signed>(end_row) > menu.persub) |
1239 | id_d = menu.persub; | 1245 | end_row = menu.persub; |
1240 | 1246 | ||
1241 | // draw the sublevels and the number of items the exposure spans | 1247 | // draw the sublevels and the number of items the exposure spans |
1242 | unsigned int i, ii; | 1248 | unsigned int col, row; |
1243 | int max_y = 0; | 1249 | int max_y = 0; |
1244 | for (i = sbl; i <= sbl_d; i++) { | 1250 | for (col = start_column; col <= end_column; col++) { |
1245 | // set the iterator to the first item in the sublevel needing redrawing | 1251 | // set the iterator to the first item in the column needing redrawing |
1246 | unsigned int index = id + i * menu.persub; | 1252 | unsigned int index = start_row + col * menu.persub; |
1247 | if (index < menuitems.size()) { | 1253 | if (index < menuitems.size()) { |
1248 | Menuitems::iterator it = menuitems.begin() + index; | 1254 | Menuitems::iterator it = menuitems.begin() + index; |
1249 | Menuitems::iterator it_end = menuitems.end(); | 1255 | Menuitems::iterator it_end = menuitems.end(); |
1250 | for (ii = id; ii <= id_d && it != it_end; ++it, ii++) { | 1256 | for (row = start_row; row <= end_row && it != it_end; ++it, row++) { |
1251 | unsigned int index = ii + (i * menu.persub); | 1257 | unsigned int index = row + (col * menu.persub); |
1252 | max_y = max(drawItem(index, | 1258 | max_y = max(drawItem(index, |
1253 | (which_sub == static_cast<signed>(index)), // highlight | 1259 | (which_sub == static_cast<signed>(index)), // highlight |
1254 | true, // clear | 1260 | true, // clear |
@@ -1257,12 +1263,10 @@ void Menu::exposeEvent(XExposeEvent &ee) { | |||
1257 | } | 1263 | } |
1258 | } | 1264 | } |
1259 | } | 1265 | } |
1260 | if (menu.persub != 0) { | 1266 | menu.frame.updateTransparent(start_column * menu.item_w, |
1261 | int index_min = id + sbl * menu.persub; | 1267 | start_row * menu.item_h, |
1262 | int min_y = (index_min - (index_min/menu.persub)*menu.persub) * menu.item_h; | 1268 | (end_column-start_column+1) * menu.item_w, |
1263 | menu.frame.updateTransparent(0, min_y, | 1269 | (end_row-start_row+1) * menu.item_h); |
1264 | width(), max_y + menu.item_h); | ||
1265 | } | ||
1266 | } | 1270 | } |
1267 | } | 1271 | } |
1268 | 1272 | ||