cleaning
This commit is contained in:
parent
77beb5472b
commit
89fddca1d7
6 changed files with 160 additions and 150 deletions
|
@ -19,7 +19,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Gnome.cc,v 1.16 2003/04/15 00:17:59 fluxgen Exp $
|
||||
// $Id: Gnome.cc,v 1.17 2003/04/15 12:22:52 fluxgen Exp $
|
||||
|
||||
#include "Gnome.hh"
|
||||
|
||||
|
@ -126,6 +126,7 @@ void Gnome::setupWindow(FluxboxWindow &win) {
|
|||
void Gnome::updateClientList(BScreen &screen) {
|
||||
size_t num=0;
|
||||
|
||||
// count window clients in each workspace
|
||||
BScreen::Workspaces::const_iterator workspace_it =
|
||||
screen.getWorkspacesList().begin();
|
||||
BScreen::Workspaces::const_iterator workspace_it_end =
|
||||
|
@ -138,14 +139,14 @@ void Gnome::updateClientList(BScreen &screen) {
|
|||
for (; win_it != win_it_end; ++win_it)
|
||||
num += (*win_it)->numClients();
|
||||
}
|
||||
//int num = getCurrentWorkspace()->getWindowList().size();
|
||||
|
||||
Window *wl = new (nothrow) Window[num];
|
||||
if (wl == 0) {
|
||||
cerr<<"Fatal: Out of memory, can't allocate for gnome client list"<<endl;
|
||||
return;
|
||||
}
|
||||
//start the iterator from begining
|
||||
|
||||
//add client windows to buffer
|
||||
workspace_it = screen.getWorkspacesList().begin();
|
||||
int win=0;
|
||||
for (; workspace_it != workspace_it_end; ++workspace_it) {
|
||||
|
|
|
@ -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.120 2003/04/15 00:50:24 rathnor Exp $
|
||||
// $Id: Screen.cc,v 1.121 2003/04/15 12:14:53 fluxgen Exp $
|
||||
|
||||
|
||||
#include "Screen.hh"
|
||||
|
@ -377,7 +377,8 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
|
|||
opaque_move(rm, false, "session.opaqueMove", "Session.OpaqueMove"),
|
||||
full_max(rm, true, scrname+".fullMaximization", altscrname+".FullMaximization"),
|
||||
max_over_slit(rm, true, scrname+".maxOverSlit",altscrname+".MaxOverSlit"),
|
||||
sloppy_window_grouping(rm, true, scrname+".sloppywindowgrouping", altscrname+".SloppyWindowGrouping"),
|
||||
sloppy_window_grouping(rm, true,
|
||||
scrname+".sloppywindowgrouping", altscrname+".SloppyWindowGrouping"),
|
||||
workspace_warping(rm, true, scrname+".workspacewarping", altscrname+".WorkspaceWarping"),
|
||||
desktop_wheeling(rm, true, scrname+".desktopwheeling", altscrname+".DesktopWheeling"),
|
||||
show_window_pos(rm, true, scrname+".showwindowposition", altscrname+".ShowWindowPosition"),
|
||||
|
@ -388,13 +389,17 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
|
|||
rootcommand(rm, "", scrname+".rootCommand", altscrname+".RootCommand"),
|
||||
focus_model(rm, Fluxbox::CLICKTOFOCUS, scrname+".focusModel", altscrname+".FocusModel"),
|
||||
workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"),
|
||||
toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
|
||||
toolbar_width_percent(rm, 65,
|
||||
scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"),
|
||||
edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"),
|
||||
slit_layernum(rm, Fluxbox::instance()->getDockLayer(), scrname+".slit.layer", altscrname+".Slit.Layer"),
|
||||
toolbar_layernum(rm, Fluxbox::instance()->getDesktopLayer(), scrname+".toolbar.layer", altscrname+".Toolbar.Layer"),
|
||||
slit_layernum(rm, Fluxbox::Layer(Fluxbox::instance()->getDockLayer()),
|
||||
scrname+".slit.layer", altscrname+".Slit.Layer"),
|
||||
toolbar_layernum(rm, Fluxbox::Layer(Fluxbox::instance()->getDesktopLayer()),
|
||||
scrname+".toolbar.layer", altscrname+".Toolbar.Layer"),
|
||||
toolbar_mode(rm, ToolbarHandler::ICONS, scrname+".toolbar.mode", altscrname+".Toolbar.Mode"),
|
||||
toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"),
|
||||
toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altscrname+".Toolbar.Placement")
|
||||
toolbar_placement(rm, Toolbar::BOTTOMCENTER,
|
||||
scrname+".toolbar.placement", altscrname+".Toolbar.Placement")
|
||||
{
|
||||
|
||||
};
|
||||
|
@ -460,7 +465,7 @@ BScreen::BScreen(ResourceManager &rm,
|
|||
image_control->installRootColormap();
|
||||
root_colormap_installed = true;
|
||||
|
||||
fluxbox->load_rc(this);
|
||||
fluxbox->load_rc(*this);
|
||||
|
||||
image_control->setDither(*resource.image_dither);
|
||||
theme = new Theme(disp, getRootWindow(), colormap(), getScreenNumber(),
|
||||
|
@ -698,7 +703,7 @@ void BScreen::reconfigure() {
|
|||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__LINE__<<"): BScreen::reconfigure"<<endl;
|
||||
#endif // DEBUG
|
||||
Fluxbox::instance()->loadRootCommand(this);
|
||||
Fluxbox::instance()->loadRootCommand(*this);
|
||||
theme->setRootCommand(getRootCommand());
|
||||
const string &filename = Fluxbox::instance()->getStyleFilename();
|
||||
theme->load(filename.c_str()); // old theme engine
|
||||
|
|
108
src/Window.cc
108
src/Window.cc
|
@ -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.132 2003/04/15 00:50:25 rathnor Exp $
|
||||
// $Id: Window.cc,v 1.133 2003/04/15 12:18:37 fluxgen Exp $
|
||||
|
||||
#include "Window.hh"
|
||||
|
||||
|
@ -34,9 +34,9 @@
|
|||
#include "Netizen.hh"
|
||||
#include "FbWinFrameTheme.hh"
|
||||
#include "MenuTheme.hh"
|
||||
|
||||
#include "TextButton.hh"
|
||||
#include "EventManager.hh"
|
||||
#include "FbAtoms.hh"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
@ -279,11 +279,12 @@ void FluxboxWindow::init() {
|
|||
// we don't want to duplicate code here and in attachClient
|
||||
m_clientlist.push_back(m_client);
|
||||
#ifdef DEBUG
|
||||
cerr<<"FluxboxWindow::init(this="<<this<<")"<<endl;
|
||||
cerr<<__FILE__<<": FluxboxWindow::init(this="<<this<<", client="<<hex<<m_client->window()<<dec<<")"<<endl;
|
||||
#endif // DEBUG
|
||||
TextButton *btn = new TextButton(m_frame.label(),
|
||||
m_frame.theme().font(),
|
||||
m_client->title());
|
||||
btn->setJustify(m_frame.theme().justify());
|
||||
m_labelbuttons[m_client] = btn;
|
||||
m_frame.addLabelButton(*btn);
|
||||
btn->show();
|
||||
|
@ -464,10 +465,6 @@ void FluxboxWindow::attachClient(WinClient &client) {
|
|||
if (client.m_win == this)
|
||||
return;
|
||||
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl;
|
||||
cerr<<"attach client window = "<<hex<<client.window()<<dec<<endl;
|
||||
#endif // DEBUG
|
||||
// reparent client win to this frame
|
||||
m_frame.setClientWindow(client);
|
||||
|
||||
|
@ -483,26 +480,31 @@ void FluxboxWindow::attachClient(WinClient &client) {
|
|||
// reparent window to this
|
||||
m_frame.setClientWindow(*(*client_it));
|
||||
(*client_it)->m_win = this;
|
||||
// create a labelbutton for this client and associate it with the pointer
|
||||
// create a labelbutton for this client and
|
||||
// associate it with the pointer
|
||||
TextButton *btn = new TextButton(m_frame.label(),
|
||||
m_frame.theme().font(),
|
||||
(*client_it)->title());
|
||||
btn->setJustify(m_frame.theme().justify());
|
||||
m_labelbuttons[(*client_it)] = btn;
|
||||
m_frame.addLabelButton(*btn);
|
||||
btn->show();
|
||||
FbTk::EventManager &evm = *FbTk::EventManager::instance();
|
||||
// we need motion notify so we mask it
|
||||
btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask);
|
||||
btn->window().setEventMask(ExposureMask | ButtonPressMask |
|
||||
ButtonReleaseMask | ButtonMotionMask);
|
||||
|
||||
|
||||
FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(*(*client_it)));
|
||||
FbTk::RefCount<FbTk::Command>
|
||||
set_client_cmd(new SetClientCmd(*(*client_it)));
|
||||
btn->setOnClick(set_client_cmd);
|
||||
evm.add(*this, btn->window()); // we take care of button events for this
|
||||
|
||||
// update transients in client to have this as transient_for
|
||||
WinClient::TransientList::iterator trans_it = (*client_it)->transientList().begin();
|
||||
WinClient::TransientList::iterator trans_it_end = (*client_it)->transientList().end();
|
||||
WinClient::TransientList::iterator trans_it =
|
||||
(*client_it)->transientList().begin();
|
||||
WinClient::TransientList::iterator trans_it_end =
|
||||
(*client_it)->transientList().end();
|
||||
for (; trans_it != trans_it_end; ++trans_it) {
|
||||
(*trans_it)->m_client->transient_for = this;
|
||||
}
|
||||
|
@ -525,8 +527,8 @@ void FluxboxWindow::attachClient(WinClient &client) {
|
|||
btn->show();
|
||||
FbTk::EventManager &evm = *FbTk::EventManager::instance();
|
||||
// we need motion notify so we mask it
|
||||
btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask);
|
||||
btn->window().setEventMask(ExposureMask | ButtonPressMask |
|
||||
ButtonReleaseMask | ButtonMotionMask);
|
||||
|
||||
|
||||
FbTk::RefCount<FbTk::Command> set_client_cmd(new SetClientCmd(client));
|
||||
|
@ -535,8 +537,10 @@ void FluxboxWindow::attachClient(WinClient &client) {
|
|||
|
||||
client.m_win = this;
|
||||
// update transients in client to have this as transient_for
|
||||
WinClient::TransientList::iterator trans_it = client.transientList().begin();
|
||||
WinClient::TransientList::iterator trans_it_end = client.transientList().end();
|
||||
WinClient::TransientList::iterator trans_it =
|
||||
client.transientList().begin();
|
||||
WinClient::TransientList::iterator trans_it_end =
|
||||
client.transientList().end();
|
||||
for (; trans_it != trans_it_end; ++trans_it) {
|
||||
(*trans_it)->m_client->transient_for = this;
|
||||
}
|
||||
|
@ -545,19 +549,11 @@ void FluxboxWindow::attachClient(WinClient &client) {
|
|||
}
|
||||
|
||||
m_frame.reconfigure();
|
||||
#ifdef DEBUG
|
||||
XSync(display, False); // so we see error/warnings in time
|
||||
cerr<<"destroyed old window "<<client.window()<<endl;
|
||||
#endif // DEBUG
|
||||
|
||||
// keep the current window on top
|
||||
m_client->raise();
|
||||
|
||||
#ifdef DEBUG
|
||||
XSync(display, False); // so we see error/warnings in time
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<") clientlist size: "<<m_clientlist.size()<<endl;
|
||||
cerr<<endl<<endl<<endl;
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -567,12 +563,6 @@ bool FluxboxWindow::detachClient(WinClient &client) {
|
|||
if (client.m_win != this || numClients() <= 1)
|
||||
return false;
|
||||
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"] client to detach: "<<
|
||||
hex<<client.window()<<dec<<endl;
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): number of clients = "<<numClients()<<endl;
|
||||
#endif // DEBUG
|
||||
|
||||
removeClient(client);
|
||||
|
||||
client.m_win = screen.createWindow(client);
|
||||
|
@ -634,11 +624,15 @@ WinClient *FluxboxWindow::findClient(Window win) {
|
|||
|
||||
/// raise and focus next client
|
||||
void FluxboxWindow::nextClient() {
|
||||
if (numClients() == 1)
|
||||
if (numClients() <= 1)
|
||||
return;
|
||||
|
||||
ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client);
|
||||
assert(it != m_clientlist.end());
|
||||
if (it == m_clientlist.end()) {
|
||||
m_client = m_clientlist.front();
|
||||
return;
|
||||
}
|
||||
|
||||
it++;
|
||||
if (it == m_clientlist.end())
|
||||
m_client = m_clientlist.front();
|
||||
|
@ -649,12 +643,14 @@ void FluxboxWindow::nextClient() {
|
|||
}
|
||||
|
||||
void FluxboxWindow::prevClient() {
|
||||
if (numClients() == 1)
|
||||
if (numClients() <= 1)
|
||||
return;
|
||||
|
||||
ClientList::iterator it = find(m_clientlist.begin(), m_clientlist.end(), m_client);
|
||||
assert(it != m_clientlist.end());
|
||||
|
||||
if (it == m_clientlist.end()) {
|
||||
m_client = m_clientlist.front();
|
||||
return;
|
||||
}
|
||||
if (it == m_clientlist.begin())
|
||||
m_client = m_clientlist.back();
|
||||
else
|
||||
|
@ -909,11 +905,11 @@ void FluxboxWindow::getMWMHints() {
|
|||
int format;
|
||||
Atom atom_return;
|
||||
unsigned long num, len;
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
|
||||
if (!XGetWindowProperty(display, m_client->window(),
|
||||
fluxbox->getMotifWMHintsAtom(), 0,
|
||||
motif_wm_hints, 0,
|
||||
PropMwmHintsElements, false,
|
||||
fluxbox->getMotifWMHintsAtom(), &atom_return,
|
||||
motif_wm_hints, &atom_return,
|
||||
&format, &num, &len,
|
||||
(unsigned char **) &m_client->mwm_hint) == Success &&
|
||||
m_client->mwm_hint) {
|
||||
|
@ -1550,7 +1546,7 @@ void FluxboxWindow::installColormap(bool install) {
|
|||
Colormap *cmaps = XListInstalledColormaps(display, m_client->window(), &ncmap);
|
||||
XWindowAttributes wattrib;
|
||||
if (cmaps) { //!!
|
||||
if (m_client->getAttrib(wattrib)) { //XGetWindowAttributes(display, m_client->window, &wattrib)) {
|
||||
if (m_client->getAttrib(wattrib)) {
|
||||
if (install) {
|
||||
// install the window's colormap
|
||||
for (i = 0; i < ncmap; i++) {
|
||||
|
@ -1613,9 +1609,8 @@ bool FluxboxWindow::getState() {
|
|||
bool ret = false;
|
||||
int foo;
|
||||
unsigned long *state, ulfoo, nitems;
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
if ((XGetWindowProperty(display, m_client->window(), fluxbox->getWMStateAtom(),
|
||||
0l, 2l, false, fluxbox->getWMStateAtom(),
|
||||
if ((XGetWindowProperty(display, m_client->window(), FbAtoms::instance()->getWMStateAtom(),
|
||||
0l, 2l, false, FbAtoms::instance()->getWMStateAtom(),
|
||||
&atom_return, &foo, &nitems, &ulfoo,
|
||||
(unsigned char **) &state) != Success) ||
|
||||
(! state)) {
|
||||
|
@ -1713,13 +1708,13 @@ void FluxboxWindow::restoreAttributes() {
|
|||
Atom atom_return;
|
||||
int foo;
|
||||
unsigned long ulfoo, nitems;
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
FbAtoms *fbatoms = FbAtoms::instance();
|
||||
|
||||
BaseDisplay::BlackboxAttributes *net;
|
||||
if (XGetWindowProperty(display, m_client->window(),
|
||||
fluxbox->getFluxboxAttributesAtom(), 0l,
|
||||
fbatoms->getFluxboxAttributesAtom(), 0l,
|
||||
PropBlackboxAttributesElements, false,
|
||||
fluxbox->getFluxboxAttributesAtom(), &atom_return, &foo,
|
||||
fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
|
||||
&nitems, &ulfoo, (unsigned char **) &net) ==
|
||||
Success && net && nitems == PropBlackboxAttributesElements) {
|
||||
blackbox_attrib.flags = net->flags;
|
||||
|
@ -1949,7 +1944,11 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) {
|
|||
|
||||
|
||||
void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) {
|
||||
if (ne.window == m_client->window() && !ne.override_redirect && visible) {
|
||||
WinClient *client = findClient(ne.window);
|
||||
if (client == 0)
|
||||
return;
|
||||
|
||||
if (!ne.override_redirect && visible) {
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
fluxbox->grab();
|
||||
if (! validateClient())
|
||||
|
@ -1990,6 +1989,7 @@ void FluxboxWindow::unmapNotifyEvent(XUnmapEvent &ue) {
|
|||
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): 0x"<<hex<<client->window()<<dec<<endl;
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): title="<<client->title()<<endl;
|
||||
#endif // DEBUG
|
||||
|
||||
restore(client, false);
|
||||
|
@ -2107,7 +2107,8 @@ void FluxboxWindow::exposeEvent(XExposeEvent &ee) {
|
|||
|
||||
|
||||
void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
|
||||
if (cr.window != m_client->window())
|
||||
WinClient *client = findClient(cr.window);
|
||||
if (client == 0)
|
||||
return;
|
||||
|
||||
int cx = m_frame.x(), cy = m_frame.y();
|
||||
|
@ -2116,7 +2117,7 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) {
|
|||
m_frame.titlebar().height() + frame().titlebar().borderWidth()
|
||||
: 0);
|
||||
if (cr.value_mask & CWBorderWidth)
|
||||
m_client->old_bw = cr.border_width;
|
||||
client->old_bw = cr.border_width;
|
||||
|
||||
if (cr.value_mask & CWX)
|
||||
cx = cr.x;
|
||||
|
@ -2638,8 +2639,13 @@ void FluxboxWindow::restore(WinClient *client, bool remap) {
|
|||
|
||||
delete client;
|
||||
|
||||
if (numClients() == 0)
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): numClients() = "<<numClients()<<endl;
|
||||
#endif // DEBUG
|
||||
if (numClients() == 0) {
|
||||
|
||||
m_frame.hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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.51 2003/04/14 14:59:15 fluxgen Exp $
|
||||
// $Id: Workspace.cc,v 1.52 2003/04/15 12:20:27 fluxgen Exp $
|
||||
|
||||
#include "Workspace.hh"
|
||||
|
||||
|
@ -496,15 +496,10 @@ void Workspace::updateClientmenu() {
|
|||
(*win_it)->clientList().begin();
|
||||
FluxboxWindow::ClientList::iterator client_it_end =
|
||||
(*win_it)->clientList().end();
|
||||
for (; client_it != client_it_end; ++client_it) {
|
||||
/* FbTk::RefCount<FbTk::Command>
|
||||
raise_and_focus(new RaiseFocusAndSetWorkspace(*this,
|
||||
*(*client_it)));
|
||||
*/
|
||||
for (; client_it != client_it_end; ++client_it)
|
||||
m_clientmenu.insert(new ClientMenuItem(*(*client_it), *this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_clientmenu.update();
|
||||
}
|
||||
|
||||
|
|
116
src/fluxbox.cc
116
src/fluxbox.cc
|
@ -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.108 2003/04/15 08:54:40 fluxgen Exp $
|
||||
// $Id: fluxbox.cc,v 1.109 2003/04/15 12:11:54 fluxgen Exp $
|
||||
|
||||
#include "fluxbox.hh"
|
||||
|
||||
|
@ -39,6 +39,8 @@
|
|||
#include "EventManager.hh"
|
||||
#include "FbCommands.hh"
|
||||
#include "WinClient.hh"
|
||||
#include "Keys.hh"
|
||||
#include "FbAtoms.hh"
|
||||
|
||||
//Use GNU extensions
|
||||
#ifndef _GNU_SOURCE
|
||||
|
@ -356,7 +358,8 @@ Fluxbox::Titlebar Fluxbox::m_titlebar_left[] = {STICK};
|
|||
Fluxbox::Titlebar Fluxbox::m_titlebar_right[] = {MINIMIZE, MAXIMIZE, CLOSE};
|
||||
|
||||
Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc)
|
||||
: BaseDisplay(m_argv[0], dpy_name), FbAtoms(getXDisplay()),
|
||||
: BaseDisplay(m_argv[0], dpy_name),
|
||||
m_fbatoms(new FbAtoms()),
|
||||
m_resourcemanager(), m_screen_rm(),
|
||||
m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"),
|
||||
m_rc_iconbar(m_resourcemanager, true, "session.iconbar", "Session.Iconbar"),
|
||||
|
@ -970,7 +973,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
|
|||
if (ce.format != 32)
|
||||
return;
|
||||
|
||||
if (ce.message_type == getWMChangeStateAtom()) {
|
||||
if (ce.message_type == m_fbatoms->getWMChangeStateAtom()) {
|
||||
FluxboxWindow *win = searchWindow(ce.window);
|
||||
if (! win || ! win->validateClient())
|
||||
return;
|
||||
|
@ -979,18 +982,18 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
|
|||
win->iconify();
|
||||
if (ce.data.l[0] == NormalState)
|
||||
win->deiconify();
|
||||
} else if (ce.message_type == getFluxboxChangeWorkspaceAtom()) {
|
||||
} else if (ce.message_type == m_fbatoms->getFluxboxChangeWorkspaceAtom()) {
|
||||
BScreen *screen = searchScreen(ce.window);
|
||||
|
||||
if (screen && ce.data.l[0] >= 0 &&
|
||||
ce.data.l[0] < (signed)screen->getCount())
|
||||
screen->changeWorkspaceID(ce.data.l[0]);
|
||||
|
||||
} else if (ce.message_type == getFluxboxChangeWindowFocusAtom()) {
|
||||
} else if (ce.message_type == m_fbatoms->getFluxboxChangeWindowFocusAtom()) {
|
||||
FluxboxWindow *win = searchWindow(ce.window);
|
||||
if (win && win->isVisible() && win->setInputFocus())
|
||||
win->installColormap(True);
|
||||
} else if (ce.message_type == getFluxboxCycleWindowFocusAtom()) {
|
||||
} else if (ce.message_type == m_fbatoms->getFluxboxCycleWindowFocusAtom()) {
|
||||
BScreen *screen = searchScreen(ce.window);
|
||||
|
||||
if (screen) {
|
||||
|
@ -999,7 +1002,7 @@ void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
|
|||
else
|
||||
screen->nextFocus();
|
||||
}
|
||||
} else if (ce.message_type == getFluxboxChangeAttributesAtom()) {
|
||||
} else if (ce.message_type == m_fbatoms->getFluxboxChangeAttributesAtom()) {
|
||||
|
||||
FluxboxWindow *win = searchWindow(ce.window);
|
||||
|
||||
|
@ -1290,7 +1293,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
|
|||
|
||||
|
||||
}
|
||||
void Fluxbox::doWindowAction(Keys::KeyAction action, const int param) {
|
||||
void Fluxbox::doWindowAction(int action, const int param) {
|
||||
if (!focused_window)
|
||||
return;
|
||||
|
||||
|
@ -1913,7 +1916,7 @@ void Fluxbox::load_rc() {
|
|||
}
|
||||
}
|
||||
|
||||
void Fluxbox::load_rc(BScreen *screen) {
|
||||
void Fluxbox::load_rc(BScreen &screen) {
|
||||
//get resource filename
|
||||
string dbfile(getRcFilename());
|
||||
if (dbfile.size() != 0) {
|
||||
|
@ -1936,50 +1939,51 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
|
||||
XrmValue value;
|
||||
char *value_type, name_lookup[1024], class_lookup[1024];
|
||||
int screen_number = screen->getScreenNumber();
|
||||
int screen_number = screen.getScreenNumber();
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.rowPlacementDirection", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.RowPlacementDirection", screen_number);
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "righttoleft", value.size))
|
||||
screen->saveRowPlacementDirection(BScreen::RIGHTLEFT);
|
||||
screen.saveRowPlacementDirection(BScreen::RIGHTLEFT);
|
||||
else
|
||||
screen->saveRowPlacementDirection(BScreen::LEFTRIGHT);
|
||||
screen.saveRowPlacementDirection(BScreen::LEFTRIGHT);
|
||||
} else
|
||||
screen->saveRowPlacementDirection(BScreen::LEFTRIGHT);
|
||||
screen.saveRowPlacementDirection(BScreen::LEFTRIGHT);
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.colPlacementDirection", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.ColPlacementDirection", screen_number);
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "bottomtotop", value.size))
|
||||
screen->saveColPlacementDirection(BScreen::BOTTOMTOP);
|
||||
screen.saveColPlacementDirection(BScreen::BOTTOMTOP);
|
||||
else
|
||||
screen->saveColPlacementDirection(BScreen::TOPBOTTOM);
|
||||
screen.saveColPlacementDirection(BScreen::TOPBOTTOM);
|
||||
} else
|
||||
screen->saveColPlacementDirection(BScreen::TOPBOTTOM);
|
||||
screen.saveColPlacementDirection(BScreen::TOPBOTTOM);
|
||||
|
||||
screen->removeWorkspaceNames();
|
||||
screen.removeWorkspaceNames();
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.workspaceNames", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.WorkspaceNames", screen_number);
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
#ifdef DEBUG
|
||||
cerr<<__FILE__<<"("<<__LINE__<<"): Workspaces="<<screen->getNumberOfWorkspaces()<<endl;
|
||||
cerr<<__FILE__<<"("<<__FUNCTION__<<"): Workspaces="<<
|
||||
screen.getNumberOfWorkspaces()<<endl;
|
||||
#endif // DEBUG
|
||||
char *search = StringUtil::strdup(value.addr);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < screen->getNumberOfWorkspaces(); i++) {
|
||||
for (i = 0; i < screen.getNumberOfWorkspaces(); i++) {
|
||||
char *nn;
|
||||
|
||||
if (! i) nn = strtok(search, ",");
|
||||
else nn = strtok(0, ",");
|
||||
|
||||
if (nn)
|
||||
screen->addWorkspaceName(nn);
|
||||
screen.addWorkspaceName(nn);
|
||||
else break;
|
||||
|
||||
}
|
||||
|
@ -1992,13 +1996,13 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "RowSmartPlacement", value.size))
|
||||
screen->savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
|
||||
screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
|
||||
else if (! strncasecmp(value.addr, "ColSmartPlacement", value.size))
|
||||
screen->savePlacementPolicy(BScreen::COLSMARTPLACEMENT);
|
||||
screen.savePlacementPolicy(BScreen::COLSMARTPLACEMENT);
|
||||
else
|
||||
screen->savePlacementPolicy(BScreen::CASCADEPLACEMENT);
|
||||
screen.savePlacementPolicy(BScreen::CASCADEPLACEMENT);
|
||||
} else
|
||||
screen->savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
|
||||
screen.savePlacementPolicy(BScreen::ROWSMARTPLACEMENT);
|
||||
|
||||
#ifdef SLIT
|
||||
sprintf(name_lookup, "session.screen%d.slit.placement", screen_number);
|
||||
|
@ -2006,34 +2010,34 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "TopLeft", value.size))
|
||||
screen->saveSlitPlacement(Slit::TOPLEFT);
|
||||
screen.saveSlitPlacement(Slit::TOPLEFT);
|
||||
else if (! strncasecmp(value.addr, "CenterLeft", value.size))
|
||||
screen->saveSlitPlacement(Slit::CENTERLEFT);
|
||||
screen.saveSlitPlacement(Slit::CENTERLEFT);
|
||||
else if (! strncasecmp(value.addr, "BottomLeft", value.size))
|
||||
screen->saveSlitPlacement(Slit::BOTTOMLEFT);
|
||||
screen.saveSlitPlacement(Slit::BOTTOMLEFT);
|
||||
else if (! strncasecmp(value.addr, "TopCenter", value.size))
|
||||
screen->saveSlitPlacement(Slit::TOPCENTER);
|
||||
screen.saveSlitPlacement(Slit::TOPCENTER);
|
||||
else if (! strncasecmp(value.addr, "BottomCenter", value.size))
|
||||
screen->saveSlitPlacement(Slit::BOTTOMCENTER);
|
||||
screen.saveSlitPlacement(Slit::BOTTOMCENTER);
|
||||
else if (! strncasecmp(value.addr, "TopRight", value.size))
|
||||
screen->saveSlitPlacement(Slit::TOPRIGHT);
|
||||
screen.saveSlitPlacement(Slit::TOPRIGHT);
|
||||
else if (! strncasecmp(value.addr, "BottomRight", value.size))
|
||||
screen->saveSlitPlacement(Slit::BOTTOMRIGHT);
|
||||
screen.saveSlitPlacement(Slit::BOTTOMRIGHT);
|
||||
else
|
||||
screen->saveSlitPlacement(Slit::CENTERRIGHT);
|
||||
screen.saveSlitPlacement(Slit::CENTERRIGHT);
|
||||
} else
|
||||
screen->saveSlitPlacement(Slit::CENTERRIGHT);
|
||||
screen.saveSlitPlacement(Slit::CENTERRIGHT);
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.slit.direction", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.Slit.Direction", screen_number);
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "Horizontal", value.size))
|
||||
screen->saveSlitDirection(Slit::HORIZONTAL);
|
||||
screen.saveSlitDirection(Slit::HORIZONTAL);
|
||||
else
|
||||
screen->saveSlitDirection(Slit::VERTICAL);
|
||||
screen.saveSlitDirection(Slit::VERTICAL);
|
||||
} else
|
||||
screen->saveSlitDirection(Slit::VERTICAL);
|
||||
screen.saveSlitDirection(Slit::VERTICAL);
|
||||
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.slit.autoHide", screen_number);
|
||||
|
@ -2041,11 +2045,11 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (! strncasecmp(value.addr, "True", value.size))
|
||||
screen->saveSlitAutoHide(True);
|
||||
screen.saveSlitAutoHide(true);
|
||||
else
|
||||
screen->saveSlitAutoHide(False);
|
||||
screen.saveSlitAutoHide(false);
|
||||
} else
|
||||
screen->saveSlitAutoHide(False);
|
||||
screen.saveSlitAutoHide(false);
|
||||
/*
|
||||
#ifdef XINERAMA
|
||||
int tmp_head;
|
||||
|
@ -2067,9 +2071,9 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
sprintf(class_lookup, "Session.Screen%d.StrftimeFormat", screen_number);
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value))
|
||||
screen->saveStrftimeFormat(value.addr);
|
||||
screen.saveStrftimeFormat(value.addr);
|
||||
else
|
||||
screen->saveStrftimeFormat("%I:%M %p");
|
||||
screen.saveStrftimeFormat("%I:%M %p");
|
||||
#else // HAVE_STRFTIME
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.dateFormat", screen_number);
|
||||
|
@ -2077,11 +2081,11 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
if (strncasecmp(value.addr, "european", value.size))
|
||||
screen->saveDateFormat(B_AMERICANDATE);
|
||||
screen.saveDateFormat(B_AMERICANDATE);
|
||||
else
|
||||
screen->saveDateFormat(B_EUROPEANDATE);
|
||||
screen.saveDateFormat(B_EUROPEANDATE);
|
||||
} else
|
||||
screen->saveDateFormat(B_AMERICANDATE);
|
||||
screen.saveDateFormat(B_AMERICANDATE);
|
||||
|
||||
sprintf(name_lookup, "session.screen%d.clockFormat", screen_number);
|
||||
sprintf(class_lookup, "Session.Screen%d.ClockFormat", screen_number);
|
||||
|
@ -2089,23 +2093,23 @@ void Fluxbox::load_rc(BScreen *screen) {
|
|||
&value)) {
|
||||
int clock;
|
||||
if (sscanf(value.addr, "%d", &clock) != 1)
|
||||
screen->saveClock24Hour(False);
|
||||
screen.saveClock24Hour(False);
|
||||
else if (clock == 24)
|
||||
screen->saveClock24Hour(True);
|
||||
screen.saveClock24Hour(True);
|
||||
else
|
||||
screen->saveClock24Hour(False);
|
||||
screen.saveClock24Hour(False);
|
||||
} else
|
||||
screen->saveClock24Hour(False);
|
||||
screen.saveClock24Hour(False);
|
||||
#endif // HAVE_STRFTIME
|
||||
|
||||
//check size on toolbarwidth percent
|
||||
if (screen->getToolbarWidthPercent() <= 0 ||
|
||||
screen->getToolbarWidthPercent() > 100)
|
||||
screen->saveToolbarWidthPercent(66);
|
||||
if (screen.getToolbarWidthPercent() <= 0 ||
|
||||
screen.getToolbarWidthPercent() > 100)
|
||||
screen.saveToolbarWidthPercent(66);
|
||||
|
||||
}
|
||||
|
||||
void Fluxbox::loadRootCommand(BScreen *screen) {
|
||||
void Fluxbox::loadRootCommand(BScreen &screen) {
|
||||
|
||||
string dbfile(getRcFilename());
|
||||
|
||||
|
@ -2115,13 +2119,13 @@ void Fluxbox::loadRootCommand(BScreen *screen) {
|
|||
|
||||
XrmValue value;
|
||||
char *value_type, name_lookup[1024], class_lookup[1024];
|
||||
sprintf(name_lookup, "session.screen%d.rootCommand", screen->getScreenNumber());
|
||||
sprintf(class_lookup, "Session.Screen%d.RootCommand", screen->getScreenNumber());
|
||||
sprintf(name_lookup, "session.screen%d.rootCommand", screen.getScreenNumber());
|
||||
sprintf(class_lookup, "Session.Screen%d.RootCommand", screen.getScreenNumber());
|
||||
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
|
||||
&value)) {
|
||||
screen->saveRootCommand(value.addr==0 ? "": value.addr);
|
||||
screen.saveRootCommand(value.addr==0 ? "": value.addr);
|
||||
} else
|
||||
screen->saveRootCommand("");
|
||||
screen.saveRootCommand("");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,16 +22,14 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: fluxbox.hh,v 1.48 2003/04/15 00:50:25 rathnor Exp $
|
||||
// $Id: fluxbox.hh,v 1.49 2003/04/15 12:11:10 fluxgen Exp $
|
||||
|
||||
#ifndef FLUXBOX_HH
|
||||
#define FLUXBOX_HH
|
||||
|
||||
#include "Resource.hh"
|
||||
#include "Keys.hh"
|
||||
#include "BaseDisplay.hh"
|
||||
#include "Timer.hh"
|
||||
#include "Toolbar.hh"
|
||||
#include "Observer.hh"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -39,7 +37,6 @@
|
|||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include "SignalHandler.hh"
|
||||
#include "FbAtoms.hh"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xresource.h>
|
||||
|
@ -65,6 +62,9 @@
|
|||
|
||||
class AtomHandler;
|
||||
class FluxboxWindow;
|
||||
class Keys;
|
||||
class BScreen;
|
||||
class FbAtoms;
|
||||
|
||||
/**
|
||||
main class for the window manager.
|
||||
|
@ -72,7 +72,6 @@ class FluxboxWindow;
|
|||
*/
|
||||
class Fluxbox : public BaseDisplay, public FbTk::TimeoutHandler,
|
||||
public FbTk::SignalEventHandler,
|
||||
public FbAtoms,
|
||||
public FbTk::Observer {
|
||||
public:
|
||||
Fluxbox(int argc, char **argv, const char * dpy_name= 0, const char *rc = 0);
|
||||
|
@ -80,11 +79,10 @@ public:
|
|||
|
||||
static Fluxbox *instance() { return singleton; }
|
||||
|
||||
inline bool useIconBar() { return *m_rc_iconbar; }
|
||||
inline bool useIconBar() const { return *m_rc_iconbar; }
|
||||
inline void saveIconBar(bool value) { m_rc_iconbar = value; }
|
||||
#ifdef HAVE_GETPID
|
||||
|
||||
inline Atom getFluxboxPidAtom() const { return fluxbox_pid; }
|
||||
#endif // HAVE_GETPID
|
||||
|
||||
FluxboxWindow *searchGroup(Window, FluxboxWindow *);
|
||||
FluxboxWindow *searchWindow(Window);
|
||||
|
@ -101,8 +99,8 @@ public:
|
|||
|
||||
enum FocusModel { SLOPPYFOCUS=0, SEMISLOPPYFOCUS, CLICKTOFOCUS };
|
||||
|
||||
inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; }
|
||||
inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; }
|
||||
inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; }
|
||||
inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; }
|
||||
inline const std::string &getStyleFilename() const { return *m_rc_stylefile; }
|
||||
|
||||
inline const char *getMenuFilename() const { return m_rc_menufile->c_str(); }
|
||||
|
@ -113,8 +111,8 @@ public:
|
|||
// class to store layer numbers (special Resource type)
|
||||
class Layer {
|
||||
public:
|
||||
Layer(int i) : m_num(i) {};
|
||||
const int getNum() const { return m_num; }
|
||||
explicit Layer(int i) : m_num(i) {};
|
||||
inline int getNum() const { return m_num; }
|
||||
|
||||
Layer &operator=(int num) { m_num = num; return *this; }
|
||||
|
||||
|
@ -139,25 +137,25 @@ public:
|
|||
|
||||
inline void maskWindowEvents(Window w, FluxboxWindow *bw)
|
||||
{ masked = w; masked_window = bw; }
|
||||
inline void setNoFocus(Bool f) { no_focus = f; }
|
||||
inline void setNoFocus(bool f) { no_focus = f; }
|
||||
|
||||
void watchKeyRelease(BScreen *screen, unsigned int mods);
|
||||
|
||||
void setFocusedWindow(FluxboxWindow *w);
|
||||
void shutdown();
|
||||
void load_rc(BScreen *);
|
||||
void loadRootCommand(BScreen *);
|
||||
void load_rc(BScreen &scr);
|
||||
void loadRootCommand(BScreen &scr);
|
||||
void loadTitlebar();
|
||||
void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
|
||||
void saveMenuFilename(const char *);
|
||||
void saveTitlebarFilename(const char *);
|
||||
void saveSlitlistFilename(const char *val) { m_rc_slitlistfile = (val == 0 ? "" : val); }
|
||||
void saveWindowSearch(Window, FluxboxWindow *);
|
||||
void saveGroupSearch(Window, FluxboxWindow *);
|
||||
void saveWindowSearch(Window win, FluxboxWindow *fbwin);
|
||||
void saveGroupSearch(Window win, FluxboxWindow *fbwin);
|
||||
void save_rc();
|
||||
void removeWindowSearch(Window);
|
||||
void removeGroupSearch(Window);
|
||||
void restart(const char * = 0);
|
||||
void removeWindowSearch(Window win);
|
||||
void removeGroupSearch(Window win);
|
||||
void restart(const char *command = 0);
|
||||
void reconfigure();
|
||||
void rereadMenu();
|
||||
void checkMenu();
|
||||
|
@ -211,8 +209,11 @@ private:
|
|||
void handleUnmapNotify(XUnmapEvent &ue);
|
||||
void handleClientMessage(XClientMessageEvent &ce);
|
||||
void handleKeyEvent(XKeyEvent &ke);
|
||||
void doWindowAction(Keys::KeyAction action, const int param);
|
||||
void doWindowAction(int action, const int param);
|
||||
void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
|
||||
|
||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||
|
||||
ResourceManager m_resourcemanager, m_screen_rm;
|
||||
|
||||
//--- Resources
|
||||
|
@ -226,7 +227,6 @@ private:
|
|||
Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
|
||||
Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
|
||||
|
||||
void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
|
||||
|
||||
std::map<Window, FluxboxWindow *> windowSearch;
|
||||
std::map<Window, FluxboxWindow *> groupSearch;
|
||||
|
@ -241,9 +241,7 @@ private:
|
|||
BScreen *watching_screen;
|
||||
unsigned int watch_keyrelease;
|
||||
|
||||
#ifdef HAVE_GETPID
|
||||
Atom fluxbox_pid;
|
||||
#endif // HAVE_GETPID
|
||||
|
||||
bool no_focus, reconfigure_wait, reread_menu_wait;
|
||||
Time last_time;
|
||||
|
@ -258,6 +256,7 @@ private:
|
|||
|
||||
static Fluxbox *singleton;
|
||||
std::vector<AtomHandler *> m_atomhandler;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue