aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbWinFrame.cc62
-rw-r--r--src/FbWinFrame.hh6
-rw-r--r--src/Window.cc47
3 files changed, 70 insertions, 45 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 31dfae0..387b159 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.48 2003/09/11 19:55:27 rathnor Exp $ 22// $Id: FbWinFrame.cc,v 1.49 2003/09/12 22:49:14 fluxgen Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -109,6 +109,7 @@ FbWinFrame::FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
109*/ 109*/
110 110
111FbWinFrame::~FbWinFrame() { 111FbWinFrame::~FbWinFrame() {
112 m_update_timer.stop();
112 removeEventHandler(); 113 removeEventHandler();
113 removeAllButtons(); 114 removeAllButtons();
114} 115}
@@ -137,7 +138,6 @@ void FbWinFrame::hide() {
137 138
138void FbWinFrame::show() { 139void FbWinFrame::show() {
139 m_visible = true; 140 m_visible = true;
140 reconfigure();
141 m_window.showSubwindows(); 141 m_window.showSubwindows();
142 m_window.show(); 142 m_window.show();
143} 143}
@@ -221,8 +221,17 @@ void FbWinFrame::setFocus(bool newvalue) {
221 if (m_focused == newvalue) // no need to change focus 221 if (m_focused == newvalue) // no need to change focus
222 return; 222 return;
223 223
224
225
226 if (m_focused && !newvalue && currentLabel()) {
227 renderButtonUnfocus(*m_current_label);
228 } else if (!m_focused && newvalue && currentLabel()) {
229 renderButtonFocus(*m_current_label);
230 }
231
224 m_focused = newvalue; 232 m_focused = newvalue;
225 reconfigure(); // reconfigure rendering for new focus value 233 renderButtons();
234 renderHandles();
226} 235}
227 236
228void FbWinFrame::setDoubleClickTime(unsigned int time) { 237void FbWinFrame::setDoubleClickTime(unsigned int time) {
@@ -231,7 +240,6 @@ void FbWinFrame::setDoubleClickTime(unsigned int time) {
231 240
232void FbWinFrame::setBevel(int bevel) { 241void FbWinFrame::setBevel(int bevel) {
233 m_bevel = bevel; 242 m_bevel = bevel;
234 reconfigure();
235} 243}
236 244
237void FbWinFrame::addLeftButton(FbTk::Button *btn) { 245void FbWinFrame::addLeftButton(FbTk::Button *btn) {
@@ -284,13 +292,16 @@ void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) {
284 return; 292 return;
285 293
286 m_labelbuttons.erase(erase_it); 294 m_labelbuttons.erase(erase_it);
295
296 if (*erase_it == m_current_label)
297 m_current_label = 0;
287} 298}
288 299
289 300
290void FbWinFrame::moveLabelButtonLeft(const FbTk::TextButton &btn) { 301void FbWinFrame::moveLabelButtonLeft(const FbTk::TextButton &btn) {
291 LabelList::iterator it = find(m_labelbuttons.begin(), 302 LabelList::iterator it = find(m_labelbuttons.begin(),
292 m_labelbuttons.end(), 303 m_labelbuttons.end(),
293 &btn); 304 &btn);
294 // make sure we found it and we're not at the begining 305 // make sure we found it and we're not at the begining
295 if (it == m_labelbuttons.end() || it == m_labelbuttons.begin()) 306 if (it == m_labelbuttons.end() || it == m_labelbuttons.begin())
296 return; 307 return;
@@ -333,9 +344,7 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
333 344
334 345
335 // render label buttons 346 // render label buttons
336 347 if (currentLabel() != 0)
337
338 if (m_current_label != 0)
339 renderButtonUnfocus(*m_current_label); 348 renderButtonUnfocus(*m_current_label);
340 349
341 m_current_label = *it; // current focused button 350 m_current_label = *it; // current focused button
@@ -528,9 +537,10 @@ void FbWinFrame::buttonReleaseEvent(XButtonEvent &event) {
528} 537}
529 538
530void FbWinFrame::exposeEvent(XExposeEvent &event) { 539void FbWinFrame::exposeEvent(XExposeEvent &event) {
531 if (m_label == event.window) 540 if (m_label == event.window) {
532 redrawTitle(); 541 m_label.clearArea(event.x, event.y, event.width, event.height);
533 else if (m_handle == event.window) { 542 m_label.updateTransparent(event.x, event.y, event.width, event.height);
543 } else if (m_handle == event.window) {
534 m_handle.clearArea(event.x, event.y, event.width, event.height); 544 m_handle.clearArea(event.x, event.y, event.width, event.height);
535 m_handle.updateTransparent(); 545 m_handle.updateTransparent();
536 } else if (m_grip_left == event.window) { 546 } else if (m_grip_left == event.window) {
@@ -570,6 +580,7 @@ void FbWinFrame::exposeEvent(XExposeEvent &event) {
570 if (it != m_buttons_right.end()) 580 if (it != m_buttons_right.end())
571 (*it)->exposeEvent(event); 581 (*it)->exposeEvent(event);
572 } 582 }
583
573} 584}
574 585
575void FbWinFrame::handleEvent(XEvent &event) { 586void FbWinFrame::handleEvent(XEvent &event) {
@@ -582,6 +593,8 @@ void FbWinFrame::configureNotifyEvent(XConfigureEvent &event) {
582} 593}
583 594
584void FbWinFrame::reconfigure() { 595void FbWinFrame::reconfigure() {
596 if (m_labelbuttons.size() == 0)
597 return;
585 598
586 // align titlebar and render it 599 // align titlebar and render it
587 if (m_use_titlebar) 600 if (m_use_titlebar)
@@ -660,14 +673,13 @@ unsigned int FbWinFrame::buttonHeight() const {
660 return m_titlebar.height() - m_bevel*2; 673 return m_titlebar.height() - m_bevel*2;
661} 674}
662 675
663
664//--------------------- private area 676//--------------------- private area
665 677
666/** 678/**
667 aligns and redraws title 679 aligns and redraws title
668*/ 680*/
669void FbWinFrame::redrawTitle() { 681void FbWinFrame::redrawTitle() {
670 if (m_labelbuttons.size() == 0 || !m_visible) 682 if (m_labelbuttons.size() == 0)
671 return; 683 return;
672 684
673 int button_width = label().width()/m_labelbuttons.size(); 685 int button_width = label().width()/m_labelbuttons.size();
@@ -687,7 +699,7 @@ void FbWinFrame::redrawTitle() {
687 button_width, 699 button_width,
688 label().height() + border_width); 700 label().height() + border_width);
689 (*btn_it)->clear(); 701 (*btn_it)->clear();
690 (*btn_it)->updateTransparent(); 702 (*btn_it)->updateTransparent();
691 } 703 }
692 m_titlebar.clear(); 704 m_titlebar.clear();
693 m_titlebar.updateTransparent(); 705 m_titlebar.updateTransparent();
@@ -696,7 +708,7 @@ void FbWinFrame::redrawTitle() {
696} 708}
697 709
698void FbWinFrame::redrawTitlebar() { 710void FbWinFrame::redrawTitlebar() {
699 if (!m_use_titlebar || !m_visible) 711 if (!m_use_titlebar)
700 return; 712 return;
701 713
702 redrawTitle(); 714 redrawTitle();
@@ -754,7 +766,7 @@ void FbWinFrame::reconfigureTitlebar() {
754} 766}
755 767
756void FbWinFrame::renderTitlebar() { 768void FbWinFrame::renderTitlebar() {
757 if (!m_use_titlebar || !m_visible) 769 if (!m_use_titlebar)
758 return; 770 return;
759 771
760 // render pixmaps 772 // render pixmaps
@@ -918,7 +930,7 @@ void FbWinFrame::init() {
918 // Note: we don't show clientarea yet 930 // Note: we don't show clientarea yet
919 931
920 setEventHandler(*this); 932 setEventHandler(*this);
921 reconfigure(); 933 // reconfigure();
922} 934}
923 935
924/** 936/**
@@ -1063,9 +1075,12 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
1063 button.setBorderWidth(1); 1075 button.setBorderWidth(1);
1064 button.setAlpha(theme().alpha()); 1076 button.setAlpha(theme().alpha());
1065 1077
1066 if (m_label_focused_pm != 0) 1078 if (m_label_focused_pm != 0) {
1079 // already set
1080 if (button.backgroundPixmap() == m_label_focused_pm)
1081 return;
1067 button.setBackgroundPixmap(m_label_focused_pm); 1082 button.setBackgroundPixmap(m_label_focused_pm);
1068 else 1083 } else
1069 button.setBackgroundColor(m_label_focused_color); 1084 button.setBackgroundColor(m_label_focused_color);
1070 1085
1071 button.clear(); 1086 button.clear();
@@ -1078,9 +1093,12 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1078 button.setBorderWidth(1); 1093 button.setBorderWidth(1);
1079 button.setAlpha(theme().alpha()); 1094 button.setAlpha(theme().alpha());
1080 1095
1081 if (m_label_unfocused_pm != 0) 1096 if (m_label_unfocused_pm != 0) {
1097 // already set
1098 if (button.backgroundPixmap() == m_label_unfocused_pm)
1099 return;
1082 button.setBackgroundPixmap(m_label_unfocused_pm); 1100 button.setBackgroundPixmap(m_label_unfocused_pm);
1083 else 1101 } else
1084 button.setBackgroundColor(m_label_unfocused_color); 1102 button.setBackgroundColor(m_label_unfocused_color);
1085 1103
1086 button.clear(); 1104 button.clear();
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 6906f2a..3040b68 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.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: FbWinFrame.hh,v 1.17 2003/09/11 13:17:14 rathnor Exp $ 22// $Id: FbWinFrame.hh,v 1.18 2003/09/12 22:49:14 fluxgen Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -168,6 +168,7 @@ public:
168 inline FbTk::FbWindow &gripLeft() { return m_grip_left; } 168 inline FbTk::FbWindow &gripLeft() { return m_grip_left; }
169 inline const FbTk::FbWindow &gripRight() const { return m_grip_right; } 169 inline const FbTk::FbWindow &gripRight() const { return m_grip_right; }
170 inline FbTk::FbWindow &gripRight() { return m_grip_right; } 170 inline FbTk::FbWindow &gripRight() { return m_grip_right; }
171 inline const FbTk::TextButton *currentLabel() const { return m_current_label; }
171 inline bool focused() const { return m_focused; } 172 inline bool focused() const { return m_focused; }
172 inline bool isShaded() const { return m_shaded; } 173 inline bool isShaded() const { return m_shaded; }
173 inline const FbWinFrameTheme &theme() const { return m_theme; } 174 inline const FbWinFrameTheme &theme() const { return m_theme; }
@@ -179,8 +180,9 @@ public:
179 //@} 180 //@}
180 181
181private: 182private:
182 void redrawTitle();
183 void redrawTitlebar(); 183 void redrawTitlebar();
184 void redrawTitle();
185
184 /// reposition titlebar items 186 /// reposition titlebar items
185 void reconfigureTitlebar(); 187 void reconfigureTitlebar();
186 /** 188 /**
diff --git a/src/Window.cc b/src/Window.cc
index cd97f16..1781dbf 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.225 2003/09/11 21:30:20 rathnor Exp $ 25// $Id: Window.cc,v 1.226 2003/09/12 22:48:49 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -362,7 +362,7 @@ void FluxboxWindow::init() {
362 frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor()); 362 frame().gripLeft().setCursor(frame().theme().lowerLeftAngleCursor());
363 frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor()); 363 frame().gripRight().setCursor(frame().theme().lowerRightAngleCursor());
364 364
365 frame().resize(m_client->width(), m_client->height()); 365
366 FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), 366 FbTk::TextButton *btn = new FbTk::TextButton(frame().label(),
367 frame().theme().font(), 367 frame().theme().font(),
368 m_client->title()); 368 m_client->title());
@@ -385,6 +385,8 @@ void FluxboxWindow::init() {
385 385
386 frame().setEventHandler(*this); 386 frame().setEventHandler(*this);
387 387
388 frame().resize(m_client->width(), m_client->height());
389
388 m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0; 390 m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0;
389 391
390 // display connection 392 // display connection
@@ -510,6 +512,7 @@ void FluxboxWindow::init() {
510 if (!place_window) 512 if (!place_window)
511 moveResize(frame().x(), frame().y(), frame().width(), frame().height()); 513 moveResize(frame().x(), frame().y(), frame().width(), frame().height());
512 514
515
513 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); 516 screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window);
514 517
515 if (shaded) { // start shaded 518 if (shaded) { // start shaded
@@ -549,6 +552,8 @@ void FluxboxWindow::init() {
549 552
550 if (m_shaped) 553 if (m_shaped)
551 shape(); 554 shape();
555
556
552} 557}
553 558
554/// apply shape to this window 559/// apply shape to this window
@@ -777,6 +782,8 @@ bool FluxboxWindow::removeClient(WinClient &client) {
777 782
778 m_labelbuttons.erase(&client); 783 m_labelbuttons.erase(&client);
779 784
785 frame().reconfigure();
786
780#ifdef DEBUG 787#ifdef DEBUG
781 cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] numClients = "<<numClients()<<endl; 788 cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] numClients = "<<numClients()<<endl;
782#endif // DEBUG 789#endif // DEBUG
@@ -811,7 +818,7 @@ void FluxboxWindow::nextClient() {
811 m_client = *it; 818 m_client = *it;
812 m_client->raise(); 819 m_client->raise();
813 frame().setLabelButtonFocus(*m_labelbuttons[m_client]); 820 frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
814 setInputFocus(); 821 frame().setFocus(setInputFocus());
815} 822}
816 823
817void FluxboxWindow::prevClient() { 824void FluxboxWindow::prevClient() {
@@ -830,7 +837,7 @@ void FluxboxWindow::prevClient() {
830 837
831 m_client->raise(); 838 m_client->raise();
832 frame().setLabelButtonFocus(*m_labelbuttons[m_client]); 839 frame().setLabelButtonFocus(*m_labelbuttons[m_client]);
833 setInputFocus(); 840 frame().setFocus(setInputFocus());
834} 841}
835 842
836 843
@@ -908,8 +915,6 @@ void FluxboxWindow::associateClientWindow() {
908 915
909 frame().setClientWindow(*m_client); 916 frame().setClientWindow(*m_client);
910 frame().resizeForClient(m_client->width(), m_client->height()); 917 frame().resizeForClient(m_client->width(), m_client->height());
911 // make sure the frame reconfigures
912 frame().reconfigure();
913} 918}
914 919
915 920
@@ -955,6 +960,8 @@ void FluxboxWindow::reconfigure() {
955 frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); 960 frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval());
956 frame().setUpdateDelayTime(Fluxbox::instance()->getUpdateDelayTime()); 961 frame().setUpdateDelayTime(Fluxbox::instance()->getUpdateDelayTime());
957 962
963 frame().reconfigure();
964
958 m_windowmenu.reconfigure(); 965 m_windowmenu.reconfigure();
959 966
960} 967}
@@ -1100,9 +1107,10 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
1100 new_width = width(); 1107 new_width = width();
1101 new_height = height(); 1108 new_height = height();
1102 } 1109 }
1103 frame().moveResize(new_x, new_y, new_width, new_height);
1104 1110
1105 setFocusFlag(focused); 1111 setFocusFlag(focused);
1112 frame().moveResize(new_x, new_y, new_width, new_height);
1113
1106 shaded = false; 1114 shaded = false;
1107 send_event = true; 1115 send_event = true;
1108 } else { 1116 } else {
@@ -1258,13 +1266,8 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1258 1266
1259 frame().show(); 1267 frame().show();
1260 1268
1261 if (was_iconic && screen().doFocusNew()) { 1269 if (was_iconic && screen().doFocusNew())
1262 setInputFocus(); 1270 setInputFocus();
1263 }
1264
1265 if (focused != frame().focused())
1266 frame().setFocus(focused);
1267
1268 1271
1269 if (reassoc && !m_client->transients.empty()) { 1272 if (reassoc && !m_client->transients.empty()) {
1270 // deiconify all transients 1273 // deiconify all transients
@@ -1281,7 +1284,9 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1281 } 1284 }
1282 } 1285 }
1283 } 1286 }
1287
1284 oplock = false; 1288 oplock = false;
1289
1285 if (do_raise) 1290 if (do_raise)
1286 raise(); 1291 raise();
1287} 1292}
@@ -1646,7 +1651,10 @@ void FluxboxWindow::setFocusFlag(bool focus) {
1646 } 1651 }
1647 1652
1648 installColormap(focus); 1653 installColormap(focus);
1649 frame().setFocus(focus); 1654
1655 if (focus != frame().focused()) {
1656 frame().setFocus(focus);
1657 }
1650 1658
1651 if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus()) 1659 if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus())
1652 && screen().doAutoRaise()) { 1660 && screen().doAutoRaise()) {
@@ -1712,8 +1720,7 @@ void FluxboxWindow::saveBlackboxAttribs() {
1712 PropModeReplace, 1720 PropModeReplace,
1713 (unsigned char *)&m_blackbox_attrib, 1721 (unsigned char *)&m_blackbox_attrib,
1714 PropBlackboxAttributesElements 1722 PropBlackboxAttributesElements
1715 ) 1723 ));
1716 );
1717} 1724}
1718 1725
1719/** 1726/**
@@ -2013,11 +2020,10 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
2013 2020
2014 setState(NormalState); 2021 setState(NormalState);
2015 2022
2016 if (client->isTransient() || screen().doFocusNew()) { 2023 if (client->isTransient() || screen().doFocusNew())
2017 setCurrentClient(*client, true); 2024 setCurrentClient(*client, true);
2018 }
2019 else 2025 else
2020 setFocusFlag(false); 2026 setFocusFlag(false);
2021 2027
2022 iconic = false; 2028 iconic = false;
2023 2029
@@ -2169,7 +2175,6 @@ void FluxboxWindow::exposeEvent(XExposeEvent &ee) {
2169 frame().exposeEvent(ee); 2175 frame().exposeEvent(ee);
2170} 2176}
2171 2177
2172
2173void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { 2178void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
2174 WinClient *client = findClient(cr.window); 2179 WinClient *client = findClient(cr.window);
2175 if (client == 0) 2180 if (client == 0)
@@ -2609,10 +2614,10 @@ void FluxboxWindow::applyDecorations(bool initial) {
2609 2614
2610 if (decorations.handle) { 2615 if (decorations.handle) {
2611 frame().showHandle(); 2616 frame().showHandle();
2612 frame().reconfigure(); // show handle requires reconfigure
2613 } else 2617 } else
2614 frame().hideHandle(); 2618 frame().hideHandle();
2615 2619
2620 frame().reconfigure();
2616} 2621}
2617 2622
2618void FluxboxWindow::toggleDecoration() { 2623void FluxboxWindow::toggleDecoration() {