diff options
author | fluxgen <fluxgen> | 2003-08-04 12:47:36 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-04 12:47:36 (GMT) |
commit | 10c972f7f790fa3d48d9f41abe4cce2933e8f5e3 (patch) | |
tree | 93eecfdba5b0fc9026f194d80a114f2975072014 | |
parent | aab891843a852f5eaf8dd7369508d3dbfbc5423d (diff) | |
download | fluxbox-10c972f7f790fa3d48d9f41abe4cce2933e8f5e3.zip fluxbox-10c972f7f790fa3d48d9f41abe4cce2933e8f5e3.tar.bz2 |
using transparent window
-rw-r--r-- | src/FbWinFrame.cc | 111 |
1 files changed, 87 insertions, 24 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 418efdb..b13f021 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.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: FbWinFrame.cc,v 1.32 2003/07/28 12:11:57 fluxgen Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.33 2003/08/04 12:47:36 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | #include "ImageControl.hh" | 25 | #include "ImageControl.hh" |
@@ -156,7 +156,35 @@ void FbWinFrame::shade() { | |||
156 | 156 | ||
157 | 157 | ||
158 | void FbWinFrame::move(int x, int y) { | 158 | void FbWinFrame::move(int x, int y) { |
159 | m_window.move(x, y); | 159 | // don't update unless we really changes position |
160 | if (x == window().x() && y == window().y()) | ||
161 | return; | ||
162 | |||
163 | window().move(x, y); | ||
164 | // update transparent only if we need to | ||
165 | if (theme().alpha() == 255) | ||
166 | return; | ||
167 | |||
168 | redrawTitlebar(); | ||
169 | |||
170 | ButtonList::iterator btn_it = m_buttons_left.begin(); | ||
171 | ButtonList::iterator btn_it_end = m_buttons_left.begin(); | ||
172 | for (; btn_it != btn_it_end; ++btn_it) { | ||
173 | (*btn_it)->clear(); | ||
174 | (*btn_it)->window().updateTransparent(); | ||
175 | } | ||
176 | btn_it = m_buttons_right.begin(); | ||
177 | btn_it_end = m_buttons_right.end(); | ||
178 | for (; btn_it != btn_it_end; ++btn_it) { | ||
179 | (*btn_it)->clear(); | ||
180 | (*btn_it)->window().updateTransparent(); | ||
181 | } | ||
182 | m_grip_left.clear(); | ||
183 | m_grip_right.clear(); | ||
184 | m_handle.clear(); | ||
185 | m_grip_left.updateTransparent(); | ||
186 | m_grip_right.updateTransparent(); | ||
187 | m_handle.updateTransparent(); | ||
160 | } | 188 | } |
161 | 189 | ||
162 | void FbWinFrame::resize(unsigned int width, unsigned int height) { | 190 | void FbWinFrame::resize(unsigned int width, unsigned int height) { |
@@ -462,6 +490,7 @@ void FbWinFrame::buttonPressEvent(XButtonEvent &event) { | |||
462 | event.window == m_handle.window() || | 490 | event.window == m_handle.window() || |
463 | event.window == m_window.window()) | 491 | event.window == m_window.window()) |
464 | return; | 492 | return; |
493 | // we handle only buttons 0 to 5 | ||
465 | if (event.button > 5 || event.button < 1) | 494 | if (event.button > 5 || event.button < 1) |
466 | return; | 495 | return; |
467 | 496 | ||
@@ -506,12 +535,44 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) { | |||
506 | void FbWinFrame::exposeEvent(XExposeEvent &event) { | 535 | void FbWinFrame::exposeEvent(XExposeEvent &event) { |
507 | if (m_label == event.window) | 536 | if (m_label == event.window) |
508 | redrawTitle(); | 537 | redrawTitle(); |
509 | else if (m_handle == event.window || | 538 | else if (m_handle == event.window) { |
510 | m_grip_left == event.window || | 539 | m_handle.clearArea(event.x, event.y, event.width, event.height); |
511 | m_grip_right == event.window) | 540 | m_handle.updateTransparent(); |
512 | renderHandles(); | 541 | } else if (m_grip_left == event.window) { |
513 | else | 542 | m_grip_left.clearArea(event.x, event.y, event.width, event.height); |
514 | redrawTitlebar(); | 543 | m_grip_left.updateTransparent(); |
544 | } else if (m_grip_right == event.window) { | ||
545 | m_grip_right.clearArea(event.x, event.y, event.width, event.height); | ||
546 | m_grip_right.updateTransparent(); | ||
547 | } else { | ||
548 | LabelList::iterator btn_it = m_labelbuttons.begin(); | ||
549 | LabelList::iterator btn_it_end = m_labelbuttons.end(); | ||
550 | for (; btn_it != btn_it_end; ++btn_it) { | ||
551 | if ((*btn_it)->window() == event.window) { | ||
552 | (*btn_it)->exposeEvent(event); | ||
553 | return; | ||
554 | } | ||
555 | } | ||
556 | |||
557 | ButtonList::iterator it = m_buttons_left.begin(); | ||
558 | ButtonList::iterator it_end = m_buttons_left.end(); | ||
559 | for (; it != it_end; ++it) { | ||
560 | if ((*it)->window() == event.window) { | ||
561 | (*it)->exposeEvent(event); | ||
562 | return; | ||
563 | } | ||
564 | } | ||
565 | |||
566 | it = m_buttons_right.begin(); | ||
567 | it_end = m_buttons_right.end(); | ||
568 | for (; it != it_end; ++it) { | ||
569 | if ((*it)->window() == event.window) { | ||
570 | (*it)->exposeEvent(event); | ||
571 | return; | ||
572 | } | ||
573 | } | ||
574 | } | ||
575 | |||
515 | 576 | ||
516 | } | 577 | } |
517 | 578 | ||
@@ -525,13 +586,11 @@ void FbWinFrame::configureNotifyEvent(XConfigureEvent &event) { | |||
525 | } | 586 | } |
526 | 587 | ||
527 | void FbWinFrame::reconfigure() { | 588 | void FbWinFrame::reconfigure() { |
528 | m_window.clear(); | ||
529 | 589 | ||
530 | // align titlebar and render it | 590 | // align titlebar and render it |
531 | if (m_use_titlebar) | 591 | if (m_use_titlebar) |
532 | reconfigureTitlebar(); | 592 | reconfigureTitlebar(); |
533 | 593 | ||
534 | |||
535 | // leave client+grips alone if we're shaded (it'll get fixed when we unshade) | 594 | // leave client+grips alone if we're shaded (it'll get fixed when we unshade) |
536 | if (!m_shaded) { | 595 | if (!m_shaded) { |
537 | int client_top = 0; | 596 | int client_top = 0; |
@@ -623,6 +682,7 @@ void FbWinFrame::redrawTitle() { | |||
623 | button_width, | 682 | button_width, |
624 | label().height() + border_width); | 683 | label().height() + border_width); |
625 | (*btn_it)->clear(); | 684 | (*btn_it)->clear(); |
685 | (*btn_it)->window().updateTransparent(); | ||
626 | } | 686 | } |
627 | 687 | ||
628 | } | 688 | } |
@@ -630,12 +690,9 @@ void FbWinFrame::redrawTitle() { | |||
630 | void FbWinFrame::redrawTitlebar() { | 690 | void FbWinFrame::redrawTitlebar() { |
631 | if (!m_use_titlebar || !m_visible) | 691 | if (!m_use_titlebar || !m_visible) |
632 | return; | 692 | return; |
633 | m_titlebar.clear(); | 693 | |
634 | m_label.clear(); | ||
635 | redrawTitle(); | 694 | redrawTitle(); |
636 | 695 | ||
637 | if (m_current_label) | ||
638 | m_current_label->clear(); | ||
639 | } | 696 | } |
640 | 697 | ||
641 | /** | 698 | /** |
@@ -669,8 +726,7 @@ void FbWinFrame::reconfigureTitlebar() { | |||
669 | 726 | ||
670 | space_left -= m_bevel; | 727 | space_left -= m_bevel; |
671 | 728 | ||
672 | m_label.moveResize( | 729 | m_label.moveResize(next_x, m_bevel, |
673 | next_x, m_bevel, | ||
674 | space_left, button_size); | 730 | space_left, button_size); |
675 | 731 | ||
676 | next_x += m_label.width() + m_bevel;; | 732 | next_x += m_label.width() + m_bevel;; |
@@ -783,12 +839,17 @@ void FbWinFrame::renderHandles() { | |||
783 | m_grip_right.setBackgroundColor(m_grip_unfocused_color); | 839 | m_grip_right.setBackgroundColor(m_grip_unfocused_color); |
784 | } | 840 | } |
785 | } | 841 | } |
786 | /* | 842 | |
787 | TODO: set border color | ||
788 | */ | ||
789 | m_grip_left.clear(); | 843 | m_grip_left.clear(); |
844 | m_grip_left.setAlpha(theme().alpha()); | ||
845 | m_grip_left.updateTransparent(); | ||
790 | m_grip_right.clear(); | 846 | m_grip_right.clear(); |
847 | m_grip_right.setAlpha(theme().alpha()); | ||
848 | m_grip_right.updateTransparent(); | ||
791 | m_handle.clear(); | 849 | m_handle.clear(); |
850 | m_handle.setAlpha(theme().alpha()); | ||
851 | m_handle.updateTransparent(); | ||
852 | |||
792 | } | 853 | } |
793 | 854 | ||
794 | void FbWinFrame::renderButtons() { | 855 | void FbWinFrame::renderButtons() { |
@@ -848,10 +909,9 @@ void FbWinFrame::init() { | |||
848 | void FbWinFrame::setupButton(FbTk::Button &btn) { | 909 | void FbWinFrame::setupButton(FbTk::Button &btn) { |
849 | if (m_button_pressed_pm) { | 910 | if (m_button_pressed_pm) { |
850 | btn.setPressedPixmap(m_button_pressed_pm); | 911 | btn.setPressedPixmap(m_button_pressed_pm); |
851 | } else { | ||
852 | // cerr<<"No pixmap for button pressed"<<endl; | ||
853 | } | 912 | } |
854 | //TODO button pressed color | 913 | |
914 | //!! TODO button pressed color | ||
855 | 915 | ||
856 | if (m_focused) { | 916 | if (m_focused) { |
857 | btn.setGC(m_theme.buttonPicFocusGC()); | 917 | btn.setGC(m_theme.buttonPicFocusGC()); |
@@ -865,7 +925,10 @@ void FbWinFrame::setupButton(FbTk::Button &btn) { | |||
865 | btn.setBackgroundPixmap(m_button_unfocused_pm); | 925 | btn.setBackgroundPixmap(m_button_unfocused_pm); |
866 | else | 926 | else |
867 | btn.setBackgroundColor(m_button_color); | 927 | btn.setBackgroundColor(m_button_color); |
928 | |||
868 | } | 929 | } |
930 | |||
931 | btn.window().setAlpha(theme().alpha()); | ||
869 | btn.clear(); | 932 | btn.clear(); |
870 | } | 933 | } |
871 | 934 | ||
@@ -932,13 +995,13 @@ void FbWinFrame::renderLabelButtons() { | |||
932 | 995 | ||
933 | (*btn_it)->setGC(theme().labelTextFocusGC()); | 996 | (*btn_it)->setGC(theme().labelTextFocusGC()); |
934 | (*btn_it)->window().setBorderWidth(1); | 997 | (*btn_it)->window().setBorderWidth(1); |
998 | (*btn_it)->window().setAlpha(theme().alpha()); | ||
935 | 999 | ||
936 | if (m_label_unfocused_pm != 0) | 1000 | if (m_label_unfocused_pm != 0) |
937 | (*btn_it)->setBackgroundPixmap(m_label_unfocused_pm); | 1001 | (*btn_it)->setBackgroundPixmap(m_label_unfocused_pm); |
938 | else | 1002 | else |
939 | (*btn_it)->setBackgroundColor(m_label_unfocused_color); | 1003 | (*btn_it)->setBackgroundColor(m_label_unfocused_color); |
940 | 1004 | ||
941 | (*btn_it)->clear(); | ||
942 | } | 1005 | } |
943 | 1006 | ||
944 | if (m_current_label != 0) { | 1007 | if (m_current_label != 0) { |
@@ -948,7 +1011,6 @@ void FbWinFrame::renderLabelButtons() { | |||
948 | } else | 1011 | } else |
949 | m_current_label->setBackgroundColor(label_color); | 1012 | m_current_label->setBackgroundColor(label_color); |
950 | 1013 | ||
951 | m_current_label->clear(); | ||
952 | } | 1014 | } |
953 | 1015 | ||
954 | } | 1016 | } |
@@ -971,3 +1033,4 @@ void FbWinFrame::setBorderWidth(unsigned int borderW) { | |||
971 | if (bw_changes != 0) | 1033 | if (bw_changes != 0) |
972 | resize(width(), height() + bw_changes); | 1034 | resize(width(), height() + bw_changes); |
973 | } | 1035 | } |
1036 | |||