Client::~Client()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
+ // clean up childrens' references
+ while (!_transients.empty()) {
+ _transients.front()->_transient_for = 0;
+ _transients.pop_front();
+ }
+
// clean up parents reference to this
if (_transient_for)
_transient_for->_transients.remove(this); // remove from old parent
- if (Openbox::instance->state() != Openbox::State_Exiting) {
+ if (openbox->state() != Openbox::State_Exiting) {
// these values should not be persisted across a window unmapping/mapping
property->erase(_window, otk::Property::net_wm_desktop);
property->erase(_window, otk::Property::net_wm_state);
void Client::getDesktop()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// defaults to the current desktop
- _desktop = Openbox::instance->screen(_screen)->desktop();
+ _desktop = openbox->screen(_screen)->desktop();
if (!property->get(_window, otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal,
(long unsigned*)&_desktop)) {
// make sure the hint exists
- Openbox::instance->property()->set(_window,
+ openbox->property()->set(_window,
otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal,
(unsigned)_desktop);
void Client::getType()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_type = (WindowType) -1;
void Client::getMwmHints()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long num = MwmHints::elements;
unsigned long *hints;
void Client::getState()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_modal = _shaded = _max_horz = _max_vert = _fullscreen = _above = _below =
_skip_taskbar = _skip_pager = false;
if we don't have a frame, then we aren't mapped yet (and this would
SIGSEGV :)
*/
- Openbox::instance->screen(_screen)->restack(true, this); // raise
+ openbox->screen(_screen)->restack(true, this); // raise
}
}
}
void Client::updateProtocols()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
Atom *proto;
int num_return = 0;
void Client::updateTitle()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_title = "";
void Client::updateIconTitle()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
_icon_title = "";
void Client::updateClass()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// set the defaults
_app_name = _app_class = _role = "";
if (property->get(_window, otk::Property::wm_class,
otk::Property::ascii, &num, &v)) {
- if (num > 0) _app_name = v[0];
- if (num > 1) _app_class = v[1];
+ if (num > 0) _app_name = v[0].c_str();
+ if (num > 1) _app_class = v[1].c_str();
}
v.clear();
num = 1;
if (property->get(_window, otk::Property::wm_window_role,
otk::Property::ascii, &num, &v)) {
- if (num > 0) _role = v[0];
+ if (num > 0) _role = v[0].c_str();
}
}
{
unsigned long num = 4;
unsigned long *data;
- if (!Openbox::instance->property()->get(_window,
+ if (!openbox->property()->get(_window,
otk::Property::net_wm_strut,
otk::Property::Atom_Cardinal,
&num, &data))
_strut.top = data[2];
_strut.bottom = data[3];
- Openbox::instance->screen(_screen)->updateStrut();
+ openbox->screen(_screen)->updateStrut();
}
delete [] data;
if (XGetTransientForHint(otk::Display::display, _window, &t) &&
t != _window) { // cant be transient to itself!
- c = Openbox::instance->findClient(t);
+ c = openbox->findClient(t);
assert(c != this); // if this happens then we need to check for it
if (!c /*XXX: && _group*/) {
{
otk::EventHandler::propertyHandler(e);
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// compress changes to a single property into a single change
XEvent ce;
_desktop = target;
- Openbox::instance->property()->set(_window,
+ openbox->property()->set(_window,
otk::Property::net_wm_desktop,
otk::Property::Atom_Cardinal,
(unsigned)_desktop);
// 'move' the window to the new desktop
- if (_desktop == Openbox::instance->screen(_screen)->desktop() ||
+ if (_desktop == openbox->screen(_screen)->desktop() ||
_desktop == (signed)0xffffffff)
frame->show();
else
void Client::setState(StateAction action, long data1, long data2)
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
bool shadestate = _shaded;
if (!(action == State_Add || action == State_Remove ||
if (e.format != 32) return;
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
if (e.message_type == property->atom(otk::Property::wm_change_state)) {
// compress changes into a single change
shade(false);
// XXX: deiconify
focus();
- Openbox::instance->screen(_screen)->restack(true, this); // raise
+ openbox->screen(_screen)->restack(true, this); // raise
}
}
void Client::close()
{
XEvent ce;
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
if (!(_functions & Func_Close)) return;
void Client::changeState()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long state[2];
state[0] = _wmstate;
if (_focus_notify) {
XEvent ce;
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
ce.xclient.type = ClientMessage;
ce.xclient.message_type = property->atom(otk::Property::wm_protocols);
ce.xclient.window = _window;
ce.xclient.format = 32;
ce.xclient.data.l[0] = property->atom(otk::Property::wm_take_focus);
- ce.xclient.data.l[1] = Openbox::instance->lastTime();
+ ce.xclient.data.l[1] = openbox->lastTime();
ce.xclient.data.l[2] = 0l;
ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l;
{
if (!_focused) return;
- assert(Openbox::instance->focusedClient() == this);
- Openbox::instance->setFocusedClient(0);
+ assert(openbox->focusedClient() == this);
+ openbox->setFocusedClient(0);
}
frame->focus();
_focused = true;
- Openbox::instance->setFocusedClient(this);
+ openbox->setFocusedClient(this);
}
frame->unfocus();
_focused = false;
- if (Openbox::instance->focusedClient() == this)
- Openbox::instance->setFocusedClient(0);
+ if (openbox->focusedClient() == this)
+ openbox->setFocusedClient(0);
}
switch (e.detail) {
case Below:
case BottomIf:
- Openbox::instance->screen(_screen)->restack(false, this); // lower
+ openbox->screen(_screen)->restack(false, this); // lower
break;
case Above:
case TopIf:
default:
- Openbox::instance->screen(_screen)->restack(true, this); // raise
+ openbox->screen(_screen)->restack(true, this); // raise
break;
}
}
otk::EventHandler::unmapHandler(e);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
otk::EventHandler::destroyHandler(e);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
XPutBackEvent(otk::Display::display, &ev);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
}