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)
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:
* fix cause of (some?) excessive reconfigures (Simon)
fluxbox.cc

View file

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

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// 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
#define FBWINFRAME_HH
@ -67,6 +67,7 @@ public:
void hide();
void show();
inline bool isVisible() const { return m_visible; }
/// shade frame (ie resize to titlebar size)
void shade();
void move(int x, int y);
@ -210,6 +211,7 @@ private:
bool m_use_titlebar; ///< if we should use titlebar
bool m_use_handle; ///< if we should use handle
bool m_focused; ///< focused/unfocused mode
bool m_visible; ///< if we are currently showing
/**
@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
// 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"
@ -201,7 +201,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
m_workspacesig(*this),
m_diesig(*this),
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),
screen(scr),
timer(this),
@ -233,7 +233,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
m_workspacesig(*this),
m_diesig(*this),
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),
screen(scr),
timer(this),
@ -850,7 +850,6 @@ void FluxboxWindow::getWMHints() {
//!!
XWMHints *wmhint = XGetWMHints(display, m_client->window());
if (! wmhint) {
visible = true;
iconic = false;
focus_mode = F_PASSIVE;
m_client->window_group = None;
@ -1152,11 +1151,10 @@ bool FluxboxWindow::setInputFocus() {
return false;
}
m_frame.setFocus(true);
screen.setFocusedWindow(*m_client);
Fluxbox::instance()->setFocusedWindow(this);
if (send_focus_message)
m_client->sendFocus();
@ -1191,7 +1189,6 @@ void FluxboxWindow::iconify() {
return;
m_windowmenu.hide();
visible = false;
iconic = true;
setState(IconicState);
@ -1229,7 +1226,6 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) {
bool was_iconic = iconic;
iconic = false;
visible = true;
setState(NormalState);
ClientList::iterator client_it = clientList().begin();
@ -1283,7 +1279,6 @@ void FluxboxWindow::close() {
Set window in withdrawn state
*/
void FluxboxWindow::withdraw() {
visible = false;
iconic = false;
if (isResizing())
@ -1989,7 +1984,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
if (client == 0)
return;
if (!ne.override_redirect && visible) {
if (!ne.override_redirect && isVisible()) {
Fluxbox *fluxbox = Fluxbox::instance();
fluxbox->grab();
if (! validateClient())
@ -2005,7 +2000,6 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
if (focused)
m_frame.setFocus(true);
visible = true;
iconic = false;
// Auto-group from tab?
@ -2468,13 +2462,11 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
!isVisible()) {
return;
}
if (ev.window == frame().window() ||
ev.window == m_client->window()) {
if ((screen.isSloppyFocus() || screen.isSemiSloppyFocus())
&& !isFocused()) {
// check that there aren't any subsequent leave notify events in the
// X event queue
XEvent dummy;
@ -2482,11 +2474,9 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
sa.w = ev.window;
sa.enter = sa.leave = False;
XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa);
if ((!sa.leave || sa.inferior) && setInputFocus())
installColormap(True);
}
}
}

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// 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
#define WINDOW_HH
@ -242,7 +242,7 @@ public:
bool hasTransient() const;
inline bool isManaged() const { return m_managed; }
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 isShaded() const { return shaded; }
inline bool isMaximized() const { return maximized; }
@ -387,7 +387,7 @@ private:
std::string m_class_name; /// class name from WM_CLASS
//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;
WinClient *m_attaching_tab;