summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-05-01 13:19:36 (GMT)
committerrathnor <rathnor>2003-05-01 13:19:36 (GMT)
commitc5e5009c2faf48db34ae2d15fda05ba1c46e10d9 (patch)
treef2a65de646c1f8c53dde367bae15e21865acc7b8
parent80c1f78cb55923980a2121dac2dfa2d330669fdd (diff)
downloadfluxbox_lack-c5e5009c2faf48db34ae2d15fda05ba1c46e10d9.zip
fluxbox_lack-c5e5009c2faf48db34ae2d15fda05ba1c46e10d9.tar.bz2
clean ups of reconfigure/redraws
-rw-r--r--ChangeLog4
-rw-r--r--src/FbWinFrame.cc27
-rw-r--r--src/FbWinFrame.hh4
-rw-r--r--src/Window.cc22
-rw-r--r--src/Window.hh6
5 files changed, 32 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 10a7117..8a3da44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.2: 2Changes for 0.9.2:
3*03/05/01:
4 * Clean ups and optimising of redraw/reconfigures
5 Also fixes warping in outline focus bug (Simon)
6 Window.hh/cc FbWinFrame.hh/cc
3*03/04/29: 7*03/04/29:
4 * fix cause of (some?) excessive reconfigures (Simon) 8 * fix cause of (some?) excessive reconfigures (Simon)
5 fluxbox.cc 9 fluxbox.cc
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index c7e1cb1..8d33a3e 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.22 2003/04/16 22:15:22 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.23 2003/05/01 13:19:36 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -69,6 +69,7 @@ FbWinFrame::FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
69 m_use_titlebar(true), 69 m_use_titlebar(true),
70 m_use_handle(true), 70 m_use_handle(true),
71 m_focused(false), 71 m_focused(false),
72 m_visible(false),
72 m_button_pm(0), 73 m_button_pm(0),
73 m_themelistener(*this) { 74 m_themelistener(*this) {
74 75
@@ -124,12 +125,14 @@ bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mous
124 125
125void FbWinFrame::hide() { 126void FbWinFrame::hide() {
126 m_window.hide(); 127 m_window.hide();
128 m_visible = false;
127} 129}
128 130
129void FbWinFrame::show() { 131void FbWinFrame::show() {
132 m_visible = true;
133 reconfigure();
130 m_window.showSubwindows(); 134 m_window.showSubwindows();
131 m_window.show(); 135 m_window.show();
132 reconfigure();
133} 136}
134 137
135/** 138/**
@@ -534,12 +537,13 @@ void FbWinFrame::reconfigure() {
534 } 537 }
535 } 538 }
536 539
540 if (!m_visible) return;
541
537 // render the theme 542 // render the theme
538 renderButtons(); 543 renderButtons();
539 if (!m_shaded) 544 if (!m_shaded)
540 renderHandles(); 545 renderHandles();
541 redrawTitle(); 546 // titlebar stuff rendered already by reconftitlebar
542 redrawTitlebar();
543} 547}
544 548
545unsigned int FbWinFrame::titleHeight() const { 549unsigned int FbWinFrame::titleHeight() const {
@@ -557,7 +561,7 @@ unsigned int FbWinFrame::buttonHeight() const {
557 aligns and redraws title 561 aligns and redraws title
558*/ 562*/
559void FbWinFrame::redrawTitle() { 563void FbWinFrame::redrawTitle() {
560 if (m_labelbuttons.size() == 0) 564 if (m_labelbuttons.size() == 0 || !m_visible)
561 return; 565 return;
562 566
563 int button_width = label().width()/m_labelbuttons.size(); 567 int button_width = label().width()/m_labelbuttons.size();
@@ -581,12 +585,12 @@ void FbWinFrame::redrawTitle() {
581} 585}
582 586
583void FbWinFrame::redrawTitlebar() { 587void FbWinFrame::redrawTitlebar() {
584 if (!m_use_titlebar) 588 if (!m_use_titlebar || !m_visible)
585 return; 589 return;
586 m_titlebar.clear(); 590 m_titlebar.clear();
587 m_label.clear(); 591 m_label.clear();
588 redrawTitle(); 592 redrawTitle();
589} 593 }
590 594
591/** 595/**
592 Align buttons with title text window 596 Align buttons with title text window
@@ -637,7 +641,7 @@ void FbWinFrame::reconfigureTitlebar() {
637} 641}
638 642
639void FbWinFrame::renderTitlebar() { 643void FbWinFrame::renderTitlebar() {
640 if (!m_use_titlebar) 644 if (!m_use_titlebar || !m_visible)
641 return; 645 return;
642 646
643 // render pixmaps 647 // render pixmaps
@@ -679,12 +683,12 @@ void FbWinFrame::renderTitlebar() {
679 m_titlebar.setBackgroundColor(title_color); 683 m_titlebar.setBackgroundColor(title_color);
680 684
681 renderLabelButtons(); 685 renderLabelButtons();
682 redrawTitle(); 686 redrawTitlebar();
683} 687}
684 688
685 689
686void FbWinFrame::renderHandles() { 690void FbWinFrame::renderHandles() {
687 if (!m_use_handle) 691 if (!m_use_handle || !m_visible)
688 return; 692 return;
689 render(m_theme.handleFocusTexture(), m_handle_focused_color, 693 render(m_theme.handleFocusTexture(), m_handle_focused_color,
690 m_handle_focused_pm, 694 m_handle_focused_pm,
@@ -741,6 +745,7 @@ void FbWinFrame::renderHandles() {
741} 745}
742 746
743void FbWinFrame::renderButtons() { 747void FbWinFrame::renderButtons() {
748 if (!m_visible) return;
744 749
745 render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm, 750 render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm,
746 m_button_size, m_button_size); 751 m_button_size, m_button_size);
@@ -785,7 +790,6 @@ void FbWinFrame::init() {
785 790
786 setEventHandler(*this); 791 setEventHandler(*this);
787 792
788 reconfigureTitlebar();
789 reconfigure(); 793 reconfigure();
790} 794}
791 795
@@ -864,6 +868,7 @@ void FbWinFrame::getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
864} 868}
865 869
866void FbWinFrame::renderLabelButtons() { 870void FbWinFrame::renderLabelButtons() {
871 if (!m_visible) return;
867 Pixmap label_pm = None; 872 Pixmap label_pm = None;
868 Pixmap not_used_pm = None; 873 Pixmap not_used_pm = None;
869 FbTk::Color label_color; 874 FbTk::Color label_color;
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 590c30a..d71fc9b 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.6 2003/04/16 12:24:28 fluxgen Exp $ 22// $Id: FbWinFrame.hh,v 1.7 2003/05/01 13:19:36 rathnor Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -67,6 +67,7 @@ public:
67 67
68 void hide(); 68 void hide();
69 void show(); 69 void show();
70 inline bool isVisible() const { return m_visible; }
70 /// shade frame (ie resize to titlebar size) 71 /// shade frame (ie resize to titlebar size)
71 void shade(); 72 void shade();
72 void move(int x, int y); 73 void move(int x, int y);
@@ -210,6 +211,7 @@ private:
210 bool m_use_titlebar; ///< if we should use titlebar 211 bool m_use_titlebar; ///< if we should use titlebar
211 bool m_use_handle; ///< if we should use handle 212 bool m_use_handle; ///< if we should use handle
212 bool m_focused; ///< focused/unfocused mode 213 bool m_focused; ///< focused/unfocused mode
214 bool m_visible; ///< if we are currently showing
213 215
214 /** 216 /**
215 @name pixmaps and colors for rendering 217 @name pixmaps and colors for rendering
diff --git a/src/Window.cc b/src/Window.cc
index 7aaeb41..33bf9bc 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.155 2003/04/28 13:38:23 rathnor Exp $ 25// $Id: Window.cc,v 1.156 2003/05/01 13:19:36 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -201,7 +201,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
201 m_workspacesig(*this), 201 m_workspacesig(*this),
202 m_diesig(*this), 202 m_diesig(*this),
203 moving(false), resizing(false), shaded(false), maximized(false), 203 moving(false), resizing(false), shaded(false), maximized(false),
204 visible(false), iconic(false), transient(false), focused(false), 204 iconic(false), transient(false), focused(false),
205 stuck(false), modal(false), send_focus_message(false), m_managed(false), 205 stuck(false), modal(false), send_focus_message(false), m_managed(false),
206 screen(scr), 206 screen(scr),
207 timer(this), 207 timer(this),
@@ -233,7 +233,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
233 m_workspacesig(*this), 233 m_workspacesig(*this),
234 m_diesig(*this), 234 m_diesig(*this),
235 moving(false), resizing(false), shaded(false), maximized(false), 235 moving(false), resizing(false), shaded(false), maximized(false),
236 visible(false), iconic(false), transient(false), focused(false), 236 iconic(false), transient(false), focused(false),
237 stuck(false), modal(false), send_focus_message(false), m_managed(false), 237 stuck(false), modal(false), send_focus_message(false), m_managed(false),
238 screen(scr), 238 screen(scr),
239 timer(this), 239 timer(this),
@@ -850,7 +850,6 @@ void FluxboxWindow::getWMHints() {
850 //!! 850 //!!
851 XWMHints *wmhint = XGetWMHints(display, m_client->window()); 851 XWMHints *wmhint = XGetWMHints(display, m_client->window());
852 if (! wmhint) { 852 if (! wmhint) {
853 visible = true;
854 iconic = false; 853 iconic = false;
855 focus_mode = F_PASSIVE; 854 focus_mode = F_PASSIVE;
856 m_client->window_group = None; 855 m_client->window_group = None;
@@ -1152,11 +1151,10 @@ bool FluxboxWindow::setInputFocus() {
1152 return false; 1151 return false;
1153 } 1152 }
1154 1153
1155 m_frame.setFocus(true);
1156 screen.setFocusedWindow(*m_client); 1154 screen.setFocusedWindow(*m_client);
1157 1155
1158 Fluxbox::instance()->setFocusedWindow(this); 1156 Fluxbox::instance()->setFocusedWindow(this);
1159 1157
1160 if (send_focus_message) 1158 if (send_focus_message)
1161 m_client->sendFocus(); 1159 m_client->sendFocus();
1162 1160
@@ -1191,7 +1189,6 @@ void FluxboxWindow::iconify() {
1191 return; 1189 return;
1192 1190
1193 m_windowmenu.hide(); 1191 m_windowmenu.hide();
1194 visible = false;
1195 iconic = true; 1192 iconic = true;
1196 1193
1197 setState(IconicState); 1194 setState(IconicState);
@@ -1229,7 +1226,6 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
1229 bool was_iconic = iconic; 1226 bool was_iconic = iconic;
1230 1227
1231 iconic = false; 1228 iconic = false;
1232 visible = true;
1233 setState(NormalState); 1229 setState(NormalState);
1234 1230
1235 ClientList::iterator client_it = clientList().begin(); 1231 ClientList::iterator client_it = clientList().begin();
@@ -1283,7 +1279,6 @@ void FluxboxWindow::close() {
1283 Set window in withdrawn state 1279 Set window in withdrawn state
1284*/ 1280*/
1285void FluxboxWindow::withdraw() { 1281void FluxboxWindow::withdraw() {
1286 visible = false;
1287 iconic = false; 1282 iconic = false;
1288 1283
1289 if (isResizing()) 1284 if (isResizing())
@@ -1989,7 +1984,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
1989 if (client == 0) 1984 if (client == 0)
1990 return; 1985 return;
1991 1986
1992 if (!ne.override_redirect && visible) { 1987 if (!ne.override_redirect && isVisible()) {
1993 Fluxbox *fluxbox = Fluxbox::instance(); 1988 Fluxbox *fluxbox = Fluxbox::instance();
1994 fluxbox->grab(); 1989 fluxbox->grab();
1995 if (! validateClient()) 1990 if (! validateClient())
@@ -2005,7 +2000,6 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
2005 if (focused) 2000 if (focused)
2006 m_frame.setFocus(true); 2001 m_frame.setFocus(true);
2007 2002
2008 visible = true;
2009 iconic = false; 2003 iconic = false;
2010 2004
2011 // Auto-group from tab? 2005 // Auto-group from tab?
@@ -2468,13 +2462,11 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2468 !isVisible()) { 2462 !isVisible()) {
2469 return; 2463 return;
2470 } 2464 }
2471
2472 if (ev.window == frame().window() || 2465 if (ev.window == frame().window() ||
2473 ev.window == m_client->window()) { 2466 ev.window == m_client->window()) {
2474 if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus()) 2467 if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus())
2475 && !isFocused()) { 2468 && !isFocused()) {
2476 2469
2477
2478 // check that there aren't any subsequent leave notify events in the 2470 // check that there aren't any subsequent leave notify events in the
2479 // X event queue 2471 // X event queue
2480 XEvent dummy; 2472 XEvent dummy;
@@ -2482,11 +2474,9 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2482 sa.w = ev.window; 2474 sa.w = ev.window;
2483 sa.enter = sa.leave = False; 2475 sa.enter = sa.leave = False;
2484 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa); 2476 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa);
2485 2477
2486 if ((!sa.leave || sa.inferior) && setInputFocus()) 2478 if ((!sa.leave || sa.inferior) && setInputFocus())
2487 installColormap(True); 2479 installColormap(True);
2488
2489
2490 } 2480 }
2491 } 2481 }
2492} 2482}
diff --git a/src/Window.hh b/src/Window.hh
index d8ddcdd..426196d 100644
--- a/src/Window.hh
+++ b/src/Window.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: Window.hh,v 1.65 2003/04/28 13:38:23 rathnor Exp $ 25// $Id: Window.hh,v 1.66 2003/05/01 13:19:36 rathnor Exp $
26 26
27#ifndef WINDOW_HH 27#ifndef WINDOW_HH
28#define WINDOW_HH 28#define WINDOW_HH
@@ -242,7 +242,7 @@ public:
242 bool hasTransient() const; 242 bool hasTransient() const;
243 inline bool isManaged() const { return m_managed; } 243 inline bool isManaged() const { return m_managed; }
244 inline bool isFocused() const { return focused; } 244 inline bool isFocused() const { return focused; }
245 inline bool isVisible() const { return visible; } 245 inline bool isVisible() const { return m_frame.isVisible(); }
246 inline bool isIconic() const { return iconic; } 246 inline bool isIconic() const { return iconic; }
247 inline bool isShaded() const { return shaded; } 247 inline bool isShaded() const { return shaded; }
248 inline bool isMaximized() const { return maximized; } 248 inline bool isMaximized() const { return maximized; }
@@ -387,7 +387,7 @@ private:
387 std::string m_class_name; /// class name from WM_CLASS 387 std::string m_class_name; /// class name from WM_CLASS
388 388
389 //Window state 389 //Window state
390 bool moving, resizing, shaded, maximized, visible, iconic, transient, 390 bool moving, resizing, shaded, maximized, iconic, transient,
391 focused, stuck, modal, send_focus_message, m_managed; 391 focused, stuck, modal, send_focus_message, m_managed;
392 WinClient *m_attaching_tab; 392 WinClient *m_attaching_tab;
393 393