clean ups of reconfigure/redraws

This commit is contained in:
rathnor 2003-05-01 13:19:36 +00:00
parent 80c1f78cb5
commit c5e5009c2f
5 changed files with 32 additions and 31 deletions

View file

@ -1,5 +1,9 @@
(Format: Year/Month/Day) (Format: Year/Month/Day)
Changes for 0.9.2: Changes for 0.9.2:
*03/05/01:
* Clean ups and optimising of redraw/reconfigures
Also fixes warping in outline focus bug (Simon)
Window.hh/cc FbWinFrame.hh/cc
*03/04/29: *03/04/29:
* fix cause of (some?) excessive reconfigures (Simon) * fix cause of (some?) excessive reconfigures (Simon)
fluxbox.cc fluxbox.cc

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: FbWinFrame.cc,v 1.22 2003/04/16 22:15:22 fluxgen Exp $ // $Id: FbWinFrame.cc,v 1.23 2003/05/01 13:19:36 rathnor Exp $
#include "FbWinFrame.hh" #include "FbWinFrame.hh"
#include "ImageControl.hh" #include "ImageControl.hh"
@ -69,6 +69,7 @@ FbWinFrame::FbWinFrame(FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl,
m_use_titlebar(true), m_use_titlebar(true),
m_use_handle(true), m_use_handle(true),
m_focused(false), m_focused(false),
m_visible(false),
m_button_pm(0), m_button_pm(0),
m_themelistener(*this) { m_themelistener(*this) {
@ -124,12 +125,14 @@ bool FbWinFrame::setOnClickTitlebar(FbTk::RefCount<FbTk::Command> &ref, int mous
void FbWinFrame::hide() { void FbWinFrame::hide() {
m_window.hide(); m_window.hide();
m_visible = false;
} }
void FbWinFrame::show() { void FbWinFrame::show() {
m_visible = true;
reconfigure();
m_window.showSubwindows(); m_window.showSubwindows();
m_window.show(); m_window.show();
reconfigure();
} }
/** /**
@ -534,12 +537,13 @@ void FbWinFrame::reconfigure() {
} }
} }
if (!m_visible) return;
// render the theme // render the theme
renderButtons(); renderButtons();
if (!m_shaded) if (!m_shaded)
renderHandles(); renderHandles();
redrawTitle(); // titlebar stuff rendered already by reconftitlebar
redrawTitlebar();
} }
unsigned int FbWinFrame::titleHeight() const { unsigned int FbWinFrame::titleHeight() const {
@ -557,7 +561,7 @@ unsigned int FbWinFrame::buttonHeight() const {
aligns and redraws title aligns and redraws title
*/ */
void FbWinFrame::redrawTitle() { void FbWinFrame::redrawTitle() {
if (m_labelbuttons.size() == 0) if (m_labelbuttons.size() == 0 || !m_visible)
return; return;
int button_width = label().width()/m_labelbuttons.size(); int button_width = label().width()/m_labelbuttons.size();
@ -581,12 +585,12 @@ void FbWinFrame::redrawTitle() {
} }
void FbWinFrame::redrawTitlebar() { void FbWinFrame::redrawTitlebar() {
if (!m_use_titlebar) if (!m_use_titlebar || !m_visible)
return; return;
m_titlebar.clear(); m_titlebar.clear();
m_label.clear(); m_label.clear();
redrawTitle(); redrawTitle();
} }
/** /**
Align buttons with title text window Align buttons with title text window
@ -637,7 +641,7 @@ void FbWinFrame::reconfigureTitlebar() {
} }
void FbWinFrame::renderTitlebar() { void FbWinFrame::renderTitlebar() {
if (!m_use_titlebar) if (!m_use_titlebar || !m_visible)
return; return;
// render pixmaps // render pixmaps
@ -679,12 +683,12 @@ void FbWinFrame::renderTitlebar() {
m_titlebar.setBackgroundColor(title_color); m_titlebar.setBackgroundColor(title_color);
renderLabelButtons(); renderLabelButtons();
redrawTitle(); redrawTitlebar();
} }
void FbWinFrame::renderHandles() { void FbWinFrame::renderHandles() {
if (!m_use_handle) if (!m_use_handle || !m_visible)
return; return;
render(m_theme.handleFocusTexture(), m_handle_focused_color, render(m_theme.handleFocusTexture(), m_handle_focused_color,
m_handle_focused_pm, m_handle_focused_pm,
@ -741,6 +745,7 @@ void FbWinFrame::renderHandles() {
} }
void FbWinFrame::renderButtons() { void FbWinFrame::renderButtons() {
if (!m_visible) return;
render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm, render(m_theme.buttonFocusTexture(), m_button_color, m_button_pm,
m_button_size, m_button_size); m_button_size, m_button_size);
@ -785,7 +790,6 @@ void FbWinFrame::init() {
setEventHandler(*this); setEventHandler(*this);
reconfigureTitlebar();
reconfigure(); reconfigure();
} }
@ -864,6 +868,7 @@ void FbWinFrame::getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
} }
void FbWinFrame::renderLabelButtons() { void FbWinFrame::renderLabelButtons() {
if (!m_visible) return;
Pixmap label_pm = None; Pixmap label_pm = None;
Pixmap not_used_pm = None; Pixmap not_used_pm = None;
FbTk::Color label_color; FbTk::Color label_color;

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: FbWinFrame.hh,v 1.6 2003/04/16 12:24:28 fluxgen Exp $ // $Id: FbWinFrame.hh,v 1.7 2003/05/01 13:19:36 rathnor Exp $
#ifndef FBWINFRAME_HH #ifndef FBWINFRAME_HH
#define FBWINFRAME_HH #define FBWINFRAME_HH
@ -67,6 +67,7 @@ public:
void hide(); void hide();
void show(); void show();
inline bool isVisible() const { return m_visible; }
/// shade frame (ie resize to titlebar size) /// shade frame (ie resize to titlebar size)
void shade(); void shade();
void move(int x, int y); void move(int x, int y);
@ -210,6 +211,7 @@ private:
bool m_use_titlebar; ///< if we should use titlebar bool m_use_titlebar; ///< if we should use titlebar
bool m_use_handle; ///< if we should use handle bool m_use_handle; ///< if we should use handle
bool m_focused; ///< focused/unfocused mode bool m_focused; ///< focused/unfocused mode
bool m_visible; ///< if we are currently showing
/** /**
@name pixmaps and colors for rendering @name pixmaps and colors for rendering

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Window.cc,v 1.155 2003/04/28 13:38:23 rathnor Exp $ // $Id: Window.cc,v 1.156 2003/05/01 13:19:36 rathnor Exp $
#include "Window.hh" #include "Window.hh"
@ -201,7 +201,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
m_workspacesig(*this), m_workspacesig(*this),
m_diesig(*this), m_diesig(*this),
moving(false), resizing(false), shaded(false), maximized(false), moving(false), resizing(false), shaded(false), maximized(false),
visible(false), iconic(false), transient(false), focused(false), iconic(false), transient(false), focused(false),
stuck(false), modal(false), send_focus_message(false), m_managed(false), stuck(false), modal(false), send_focus_message(false), m_managed(false),
screen(scr), screen(scr),
timer(this), timer(this),
@ -233,7 +233,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
m_workspacesig(*this), m_workspacesig(*this),
m_diesig(*this), m_diesig(*this),
moving(false), resizing(false), shaded(false), maximized(false), moving(false), resizing(false), shaded(false), maximized(false),
visible(false), iconic(false), transient(false), focused(false), iconic(false), transient(false), focused(false),
stuck(false), modal(false), send_focus_message(false), m_managed(false), stuck(false), modal(false), send_focus_message(false), m_managed(false),
screen(scr), screen(scr),
timer(this), timer(this),
@ -850,7 +850,6 @@ void FluxboxWindow::getWMHints() {
//!! //!!
XWMHints *wmhint = XGetWMHints(display, m_client->window()); XWMHints *wmhint = XGetWMHints(display, m_client->window());
if (! wmhint) { if (! wmhint) {
visible = true;
iconic = false; iconic = false;
focus_mode = F_PASSIVE; focus_mode = F_PASSIVE;
m_client->window_group = None; m_client->window_group = None;
@ -1152,7 +1151,6 @@ bool FluxboxWindow::setInputFocus() {
return false; return false;
} }
m_frame.setFocus(true);
screen.setFocusedWindow(*m_client); screen.setFocusedWindow(*m_client);
Fluxbox::instance()->setFocusedWindow(this); Fluxbox::instance()->setFocusedWindow(this);
@ -1191,7 +1189,6 @@ void FluxboxWindow::iconify() {
return; return;
m_windowmenu.hide(); m_windowmenu.hide();
visible = false;
iconic = true; iconic = true;
setState(IconicState); setState(IconicState);
@ -1229,7 +1226,6 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
bool was_iconic = iconic; bool was_iconic = iconic;
iconic = false; iconic = false;
visible = true;
setState(NormalState); setState(NormalState);
ClientList::iterator client_it = clientList().begin(); ClientList::iterator client_it = clientList().begin();
@ -1283,7 +1279,6 @@ void FluxboxWindow::close() {
Set window in withdrawn state Set window in withdrawn state
*/ */
void FluxboxWindow::withdraw() { void FluxboxWindow::withdraw() {
visible = false;
iconic = false; iconic = false;
if (isResizing()) if (isResizing())
@ -1989,7 +1984,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
if (client == 0) if (client == 0)
return; return;
if (!ne.override_redirect && visible) { if (!ne.override_redirect && isVisible()) {
Fluxbox *fluxbox = Fluxbox::instance(); Fluxbox *fluxbox = Fluxbox::instance();
fluxbox->grab(); fluxbox->grab();
if (! validateClient()) if (! validateClient())
@ -2005,7 +2000,6 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
if (focused) if (focused)
m_frame.setFocus(true); m_frame.setFocus(true);
visible = true;
iconic = false; iconic = false;
// Auto-group from tab? // Auto-group from tab?
@ -2468,13 +2462,11 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
!isVisible()) { !isVisible()) {
return; return;
} }
if (ev.window == frame().window() || if (ev.window == frame().window() ||
ev.window == m_client->window()) { ev.window == m_client->window()) {
if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus()) if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus())
&& !isFocused()) { && !isFocused()) {
// check that there aren't any subsequent leave notify events in the // check that there aren't any subsequent leave notify events in the
// X event queue // X event queue
XEvent dummy; XEvent dummy;
@ -2485,8 +2477,6 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
if ((!sa.leave || sa.inferior) && setInputFocus()) if ((!sa.leave || sa.inferior) && setInputFocus())
installColormap(True); installColormap(True);
} }
} }
} }

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Window.hh,v 1.65 2003/04/28 13:38:23 rathnor Exp $ // $Id: Window.hh,v 1.66 2003/05/01 13:19:36 rathnor Exp $
#ifndef WINDOW_HH #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -242,7 +242,7 @@ public:
bool hasTransient() const; bool hasTransient() const;
inline bool isManaged() const { return m_managed; } inline bool isManaged() const { return m_managed; }
inline bool isFocused() const { return focused; } inline bool isFocused() const { return focused; }
inline bool isVisible() const { return visible; } inline bool isVisible() const { return m_frame.isVisible(); }
inline bool isIconic() const { return iconic; } inline bool isIconic() const { return iconic; }
inline bool isShaded() const { return shaded; } inline bool isShaded() const { return shaded; }
inline bool isMaximized() const { return maximized; } inline bool isMaximized() const { return maximized; }
@ -387,7 +387,7 @@ private:
std::string m_class_name; /// class name from WM_CLASS std::string m_class_name; /// class name from WM_CLASS
//Window state //Window state
bool moving, resizing, shaded, maximized, visible, iconic, transient, bool moving, resizing, shaded, maximized, iconic, transient,
focused, stuck, modal, send_focus_message, m_managed; focused, stuck, modal, send_focus_message, m_managed;
WinClient *m_attaching_tab; WinClient *m_attaching_tab;