fixed focus issues with remember hidden, patch from Mathias Gumz

This commit is contained in:
fluxgen 2004-02-20 09:07:27 +00:00
parent 1e405808fb
commit 3c78d753c0
8 changed files with 85 additions and 39 deletions

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: Ewmh.cc,v 1.43 2004/02/14 12:15:35 fluxgen Exp $ // $Id: Ewmh.cc,v 1.44 2004/02/20 09:05:38 fluxgen Exp $
#include "Ewmh.hh" #include "Ewmh.hh"
@ -174,7 +174,8 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
*/ */
if (atoms[l] == m_net_wm_window_type_dock) { if (atoms[l] == m_net_wm_window_type_dock) {
// we also assume it shouldn't be visible in any toolbar // we also assume it shouldn't be visible in any toolbar
win.setHidden(true); win.setFocusHidden(true);
win.setIconHidden(true);
break; break;
} }
@ -722,7 +723,8 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
setFullscreen(win, value); setFullscreen(win, value);
} else if (state == m_net_wm_state_hidden || } else if (state == m_net_wm_state_hidden ||
state == m_net_wm_state_skip_taskbar) { state == m_net_wm_state_skip_taskbar) {
win.setHidden(value); win.setFocusHidden(value);
win.setIconHidden(win.isFocusHidden());
} else if (state == m_net_wm_state_below) { } else if (state == m_net_wm_state_below) {
if (value) if (value)
win.moveToLayer(Fluxbox::instance()->getBottomLayer()); win.moveToLayer(Fluxbox::instance()->getBottomLayer());
@ -752,7 +754,8 @@ void Ewmh::toggleState(FluxboxWindow &win, Atom state) {
setFullscreen(win, getState(win) == 0); // toggle current state setFullscreen(win, getState(win) == 0); // toggle current state
} else if (state == m_net_wm_state_hidden || } else if (state == m_net_wm_state_hidden ||
state == m_net_wm_state_skip_taskbar) { state == m_net_wm_state_skip_taskbar) {
win.setHidden(!win.isHidden()); win.setFocusHidden(!win.isFocusHidden());
win.setIconHidden(!win.isIconHidden());
} else if (state == m_net_wm_state_below) { } else if (state == m_net_wm_state_below) {
if (win.layerNum() == Fluxbox::instance()->getBottomLayer()) if (win.layerNum() == Fluxbox::instance()->getBottomLayer())
win.moveToLayer(Fluxbox::instance()->getNormalLayer()); win.moveToLayer(Fluxbox::instance()->getNormalLayer());

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: Gnome.cc,v 1.33 2004/01/19 18:36:27 fluxgen Exp $ // $Id: Gnome.cc,v 1.34 2004/02/20 09:05:38 fluxgen Exp $
#include "Gnome.hh" #include "Gnome.hh"
@ -369,7 +369,10 @@ void Gnome::setState(FluxboxWindow *win, int state) {
win->shade(); win->shade();
if (state & WIN_STATE_HIDDEN) if (state & WIN_STATE_HIDDEN)
win->setHidden(! win->isHidden()); {
win->setFocusHidden(! win->isFocusHidden());
win->setIconHidden(! win->isIconHidden());
}
/* /*

View file

@ -20,7 +20,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: IconbarTool.cc,v 1.33 2004/02/16 10:26:03 fluxgen Exp $ // $Id: IconbarTool.cc,v 1.34 2004/02/20 09:05:24 fluxgen Exp $
#include "IconbarTool.hh" #include "IconbarTool.hh"
@ -211,7 +211,7 @@ inline bool checkAddWindow(IconbarTool::Mode mode, const FluxboxWindow &win) {
break; break;
} }
if (win.isHidden()) if (win.isIconHidden())
ret_val = false; ret_val = false;
return ret_val; return ret_val;
@ -682,7 +682,7 @@ void IconbarTool::removeWindow(FluxboxWindow &win) {
void IconbarTool::addWindow(FluxboxWindow &win) { void IconbarTool::addWindow(FluxboxWindow &win) {
// we just want windows that has clients // we just want windows that has clients
if (win.clientList().empty() || win.isHidden() ) if (win.clientList().empty() || win.isIconHidden() )
return; return;
IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win); IconButton *button = new IconButton(m_icon_container, m_theme.focusedText().font(), win);

View file

@ -21,7 +21,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: Remember.cc,v 1.34 2004/02/16 10:25:33 fluxgen Exp $ // $Id: Remember.cc,v 1.35 2004/02/20 09:05:38 fluxgen Exp $
#include "Remember.hh" #include "Remember.hh"
#include "ClientPattern.hh" #include "ClientPattern.hh"
@ -210,7 +210,8 @@ Application::Application(bool grouped)
{ {
decostate_remember = decostate_remember =
dimensions_remember = dimensions_remember =
hiddenstate_remember = focushiddenstate_remember =
iconhiddenstate_remember =
jumpworkspace_remember = jumpworkspace_remember =
layer_remember = layer_remember =
position_remember = position_remember =
@ -364,8 +365,13 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
app.rememberShadedstate((str_label=="yes")); app.rememberShadedstate((str_label=="yes"));
} else if (str_key == "Tab") { } else if (str_key == "Tab") {
app.rememberTabstate((str_label=="yes")); app.rememberTabstate((str_label=="yes"));
} else if (str_key == "FocusHidden") {
app.rememberFocusHiddenstate((str_label=="yes"));
} else if (str_key == "IconHidden") {
app.rememberIconHiddenstate((str_label=="yes"));
} else if (str_key == "Hidden") { } else if (str_key == "Hidden") {
app.rememberHiddenstate((str_label=="yes")); app.rememberIconHiddenstate((str_label=="yes"));
app.rememberFocusHiddenstate((str_label=="yes"));
} else if (str_key == "Deco") { } else if (str_key == "Deco") {
if (str_label == "NONE") { if (str_label == "NONE") {
app.rememberDecostate((unsigned int) 0); app.rememberDecostate((unsigned int) 0);
@ -548,9 +554,6 @@ void Remember::save() {
if (a.tabstate_remember) { if (a.tabstate_remember) {
apps_file << " [Tab]\t\t{" << ((a.tabstate)?"yes":"no") << "}" << endl; apps_file << " [Tab]\t\t{" << ((a.tabstate)?"yes":"no") << "}" << endl;
} }
if (a.hiddenstate_remember) {
apps_file << " [Hidden]\t\t{" << ((a.tabstate)?"yes":"no") << "}" << endl;
}
if (a.decostate_remember) { if (a.decostate_remember) {
switch (a.decostate) { switch (a.decostate) {
case (0) : case (0) :
@ -578,6 +581,17 @@ void Remember::save() {
break; break;
} }
} }
if (a.focushiddenstate_remember || a.iconhiddenstate_remember) {
if (a.focushiddenstate_remember && a.iconhiddenstate_remember &&
a.focushiddenstate && a.iconhiddenstate)
apps_file << " [Hidden]\t{" << ((a.focushiddenstate)?"yes":"no") << "}" << endl;
else if (a.focushiddenstate_remember) {
apps_file << " [FocusHidden]\t{" << ((a.focushiddenstate)?"yes":"no") << "}" << endl;
} else if (a.iconhiddenstate_remember) {
apps_file << " [IconHidden]\t{" << ((a.iconhiddenstate)?"yes":"no") << "}" << endl;
}
}
if (a.stuckstate_remember) { if (a.stuckstate_remember) {
apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl; apps_file << " [Sticky]\t{" << ((a.stuckstate)?"yes":"no") << "}" << endl;
} }
@ -607,8 +621,11 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
case REM_POSITION: case REM_POSITION:
return app->position_remember; return app->position_remember;
break; break;
case REM_HIDDENSTATE: case REM_FOCUSHIDDENSTATE:
return app->hiddenstate_remember; return app->focushiddenstate_remember;
break;
case REM_ICONHIDDENSTATE:
return app->iconhiddenstate_remember;
break; break;
case REM_STUCKSTATE: case REM_STUCKSTATE:
return app->stuckstate_remember; return app->stuckstate_remember;
@ -655,8 +672,11 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
case REM_POSITION: case REM_POSITION:
app->rememberPosition(win->x(), win->y()); app->rememberPosition(win->x(), win->y());
break; break;
case REM_HIDDENSTATE: case REM_FOCUSHIDDENSTATE:
app->rememberHiddenstate(win->isHidden()); app->rememberFocusHiddenstate(win->isFocusHidden());
break;
case REM_ICONHIDDENSTATE:
app->rememberIconHiddenstate(win->isIconHidden());
break; break;
case REM_SHADEDSTATE: case REM_SHADEDSTATE:
app->rememberShadedstate(win->isShaded()); app->rememberShadedstate(win->isShaded());
@ -703,8 +723,11 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
case REM_POSITION: case REM_POSITION:
app->forgetPosition(); app->forgetPosition();
break; break;
case REM_HIDDENSTATE: case REM_FOCUSHIDDENSTATE:
app->forgetHiddenstate(); app->forgetFocusHiddenstate();
break;
case REM_ICONHIDDENSTATE:
app->forgetIconHiddenstate();
break; break;
case REM_STUCKSTATE: case REM_STUCKSTATE:
app->forgetStuckstate(); app->forgetStuckstate();
@ -809,8 +832,10 @@ void Remember::setupFrame(FluxboxWindow &win) {
if (win.isStuck() && !app->stuckstate || if (win.isStuck() && !app->stuckstate ||
!win.isStuck() && app->stuckstate) !win.isStuck() && app->stuckstate)
win.stick(); // toggles win.stick(); // toggles
if (app->hiddenstate_remember) if (app->focushiddenstate_remember)
win.setHidden(true); win.setFocusHidden(true);
if (app->iconhiddenstate_remember)
win.setIconHidden(true);
if (app->layer_remember) if (app->layer_remember)
win.moveToLayer(app->layer); win.moveToLayer(app->layer);

View file

@ -21,7 +21,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: Remember.hh,v 1.15 2004/02/16 10:25:34 fluxgen Exp $ // $Id: Remember.hh,v 1.16 2004/02/20 09:05:38 fluxgen Exp $
/* Based on the original "Remember patch" by Xavier Brouckaert */ /* Based on the original "Remember patch" by Xavier Brouckaert */
@ -50,7 +50,8 @@ public:
inline void forgetShadedstate() { shadedstate_remember = false; } inline void forgetShadedstate() { shadedstate_remember = false; }
inline void forgetTabstate() { tabstate_remember = false; } inline void forgetTabstate() { tabstate_remember = false; }
inline void forgetDecostate() { decostate_remember = false; } inline void forgetDecostate() { decostate_remember = false; }
inline void forgetHiddenstate() { hiddenstate_remember= false; } inline void forgetFocusHiddenstate() { focushiddenstate_remember= false; }
inline void forgetIconHiddenstate() { iconhiddenstate_remember= false; }
inline void forgetStuckstate() { stuckstate_remember = false; } inline void forgetStuckstate() { stuckstate_remember = false; }
inline void forgetJumpworkspace() { jumpworkspace_remember = false; } inline void forgetJumpworkspace() { jumpworkspace_remember = false; }
inline void forgetLayer() { layer_remember = false; } inline void forgetLayer() { layer_remember = false; }
@ -60,9 +61,10 @@ public:
{ workspace = ws; workspace_remember = true; } { workspace = ws; workspace_remember = true; }
inline void rememberDimensions(int width, int height) inline void rememberDimensions(int width, int height)
{ w = width; h = height; dimensions_remember = true; } { w = width; h = height; dimensions_remember = true; }
inline void rememberFocusHiddenstate(bool state)
inline void rememberHiddenstate(bool state) { focushiddenstate= state; focushiddenstate_remember= true; }
{ hiddenstate= state; hiddenstate_remember= true; } inline void rememberIconHiddenstate(bool state)
{ iconhiddenstate= state; iconhiddenstate_remember= true; }
inline void rememberPosition(int posx, int posy, unsigned char rfc= 0 ) inline void rememberPosition(int posx, int posy, unsigned char rfc= 0 )
{ x = posx; y = posy; refc = rfc; position_remember = true; } { x = posx; y = posy; refc = rfc; position_remember = true; }
inline void rememberShadedstate(bool state) inline void rememberShadedstate(bool state)
@ -106,8 +108,11 @@ public:
bool stuckstate_remember; bool stuckstate_remember;
bool stuckstate; bool stuckstate;
bool hiddenstate_remember; bool focushiddenstate_remember;
bool hiddenstate; bool focushiddenstate;
bool iconhiddenstate_remember;
bool iconhiddenstate;
bool jumpworkspace_remember; bool jumpworkspace_remember;
bool jumpworkspace; bool jumpworkspace;
@ -138,7 +143,8 @@ public:
enum Attribute { enum Attribute {
REM_DECOSTATE= 0, REM_DECOSTATE= 0,
REM_DIMENSIONS, REM_DIMENSIONS,
REM_HIDDENSTATE, REM_FOCUSHIDDENSTATE,
REM_ICONHIDDENSTATE,
REM_JUMPWORKSPACE, REM_JUMPWORKSPACE,
REM_LAYER, REM_LAYER,
REM_POSITION, REM_POSITION,

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: Screen.cc,v 1.266 2004/02/10 18:53:37 fluxgen Exp $ // $Id: Screen.cc,v 1.267 2004/02/20 09:06:19 fluxgen Exp $
#include "Screen.hh" #include "Screen.hh"
@ -2411,7 +2411,7 @@ bool BScreen::doSkipWindow(const WinClient &winclient, int opts) {
// skip if not active client (i.e. only visit each fbwin once) // skip if not active client (i.e. only visit each fbwin once)
(opts & CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() || (opts & CYCLEGROUPS) != 0 && win->winClient().window() != winclient.window() ||
(opts & CYCLESKIPSHADED) != 0 && win->isShaded() || // skip if shaded (opts & CYCLESKIPSHADED) != 0 && win->isShaded() || // skip if shaded
win->isHidden() win->isFocusHidden()
); );
} }

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.267 2004/02/16 09:19:45 fluxgen Exp $ // $Id: Window.cc,v 1.268 2004/02/20 09:07:27 fluxgen Exp $
#include "Window.hh" #include "Window.hh"
@ -265,6 +265,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
m_focussig(*this), m_focussig(*this),
m_titlesig(*this), m_titlesig(*this),
m_themelistener(*this), m_themelistener(*this),
m_icon_hidden(false),
moving(false), resizing(false), shaded(false), moving(false), resizing(false), shaded(false),
iconic(false), focused(false), iconic(false), focused(false),
stuck(false), m_managed(false), stuck(false), m_managed(false),
@ -1688,7 +1689,7 @@ void FluxboxWindow::moveToLayer(int layernum) {
} }
} }
void FluxboxWindow::setHidden(bool value) { void FluxboxWindow::setFocusHidden(bool value) {
if(value) if(value)
m_blackbox_attrib.flags |= ATTRIB_HIDDEN; m_blackbox_attrib.flags |= ATTRIB_HIDDEN;
else else
@ -1697,6 +1698,12 @@ void FluxboxWindow::setHidden(bool value) {
m_statesig.notify(); m_statesig.notify();
} }
void FluxboxWindow::setIconHidden(bool value) {
m_icon_hidden= value;
m_statesig.notify();
}
// window has actually RECEIVED focus (got a FocusIn event) // window has actually RECEIVED focus (got a FocusIn event)
// so now we make it a focused frame etc // so now we make it a focused frame etc
void FluxboxWindow::setFocusFlag(bool focus) { void FluxboxWindow::setFocusFlag(bool focus) {

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.108 2004/02/16 20:47:51 fluxgen Exp $ // $Id: Window.hh,v 1.109 2004/02/20 09:07:27 fluxgen Exp $
#ifndef WINDOW_HH #ifndef WINDOW_HH
#define WINDOW_HH #define WINDOW_HH
@ -207,7 +207,8 @@ public:
void raiseLayer(); void raiseLayer();
void lowerLayer(); void lowerLayer();
void moveToLayer(int layernum); void moveToLayer(int layernum);
void setHidden(bool value); void setFocusHidden(bool value);
void setIconHidden(bool value);
void reconfigure(); void reconfigure();
@ -262,7 +263,8 @@ public:
@name accessors @name accessors
*/ */
//@{ //@{
inline bool isHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); }
inline bool isIconHidden() const { return m_icon_hidden; }
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; }
bool isVisible() const; bool isVisible() const;
@ -468,7 +470,7 @@ private:
} functions; } functions;
bool m_shaped; ///< if the window is shaped with a mask bool m_shaped; ///< if the window is shaped with a mask
bool m_icon_hidden; ///< if the window is in the iconbar
int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized
unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state
int m_last_button_x, ///< last known x position of the mouse button int m_last_button_x, ///< last known x position of the mouse button