diff options
author | fluxgen <fluxgen> | 2003-04-25 16:23:59 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-04-25 16:23:59 (GMT) |
commit | 834abda73cee89f300567b815d4b53ea2042ab9f (patch) | |
tree | 54b5ee05c18f255ebd6a002764fb029b1ee37226 /src/FbTk | |
parent | 7028c5e3f53cd3958a03caba7d6a9e61b80abe22 (diff) | |
download | fluxbox_lack-834abda73cee89f300567b815d4b53ea2042ab9f.zip fluxbox_lack-834abda73cee89f300567b815d4b53ea2042ab9f.tar.bz2 |
minor transparent fix
Diffstat (limited to 'src/FbTk')
-rw-r--r-- | src/FbTk/Menu.cc | 123 | ||||
-rw-r--r-- | src/FbTk/Menu.hh | 3 |
2 files changed, 64 insertions, 62 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index caa731c..0db0548 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.14 2003/04/25 12:32:57 fluxgen Exp $ | 25 | // $Id: Menu.cc,v 1.15 2003/04/25 16:23:59 fluxgen Exp $ |
26 | 26 | ||
27 | //use GNU extensions | 27 | //use GNU extensions |
28 | #ifndef _GNU_SOURCE | 28 | #ifndef _GNU_SOURCE |
@@ -449,17 +449,7 @@ void Menu::update() { | |||
449 | m_parent->drawSubmenu(m_parent->which_sub); | 449 | m_parent->drawSubmenu(m_parent->which_sub); |
450 | } | 450 | } |
451 | 451 | ||
452 | menu.frame.clear(); | 452 | renderTransFrame(); |
453 | |||
454 | if (m_trans.get() && m_trans->alpha() != s_alpha) | ||
455 | m_trans->setAlpha(s_alpha); | ||
456 | |||
457 | m_trans->setDest(menu.frame.window(), menu.frame.screenNumber()); | ||
458 | m_trans->render(menu.window.x() + menu.frame.x() - menu.window.borderWidth(), | ||
459 | menu.window.y() + menu.frame.y() - menu.window.borderWidth(), | ||
460 | 0, 0, | ||
461 | menu.frame.width(), menu.frame.height()); | ||
462 | |||
463 | 453 | ||
464 | m_need_update = false; | 454 | m_need_update = false; |
465 | menu.window.showSubwindows(); | 455 | menu.window.showSubwindows(); |
@@ -519,25 +509,7 @@ void Menu::internal_hide() { | |||
519 | 509 | ||
520 | 510 | ||
521 | void Menu::move(int x, int y) { | 511 | void Menu::move(int x, int y) { |
522 | if (m_trans.get() && m_trans->alpha() != s_alpha) | ||
523 | m_trans->setAlpha(s_alpha); | ||
524 | |||
525 | if ((menu.x != x || menu.y != y) && m_trans->alpha() != 255) { | ||
526 | |||
527 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); | ||
528 | |||
529 | if (m_root_pm != root_pm) { | ||
530 | m_trans->setSource(root_pm, menu.window.screenNumber()); | ||
531 | m_root_pm = root_pm; | ||
532 | } | ||
533 | menu.frame.clear(); | ||
534 | m_trans->setDest(menu.frame.window(), menu.window.screenNumber()); | ||
535 | m_trans->render(x, y, | ||
536 | 0, 0, | ||
537 | menu.frame.width(), menu.frame.height()); | ||
538 | 512 | ||
539 | } | ||
540 | |||
541 | menu.x = x; | 513 | menu.x = x; |
542 | menu.y = y; | 514 | menu.y = y; |
543 | menu.window.move(x, y); | 515 | menu.window.move(x, y); |
@@ -545,6 +517,8 @@ void Menu::move(int x, int y) { | |||
545 | if (which_sub != -1) | 517 | if (which_sub != -1) |
546 | drawSubmenu(which_sub); | 518 | drawSubmenu(which_sub); |
547 | 519 | ||
520 | if (m_parent && !m_parent->moving && !torn) | ||
521 | renderTransFrame(); | ||
548 | } | 522 | } |
549 | 523 | ||
550 | 524 | ||
@@ -573,23 +547,24 @@ void Menu::redrawTitle() { | |||
573 | m_theme.titleTextGC(), // graphic context | 547 | m_theme.titleTextGC(), // graphic context |
574 | text, len, // text string with lenght | 548 | text, len, // text string with lenght |
575 | dx, font.ascent() + menu.bevel_w); // position | 549 | dx, font.ascent() + menu.bevel_w); // position |
576 | if (m_trans.get() && m_trans->alpha() != s_alpha) | 550 | if (m_trans.get()) { |
577 | m_trans->setAlpha(s_alpha); | 551 | if (m_trans->alpha() != s_alpha) |
552 | m_trans->setAlpha(s_alpha); | ||
578 | 553 | ||
579 | if (m_trans->alpha() != 255) { | 554 | if (m_trans->alpha() != 255) { |
580 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); | 555 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); |
581 | 556 | ||
582 | if (m_root_pm != root_pm) { | 557 | if (m_root_pm != root_pm) { |
583 | m_trans->setSource(root_pm, menu.title.screenNumber()); | 558 | m_trans->setSource(root_pm, menu.title.screenNumber()); |
584 | m_root_pm = root_pm; | 559 | m_root_pm = root_pm; |
560 | } | ||
561 | m_trans->setDest(menu.title.window(), menu.title.screenNumber()); | ||
562 | m_trans->render(menu.window.x() + menu.title.x() - menu.window.borderWidth(), | ||
563 | menu.window.y() + menu.title.y() - menu.window.borderWidth(), | ||
564 | menu.title.x(), menu.title.y(), | ||
565 | menu.title.width(), menu.title.height()); | ||
585 | } | 566 | } |
586 | m_trans->setDest(menu.title.window(), menu.title.screenNumber()); | ||
587 | m_trans->render(menu.window.x() + menu.title.x() - menu.window.borderWidth(), | ||
588 | menu.window.y() + menu.title.y() - menu.window.borderWidth(), | ||
589 | menu.title.x(), menu.title.y(), | ||
590 | menu.title.width(), menu.title.height()); | ||
591 | } | 567 | } |
592 | |||
593 | } | 568 | } |
594 | 569 | ||
595 | 570 | ||
@@ -864,26 +839,27 @@ void Menu::drawItem(unsigned int index, bool highlight, bool clear, bool render_ | |||
864 | item_x, item_y, | 839 | item_x, item_y, |
865 | menu.item_w, menu.item_h, False); | 840 | menu.item_w, menu.item_h, False); |
866 | 841 | ||
867 | if (m_trans.get() && m_trans->alpha() != s_alpha) | 842 | if (m_trans.get() && render_trans) { |
868 | m_trans->setAlpha(s_alpha); | 843 | if (m_trans->alpha() != s_alpha) |
844 | m_trans->setAlpha(s_alpha); | ||
869 | 845 | ||
870 | if (m_trans->alpha() != 255) { | 846 | if (m_trans->alpha() != 255) { |
871 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); | 847 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); |
872 | 848 | ||
873 | if (m_root_pm != root_pm) { | 849 | if (m_root_pm != root_pm) { |
874 | m_trans->setSource(root_pm, menu.window.screenNumber()); | 850 | m_trans->setSource(root_pm, menu.window.screenNumber()); |
875 | m_root_pm = root_pm; | 851 | m_root_pm = root_pm; |
876 | } | 852 | } |
877 | 853 | ||
878 | m_trans->setDest(menu.frame.window(), menu.frame.screenNumber()); | 854 | m_trans->setDest(menu.frame.window(), menu.frame.screenNumber()); |
879 | m_trans->render(menu.window.x() + menu.frame.x() + item_x - | 855 | m_trans->render(menu.window.x() + menu.frame.x() + item_x - |
880 | menu.window.borderWidth(), | 856 | menu.window.borderWidth(), |
881 | menu.window.y() + menu.frame.y() + item_y - | 857 | menu.window.y() + menu.frame.y() + item_y - |
882 | menu.window.borderWidth(), | 858 | menu.window.borderWidth(), |
883 | item_x, item_y, | 859 | item_x, item_y, |
884 | menu.item_w, menu.item_h); | 860 | menu.item_w, menu.item_h); |
861 | } | ||
885 | } | 862 | } |
886 | |||
887 | XSync(m_display, False); | 863 | XSync(m_display, False); |
888 | 864 | ||
889 | } | 865 | } |
@@ -945,7 +921,7 @@ bool Menu::isItemEnabled(unsigned int index) const { | |||
945 | 921 | ||
946 | 922 | ||
947 | void Menu::buttonPressEvent(XButtonEvent &be) { | 923 | void Menu::buttonPressEvent(XButtonEvent &be) { |
948 | if (be.window == menu.frame) { | 924 | if (be.window == menu.frame && menu.item_h != 0 && menu.item_w != 0) { |
949 | int sbl = (be.x / menu.item_w), i = (be.y / menu.item_h); | 925 | int sbl = (be.x / menu.item_w), i = (be.y / menu.item_h); |
950 | int w = (sbl * menu.persub) + i; | 926 | int w = (sbl * menu.persub) + i; |
951 | 927 | ||
@@ -1022,7 +998,7 @@ void Menu::motionNotifyEvent(XMotionEvent &me) { | |||
1022 | m_parent->which_sub = -1; | 998 | m_parent->which_sub = -1; |
1023 | } | 999 | } |
1024 | 1000 | ||
1025 | moving = torn = True; | 1001 | moving = torn = true; |
1026 | 1002 | ||
1027 | if (which_sub >= 0) | 1003 | if (which_sub >= 0) |
1028 | drawSubmenu(which_sub); | 1004 | drawSubmenu(which_sub); |
@@ -1209,4 +1185,29 @@ void Menu::reconfigure() { | |||
1209 | } | 1185 | } |
1210 | 1186 | ||
1211 | 1187 | ||
1188 | void Menu::renderTransFrame() { | ||
1189 | if (m_trans.get() == 0 || moving) | ||
1190 | return; | ||
1191 | |||
1192 | if (m_trans->alpha() != s_alpha) | ||
1193 | m_trans->setAlpha(s_alpha); | ||
1194 | |||
1195 | if (m_trans->alpha() != 255) { | ||
1196 | |||
1197 | Pixmap root_pm = getRootPixmap(menu.window.screenNumber()); | ||
1198 | |||
1199 | if (m_root_pm != root_pm) { | ||
1200 | m_trans->setSource(root_pm, menu.window.screenNumber()); | ||
1201 | m_root_pm = root_pm; | ||
1202 | } | ||
1203 | menu.frame.clear(); | ||
1204 | m_trans->setDest(menu.frame.window(), menu.window.screenNumber()); | ||
1205 | m_trans->render(menu.window.x() + menu.frame.x(), | ||
1206 | menu.window.y() + menu.frame.y(), | ||
1207 | 0, 0, | ||
1208 | menu.frame.width(), menu.frame.height()); | ||
1209 | |||
1210 | } | ||
1211 | } | ||
1212 | |||
1212 | }; // end namespace FbTk | 1213 | }; // end namespace FbTk |
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh index 6be2570..9e0d79f 100644 --- a/src/FbTk/Menu.hh +++ b/src/FbTk/Menu.hh | |||
@@ -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.hh,v 1.13 2003/04/25 12:32:11 fluxgen Exp $ | 25 | // $Id: Menu.hh,v 1.14 2003/04/25 16:23:59 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FBTK_MENU_HH | 27 | #ifndef FBTK_MENU_HH |
28 | #define FBTK_MENU_HH | 28 | #define FBTK_MENU_HH |
@@ -163,6 +163,7 @@ protected: | |||
163 | inline const Menu *parent() const { return m_parent; } | 163 | inline const Menu *parent() const { return m_parent; } |
164 | 164 | ||
165 | private: | 165 | private: |
166 | void renderTransFrame(); | ||
166 | 167 | ||
167 | typedef std::vector<MenuItem *> Menuitems; | 168 | typedef std::vector<MenuItem *> Menuitems; |
168 | const MenuTheme &m_theme; | 169 | const MenuTheme &m_theme; |