Integration of new Layering code, plus updates to the layering code itself

- new KeyActions: Raise/LowerLayer, AlwaysOnTop/Bottom, Top/BottomLayer
Added a "Quit" KeyAction
This commit is contained in:
rathnor 2003-02-02 16:32:41 +00:00
parent 5244fc3244
commit 1b063dcea9
27 changed files with 656 additions and 283 deletions

View file

@ -1,5 +1,13 @@
(Format: Year/Month/Day)
Changes for 0.1.15:
*03/02/03:
* Integration of new Layering code, plus updates to the code (Simon)
- new KeyActions: Raise/LowerLayer, AlwaysOnTop/Bottom, Top/BottomLayer
AtomHandler.hh Ewmh.hh/cc FbWindow.hh/cc Menu.hh MultLayers.hh/cc
XLayer.hh/cc XLayerItem.hh/cc Gnome.hh/cc Keys.hh/cc Screen.hh/cc Tab.cc
Window.hh/cc Workspace.hh/cc fluxbox.hh/cc fluxbox.1.in
* Added a "Quit" KeyAction (Simon)
Keys.hh/cc, fluxbox.cc fluxbox.1.in
*03/01/23:
* Added polish locales to fluxbox-generate_menu (thanks Adam Byrtek)
*03/01/16:

View file

@ -751,7 +751,14 @@ Here is a list of possible Operations:
Minimize
Raise
Lower
RaiseLayer
LowerLayer
TopLayer
BottomLayer
AlwaysOnTop (this is an alias for TopLayer)
AlwaysOnBottom (similarly)
Close
Quit
RootMenu
Workspace N (where N is positive integer)
Workspace1

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: AtomHandler.hh,v 1.5 2002/12/01 13:41:54 rathnor Exp $
// $Id: AtomHandler.hh,v 1.6 2003/02/02 16:32:37 rathnor Exp $
#ifndef ATOMHANDLER_HH
#define ATOMHANDLER_HH
@ -44,7 +44,8 @@ public:
virtual void updateWorkspace(FluxboxWindow &win) = 0;
virtual void updateState(FluxboxWindow &win) = 0;
virtual void updateHints(FluxboxWindow &win) = 0;
virtual void updateLayer(FluxboxWindow &win) = 0;
virtual bool checkClientMessage(const XClientMessageEvent &ce,
BScreen * const screen, FluxboxWindow * const win) = 0;

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: Ewmh.cc,v 1.9 2003/01/05 23:04:46 fluxgen Exp $
// $Id: Ewmh.cc,v 1.10 2003/02/02 16:32:37 rathnor Exp $
#include "Ewmh.hh"
@ -206,6 +206,10 @@ void Ewmh::updateState(FluxboxWindow &win) {
}
void Ewmh::updateLayer(FluxboxWindow &win) {
//TODO _NET_WM_WINDOW_TYPE
}
void Ewmh::updateHints(FluxboxWindow &win) {
}

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: Ewmh.hh,v 1.4 2002/12/01 13:41:56 rathnor Exp $
// $Id: Ewmh.hh,v 1.5 2003/02/02 16:32:37 rathnor Exp $
#include "AtomHandler.hh"
@ -40,6 +40,7 @@ public:
void updateWorkspaceCount(const BScreen &screen);
void updateState(FluxboxWindow &win);
void updateLayer(FluxboxWindow &win);
void updateHints(FluxboxWindow &win);
void updateWorkspace(FluxboxWindow &win);

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: FbWindow.cc,v 1.4 2003/01/05 22:58:11 fluxgen Exp $
// $Id: FbWindow.cc,v 1.5 2003/02/02 16:32:40 rathnor Exp $
#include "FbWindow.hh"
@ -33,7 +33,7 @@ namespace FbTk {
Display *FbWindow::s_display = 0;
FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0), m_x(0), m_y(0),
m_width(0), m_height(0), m_border_width(0) {
m_width(0), m_height(0), m_border_width(0), m_layeritem(0) {
if (s_display == 0)
s_display = App::instance()->display();

View file

@ -19,11 +19,13 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: FbWindow.hh,v 1.6 2003/01/05 22:55:14 fluxgen Exp $
// $Id: FbWindow.hh,v 1.7 2003/02/02 16:32:40 rathnor Exp $
#ifndef FBTK_FBWINDOW_HH
#define FBTK_FBWINDOW_HH
#include "XLayerItem.hh"
#include <X11/Xlib.h>
namespace FbTk {
@ -70,6 +72,10 @@ public:
void lower();
void raise();
XLayerItem *getLayerItem() const { return m_layeritem; }
void setLayerItem(XLayerItem *item) { m_layeritem = item; }
const FbWindow *parent() const { return m_parent; }
Window window() const { return m_window; }
int x() const { return m_x; }
@ -98,6 +104,8 @@ private:
int m_x, m_y; ///< position of window
size_t m_width, m_height; ///< size of window
size_t m_border_width; // border size
XLayerItem *m_layeritem;
};
bool operator == (Window win, const FbWindow &fbwin);

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: Menu.hh,v 1.5 2003/01/12 17:02:33 fluxgen Exp $
// $Id: Menu.hh,v 1.6 2003/02/02 16:32:41 rathnor Exp $
#ifndef FBTK_MENU_HH
#define FBTK_MENU_HH
@ -35,6 +35,7 @@
#include "EventHandler.hh"
#include "RefCount.hh"
#include "Command.hh"
#include "XLayerItem.hh"
namespace FbTk {
@ -80,6 +81,11 @@ public:
void raise();
/// lower this window
void lower();
XLayerItem *getLayerItem() const { return menu.window.getLayerItem(); }
void setLayerItem(XLayerItem *item) { menu.window.setLayerItem(item); }
void disableTitle();
void enableTitle();
/**

View file

@ -20,11 +20,12 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MultLayers.cc,v 1.2 2003/01/29 21:42:52 rathnor Exp $
// $Id: MultLayers.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $
#include "MultLayers.hh"
#include "XLayer.hh"
#include "XLayerItem.hh"
#include "App.hh"
using namespace FbTk;
@ -51,10 +52,44 @@ XLayerItem *MultLayers::getLowestItemAboveLayer(int layernum) {
}
XLayerItem *MultLayers::getItemBelow(XLayerItem &item) {
XLayer *curr_layer = item.getLayer();
cerr<<"getItemBelow xlayer = "<<hex<<curr_layer<<endl;
// assume that the LayerItem does exist in a layer.
XLayerItem *ret = curr_layer->getItemBelow(item);
if (!ret) {
int num = curr_layer->getLayerNum()-1;
while (num >= 0 && !ret) {
ret = m_layers[num]->getItemBelow(item);
num--;
}
}
return ret;
}
XLayerItem *MultLayers::getItemAbove(XLayerItem &item) {
XLayer *curr_layer = item.getLayer();
// assume that the LayerItem does exist in a layer.
XLayerItem *ret = curr_layer->getItemAbove(item);
if (!ret) {
ret = getLowestItemAboveLayer(curr_layer->getLayerNum());
}
return ret;
}
void MultLayers::addToTop(XLayerItem &item, int layernum) {
if (layernum < 0 || layernum >= m_numlayers) return;
if (layernum < 0)
layernum = 0;
else if (layernum >= m_numlayers)
layernum = m_numlayers-1;
m_layers[layernum]->insert(item);
restack();
}
void MultLayers::remove(XLayerItem &item) {
@ -70,24 +105,64 @@ void MultLayers::remove(XLayerItem &item) {
void MultLayers::raise(XLayerItem &item) {
// get the layer it is in
XLayer *curr_layer = item.getLayer();
if (!curr_layer || curr_layer->getLayerNum() == 0 || m_numlayers == 1) {
// do nothing
return;
}
curr_layer->remove(item);
m_layers[curr_layer->getLayerNum()-1]->insert(item);
moveToLayer(item, curr_layer->getLayerNum()-1);
}
/* lower the item one level */
void MultLayers::lower(XLayerItem &item) {
// get the layer it is in
XLayer *curr_layer = item.getLayer();
if (!curr_layer || curr_layer->getLayerNum() >= (m_numlayers-1) || m_numlayers == 1) {
// do nothing
moveToLayer(item, curr_layer->getLayerNum()+1);
}
void MultLayers::moveToLayer(XLayerItem &item, int layernum) {
// get the layer it is in
XLayer *curr_layer = item.getLayer();
if (!curr_layer) {
addToTop(item, layernum);
return;
}
if (curr_layer->getLayerNum() == layernum )
// do nothing
return;
if (layernum < 0)
layernum = 0;
else if (layernum >= m_numlayers)
layernum = m_numlayers-1;
curr_layer->remove(item);
m_layers[curr_layer->getLayerNum()+1]->insert(item);
m_layers[layernum]->insert(item);
}
void MultLayers::restack() {
int i=0, j=0, size=0;
for (; i < m_numlayers; i++) {
size += m_layers[i]->countWindows();
}
Window *winlist = new Window[size];
for (i=0; i < m_numlayers; i++) {
XLayer::ItemList::iterator it = m_layers[i]->getItemList().begin();
XLayer::ItemList::iterator it_end = m_layers[i]->getItemList().end();
for (; it != it_end; ++it) {
XLayerItem::Windows::const_iterator wit = (*it)->getWindows().begin();
XLayerItem::Windows::const_iterator wit_end = (*it)->getWindows().end();
for (; wit != wit_end; ++wit, j++) {
winlist[j] = (*wit);
}
}
}
XRestackWindows(FbTk::App::instance()->display(), winlist, size);
}
int MultLayers::size() {
int i = 0, num = 0;
for (; i < m_numlayers; i++) {
num += m_layers[i]->countWindows();
}
return num;
}

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: MultLayers.hh,v 1.2 2003/01/29 21:42:53 rathnor Exp $
// $Id: MultLayers.hh,v 1.3 2003/02/02 16:32:41 rathnor Exp $
#ifndef FBTK_MULTLAYERS_HH
#define FBTK_MULTLAYERS_HH
@ -37,17 +37,20 @@ public:
MultLayers(int numlayers);
~MultLayers();
XLayerItem *getLowestItemAboveLayer(int layernum);
// if there are none below, it will return null
XLayerItem *getItemBelow(XLayerItem &item);
XLayerItem *getItemAbove(XLayerItem &item);
void addToTop(XLayerItem &item, int layernum);
void remove(XLayerItem &item);
//void move(XLayerItem &item, int layernum);
// raise/lower the item a whole layer, not just to top of current layer
void raise(XLayerItem &item);
void lower(XLayerItem &item);
//void moveToTop(XLayerItem &item);
//void moveToBottom(XLayerItem &item);
void moveToLayer(XLayerItem &item, int layernum);
int size();
void restack();
private:
int m_numlayers;

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayer.cc,v 1.2 2003/01/29 21:42:53 rathnor Exp $
// $Id: XLayer.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $
#include "XLayer.hh"
#include "XLayerItem.hh"
@ -38,14 +38,11 @@ XLayer::~XLayer() {
}
void XLayer::restack() {
int numWindows = 0;
iterator it = itemList().begin();
iterator it_end = itemList().end();
for (size_t i=0; it != it_end; ++it, i++) {
numWindows += (*it)->numWindows();
}
int numWindows = countWindows();
// each LayerItem can contain several windows
iterator it = itemList().begin();
iterator it_end = itemList().end();
it = itemList().begin();
it_end = itemList().end();
Window *winlist = new Window[numWindows];
@ -63,6 +60,17 @@ void XLayer::restack() {
delete [] winlist;
}
int XLayer::countWindows() {
int numWindows = 0;
iterator it = itemList().begin();
iterator it_end = itemList().end();
for (size_t i=0; it != it_end; ++it, i++) {
numWindows += (*it)->numWindows();
}
return numWindows;
}
void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
// little optimisation
Window *winlist;
@ -79,6 +87,7 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
return;
}
} else {
i=1;
// stack relative to one above
@ -87,13 +96,12 @@ void XLayer::stackBelowItem(XLayerItem *item, XLayerItem *above) {
winlist[0] = above->getWindows().front();
}
XLayerItem::Windows::iterator it = item->getWindows().begin();
XLayerItem::Windows::iterator it_end = item->getWindows().end();
for (; it != it_end; ++it, i++) {
winlist[i] = (*it);
}
XRestackWindows(FbTk::App::instance()->display(), winlist, size);
delete [] winlist;
@ -106,7 +114,7 @@ XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
#endif // DEBUG
itemList().push_front(&item);
item.setLayer(*this);
item.setLayer(this);
// restack below next window up
item.setLayerIterator(itemList().begin());
stackBelowItem(&item, m_manager.getLowestItemAboveLayer(m_layernum));
@ -115,6 +123,7 @@ XLayer::iterator XLayer::insert(XLayerItem &item, unsigned int pos) {
void XLayer::remove(XLayerItem &item) {
itemList().erase(item.getLayerIterator());
item.setLayer(0);
}
void XLayer::cycleUp() {
@ -187,8 +196,9 @@ void XLayer::stepDown(XLayerItem &item) {
void XLayer::raise(XLayerItem &item) {
// assume it is already in this layer
if (&item == itemList().front())
if (&item == itemList().front()) {
return; // nothing to do
}
itemList().erase(item.getLayerIterator());
itemList().push_front(&item);
@ -215,3 +225,22 @@ XLayerItem *XLayer::getLowestItem() {
if (itemList().empty()) return 0;
else return itemList().back();
}
XLayerItem *XLayer::getItemBelow(XLayerItem &item) {
iterator it = item.getLayerIterator();
if (it == itemList().begin()) {
return 0;
} else {
return *(--it);
}
}
XLayerItem *XLayer::getItemAbove(XLayerItem &item) {
iterator it = item.getLayerIterator();
it++;
if (it == itemList().end()) {
return 0;
} else {
return *it;
}
}

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayer.hh,v 1.1 2003/01/16 12:41:27 rathnor Exp $
// $Id: XLayer.hh,v 1.2 2003/02/02 16:32:41 rathnor Exp $
#ifndef FBTK_XLAYER_HH
@ -36,18 +36,27 @@ class XLayerItem;
class XLayer : public FbTk::Layer<XLayerItem, std::list<XLayerItem *> > {
public:
XLayer(MultLayers &manager, int layernum);
~XLayer();
//typedef std::list<XLayerItem *>::iterator iterator;
typedef std::list<XLayerItem *> ItemList;
typedef std::list<XLayerItem *>::iterator iterator;
//typedef std::list<XLayerItem *>::reverse_iterator reverse_iterator;
void setLayerNum(int layernum) { m_layernum = layernum; };
int getLayerNum() { return m_layernum; };
void restack();
int countWindows();
void stackBelowItem(XLayerItem *item, XLayerItem *above);
XLayerItem *getLowestItem();
XLayerItem *getItemBelow(XLayerItem &item);
XLayerItem *getItemAbove(XLayerItem &item);
const ItemList &getItemList() const { return itemList(); }
ItemList &getItemList() { return itemList(); }
// we redefine these as XLayer has special optimisations, and X restacking needs
iterator insert(XLayerItem &item, unsigned int pos=0);
void remove(XLayerItem &item);

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayerItem.cc,v 1.2 2003/01/29 21:42:53 rathnor Exp $
// $Id: XLayerItem.cc,v 1.3 2003/02/02 16:32:41 rathnor Exp $
#include "XLayerItem.hh"
#include "XLayer.hh"
@ -39,12 +39,13 @@ XLayerItem::XLayerItem(XLayer &layer):
}*/
XLayerItem::~XLayerItem() {
m_layer->remove(*this);
if (m_layer)
m_layer->remove(*this);
}
void XLayerItem::setLayer(XLayer &layer) {
void XLayerItem::setLayer(XLayer *layer) {
// make sure we don't try to set the same layer
m_layer = &layer;
m_layer = layer;
}
void XLayerItem::raise() {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: XLayerItem.hh,v 1.2 2003/01/29 21:42:53 rathnor Exp $
// $Id: XLayerItem.hh,v 1.3 2003/02/02 16:32:41 rathnor Exp $
#ifndef FBTK_XLAYERITEM_HH
#define FBTK_XLAYERITEM_HH
@ -38,7 +38,7 @@ public:
XLayerItem(Window win);
~XLayerItem();
void setLayer(XLayer &layer);
void setLayer(XLayer *layer);
XLayer *getLayer() const { return m_layer; }
void raise();
void lower();
@ -46,7 +46,8 @@ public:
void stepDown();
XLayer::iterator getLayerIterator() const { return m_layeriterator; };
void setLayerIterator(XLayer::iterator it) { m_layeriterator = it; };
bool isEmpty() const { return m_windows.empty(); }
// not currently implemented
bool visible() { return true; }

View file

@ -19,10 +19,11 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Gnome.cc,v 1.6 2002/12/01 13:41:57 rathnor Exp $
// $Id: Gnome.cc,v 1.7 2003/02/02 16:32:37 rathnor Exp $
#include "Gnome.hh"
#include "fluxbox.hh"
#include "Window.hh"
#include "Screen.hh"
@ -61,8 +62,8 @@ void Gnome::initForScreen(const BScreen &screen) {
m_gnome_wm_win_workspace_names,
m_gnome_wm_win_client_list,
m_gnome_wm_win_state,
m_gnome_wm_win_hints
// m_gnome_wm_win_layer not supported yet
m_gnome_wm_win_hints,
m_gnome_wm_win_layer
};
//list atoms that we support
@ -96,8 +97,25 @@ void Gnome::setupWindow(FluxboxWindow &win) {
XFree (data);
}
// make sure we get right workspace
updateWorkspace(win);
// load gnome layer atom
if (XGetWindowProperty(disp, win.getClientWindow(),
m_gnome_wm_win_layer, 0, 1, False, XA_CARDINAL,
&ret_type, &fmt, &nitems, &bytes_after,
(unsigned char **) &data) == Success && data) {
flags = *data;
setLayer(&win, flags);
XFree (data);
}
// load gnome layer atom
if (XGetWindowProperty(disp, win.getClientWindow(),
m_gnome_wm_win_workspace, 0, 1, False, XA_CARDINAL,
&ret_type, &fmt, &nitems, &bytes_after,
(unsigned char **) &data) == Success && data) {
flags = *data;
win.getScreen()->reassociateWindow(&win, flags ,false);
XFree (data);
}
}
@ -209,6 +227,15 @@ void Gnome::updateState(FluxboxWindow &win) {
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&state, 1);
}
void Gnome::updateLayer(FluxboxWindow &win) {
//TODO - map from flux layers to gnome ones
int layernum = win.getLayerNum();
XChangeProperty(BaseDisplay::getXDisplay(), win.getClientWindow(),
m_gnome_wm_win_layer,
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&layernum, 1);
}
void Gnome::updateHints(FluxboxWindow &win) {
//TODO
@ -258,7 +285,13 @@ bool Gnome::checkClientMessage(const XClientMessageEvent &ce, BScreen * const sc
cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
#endif // DEBUG
} else
} else if (ce.message_type == m_gnome_wm_win_layer) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_LAYER"<<endl;
#endif // DEBUG
setLayer(win, ce.data.l[0]);
} else
return false; //the gnome atom wasn't found or not supported
return true; // we handled the atom
@ -314,29 +347,37 @@ void Gnome::setState(FluxboxWindow *win, int state) {
*/
}
void Gnome::setLayer(GnomeLayer layer) {
FluxboxWindow::WinLayer winlayer;
void Gnome::setLayer(FluxboxWindow *win, int layer) {
if (!win) return;
switch (layer) {
case WIN_LAYER_DESKTOP:
winlayer = FluxboxWindow::LAYER_BOTTOM;
layer = Fluxbox::instance()->getDesktopLayer();
break;
case WIN_LAYER_BELOW:
winlayer = FluxboxWindow::LAYER_BELOW;
layer = Fluxbox::instance()->getBottomLayer();
break;
case WIN_LAYER_NORMAL:
winlayer = FluxboxWindow::LAYER_NORMAL;
layer = Fluxbox::instance()->getNormalLayer();
break;
case WIN_LAYER_ONTOP:
layer = Fluxbox::instance()->getTopLayer();
break;
case WIN_LAYER_DOCK:
case WIN_LAYER_ABOVE_DOCK:
layer = Fluxbox::instance()->getSlitLayer();
break;
//case WIN_LAYER_ABOVE_DOCK:
case WIN_LAYER_MENU:
winlayer = FluxboxWindow::LAYER_TOP;
layer = Fluxbox::instance()->getMenuLayer();
break;
default:
winlayer = FluxboxWindow::LAYER_NORMAL;
// our windows are in the opposite direction to gnome
layer = Fluxbox::instance()->getDesktopLayer() - layer;
break;
}
win->getScreen()->setLayer(*win->getLayerItem(),layer);
}
void Gnome::createAtoms() {

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: Gnome.hh,v 1.4 2002/12/01 13:41:57 rathnor Exp $
// $Id: Gnome.hh,v 1.5 2003/02/02 16:32:37 rathnor Exp $
#ifndef GNOME_HH
#define GNOME_HH
@ -73,6 +73,7 @@ public:
void updateWorkspaceCount(const BScreen &screen);
void updateState(FluxboxWindow &win);
void updateLayer(FluxboxWindow &win);
void updateHints(FluxboxWindow &win);
void updateWorkspace(FluxboxWindow &win);
@ -80,7 +81,7 @@ public:
bool checkClientMessage(const XClientMessageEvent &ce, BScreen * const screen, FluxboxWindow * const win);
private:
void setLayer(GnomeLayer layer);
void setLayer(FluxboxWindow *win, int layer);
void setState(FluxboxWindow *win, int state);
void setLayer(int layer);
void createAtoms();

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: Keys.cc,v 1.21 2002/12/01 13:41:57 rathnor Exp $
//$Id: Keys.cc,v 1.22 2003/02/02 16:32:37 rathnor Exp $
#include "Keys.hh"
@ -72,6 +72,12 @@ Keys::t_actionstr Keys::m_actionlist[] = {
{"Minimize", ICONIFY},
{"Raise", RAISE},
{"Lower", LOWER},
{"RaiseLayer", RAISELAYER},
{"LowerLayer", LOWERLAYER},
{"TopLayer", TOPLAYER},
{"BottomLayer", BOTTOMLAYER},
{"AlwaysOnTop", TOPLAYER},
{"AlwaysOnBottom", BOTTOMLAYER},
{"Close", CLOSE},
{"AbortKeychain", ABORTKEYCHAIN},
{"Workspace", WORKSPACE},
@ -122,6 +128,7 @@ Keys::t_actionstr Keys::m_actionlist[] = {
{"ToggleDecor", TOGGLEDECOR},
{"ToggleTab", TOGGLETAB},
{"RootMenu", ROOTMENU},
{"Quit", QUIT},
{0, LASTKEYGRAB}
};
@ -249,8 +256,9 @@ bool Keys::load(const char *filename) {
for (i=0; i< LASTKEYGRAB; i++) {
// +1 on the val[argc] because we dont want to compare the ':'
if (strcasecmp(m_actionlist[i].string, val[argc].c_str()+1) == 0)
if (strcasecmp(m_actionlist[i].string, val[argc].c_str()+1) == 0) {
break;
}
}
if (i < LASTKEYGRAB ) {

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: Keys.hh,v 1.18 2002/12/01 13:41:57 rathnor Exp $
// $Id: Keys.hh,v 1.19 2003/02/02 16:32:38 rathnor Exp $
#ifndef KEYS_HH
#define KEYS_HH
@ -36,7 +36,9 @@ public:
*/
enum KeyAction{
ICONIFY=0,
RAISE, LOWER,
RAISE, LOWER,
RAISELAYER, LOWERLAYER, TOPLAYER, BOTTOMLAYER,
ALWAYSONTOP, ALWAYSONBOTTOM, // aliases for TOPLAYER, etc
CLOSE,
ABORTKEYCHAIN,
WORKSPACE,
@ -59,6 +61,7 @@ public:
TOGGLEDECOR,// toggle visibility of decor (title, frame, handles)
TOGGLETAB, // toggle visibilty of tab
ROOTMENU, // pop up rootmenu
QUIT, // Die, quit, logout, shutdown
LASTKEYGRAB //mark end of keygrabbs
};
/**

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: Screen.cc,v 1.100 2003/01/12 23:56:49 fluxgen Exp $
// $Id: Screen.cc,v 1.101 2003/02/02 16:32:38 rathnor Exp $
#include "Screen.hh"
@ -43,6 +43,8 @@
#include "BoolMenuItem.hh"
//#include "IntResMenuItem.hh"
#include "MacroCommand.hh"
#include "XLayerItem.hh"
#include "MultLayers.hh"
//use GNU extensions
#ifndef _GNU_SOURCE
@ -132,7 +134,11 @@ int dcmp(const void *one, const void *two) {
}
FbTk::Menu *createMenuFromScreen(BScreen &screen) {
return new FbTk::Menu(*screen.menuTheme(), screen.getScreenNumber(), *screen.getImageControl());
FbTk::Menu *menu = new FbTk::Menu(*screen.menuTheme(), screen.getScreenNumber(), *screen.getImageControl());
menu->setLayerItem(new FbTk::XLayerItem(menu->windowID()));
screen.setLayer(*menu->getLayerItem(), Fluxbox::instance()->getMenuLayer());
return menu;
}
};
@ -340,7 +346,8 @@ BScreen::BScreen(ResourceManager &rm,
m_workspacecount_sig(*this), // workspace count signal
m_workspacenames_sig(*this), // workspace names signal
m_currentworkspace_sig(*this), // current workspace signal
theme(0), m_windowtheme(scrn),
m_layermanager(0),
theme(0), m_windowtheme(scrn),
m_menutheme(new FbTk::MenuTheme(scrn)),
resource(rm, screenname, altscreenname),
m_root_theme(new RootTheme(*this))
@ -392,6 +399,7 @@ BScreen::BScreen(ResourceManager &rm,
fluxbox->load_rc(this);
m_layermanager = new FbTk::MultLayers(fluxbox->getNumberOfLayers());
image_control->setDither(*resource.image_dither);
theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(),
fluxbox->getStyleFilename(), getRootCommand().c_str());
@ -461,12 +469,12 @@ BScreen::BScreen(ResourceManager &rm,
Workspace *wkspc = (Workspace *) 0;
if (*resource.workspaces != 0) {
for (int i = 0; i < *resource.workspaces; ++i) {
wkspc = new Workspace(this, workspacesList.size());
wkspc = new Workspace(this, *m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc);
workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu());
}
} else {
wkspc = new Workspace(this, workspacesList.size());
wkspc = new Workspace(this, *m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc);
workspacemenu->insert(wkspc->name().c_str(), &wkspc->menu());
}
@ -547,7 +555,6 @@ BScreen::BScreen(ResourceManager &rm,
if (win) {
XMapRequestEvent mre;
mre.window = children[i];
win->restoreAttributes();
win->mapRequestEvent(mre);
}
}
@ -809,7 +816,7 @@ void BScreen::setAntialias(bool value) {
}
int BScreen::addWorkspace() {
Workspace *wkspc = new Workspace(this, workspacesList.size());
Workspace *wkspc = new Workspace(this, *m_layermanager, workspacesList.size());
workspacesList.push_back(wkspc);
addWorkspaceName(wkspc->name().c_str()); // update names
//add workspace to workspacemenu
@ -902,7 +909,7 @@ void BScreen::changeWorkspaceID(unsigned int id) {
!(focused && focused->isMoving())) {
current_workspace->getLastFocusedWindow()->setInputFocus();
} else if (focused && focused->isStuck()) {
} else if (focused && (focused->isStuck() || focused->isMoving())) {
focused->setInputFocus();
}
@ -1184,6 +1191,13 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
}
void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
// TODO: I don't think we need this...
#ifdef DEBUG
cerr<<"BScreen::raiseWindows() called"<<endl;
#endif //DEBUG
/*
Window session_stack[(workspace_stack.size() + workspacesList.size() + rootmenuList.size() + 30)];
int i = 0;
@ -1217,7 +1231,7 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) {
}
XRestackWindows(getBaseDisplay()->getXDisplay(), session_stack, i);
*/
}
void BScreen::saveStrftimeFormat(const char *format) {
@ -1311,7 +1325,7 @@ void BScreen::nextFocus(int opts) {
} while (*it != focused);
if (*it != focused && it != wins.end())
wksp->raiseWindow(*it);
raiseWindow(*it);
}
@ -1354,7 +1368,7 @@ void BScreen::prevFocus(int opts) {
} while (*it != focused);
if (*it != focused && it != wins.end())
wksp->raiseWindow(*it);
raiseWindow(*it);
}
}
@ -1375,8 +1389,7 @@ void BScreen::raiseFocus() {
}
if ((getCurrentWorkspace()->getCount() > 1) && have_focused)
getWorkspace(fb->getFocusedWindow()->getWorkspaceNumber())->
raiseWindow(fb->getFocusedWindow());
raiseWindow(fb->getFocusedWindow());
}
void BScreen::initMenu() {
@ -1924,6 +1937,151 @@ void BScreen::hideGeometry() {
}
}
void BScreen::raise(FbTk::XLayerItem &item) {
item.raise();
}
void BScreen::lower(FbTk::XLayerItem &item) {
item.lower();
}
void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) {
m_layermanager->moveToLayer(item, layernum);
}
void BScreen::removeLayerItem(FbTk::XLayerItem *item) {
m_layermanager->remove(*item);
delete item;
}
void BScreen::raiseWindow(FluxboxWindow *w) {
FluxboxWindow *win = w;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
win->getLayerItem()->raise();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
(*it)->getLayerItem()->raise();
}
}
}
void BScreen::lowerWindow(FluxboxWindow *w) {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
updateNetizenWindowLower(win->getClientWindow());
win->getLayerItem()->lower();
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowLower((*it)->getClientWindow());
(*it)->getLayerItem()->lower();
}
}
}
void BScreen::raiseWindowLayer(FluxboxWindow *w) {
FluxboxWindow *win = w;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
m_layermanager->raise(*win->getLayerItem());
win->setLayerNum(win->getLayerNum()-1);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
m_layermanager->raise(*(*it)->getLayerItem());
(*it)->setLayerNum((*it)->getLayerNum()-1);
}
}
}
void BScreen::lowerWindowLayer(FluxboxWindow *w) {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
if (!win->isIconic()) {
updateNetizenWindowLower(win->getClientWindow());
m_layermanager->lower(*win->getLayerItem());
win->setLayerNum(win->getLayerNum()+1);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowLower((*it)->getClientWindow());
m_layermanager->lower(*(*it)->getLayerItem());
(*it)->setLayerNum((*it)->getLayerNum()+1);
}
}
}
void BScreen::moveWindowToLayer(FluxboxWindow *win, int layernum) {
Fluxbox * fluxbox = Fluxbox::instance();
// don't let it set its layer into menu area
if (layernum <= fluxbox->getMenuLayer()) {
layernum = fluxbox->getMenuLayer() + 1;
}
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
if (!win->isIconic()) {
updateNetizenWindowRaise(win->getClientWindow());
m_layermanager->moveToLayer(*win->getLayerItem(),layernum);
win->setLayerNum(layernum);
}
std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end();
for (; it != it_end; ++it) {
if (!(*it)->isIconic()) {
updateNetizenWindowRaise((*it)->getClientWindow());
m_layermanager->moveToLayer(*(*it)->getLayerItem(), layernum);
(*it)->setLayerNum(layernum);
}
}
}
/**
Goes to the workspace "right" of the current
*/

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: Screen.hh,v 1.63 2003/01/12 23:54:10 fluxgen Exp $
// $Id: Screen.hh,v 1.64 2003/02/02 16:32:38 rathnor Exp $
#ifndef SCREEN_HH
#define SCREEN_HH
@ -34,6 +34,8 @@
#include "Resource.hh"
#include "Subject.hh"
#include "FbWinFrameTheme.hh"
#include "MultLayers.hh"
#include "XLayerItem.hh"
#include <X11/Xlib.h>
#include <X11/Xresource.h>
@ -273,6 +275,16 @@ public:
void showGeometry(unsigned int, unsigned int);
void hideGeometry();
void raise(FbTk::XLayerItem &item);
void lower(FbTk::XLayerItem &item);
void setLayer(FbTk::XLayerItem &item, int layernum);
void removeLayerItem(FbTk::XLayerItem *item);
void raiseWindow(FluxboxWindow *win);
void lowerWindow(FluxboxWindow *win);
void raiseWindowLayer(FluxboxWindow *win);
void lowerWindowLayer(FluxboxWindow *win);
void moveWindowToLayer(FluxboxWindow *win, int layernum);
FluxboxWindow* useAutoGroupWindow();
void updateNetizenCurrentWorkspace();
@ -323,6 +335,7 @@ private:
m_workspacenames_sig, ///< workspace names signal
m_currentworkspace_sig; ///< current workspace signal
FbTk::MultLayers *m_layermanager;
Theme *theme;
@ -398,4 +411,4 @@ private:
};
#endif // SCREEN_HH
#endif // SCREEN_

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: Tab.cc,v 1.52 2003/01/12 18:31:33 fluxgen Exp $
// $Id: Tab.cc,v 1.53 2003/02/02 16:32:38 rathnor Exp $
#include "Tab.hh"
@ -173,7 +173,7 @@ void Tab::lower() {
do {
XLowerWindow(m_display, current->m_tabwin); //lower tabwin and tabs window
win = current->getWindow();
win->getScreen()->getWorkspace(win->getWorkspaceNumber())->lowerWindow(win);
win->getScreen()->lowerWindow(win);
current = current->next(); //get next
if (current == 0)

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.112 2003/01/10 20:20:37 fluxgen Exp $
// $Id: Window.cc,v 1.113 2003/02/02 16:32:39 rathnor Exp $
#include "Window.hh"
@ -99,6 +99,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
FbTk::MenuTheme &menutheme):
m_hintsig(*this),
m_statesig(*this),
m_layersig(*this),
m_workspacesig(*this),
m_diesig(*this),
moving(false), resizing(false), shaded(false), maximized(false),
@ -109,7 +110,9 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
display(0),
lastButtonPressTime(0),
m_windowmenu(menutheme, screen_num, imgctrl),
m_layer(LAYER_NORMAL), old_decoration(DECOR_NORMAL),
m_layeritem(0),
m_layernum(4),
old_decoration(DECOR_NORMAL),
tab(0),
m_frame(tm, imgctrl, screen_num, 0, 0, 100, 100) {
@ -150,13 +153,18 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
client.mwm_hint = 0;
client.blackbox_hint = 0;
Fluxbox *fluxbox = Fluxbox::instance();
// default to normal layer
m_layernum = fluxbox->getNormalLayer();
getBlackboxHints();
if (! client.blackbox_hint)
if (! client.blackbox_hint) {
getMWMHints();
}
// get size, aspect, minimum/maximum size and other hints set
// by the client
getWMProtocols();
getWMHints();
getWMNormalHints();
@ -206,7 +214,7 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
}
upsize();
bool place_window = true;
if (fluxbox->isStartup() || transient ||
client.normal_hint_flags & (PPosition|USPosition)) {
@ -241,13 +249,18 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
associateClientWindow();
grabButtons();
positionWindows();
m_layeritem = new FbTk::XLayerItem(getFrameWindow());
if (workspace_number < 0 || workspace_number >= screen->getCount())
screen->getCurrentWorkspace()->addWindow(this, place_window);
else
screen->getWorkspace(workspace_number)->addWindow(this, place_window);
workspace_number = screen->getCurrentWorkspaceID();
restoreAttributes(place_window);
screen->moveWindowToLayer(this, m_layernum);
screen->getWorkspace(workspace_number)->addWindow(this, place_window);
moveResize(m_frame.x(), m_frame.y(), m_frame.width(), m_frame.height());
@ -267,10 +280,13 @@ FluxboxWindow::FluxboxWindow(Window w, BScreen *s, int screen_num, FbTk::ImageCo
deiconify(); //we're omnipresent and visible
}
setState(current_state);
// no focus default
setFocusFlag(false);
// finaly show the frame and the client window
m_frame.show();
XSync(display, False);
}
@ -342,6 +358,15 @@ FluxboxWindow::~FluxboxWindow() {
if (client.window)
fluxbox->removeWindowSearch(client.window);
if (m_layeritem) {
m_layeritem->removeWindow(getFrameWindow());
//if (hasTab())
// m_layeritem->removeWindow(get tab window)
if (m_layeritem->isEmpty()) {
screen->removeLayerItem(m_layeritem);
}
}
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): ~FluxboxWindow("<<this<<")"<<endl;
#endif // DEBUG
@ -732,6 +757,8 @@ void FluxboxWindow::getBlackboxHints() {
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_WORKSPACE)
workspace_number = client.blackbox_hint->workspace;
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_STACK)
workspace_number = client.blackbox_hint->stack;
if (client.blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) {
old_decoration = static_cast<Decoration>(client.blackbox_hint->decoration);
@ -1093,6 +1120,19 @@ void FluxboxWindow::setWorkspace(int n) {
m_workspacesig.notify();
}
void FluxboxWindow::setLayerNum(int layernum) {
m_layernum = layernum;
blackbox_attrib.flags |= BaseDisplay::ATTRIB_STACK;
blackbox_attrib.stack = layernum;
saveBlackboxHints();
#ifdef DEBUG
cerr<<this<<" notify layer signal"<<endl;
#endif // DEBUG
m_layersig.notify();
}
void FluxboxWindow::shade() {
if (decorations.titlebar) {
@ -1147,18 +1187,13 @@ void FluxboxWindow::lower() {
if (isIconic())
deiconify();
screen->getWorkspace(workspace_number)->lowerWindow(this);
if (hasTab())
getTab()->lower(); //lower the tab AND it's windows
screen->lowerWindow(this);
}
void FluxboxWindow::raise() {
if (isIconic())
deiconify();
screen->getWorkspace(workspace_number)->raiseWindow(this);
//raise tab first if there is any
if (hasTab())
tab->raise();
screen->raiseWindow(this);
}
void FluxboxWindow::setFocusFlag(bool focus) {
@ -1214,6 +1249,13 @@ void FluxboxWindow::installColormap(bool install) {
fluxbox->ungrab();
}
void FluxboxWindow::saveBlackboxHints() {
Fluxbox *fluxbox = Fluxbox::instance();
XChangeProperty(display, client.window, fluxbox->getFluxboxAttributesAtom(),
fluxbox->getFluxboxAttributesAtom(), 32, PropModeReplace,
(unsigned char *) &blackbox_attrib, PropBlackboxAttributesElements);
}
void FluxboxWindow::setState(unsigned long new_state) {
current_state = new_state;
@ -1225,10 +1267,7 @@ void FluxboxWindow::setState(unsigned long new_state) {
fluxbox->getWMStateAtom(), 32, PropModeReplace,
(unsigned char *) state, 2);
XChangeProperty(display, client.window, fluxbox->getFluxboxAttributesAtom(),
fluxbox->getFluxboxAttributesAtom(), 32, PropModeReplace,
(unsigned char *) &blackbox_attrib, PropBlackboxAttributesElements);
saveBlackboxHints();
//notify state changed
m_statesig.notify();
}
@ -1328,8 +1367,12 @@ void FluxboxWindow::setGravityOffsets() {
m_frame.move(newx, newy);
}
void FluxboxWindow::restoreAttributes() {
/*
* restoreAttributes sets the attributes to what they should be
* but doesn't change the actual state
* (so the caller can set defaults etc as well)
*/
void FluxboxWindow::restoreAttributes(bool place_window) {
if (!getState())
current_state = NormalState;
@ -1363,15 +1406,14 @@ void FluxboxWindow::restoreAttributes() {
int save_state =
((current_state == IconicState) ? NormalState : current_state);
shaded = false;
shade();
shaded = true;
current_state = save_state;
}
if (( blackbox_attrib.workspace != screen->getCurrentWorkspaceID()) &&
( blackbox_attrib.workspace < screen->getCount())) {
screen->reassociateWindow(this, blackbox_attrib.workspace, true);
workspace_number = blackbox_attrib.workspace;
if (current_state == NormalState) current_state = WithdrawnState;
} else if (current_state == WithdrawnState)
@ -1379,12 +1421,16 @@ void FluxboxWindow::restoreAttributes() {
if (blackbox_attrib.flags & BaseDisplay::ATTRIB_OMNIPRESENT &&
blackbox_attrib.attrib & BaseDisplay::ATTRIB_OMNIPRESENT) {
stuck = false;
stick();
stuck = true;
current_state = NormalState;
}
if (blackbox_attrib.flags & BaseDisplay::ATTRIB_STACK) {
//TODO check value?
m_layernum = blackbox_attrib.stack;
}
if ((blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ) ||
(blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT)) {
int x = blackbox_attrib.premax_x, y = blackbox_attrib.premax_y;
@ -1392,7 +1438,7 @@ void FluxboxWindow::restoreAttributes() {
maximized = false;
if ((blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ) &&
(blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT))
maximize();
maximized = true;
else if (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT)
maximizeVertical();
else if (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ)
@ -2221,7 +2267,7 @@ void FluxboxWindow::restore(bool remap) {
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
&dummy)) {
#ifdef DEBUG
cerr<<"FluxboxWindow::restore: reparent 0x"<<hex<<client.window<<dec<<"to root"<<endl;
cerr<<"FluxboxWindow::restore: reparent 0x"<<hex<<client.window<<dec<<" to root"<<endl;
#endif // DEBUG
// reparent to screen window
@ -2282,6 +2328,12 @@ void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) {
deiconify();
}
if (net.flags & BaseDisplay::ATTRIB_STACK) {
if ((unsigned int) m_layernum != net.stack) {
screen->moveWindowToLayer(this, net.stack);
}
}
if (net.flags & BaseDisplay::ATTRIB_DECORATION) {
old_decoration = static_cast<Decoration>(net.decoration);
setDecoration(old_decoration);

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.42 2003/01/09 22:16:40 fluxgen Exp $
// $Id: Window.hh,v 1.43 2003/02/02 16:32:40 rathnor Exp $
#ifndef WINDOW_HH
#define WINDOW_HH
@ -33,6 +33,7 @@
#include "Subject.hh"
#include "FbWinFrame.hh"
#include "EventHandler.hh"
#include "XLayerItem.hh"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -59,14 +60,6 @@ class ImageControl;
/// Creates the window frame and handles any window event for it
class FluxboxWindow : public FbTk::TimeoutHandler, public FbTk::EventHandler {
public:
/// layer bits
enum WinLayer {
LAYER_BOTTOM = 0x01, ///< bottom layer
LAYER_BELOW = 0x02, ///< below normal layer but above bottom
LAYER_NORMAL = 0x04, ///< normal layer
LAYER_TOP = 0x08 ///< top layer
};
/// decoration bit
enum Decoration {
DECOR_NONE=0, ///< no decor at all
@ -145,7 +138,7 @@ public:
void setWorkspace(int n);
void changeBlackboxHints(const BaseDisplay::BlackboxHints &bh);
void restoreAttributes();
void restoreAttributes(bool place_window);
void showMenu(int mx, int my);
// popup menu on last button press position
void popupMenu();
@ -204,6 +197,9 @@ public:
const BScreen *getScreen() const { return screen; }
BScreen *getScreen() { return screen; }
const FbTk::XLayerItem *getLayerItem() const { return m_layeritem; }
FbTk::XLayerItem *getLayerItem() { return m_layeritem; }
const Tab *getTab() const { return tab; }
Tab *getTab() { return tab; }
@ -227,7 +223,8 @@ public:
int getYClient() const { return client.y; }
unsigned int getWorkspaceNumber() const { return workspace_number; }
int getWindowNumber() const { return window_number; }
WinLayer getLayer() const { return m_layer; }
int getLayerNum() const { return m_layernum; }
void setLayerNum(int layernum);
unsigned int getWidth() const { return m_frame.width(); }
unsigned int getHeight() const { return m_frame.height(); }
unsigned int getClientHeight() const { return client.height; }
@ -247,6 +244,8 @@ public:
*/
FbTk::Subject &stateSig() { return m_statesig; }
const FbTk::Subject &stateSig() const { return m_statesig; }
FbTk::Subject &layerSig() { return m_layersig; }
const FbTk::Subject &layerSig() const { return m_layersig; }
FbTk::Subject &hintSig() { return m_hintsig; }
const FbTk::Subject &hintSig() const { return m_hintsig; }
FbTk::Subject &workspaceSig() { return m_workspacesig; }
@ -297,6 +296,7 @@ private:
void getWMHints();
void getMWMHints();
void getBlackboxHints();
void saveBlackboxHints();
void setNetWMAttributes();
void associateClientWindow();
void createWinButtons();
@ -312,7 +312,7 @@ private:
void left_fixsize(int *x = 0, int *y = 0);
// state and hint signals
WinSubject m_hintsig, m_statesig, m_workspacesig, m_diesig;
WinSubject m_hintsig, m_statesig, m_layersig, m_workspacesig, m_diesig;
std::string m_instance_name; /// instance name from WM_CLASS
std::string m_class_name; /// class name from WM_CLASS
@ -328,6 +328,8 @@ private:
Time lastButtonPressTime;
FbTk::Menu m_windowmenu;
FbTk::XLayerItem *m_layeritem;
int m_layernum;
timeval lastFocusTime;
@ -338,7 +340,7 @@ private:
int focus_mode, window_number;
unsigned int workspace_number;
unsigned long current_state;
WinLayer m_layer;
Decoration old_decoration;
struct _client {

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: Workspace.cc,v 1.43 2003/01/13 12:59:26 fluxgen Exp $
// $Id: Workspace.cc,v 1.44 2003/02/02 16:32:40 rathnor Exp $
#include "Workspace.hh"
@ -72,10 +72,11 @@ int countTransients(const FluxboxWindow &win) {
Workspace::GroupList Workspace::m_groups;
Workspace::Workspace(BScreen *scrn, unsigned int i):
Workspace::Workspace(BScreen *scrn, FbTk::MultLayers &layermanager, unsigned int i):
screen(scrn),
lastfocus(0),
m_clientmenu(*scrn->menuTheme(), scrn->getScreenNumber(), *scrn->getImageControl()),
m_layermanager(layermanager),
m_name(""),
m_id(i),
cascade_x(32), cascade_y(32) {
@ -107,8 +108,6 @@ int Workspace::addWindow(FluxboxWindow *w, bool place) {
w->setWorkspace(m_id);
w->setWindowNumber(m_windowlist.size());
stackingList.push_front(w);
//insert window after the currently focused window
//FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow();
@ -139,14 +138,14 @@ int Workspace::addWindow(FluxboxWindow *w, bool place) {
m_clientmenu.insert(w->getTitle().c_str());
m_windowlist.push_back(w);
w->raise();
//update menugraphics
m_clientmenu.update();
if (!w->isStuck())
screen->updateNetizenWindowAdd(w->getClientWindow(), m_id);
raiseWindow(w);
return w->getWindowNumber();
}
@ -159,8 +158,6 @@ int Workspace::removeWindow(FluxboxWindow *w) {
lastfocus = 0;
}
stackingList.remove(w);
if (w->isFocused()) {
if (screen->isSloppyFocus()) {
Fluxbox::instance()->setFocusedWindow(0); // set focused window to none
@ -174,8 +171,43 @@ int Workspace::removeWindow(FluxboxWindow *w) {
w->getTransientFor()->setInputFocus();
} else {
FluxboxWindow *top = 0;
if (stackingList.size() != 0)
top = stackingList.front();
// this bit is pretty dodgy at present
// it gets the next item down, then scans through our windowlist to see if it is
// in this workspace. If not, goes down more
FbTk::XLayerItem *item = 0, *lastitem = w->getLayerItem();
do {
item = m_layermanager.getItemBelow(*lastitem);
Windows::iterator it = m_windowlist.begin();
Windows::iterator it_end = m_windowlist.end();
for (; it != it_end; ++it) {
if ((*it)->getLayerItem() == item) {
// found one!
top = *it;
}
}
lastitem = item;
} while (item && !top);
if (!top) {
// look upwards
lastitem = w->getLayerItem();
do {
item = m_layermanager.getItemAbove(*lastitem);
Windows::iterator it = m_windowlist.begin();
Windows::iterator it_end = m_windowlist.end();
for (; it != it_end; ++it) {
if ((*it)->getLayerItem() == item) {
// found one!
top = *it;
}
}
lastitem = item;
} while (item && !top);
}
if (top == 0|| !top->setInputFocus()) {
Fluxbox::instance()->setFocusedWindow(0); // set focused window to none
@ -183,7 +215,7 @@ int Workspace::removeWindow(FluxboxWindow *w) {
}
}
// we don't remove it from the layermanager, as it may be being moved
Windows::iterator it = m_windowlist.begin();
Windows::iterator it_end = m_windowlist.end();
@ -216,8 +248,8 @@ int Workspace::removeWindow(FluxboxWindow *w) {
void Workspace::showAll() {
WindowStack::iterator it = stackingList.begin();
WindowStack::iterator it_end = stackingList.end();
Windows::iterator it = m_windowlist.begin();
Windows::iterator it_end = m_windowlist.end();
for (; it != it_end; ++it) {
(*it)->deiconify(false, false);
}
@ -225,8 +257,8 @@ void Workspace::showAll() {
void Workspace::hideAll() {
WindowStack::reverse_iterator it = stackingList.rbegin();
WindowStack::reverse_iterator it_end = stackingList.rend();
Windows::reverse_iterator it = m_windowlist.rbegin();
Windows::reverse_iterator it_end = m_windowlist.rend();
for (; it != it_end; ++it) {
if (! (*it)->isStuck())
(*it)->withdraw();
@ -243,63 +275,6 @@ void Workspace::removeAll() {
}
void Workspace::raiseWindow(FluxboxWindow *w) {
FluxboxWindow *win = w;
while (win->getTransientFor()) {
win = win->getTransientFor();
assert(win != win->getTransientFor());
}
int i = 1 + countTransients(*win);
Stack nstack(i);
Stack::iterator stackit = nstack.begin();
*(stackit++) = win->getFrameWindow();
screen->updateNetizenWindowRaise(win->getClientWindow());
if (! win->isIconic()) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win);
wkspc->stackingList.push_front(win);
}
raiseAndFillStack(stackit, *win);
screen->raiseWindows(nstack);
}
void Workspace::lowerWindow(FluxboxWindow *w) {
FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = w;
while (bottom->getTransientFor()) {
bottom = bottom->getTransientFor();
assert(bottom != bottom->getTransientFor());
}
win = bottom;
int i = 1 + countTransients(*win);
Stack st(i);
Stack::iterator stackit = st.begin();
lowerAndFillStack(stackit, *win);
(*stackit) = win->getFrameWindow();
screen->updateNetizenWindowLower(win->getClientWindow());
if (! win->isIconic()) {
Workspace *wkspc = screen->getWorkspace(win->getWorkspaceNumber());
wkspc->stackingList.remove(win);
wkspc->stackingList.push_back(win);
}
XLowerWindow(BaseDisplay::getXDisplay(), st.front());
XRestackWindows(BaseDisplay::getXDisplay(), &st[0], st.size());
}
void Workspace::reconfigure() {
m_clientmenu.reconfigure();
@ -460,6 +435,7 @@ void Workspace::setName(const std::string &name) {
void Workspace::shutdown() {
// note: when the window dies it'll remove it self from the list
while (!m_windowlist.empty()) {
cerr<<m_windowlist.size()<<endl;
m_windowlist.back()->restore(true); // restore with remap
delete m_windowlist.back(); //delete window (the window removes it self from m_windowlist)
}
@ -800,55 +776,3 @@ void Workspace::placeWindow(FluxboxWindow *win) {
win->moveResize(place_x, place_y, win->getWidth(), win->getHeight());
}
void Workspace::raiseAndFillStack(Stack::iterator &stackit, const FluxboxWindow &w) {
if (w.getTransients().empty())
return;
std::list<FluxboxWindow *>::const_iterator it = w.getTransients().begin();
std::list<FluxboxWindow *>::const_iterator it_end = w.getTransients().end();
for (; it != it_end; ++it) {
*stackit++ = (*it)->getFrameWindow();
screen->updateNetizenWindowRaise((*it)->getClientWindow());
if (! (*it)->isIconic()) {
Workspace *wkspc = screen->getWorkspace((*it)->getWorkspaceNumber());
wkspc->stackingList.remove((*it));
wkspc->stackingList.push_front((*it));
}
}
it = w.getTransients().begin();
for (; it != it_end; ++it)
raiseAndFillStack(stackit, *(*it));
}
void Workspace::lowerAndFillStack(Stack::iterator &stackit, const FluxboxWindow &win) {
if (win.getTransients().empty()) // nothing to lower and stack
return;
std::list<FluxboxWindow *>::const_reverse_iterator it = win.getTransients().rbegin();
std::list<FluxboxWindow *>::const_reverse_iterator it_end = win.getTransients().rend();
for (; it != it_end; ++it)
lowerAndFillStack(stackit, *(*it));
it = win.getTransients().rbegin();
for (; it != it_end; ++it) {
(*stackit) = (*it)->getFrameWindow();
++stackit;
screen->updateNetizenWindowLower((*it)->getClientWindow());
if (! (*it)->isIconic()) {
Workspace *wkspc = screen->getWorkspace((*it)->getWorkspaceNumber());
wkspc->stackingList.remove((*it));
wkspc->stackingList.push_back((*it));
}
}
}

View file

@ -28,6 +28,7 @@
#include "NotCopyable.hh"
#include "Menu.hh"
#include "MultLayers.hh"
#include <X11/Xlib.h>
@ -46,7 +47,7 @@ public:
typedef std::vector<FluxboxWindow *> Windows;
typedef std::vector<Window> Stack;
explicit Workspace(BScreen *screen, unsigned int workspaceid = 0);
explicit Workspace(BScreen *screen, FbTk::MultLayers &layermanager, unsigned int workspaceid = 0);
~Workspace();
void setLastFocusedWindow(FluxboxWindow *w);
@ -57,8 +58,6 @@ public:
void showAll();
void hideAll();
void removeAll();
void raiseWindow(FluxboxWindow *win);
void lowerWindow(FluxboxWindow *win);
void reconfigure();
void update();
void setCurrent();
@ -97,9 +96,6 @@ protected:
private:
void raiseAndFillStack(Stack::iterator &it, const FluxboxWindow &win);
void lowerAndFillStack(Stack::iterator &it, const FluxboxWindow &win);
BScreen *screen;
FluxboxWindow *lastfocus;
FbTk::Menu m_clientmenu;
@ -110,7 +106,7 @@ private:
static GroupList m_groups; ///< handle auto groupings
WindowStack stackingList;
FbTk::MultLayers &m_layermanager;
Windows m_windowlist;
std::string m_name; ///< name of this workspace

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: fluxbox.cc,v 1.92 2003/01/12 18:50:27 fluxgen Exp $
// $Id: fluxbox.cc,v 1.93 2003/02/02 16:32:40 rathnor Exp $
#include "fluxbox.hh"
@ -296,6 +296,7 @@ Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc
m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"),
m_rc_iconbar(m_resourcemanager, true, "session.iconbar", "Session.Iconbar"),
m_rc_colors_per_channel(m_resourcemanager, 4, "session.colorsPerChannel", "Session.ColorsPerChannel"),
m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"),
m_rc_stylefile(m_resourcemanager, "", "session.styleFile", "Session.StyleFile"),
m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"),
m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"),
@ -701,7 +702,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
win = tab->getWindow();
if (win->getScreen()->isSloppyFocus() && (! win->isFocused()) &&
(! no_focus)) {
win->getScreen()->getWorkspace(win->getWorkspaceNumber())->raiseWindow(win);
win->getScreen()->raiseWindow(win);
grab();
@ -1112,24 +1113,18 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
break;
case Keys::NEXTWINDOW: //activate next window
screen->nextFocus(key->getParam());
if (focused_window && focused_window->getTab())
focused_window->getTab()->raise();
break;
case Keys::PREVWINDOW: //activate prev window
screen->prevFocus(key->getParam());
if (focused_window && focused_window->getTab())
focused_window->getTab()->raise();
break;
case Keys::NEXTTAB:
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
if (tab->next()) {
screen->getCurrentWorkspace()->raiseWindow(
tab->next()->getWindow());
screen->raiseWindow(tab->next()->getWindow());
tab->next()->getWindow()->setInputFocus();
} else {
screen->getCurrentWorkspace()->raiseWindow(
tab->first()->getWindow());
screen->raiseWindow(tab->first()->getWindow());
tab->first()->getWindow()->setInputFocus();
}
}
@ -1138,12 +1133,10 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
if (tab->prev()) {
screen->getCurrentWorkspace()->raiseWindow(
tab->prev()->getWindow());
screen->raiseWindow(tab->prev()->getWindow());
tab->prev()->getWindow()->setInputFocus();
} else {
screen->getCurrentWorkspace()->raiseWindow(
tab->last()->getWindow());
screen->raiseWindow(tab->last()->getWindow());
tab->last()->getWindow()->setInputFocus();
}
}
@ -1151,16 +1144,14 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
case Keys::FIRSTTAB:
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
screen->getCurrentWorkspace()->raiseWindow(
tab->first()->getWindow());
screen->raiseWindow(tab->first()->getWindow());
tab->first()->getWindow()->setInputFocus();
}
break;
case Keys::LASTTAB:
if (focused_window && focused_window->getTab()) {
Tab *tab = focused_window->getTab();
screen->getCurrentWorkspace()->raiseWindow(
tab->last()->getWindow());
screen->raiseWindow(tab->last()->getWindow());
tab->last()->getWindow()->setInputFocus();
}
break;
@ -1180,6 +1171,11 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
}
break;
case Keys::QUIT:
{
shutdown();
}
break;
case Keys::ROOTMENU: //show root menu
{
ScreenList::iterator it = screenList.begin();
@ -1247,15 +1243,22 @@ void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
focused_window->iconify();
break;
case Keys::RAISE:
if (focused_window->hasTab())
focused_window->getTab()->raise(); //raise the tabs if we have any
focused_window->getScreen()->getWorkspace(focused_window->getWorkspaceNumber())->raiseWindow(focused_window);
focused_window->raise();
break;
case Keys::LOWER:
focused_window->getScreen()->getWorkspace(focused_window->getWorkspaceNumber())->lowerWindow(focused_window);
if (focused_window->hasTab())
focused_window->getTab()->lower(); //lower the tabs AND it's windows
focused_window->lower();
break;
case Keys::RAISELAYER:
focused_window->getScreen()->raiseWindowLayer(focused_window);
break;
case Keys::LOWERLAYER:
focused_window->getScreen()->lowerWindowLayer(focused_window);
break;
case Keys::TOPLAYER:
focused_window->getScreen()->moveWindowToLayer(focused_window,getBottomLayer());
break;
case Keys::BOTTOMLAYER:
focused_window->getScreen()->moveWindowToLayer(focused_window,getTopLayer());
break;
case Keys::CLOSE:
focused_window->close();
@ -1459,6 +1462,14 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
if (m_atomhandler[i]->update())
m_atomhandler[i]->updateState(win);
}
} else if ((&(win.layerSig())) == changedsub) { // layer signal
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<") WINDOW layer signal from "<<&win<<endl;
#endif // DEBUG
for (size_t i=0; i<m_atomhandler.size(); ++i) {
if (m_atomhandler[i]->update())
m_atomhandler[i]->updateLayer(win);
}
} else if ((&(win.workspaceSig())) == changedsub) { // workspace signal
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<") WINDOW workspace signal from "<<&win<<endl;
@ -1516,6 +1527,7 @@ void Fluxbox::attachSignals(FluxboxWindow &win) {
win.hintSig().attach(this);
win.stateSig().attach(this);
win.workspaceSig().attach(this);
win.layerSig().attach(this);
for (size_t i=0; i<m_atomhandler.size(); ++i) {
m_atomhandler[i]->setupWindow(win);
}

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: fluxbox.hh,v 1.39 2003/01/12 18:49:36 fluxgen Exp $
// $Id: fluxbox.hh,v 1.40 2003/02/02 16:32:40 rathnor Exp $
#ifndef FLUXBOX_HH
#define FLUXBOX_HH
@ -111,6 +111,16 @@ public:
inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); }
inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; }
inline int colorsPerChannel() const { return *m_rc_colors_per_channel; }
inline int getNumberOfLayers() const { return *m_rc_numlayers; }
// TODO there probably should be configurable
inline int getDesktopLayer() const { return 12; }
inline int getBottomLayer() const { return 10; }
inline int getNormalLayer() const { return 8; }
inline int getTopLayer() const { return 2; }
inline int getSlitLayer() const { return 4; }
inline int getMenuLayer() const { return 0; }
inline const timeval &getAutoRaiseDelay() const { return resource.auto_raise_delay; }
@ -201,7 +211,7 @@ private:
//--- Resources
Resource<bool> m_rc_tabs, m_rc_iconbar;
Resource<int> m_rc_colors_per_channel;
Resource<int> m_rc_colors_per_channel, m_rc_numlayers;
Resource<std::string> m_rc_stylefile,
m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile,
m_rc_groupfile;