2002-02-09 16:41:53 +00:00
|
|
|
// Workspace.cc for Fluxbox
|
2003-01-12 18:08:05 +00:00
|
|
|
// Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
|
2002-02-09 16:41:53 +00:00
|
|
|
//
|
2001-12-11 20:47:02 +00:00
|
|
|
// Workspace.cc for Blackbox - an X11 Window manager
|
2003-01-12 18:08:05 +00:00
|
|
|
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
|
2001-12-11 20:47:02 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
2003-01-12 18:08:05 +00:00
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
2001-12-11 20:47:02 +00:00
|
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2003-02-20 12:06:26 +00:00
|
|
|
// $Id: Workspace.cc,v 1.49 2003/02/20 12:06:26 rathnor Exp $
|
2002-01-20 02:08:12 +00:00
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
#include "Workspace.hh"
|
2001-12-11 20:47:02 +00:00
|
|
|
|
|
|
|
#include "i18n.hh"
|
|
|
|
#include "fluxbox.hh"
|
|
|
|
#include "Screen.hh"
|
|
|
|
#include "Window.hh"
|
2002-01-06 11:07:42 +00:00
|
|
|
#include "StringUtil.hh"
|
2003-02-16 16:40:19 +00:00
|
|
|
#include "SimpleCommand.hh"
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
// use GNU extensions
|
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif // _GNU_SOURCE
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2002-10-13 21:52:00 +00:00
|
|
|
#include "config.h"
|
2002-08-11 22:35:40 +00:00
|
|
|
#endif // HAVE_CONFIG_H
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-01-20 02:08:12 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xatom.h>
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstring>
|
|
|
|
|
2002-02-08 14:06:35 +00:00
|
|
|
#include <algorithm>
|
2002-02-10 19:05:12 +00:00
|
|
|
#include <iostream>
|
2002-08-11 22:35:40 +00:00
|
|
|
|
2002-02-10 19:05:12 +00:00
|
|
|
using namespace std;
|
2002-02-08 14:06:35 +00:00
|
|
|
|
2002-09-08 19:38:48 +00:00
|
|
|
namespace { // anonymous
|
|
|
|
|
|
|
|
int countTransients(const FluxboxWindow &win) {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (win.getTransients().size() == 0)
|
|
|
|
return 0;
|
|
|
|
// now go throu the entire tree and count transients
|
|
|
|
size_t ret = win.getTransients().size();
|
|
|
|
std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin();
|
|
|
|
std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end();
|
|
|
|
for (; it != it_end; ++it)
|
|
|
|
ret += countTransients(*(*it));
|
|
|
|
|
|
|
|
return ret;
|
2002-09-08 19:38:48 +00:00
|
|
|
}
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
class RaiseFocusAndSetWorkspace: public FbTk::Command {
|
|
|
|
public:
|
|
|
|
RaiseFocusAndSetWorkspace(Workspace &space, FluxboxWindow &win):
|
|
|
|
m_space(space), m_win(win) { }
|
|
|
|
void execute() {
|
|
|
|
// determine workspace change
|
|
|
|
for (size_t i=0; i<m_space.getScreen().getCount(); i++) {
|
|
|
|
if (m_space.getScreen().getWorkspace(i) == &m_space) {
|
|
|
|
m_space.getScreen().changeWorkspaceID(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_win.raiseAndFocus();
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
Workspace &m_space;
|
|
|
|
FluxboxWindow &m_win;
|
|
|
|
};
|
|
|
|
|
2002-09-08 19:38:48 +00:00
|
|
|
};
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
Workspace::GroupList Workspace::m_groups;
|
2002-05-07 13:57:09 +00:00
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i):
|
2002-12-01 13:42:15 +00:00
|
|
|
screen(scrn),
|
|
|
|
lastfocus(0),
|
2003-02-16 16:40:19 +00:00
|
|
|
m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()),
|
2003-02-02 16:32:41 +00:00
|
|
|
m_layermanager(layermanager),
|
2002-12-01 13:42:15 +00:00
|
|
|
m_name(""),
|
|
|
|
m_id(i),
|
|
|
|
cascade_x(32), cascade_y(32) {
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-02-20 12:06:26 +00:00
|
|
|
m_clientmenu.setInternalMenu();
|
2003-02-16 16:40:19 +00:00
|
|
|
setName(screen.getNameOfWorkspace(m_id));
|
2001-12-11 20:47:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-20 02:08:12 +00:00
|
|
|
Workspace::~Workspace() {
|
2002-05-07 13:57:09 +00:00
|
|
|
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
2002-09-21 16:02:22 +00:00
|
|
|
void Workspace::setLastFocusedWindow(FluxboxWindow *win) {
|
2002-12-01 13:42:15 +00:00
|
|
|
// make sure we have this window in the list
|
|
|
|
if (std::find(m_windowlist.begin(), m_windowlist.end(), win) != m_windowlist.end())
|
|
|
|
lastfocus = win;
|
|
|
|
else
|
|
|
|
lastfocus = 0;
|
2002-09-21 16:02:22 +00:00
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-05-17 11:07:36 +00:00
|
|
|
int Workspace::addWindow(FluxboxWindow *w, bool place) {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (w == 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (place)
|
|
|
|
placeWindow(w);
|
|
|
|
|
|
|
|
w->setWorkspace(m_id);
|
|
|
|
w->setWindowNumber(m_windowlist.size());
|
|
|
|
|
|
|
|
//insert window after the currently focused window
|
|
|
|
//FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow();
|
|
|
|
|
|
|
|
//if there isn't any window that's focused, just add it to the end of the list
|
|
|
|
/*
|
|
|
|
if (focused == 0) {
|
|
|
|
m_windowlist.push_back(w);
|
|
|
|
//Add client to clientmenu
|
|
|
|
m_clientmenu.insert(w->getTitle().c_str());
|
|
|
|
} else {
|
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
size_t client_insertpoint=0;
|
|
|
|
for (; it != m_windowlist.end(); ++it, ++client_insertpoint) {
|
|
|
|
if (*it == focused) {
|
|
|
|
++it;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_windowlist.insert(it, w);
|
|
|
|
//Add client to clientmenu
|
|
|
|
m_clientmenu.insert(w->getTitle().c_str(), client_insertpoint);
|
2002-05-07 13:57:09 +00:00
|
|
|
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
}
|
|
|
|
*/
|
2003-02-16 16:40:19 +00:00
|
|
|
FbTk::RefCount<FbTk::Command>
|
|
|
|
raise_and_focus(new RaiseFocusAndSetWorkspace(*this, *w));
|
|
|
|
|
|
|
|
m_clientmenu.insert(w->getTitle().c_str(), raise_and_focus);
|
2002-12-01 13:42:15 +00:00
|
|
|
m_windowlist.push_back(w);
|
2002-05-07 13:57:09 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
//update menugraphics
|
|
|
|
m_clientmenu.update();
|
2002-05-07 13:57:09 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
if (!w->isStuck())
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.updateNetizenWindowAdd(w->getClientWindow(), m_id);
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
return w->getWindowNumber();
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-17 11:07:36 +00:00
|
|
|
int Workspace::removeWindow(FluxboxWindow *w) {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (w == 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if (lastfocus == w) {
|
|
|
|
lastfocus = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->isFocused()) {
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.isSloppyFocus()) {
|
2002-12-01 13:42:15 +00:00
|
|
|
Fluxbox::instance()->setFocusedWindow(0); // set focused window to none
|
|
|
|
} else if (w->isTransient() && w->getTransientFor() &&
|
|
|
|
w->getTransientFor()->isVisible()) {
|
|
|
|
w->getTransientFor()->setInputFocus();
|
|
|
|
} else {
|
|
|
|
FluxboxWindow *top = 0;
|
2003-02-02 16:32:41 +00:00
|
|
|
|
|
|
|
// 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
|
2003-02-03 13:56:12 +00:00
|
|
|
/* //!! TODO! FbTk::XLayerItem *item = 0, *lastitem = w->getLayerItem();
|
2003-02-02 16:32:41 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
2003-02-03 13:56:12 +00:00
|
|
|
*/
|
2002-12-01 13:42:15 +00:00
|
|
|
if (top == 0|| !top->setInputFocus()) {
|
|
|
|
Fluxbox::instance()->setFocusedWindow(0); // set focused window to none
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-02-02 16:32:41 +00:00
|
|
|
// we don't remove it from the layermanager, as it may be being moved
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::iterator it_end = m_windowlist.end();
|
|
|
|
for (; it != it_end; ++it) {
|
|
|
|
if (*it == w) {
|
|
|
|
m_windowlist.erase(it);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_clientmenu.remove(w->getWindowNumber());
|
|
|
|
m_clientmenu.update();
|
2002-09-12 14:55:11 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
if (!w->isStuck())
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.updateNetizenWindowDel(w->getClientWindow());
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::const_iterator it_end = m_windowlist.end();
|
|
|
|
for (int i = 0; it != it_end; ++it, ++i) {
|
|
|
|
(*it)->setWindowNumber(i);
|
|
|
|
}
|
|
|
|
}
|
2002-09-21 16:02:22 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
if (lastfocus == w || m_windowlist.empty())
|
|
|
|
lastfocus = 0;
|
2002-09-21 16:02:22 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
return m_windowlist.size();
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-13 12:59:26 +00:00
|
|
|
void Workspace::showAll() {
|
2003-02-02 16:32:41 +00:00
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::iterator it_end = m_windowlist.end();
|
2002-12-01 13:42:15 +00:00
|
|
|
for (; it != it_end; ++it) {
|
|
|
|
(*it)->deiconify(false, false);
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-13 12:59:26 +00:00
|
|
|
void Workspace::hideAll() {
|
2003-02-02 16:32:41 +00:00
|
|
|
Windows::reverse_iterator it = m_windowlist.rbegin();
|
|
|
|
Windows::reverse_iterator it_end = m_windowlist.rend();
|
2002-12-01 13:42:15 +00:00
|
|
|
for (; it != it_end; ++it) {
|
|
|
|
if (! (*it)->isStuck())
|
|
|
|
(*it)->withdraw();
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-01-13 12:59:26 +00:00
|
|
|
void Workspace::removeAll() {
|
2002-12-01 13:42:15 +00:00
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::const_iterator it_end = m_windowlist.end();
|
|
|
|
for (; it != it_end; ++it) {
|
|
|
|
(*it)->iconify();
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-03 15:02:21 +00:00
|
|
|
void Workspace::reconfigure() {
|
2002-12-01 13:42:15 +00:00
|
|
|
m_clientmenu.reconfigure();
|
|
|
|
|
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::iterator it_end = m_windowlist.end();
|
|
|
|
for (; it != it_end; ++it) {
|
|
|
|
if ((*it)->validateClient())
|
|
|
|
(*it)->reconfigure();
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-07 13:57:09 +00:00
|
|
|
const FluxboxWindow *Workspace::getWindow(unsigned int index) const {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (index < m_windowlist.size())
|
|
|
|
return m_windowlist[index];
|
|
|
|
return 0;
|
2002-05-07 13:57:09 +00:00
|
|
|
}
|
2002-03-23 15:14:45 +00:00
|
|
|
|
2002-05-07 13:57:09 +00:00
|
|
|
FluxboxWindow *Workspace::getWindow(unsigned int index) {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (index < m_windowlist.size())
|
|
|
|
return m_windowlist[index];
|
|
|
|
return 0;
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
int Workspace::getCount() const {
|
2002-12-01 13:42:15 +00:00
|
|
|
return m_windowlist.size();
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
namespace {
|
|
|
|
// helper class for checkGrouping
|
|
|
|
class FindInGroup {
|
|
|
|
public:
|
2002-12-01 13:42:15 +00:00
|
|
|
FindInGroup(const FluxboxWindow &w):m_w(w) { }
|
|
|
|
bool operator ()(const string &name) {
|
|
|
|
return (name == m_w.instanceName());
|
|
|
|
}
|
2002-08-11 22:35:40 +00:00
|
|
|
private:
|
2002-12-01 13:42:15 +00:00
|
|
|
const FluxboxWindow &m_w;
|
2002-08-11 22:35:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
//Note: this function doesn't check if the window is groupable
|
|
|
|
void Workspace::checkGrouping(FluxboxWindow &win) {
|
|
|
|
#ifdef DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
cerr<<__FILE__<<"("<<__LINE__<<"): Checking grouping. ("<<win.instanceName()<<"/"<<
|
|
|
|
win.className()<<")"<<endl;
|
2002-08-11 22:35:40 +00:00
|
|
|
#endif // DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
if (!win.isGroupable()) { // make sure this window can hold a tab
|
2002-10-22 14:47:22 +00:00
|
|
|
#ifdef DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
cerr<<__FILE__<<"("<<__LINE__<<"): window can't use a tab"<<endl;
|
2002-10-22 14:47:22 +00:00
|
|
|
#endif // DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// go throu every group and search for matching win instancename
|
|
|
|
GroupList::iterator g(m_groups.begin());
|
|
|
|
GroupList::iterator g_end(m_groups.end());
|
|
|
|
for (; g != g_end; ++g) {
|
|
|
|
Group::iterator name((*g).begin());
|
|
|
|
Group::iterator name_end((*g).end());
|
|
|
|
for (; name != name_end; ++name) {
|
|
|
|
|
|
|
|
if ((*name) != win.instanceName())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// find a window with the specific name
|
|
|
|
Windows::iterator wit(m_windowlist.begin());
|
|
|
|
Windows::iterator wit_end(m_windowlist.end());
|
|
|
|
for (; wit != wit_end; ++wit) {
|
2002-08-11 22:35:40 +00:00
|
|
|
#ifdef DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
cerr<<__FILE__<<" check group with : "<<(*wit)->instanceName()<<endl;
|
2002-08-11 22:35:40 +00:00
|
|
|
#endif // DEBUG
|
2002-12-01 13:42:15 +00:00
|
|
|
if (find_if((*g).begin(), (*g).end(), FindInGroup(*(*wit))) != (*g).end()) {
|
|
|
|
// make sure the window is groupable
|
|
|
|
if ( !(*wit)->isGroupable())
|
|
|
|
break; // try next name
|
|
|
|
//toggle tab on
|
|
|
|
if ((*wit)->getTab() == 0)
|
|
|
|
(*wit)->setTab(true);
|
|
|
|
if (win.getTab() == 0)
|
|
|
|
win.setTab(true);
|
|
|
|
// did we succefully set the tab?
|
|
|
|
if ((*wit)->getTab() == 0)
|
|
|
|
break; // try another window
|
|
|
|
(*wit)->getTab()->insert(win.getTab());
|
|
|
|
|
|
|
|
return; // grouping done
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2002-08-11 22:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Workspace::loadGroups(const std::string &filename) {
|
2002-12-01 13:42:15 +00:00
|
|
|
ifstream infile(filename.c_str());
|
|
|
|
if (!infile)
|
|
|
|
return false;
|
|
|
|
m_groups.clear(); // erase old groups
|
|
|
|
|
|
|
|
// load new groups
|
|
|
|
while (!infile.eof()) {
|
|
|
|
string line;
|
|
|
|
vector<string> names;
|
|
|
|
getline(infile, line);
|
|
|
|
StringUtil::stringtok(names, line);
|
|
|
|
m_groups.push_back(names);
|
|
|
|
}
|
2002-08-11 22:35:40 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
return true;
|
2002-08-11 22:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Workspace::update() {
|
2002-12-01 13:42:15 +00:00
|
|
|
m_clientmenu.update();
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
bool Workspace::isCurrent() const{
|
2003-02-16 16:40:19 +00:00
|
|
|
return (m_id == screen.getCurrentWorkspaceID());
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-09 23:18:12 +00:00
|
|
|
bool Workspace::isLastWindow(FluxboxWindow *w) const{
|
2002-12-01 13:42:15 +00:00
|
|
|
return (w == m_windowlist.back());
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
2002-09-21 16:02:22 +00:00
|
|
|
void Workspace::setCurrent() {
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.changeWorkspaceID(m_id);
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-11 22:35:40 +00:00
|
|
|
void Workspace::setName(const std::string &name) {
|
2002-12-01 13:42:15 +00:00
|
|
|
if (name.size() != 0) {
|
|
|
|
m_name = name;
|
|
|
|
} else { //if name == 0 then set default name from nls
|
|
|
|
char tname[128];
|
|
|
|
sprintf(tname, I18n::instance()->
|
|
|
|
getMessage(
|
2002-12-04 14:16:42 +00:00
|
|
|
FBNLS::WorkspaceSet, FBNLS::WorkspaceDefaultNameFormat,
|
|
|
|
"Workspace %d"), m_id + 1); //m_id starts at 0
|
2002-12-01 13:42:15 +00:00
|
|
|
m_name = tname;
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.updateWorkspaceNamesAtom();
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
m_clientmenu.setLabel(m_name.c_str());
|
|
|
|
m_clientmenu.update();
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
2003-01-13 12:59:26 +00:00
|
|
|
/**
|
|
|
|
Calls restore on all windows
|
|
|
|
on the workspace and then
|
|
|
|
clears the m_windowlist
|
|
|
|
*/
|
2002-08-16 11:02:41 +00:00
|
|
|
void Workspace::shutdown() {
|
2002-12-01 13:42:15 +00:00
|
|
|
// note: when the window dies it'll remove it self from the list
|
|
|
|
while (!m_windowlist.empty()) {
|
|
|
|
m_windowlist.back()->restore(true); // restore with remap
|
|
|
|
delete m_windowlist.back(); //delete window (the window removes it self from m_windowlist)
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Workspace::placeWindow(FluxboxWindow *win) {
|
2002-12-01 13:42:15 +00:00
|
|
|
Bool placed = False;
|
2003-02-16 16:40:19 +00:00
|
|
|
int borderWidth4x = screen.getBorderWidth2x() * 2,
|
2003-01-12 18:08:05 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
place_x = 0, place_y = 0, change_x = 1, change_y = 1;
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP)
|
2002-12-01 13:42:15 +00:00
|
|
|
change_y = -1;
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT)
|
2002-12-01 13:42:15 +00:00
|
|
|
change_x = -1;
|
|
|
|
|
|
|
|
#ifdef XINERAMA
|
|
|
|
int head = 0,
|
|
|
|
head_x = 0,
|
|
|
|
head_y = 0;
|
|
|
|
int head_w, head_h;
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.hasXinerama()) {
|
|
|
|
head = screen.getCurrHead();
|
|
|
|
head_x = screen.getHeadX(head);
|
|
|
|
head_y = screen.getHeadY(head);
|
|
|
|
head_w = screen.getHeadWidth(head);
|
|
|
|
head_h = screen.getHeadHeight(head);
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
} else { // no xinerama
|
2003-02-16 16:40:19 +00:00
|
|
|
head_w = screen.getWidth();
|
|
|
|
head_h = screen.getHeight();
|
2002-12-01 13:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // XINERAMA
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
int win_w = win->getWidth() + screen.getBorderWidth2x(),
|
|
|
|
win_h = win->getHeight() + screen.getBorderWidth2x();
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
if (win->hasTab()) {
|
|
|
|
if ((! win->isShaded()) &&
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.getTabPlacement() == Tab::PLEFT ||
|
|
|
|
screen.getTabPlacement() == Tab::PRIGHT)
|
|
|
|
win_w += (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-01 13:42:15 +00:00
|
|
|
else // tab placement top or bottom or win is shaded
|
2003-02-16 16:40:19 +00:00
|
|
|
win_h += screen.getTabHeight();
|
2002-12-01 13:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
register int test_x, test_y, curr_x, curr_y, curr_w, curr_h;
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
switch (screen.getPlacementPolicy()) {
|
2002-12-01 13:42:15 +00:00
|
|
|
case BScreen::ROWSMARTPLACEMENT: {
|
|
|
|
#ifdef XINERAMA
|
|
|
|
test_y = head_y;
|
|
|
|
#else // !XINERAMA
|
|
|
|
test_y = 0;
|
|
|
|
#endif // XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP)
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
|
|
|
test_y = (head_y + head_h) - win_h - test_y;
|
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_y = screen.getHeight() - win_h - test_y;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ?
|
2002-03-19 14:30:43 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y >= head_y : test_y + win_h <= (head_y + head_h)
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_y > 0 : test_y + win_h < (signed) screen.getHeight()
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
) && ! placed) {
|
2002-03-19 14:30:43 +00:00
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = head_x;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = 0;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT)
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = (head_x + head_w) - win_w - test_x;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_x = screen.getWidth() - win_w - test_x;
|
2002-03-19 14:30:43 +00:00
|
|
|
#endif // XINERAMA
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x >= head_x : test_x + win_w <= (head_x + head_w)
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_x > 0 : test_x + win_w < (signed) screen.getWidth()
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
) && ! placed) {
|
|
|
|
|
|
|
|
placed = True;
|
|
|
|
|
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::iterator it_end = m_windowlist.end();
|
|
|
|
|
|
|
|
for (; it != it_end && placed; ++it) {
|
|
|
|
curr_x = (*it)->getXFrame();
|
|
|
|
curr_y = (*it)->getYFrame();
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_w = (*it)->getWidth() + screen.getBorderWidth2x();
|
2002-12-04 14:16:42 +00:00
|
|
|
curr_h =
|
|
|
|
(((*it)->isShaded())
|
|
|
|
? (*it)->getTitleHeight()
|
|
|
|
: (*it)->getHeight()) +
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.getBorderWidth2x();
|
2002-12-04 14:16:42 +00:00
|
|
|
|
|
|
|
if ((*it)->hasTab()) {
|
|
|
|
if (! (*it)->isShaded()) { // not shaded window
|
2003-02-16 16:40:19 +00:00
|
|
|
switch(screen.getTabPlacement()) {
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PTOP:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_y -= screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PBOTTOM:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_h += screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
case Tab::PLEFT:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_x -= (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PRIGHT:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_w += (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
case Tab::PNONE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else { // shaded window
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getTabPlacement() == Tab::PTOP)
|
|
|
|
curr_y -= screen.getTabHeight();
|
|
|
|
curr_h += screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
}
|
|
|
|
} // tab cheking done
|
|
|
|
|
|
|
|
if (curr_x < test_x + win_w &&
|
|
|
|
curr_x + curr_w > test_x &&
|
|
|
|
curr_y < test_y + win_h &&
|
|
|
|
curr_y + curr_h > test_y) {
|
|
|
|
placed = False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
if (placed) {
|
|
|
|
place_x = test_x;
|
|
|
|
place_y = test_y;
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x += change_x;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y += change_y;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
break; }
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
case BScreen::COLSMARTPLACEMENT: {
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = head_x;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = 0;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT)
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x = (head_x + head_w) - win_w - test_x;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_x = screen.getWidth() - win_w - test_x;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x >= 0 : test_x + win_w <= (head_x + head_w)
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_x > 0 : test_x + win_w < (signed) screen.getWidth()
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
) && ! placed) {
|
2002-12-01 13:42:15 +00:00
|
|
|
|
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y = head_y;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y = 0;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP)
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y = (head_y + head_h) - win_h - test_y;
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_y = screen.getHeight() - win_h - test_y;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
|
|
|
|
2003-02-16 16:40:19 +00:00
|
|
|
while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ?
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y >= head_y : test_y + win_h <= (head_y + head_h)
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
test_y > 0 : test_y + win_h < (signed) screen.getHeight()
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
) && ! placed) {
|
|
|
|
placed = True;
|
|
|
|
|
|
|
|
Windows::iterator it = m_windowlist.begin();
|
|
|
|
Windows::iterator it_end = m_windowlist.end();
|
|
|
|
for (; it != it_end && placed; ++it) {
|
|
|
|
curr_x = (*it)->getXFrame();
|
|
|
|
curr_y = (*it)->getYFrame();
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_w = (*it)->getWidth() + screen.getBorderWidth2x();
|
2002-12-04 14:16:42 +00:00
|
|
|
curr_h =
|
|
|
|
(((*it)->isShaded())
|
|
|
|
? (*it)->getTitleHeight()
|
|
|
|
: (*it)->getHeight()) +
|
2003-02-16 16:40:19 +00:00
|
|
|
screen.getBorderWidth2x();;
|
2002-12-04 14:16:42 +00:00
|
|
|
|
|
|
|
if ((*it)->hasTab()) {
|
|
|
|
if (! (*it)->isShaded()) { // not shaded window
|
2003-02-16 16:40:19 +00:00
|
|
|
switch(screen.getTabPlacement()) {
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PTOP:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_y -= screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PBOTTOM:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_h += screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
case Tab::PLEFT:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_x -= (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-04 14:16:42 +00:00
|
|
|
case Tab::PRIGHT:
|
2003-02-16 16:40:19 +00:00
|
|
|
curr_w += (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef DEBUG
|
2002-12-04 14:16:42 +00:00
|
|
|
cerr << __FILE__ << ":" <<__LINE__ << ": " <<
|
|
|
|
"Unsupported Placement" << endl;
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // DEBUG
|
2002-12-04 14:16:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else { // shaded window
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getTabPlacement() == Tab::PTOP)
|
|
|
|
curr_y -= screen.getTabHeight();
|
|
|
|
curr_h += screen.getTabHeight();
|
2002-12-04 14:16:42 +00:00
|
|
|
}
|
|
|
|
} // tab cheking done
|
|
|
|
|
|
|
|
if (curr_x < test_x + win_w &&
|
|
|
|
curr_x + curr_w > test_x &&
|
|
|
|
curr_y < test_y + win_h &&
|
|
|
|
curr_y + curr_h > test_y) {
|
|
|
|
placed = False;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
if (placed) {
|
|
|
|
place_x = test_x;
|
|
|
|
place_y = test_y;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
test_y += change_y;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
test_x += change_x;
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
break; }
|
|
|
|
}
|
2002-12-01 13:42:15 +00:00
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
// cascade placement or smart placement failed
|
|
|
|
if (! placed) {
|
2002-12-01 13:42:15 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
if ((cascade_x > (head_w / 2)) ||
|
|
|
|
(cascade_y > (head_h / 2)))
|
2002-12-01 13:42:15 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (((unsigned) cascade_x > (screen.getWidth() / 2)) ||
|
|
|
|
((unsigned) cascade_y > (screen.getHeight() / 2)))
|
2002-12-01 13:42:15 +00:00
|
|
|
#endif // XINERAMA
|
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
cascade_x = cascade_y = 32;
|
2002-03-19 14:30:43 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
place_x = head_x + cascade_x;
|
|
|
|
place_y = head_y + cascade_y;
|
2002-03-19 14:30:43 +00:00
|
|
|
#else // !XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
place_x = cascade_x;
|
|
|
|
place_y = cascade_y;
|
2002-03-19 14:30:43 +00:00
|
|
|
#endif // XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
cascade_x += win->getTitleHeight();
|
|
|
|
cascade_y += win->getTitleHeight();
|
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2002-03-19 14:30:43 +00:00
|
|
|
#ifdef XINERAMA
|
2002-12-04 14:16:42 +00:00
|
|
|
if (place_x + win_w > (head_x + head_w))
|
|
|
|
place_x = head_x + ((head_w - win_w) / 2);
|
|
|
|
if (place_y + win_h > (head_y + head_h))
|
|
|
|
place_y = head_y + ((head_h - win_h) / 2);
|
2002-03-19 14:30:43 +00:00
|
|
|
#else // !XINERAMA
|
2003-02-16 16:40:19 +00:00
|
|
|
if (place_x + win_w > (signed) screen.getWidth())
|
|
|
|
place_x = (((signed) screen.getWidth()) - win_w) / 2;
|
|
|
|
if (place_y + win_h > (signed) screen.getHeight())
|
|
|
|
place_y = (((signed) screen.getHeight()) - win_h) / 2;
|
2002-03-19 14:30:43 +00:00
|
|
|
#endif // XINERAMA
|
|
|
|
|
2002-12-04 14:16:42 +00:00
|
|
|
// fix window placement, think of tabs
|
|
|
|
if (win->hasTab()) {
|
2003-02-16 16:40:19 +00:00
|
|
|
if (screen.getTabPlacement() == Tab::PTOP)
|
|
|
|
place_y += screen.getTabHeight();
|
|
|
|
else if (screen.getTabPlacement() == Tab::PLEFT)
|
|
|
|
place_x += (screen.isTabRotateVertical())
|
|
|
|
? screen.getTabHeight()
|
|
|
|
: screen.getTabWidth();
|
2002-12-04 14:16:42 +00:00
|
|
|
}
|
2001-12-11 20:47:02 +00:00
|
|
|
|
2003-01-05 22:30:20 +00:00
|
|
|
win->moveResize(place_x, place_y, win->getWidth(), win->getHeight());
|
2001-12-11 20:47:02 +00:00
|
|
|
}
|