Client::~Client()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
// clean up childrens' references
while (!_transients.empty()) {
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;
XWindowAttributes wattrib;
Status ret;
- ret = XGetWindowAttributes(otk::Display::display, _window, &wattrib);
+ ret = XGetWindowAttributes(**otk::display, _window, &wattrib);
assert(ret != BadWindow);
_area.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height);
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;
{
_shaped = false;
#ifdef SHAPE
- if (otk::Display::shape()) {
+ if (otk::display->shape()) {
int foo;
unsigned int ufoo;
int s;
- XShapeSelectInput(otk::Display::display, _window, ShapeNotifyMask);
+ XShapeSelectInput(**otk::display, _window, ShapeNotifyMask);
- XShapeQueryExtents(otk::Display::display, _window, &s, &foo,
+ XShapeQueryExtents(**otk::display, _window, &s, &foo,
&foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
_shaped = (s != 0);
}
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;
_decorations &= ~Decor_Close;
_functions &= ~Func_Close;
- if (XGetWMProtocols(otk::Display::display, _window, &proto, &num_return)) {
+ if (XGetWMProtocols(**otk::display, _window, &proto, &num_return)) {
for (int i = 0; i < num_return; ++i) {
if (proto[i] == property->atom(otk::Property::wm_delete_window)) {
_decorations |= Decor_Close;
// point..
// get the hints from the window
- if (XGetWMNormalHints(otk::Display::display, _window, &size, &ret)) {
+ if (XGetWMNormalHints(**otk::display, _window, &size, &ret)) {
_positioned = (size.flags & (PPosition|USPosition));
if (size.flags & PWinGravity)
_can_focus = true;
_urgent = false;
- if ((hints = XGetWMHints(otk::Display::display, _window)) != NULL) {
+ if ((hints = XGetWMHints(**otk::display, _window)) != NULL) {
if (hints->flags & InputHint)
_can_focus = hints->input;
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;
Window t = 0;
Client *c = 0;
- if (XGetTransientForHint(otk::Display::display, _window, &t) &&
+ if (XGetTransientForHint(**otk::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*/) {
// not transient to a client, see if it is transient for a group
if (//t == _group->leader() ||
t == None ||
- t == otk::Display::screenInfo(_screen)->rootWindow()) {
+ t == otk::display->screenInfo(_screen)->rootWindow()) {
// window is a transient for its group!
// XXX: for now this is treated as non-transient.
// this needs to be fixed!
{
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;
- while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+ while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
// XXX: it would be nice to compress ALL changes to a property, not just
// changes in a row without other props between.
if (ce.xproperty.atom != e.atom) {
- XPutBackEvent(otk::Display::display, &ce);
+ XPutBackEvent(**otk::display, &ce);
break;
}
}
_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 ||
_area.setPos(x, y);
if (addborder) {
- XSetWindowBorderWidth(otk::Display::display, _window, _border_width);
+ XSetWindowBorderWidth(**otk::display, _window, _border_width);
// move the client so it is back it the right spot _with_ its border!
- XMoveWindow(otk::Display::display, _window, x, y);
+ XMoveWindow(**otk::display, _window, x, y);
} else
- XSetWindowBorderWidth(otk::Display::display, _window, 0);
+ XSetWindowBorderWidth(**otk::display, _window, 0);
}
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
bool compress = false;
XEvent ce;
- while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+ while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
// XXX: it would be nice to compress ALL messages of a type, not just
// messages in a row without other message types between.
if (ce.xclient.message_type != e.message_type) {
- XPutBackEvent(otk::Display::display, &ce);
+ XPutBackEvent(**otk::display, &ce);
break;
}
compress = true;
// compress changes into a single change
bool compress = false;
XEvent ce;
- while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+ while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
// XXX: it would be nice to compress ALL messages of a type, not just
// messages in a row without other message types between.
if (ce.xclient.message_type != e.message_type) {
- XPutBackEvent(otk::Display::display, &ce);
+ XPutBackEvent(**otk::display, &ce);
break;
}
compress = true;
shade(false);
// XXX: deiconify
focus();
- Openbox::instance->screen(_screen)->restack(true, this); // raise
+ openbox->screen(_screen)->restack(true, this); // raise
}
}
_area.setSize(w, h);
- XResizeWindow(otk::Display::display, _window, w, h);
+ XResizeWindow(**otk::display, _window, w, h);
// resize the frame to match the request
frame->adjustSize();
// yet)
XEvent event;
event.type = ConfigureNotify;
- event.xconfigure.display = otk::Display::display;
+ event.xconfigure.display = **otk::display;
event.xconfigure.event = _window;
event.xconfigure.window = _window;
event.xconfigure.x = x;
void Client::close()
{
XEvent ce;
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
if (!(_functions & Func_Close)) return;
ce.xclient.type = ClientMessage;
ce.xclient.message_type = property->atom(otk::Property::wm_protocols);
- ce.xclient.display = otk::Display::display;
+ ce.xclient.display = **otk::display;
ce.xclient.window = _window;
ce.xclient.format = 32;
ce.xclient.data.l[0] = property->atom(otk::Property::wm_delete_window);
ce.xclient.data.l[2] = 0l;
ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l;
- XSendEvent(otk::Display::display, _window, false, NoEventMask, &ce);
+ XSendEvent(**otk::display, _window, false, NoEventMask, &ce);
}
void Client::changeState()
{
- const otk::Property *property = Openbox::instance->property();
+ const otk::Property *property = openbox->property();
unsigned long state[2];
state[0] = _wmstate;
if (_focused) return true;
if (_can_focus)
- XSetInputFocus(otk::Display::display, _window,
+ XSetInputFocus(**otk::display, _window,
RevertToNone, CurrentTime);
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.display = otk::Display::display;
+ ce.xclient.display = **otk::display;
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;
- XSendEvent(otk::Display::display, _window, False, NoEventMask, &ce);
+ XSendEvent(**otk::display, _window, False, NoEventMask, &ce);
}
return true;
{
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);
}
// server to deal with after we unmanage the window
XEvent ev;
ev.xreparent = e;
- XPutBackEvent(otk::Display::display, &ev);
+ XPutBackEvent(**otk::display, &ev);
// this deletes us etc
- Openbox::instance->screen(_screen)->unmanageWindow(this);
+ openbox->screen(_screen)->unmanageWindow(this);
}
}