aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-30 01:03:48 (GMT)
committerfluxgen <fluxgen>2003-08-30 01:03:48 (GMT)
commit685a3e36b36b5181cdcb10c762b3a190f50b1255 (patch)
tree384593a8fdc7d20658d7a69ce6adaba6793ce327 /src/FbTk
parenta8ea48df6e675905d36c8b6f42f122032887190b (diff)
downloadfluxbox-685a3e36b36b5181cdcb10c762b3a190f50b1255.zip
fluxbox-685a3e36b36b5181cdcb10c762b3a190f50b1255.tar.bz2
more speed
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Menu.cc87
1 files changed, 13 insertions, 74 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 62fff0c..7800cd3 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.36 2003/08/27 14:14:04 fluxgen Exp $ 25// $Id: Menu.cc,v 1.37 2003/08/30 01:03:48 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -90,8 +90,6 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
90 m_alignment(ALIGNDONTCARE), 90 m_alignment(ALIGNDONTCARE),
91 m_border_width(0), 91 m_border_width(0),
92 m_themeobserver(*this), 92 m_themeobserver(*this),
93 /* m_trans(new Transparent(getRootPixmap(screen_num), 0,
94 tm.alpha(), screen_num)),*/
95 m_need_update(true) { 93 m_need_update(true) {
96 94
97 // make sure we get updated when the theme is reloaded 95 // make sure we get updated when the theme is reloaded
@@ -136,9 +134,6 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
136 134
137 menu.height = menu.title_h + 2 + menu.frame_h; 135 menu.height = menu.title_h + 2 + menu.frame_h;
138 136
139 // m_root_pm = getRootPixmap(screen_num);
140 // m_trans->setSource(m_root_pm, screen_num);
141 // m_trans->setAlpha(alpha());
142 long event_mask = ButtonPressMask | ButtonReleaseMask | 137 long event_mask = ButtonPressMask | ButtonReleaseMask |
143 ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask; 138 ButtonMotionMask | KeyPressMask | ExposureMask | FocusChangeMask;
144 //create menu window 139 //create menu window
@@ -529,12 +524,11 @@ void Menu::update(int active_index) {
529 524
530 if (title_vis && visible) 525 if (title_vis && visible)
531 redrawTitle(); 526 redrawTitle();
532 527 /*
533 if (m_need_update) { 528 if (m_need_update) {
534 for (unsigned int i = 0; visible && i < menuitems.size(); i++) { 529 for (unsigned int i = 0; visible && i < menuitems.size(); i++) {
535 if (i == (unsigned int)which_sub) { 530 if (i == (unsigned int)which_sub) {
536 drawItem(i, true, true, false); 531 drawItem(i, true, true, false);
537 drawSubmenu(i);
538 } else 532 } else
539 drawItem(i, (i == active_index && isItemEnabled(i)), true, false); 533 drawItem(i, (i == active_index && isItemEnabled(i)), true, false);
540 } 534 }
@@ -542,7 +536,8 @@ void Menu::update(int active_index) {
542 if (m_parent && visible) 536 if (m_parent && visible)
543 m_parent->drawSubmenu(m_parent->which_sub); 537 m_parent->drawSubmenu(m_parent->which_sub);
544 } 538 }
545 539 */
540 menu.window.clear();
546 renderTransFrame(); 541 renderTransFrame();
547 542
548 m_need_update = false; 543 m_need_update = false;
@@ -656,22 +651,7 @@ void Menu::redrawTitle() {
656 m_theme.titleTextGC(), // graphic context 651 m_theme.titleTextGC(), // graphic context
657 text, len, // text string with lenght 652 text, len, // text string with lenght
658 dx, font.ascent() + menu.bevel_w); // position 653 dx, font.ascent() + menu.bevel_w); // position
659 /* if (m_trans.get()) {
660
661 if (m_trans->alpha() != 255) {
662 Pixmap root_pm = getRootPixmap(menu.window.screenNumber());
663 654
664 if (m_root_pm != root_pm) {
665 m_trans->setSource(root_pm, menu.title.screenNumber());
666 m_root_pm = root_pm;
667 }
668 m_trans->setDest(menu.title.window(), menu.title.screenNumber());
669 m_trans->render(menu.window.x() + menu.title.x() + menu.window.borderWidth()*2,
670 menu.window.y() + menu.title.y() + menu.window.borderWidth()*2,
671 0, 0,
672 menu.title.width(), menu.title.height());
673 }
674 }*/
675 menu.title.updateTransparent(); 655 menu.title.updateTransparent();
676 656
677} 657}
@@ -1003,16 +983,13 @@ void Menu::drawItem(unsigned int index, bool highlight, bool clear, bool render_
1003 } 983 }
1004 } 984 }
1005 985
1006 XClearArea(m_display, menu.frame.window(), 986 menu.frame.clearArea(item_x, item_y,
1007 item_x, item_y, 987 menu.item_w, menu.item_h, False);
1008 menu.item_w, menu.item_h, False);
1009
1010 menu.title.setAlpha(alpha());
1011 menu.frame.setAlpha(alpha());
1012 menu.window.setAlpha(alpha());
1013 988
989
1014 menu.frame.updateTransparent(item_x, item_y, 990 menu.frame.updateTransparent(item_x, item_y,
1015 menu.item_w, menu.item_h); 991 menu.item_w, menu.item_h);
992
1016} 993}
1017 994
1018void Menu::setLabel(const char *labelstr) { 995void Menu::setLabel(const char *labelstr) {
@@ -1029,10 +1006,7 @@ void Menu::setItemSelected(unsigned int index, bool sel) {
1029 if (! item) return; 1006 if (! item) return;
1030 1007
1031 item->setSelected(sel); 1008 item->setSelected(sel);
1032 if (visible) { 1009
1033 drawItem(index, (index == (unsigned int)which_sub), true, true);
1034
1035 }
1036} 1010}
1037 1011
1038 1012
@@ -1054,8 +1028,7 @@ void Menu::setItemEnabled(unsigned int index, bool enable) {
1054 if (! item) return; 1028 if (! item) return;
1055 1029
1056 item->setEnabled(enable); 1030 item->setEnabled(enable);
1057 if (visible) 1031
1058 drawItem(index, (index == static_cast<unsigned int>(which_sub)), true, true);
1059} 1032}
1060 1033
1061 1034
@@ -1136,8 +1109,6 @@ void Menu::buttonReleaseEvent(XButtonEvent &re) {
1136 re.y > iy && re.y < (signed) (iy + menu.item_h)) { 1109 re.y > iy && re.y < (signed) (iy + menu.item_h)) {
1137 menuitems[w]->click(re.button, re.time); 1110 menuitems[w]->click(re.button, re.time);
1138 itemSelected(re.button, w); 1111 itemSelected(re.button, w);
1139 m_need_update = true;
1140 update(w); // update any changed item
1141 } 1112 }
1142 } else { 1113 } else {
1143 drawItem(p, isItemEnabled(p) && (p == which_sub), true, true); 1114 drawItem(p, isItemEnabled(p) && (p == which_sub), true, true);
@@ -1167,8 +1138,8 @@ void Menu::motionNotifyEvent(XMotionEvent &me) {
1167 1138
1168 menu.window.move(menu.x, menu.y); 1139 menu.window.move(menu.x, menu.y);
1169 1140
1170 if (which_sub >= 0) 1141 // if (which_sub >= 0)
1171 drawSubmenu(which_sub); 1142 // drawSubmenu(which_sub);
1172 } 1143 }
1173 } 1144 }
1174 } else if ((! (me.state & Button1Mask)) && me.window == menu.frame && 1145 } else if ((! (me.state & Button1Mask)) && me.window == menu.frame &&
@@ -1215,9 +1186,6 @@ void Menu::exposeEvent(XExposeEvent &ee) {
1215 if (ee.window == menu.title) { 1186 if (ee.window == menu.title) {
1216 redrawTitle(); 1187 redrawTitle();
1217 } else if (ee.window == menu.frame) { 1188 } else if (ee.window == menu.frame) {
1218 if (menuitems.size() == 0)
1219 return;
1220
1221 // this is a compilicated algorithm... lets do it step by step... 1189 // this is a compilicated algorithm... lets do it step by step...
1222 // first... we see in which sub level the expose starts... and how many 1190 // first... we see in which sub level the expose starts... and how many
1223 // items down in that sublevel 1191 // items down in that sublevel
@@ -1308,9 +1276,6 @@ void Menu::leaveNotifyEvent(XCrossingEvent &ce) {
1308 if (shifted) { 1276 if (shifted) {
1309 menu.window.move(menu.x, menu.y); 1277 menu.window.move(menu.x, menu.y);
1310 shifted = false; 1278 shifted = false;
1311
1312 if (which_sub >= 0)
1313 drawSubmenu(which_sub);
1314 } 1279 }
1315} 1280}
1316 1281
@@ -1383,37 +1348,11 @@ void Menu::reconfigure() {
1383 menu.frame.setAlpha(alpha()); 1348 menu.frame.setAlpha(alpha());
1384 menu.title.setAlpha(alpha()); 1349 menu.title.setAlpha(alpha());
1385 menu.window.setAlpha(alpha()); 1350 menu.window.setAlpha(alpha());
1386 /* 1351
1387 if (m_trans.get() && m_trans->alpha() != alpha())
1388 m_trans->setAlpha(alpha());
1389 */
1390 update(); 1352 update();
1391} 1353}
1392 1354
1393void Menu::renderTransFrame() { 1355void Menu::renderTransFrame() {
1394 /* if (m_trans.get() == 0 || moving)
1395 return;
1396
1397 if (m_trans->alpha() != alpha())
1398 m_trans->setAlpha(alpha());
1399
1400 if (m_trans->alpha() != 255) {
1401
1402 Pixmap root_pm = getRootPixmap(menu.window.screenNumber());
1403
1404 if (m_root_pm != root_pm) {
1405 m_trans->setSource(root_pm, menu.window.screenNumber());
1406 m_root_pm = root_pm;
1407 }
1408 menu.frame.clear();
1409 m_trans->setDest(menu.frame.window(), menu.window.screenNumber());
1410 m_trans->render(menu.window.x() + menu.frame.x() + menu.window.borderWidth(),
1411 menu.window.y() + menu.frame.y() + menu.window.borderWidth(),
1412 0, 0,
1413 menu.frame.width(), menu.frame.height());
1414
1415 }
1416 */
1417 menu.frame.clear(); 1356 menu.frame.clear();
1418 menu.frame.updateTransparent(); 1357 menu.frame.updateTransparent();
1419} 1358}