#include <X11/Xatom.h>
#include <X11/keysym.h>
-#ifdef STDC_HEADERS
+#ifdef HAVE_STRING_H
# include <string.h>
-#endif // STDC_HEADERS
+#endif // HAVE_STRING_H
#ifdef DEBUG
# ifdef HAVE_STDIO_H
/*
* Initializes the class with default values/the window's set initial values.
*/
-OpenboxWindow::OpenboxWindow(Openbox *b, Window w, BScreen *s) {
+OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
#ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowCreating,
"OpenboxWindow::OpenboxWindow(): creating 0x%lx\n"),
#endif // DEBUG
client.window = w;
- openbox = b;
- display = openbox->getXDisplay();
+ display = openbox.getXDisplay();
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
// fetch client size and placement
"failed\n"));
#endif // DEBUG
- b->ungrab();
+ openbox.ungrab();
return;
}
if (s) {
screen = s;
} else {
- screen = openbox->searchScreen(RootWindowOfScreen(wattrib.screen));
+ screen = openbox.searchScreen(RootWindowOfScreen(wattrib.screen));
if (! screen) {
#ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowCannotFindScreen,
RootWindowOfScreen(wattrib.screen));
#endif // DEBUG
- b->ungrab();
+ openbox.ungrab();
return;
}
}
lastButtonPressTime = 0;
image_ctrl = screen->getImageControl();
- timer = new BTimer(openbox, this);
- timer->setTimeout(openbox->getAutoRaiseDelay());
+ timer = new BTimer(openbox, *this);
+ timer->setTimeout(openbox.getAutoRaiseDelay());
timer->fireOnce(True);
getOpenboxHints();
screen->getSlit()->addClient(client.window);
delete this;
- b->ungrab();
+ openbox.ungrab();
return;
}
#endif // SLIT
flags.managed = True;
- openbox->saveWindowSearch(client.window, this);
+ openbox.saveWindowSearch(client.window, this);
// determine if this is a transient window
Window win;
if (XGetTransientForHint(display, client.window, &win)) {
if (win && (win != client.window)) {
OpenboxWindow *tr;
- if ((tr = openbox->searchWindow(win))) {
+ if ((tr = openbox.searchWindow(win))) {
while (tr->client.transient) tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
flags.stuck = client.transient_for->flags.stuck;
flags.transient = True;
} else if (win == client.window_group) {
- if ((tr = openbox->searchGroup(win, this))) {
+ if ((tr = openbox.searchGroup(win, this))) {
while (tr->client.transient) tr = tr->client.transient;
client.transient_for = tr;
tr->client.transient = this;
upsize();
Bool place_window = True;
- if (openbox->isStartup() || flags.transient ||
+ if (openbox.isStartup() || flags.transient ||
client.normal_hint_flags & (PPosition|USPosition)) {
setGravityOffsets();
- if ((openbox->isStartup()) ||
+ if ((openbox.isStartup()) ||
(frame.x >= 0 &&
(signed) (frame.y + frame.y_border) >= 0 &&
- frame.x <= (signed) screen->getWidth() &&
- frame.y <= (signed) screen->getHeight()))
+ frame.x <= (signed) screen->size().w() &&
+ frame.y <= (signed) screen->size().h()))
place_window = False;
}
frame.window = createToplevelWindow(frame.x, frame.y, frame.width,
frame.height,
frame.border_w);
- openbox->saveWindowSearch(frame.window, this);
+ openbox.saveWindowSearch(frame.window, this);
frame.plate = createChildWindow(frame.window);
- openbox->saveWindowSearch(frame.plate, this);
+ openbox.saveWindowSearch(frame.plate, this);
if (decorations.titlebar) {
frame.title = createChildWindow(frame.window);
frame.label = createChildWindow(frame.title);
- openbox->saveWindowSearch(frame.title, this);
- openbox->saveWindowSearch(frame.label, this);
+ openbox.saveWindowSearch(frame.title, this);
+ openbox.saveWindowSearch(frame.label, this);
}
if (decorations.handle) {
frame.handle = createChildWindow(frame.window);
- openbox->saveWindowSearch(frame.handle, this);
+ openbox.saveWindowSearch(frame.handle, this);
frame.left_grip =
- createChildWindow(frame.handle, openbox->getLowerLeftAngleCursor());
- openbox->saveWindowSearch(frame.left_grip, this);
+ createChildWindow(frame.handle, openbox.getLowerLeftAngleCursor());
+ openbox.saveWindowSearch(frame.left_grip, this);
frame.right_grip =
- createChildWindow(frame.handle, openbox->getLowerRightAngleCursor());
- openbox->saveWindowSearch(frame.right_grip, this);
+ createChildWindow(frame.handle, openbox.getLowerRightAngleCursor());
+ openbox.saveWindowSearch(frame.right_grip, this);
}
associateClientWindow();
- if (! screen->isSloppyFocus())
- openbox->grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
+ if (! screen->sloppyFocus())
+ openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
GrabModeSync, GrabModeSync, None, None);
- openbox->grabButton(Button1, Mod1Mask, frame.window, True,
+ openbox.grabButton(Button1, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
- GrabModeAsync, None, openbox->getMoveCursor());
- openbox->grabButton(Button2, Mod1Mask, frame.window, True,
+ GrabModeAsync, None, openbox.getMoveCursor());
+ openbox.grabButton(Button2, Mod1Mask, frame.window, True,
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
- openbox->grabButton(Button3, Mod1Mask, frame.window, True,
+ openbox.grabButton(Button3, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
GrabModeAsync, None, None);
XMapSubwindows(display, frame.window);
if (decorations.menu)
- windowmenu = new Windowmenu(this);
+ windowmenu = new Windowmenu(*this);
decorate();
- if (workspace_number < 0 || workspace_number >= screen->getCount())
+ if (workspace_number < 0 || workspace_number >= screen->getWorkspaceCount())
screen->getCurrentWorkspace()->addWindow(this, place_window);
else
screen->getWorkspace(workspace_number)->addWindow(this, place_window);
setFocusFlag(False);
- openbox->ungrab();
+ openbox.ungrab();
}
XFree(client.openbox_hint);
if (client.window_group)
- openbox->removeGroupSearch(client.window_group);
+ openbox.removeGroupSearch(client.window_group);
if (flags.transient && client.transient_for)
client.transient_for->client.transient = client.transient;
client.transient->client.transient_for = client.transient_for;
if (frame.close_button) {
- openbox->removeWindowSearch(frame.close_button);
+ openbox.removeWindowSearch(frame.close_button);
XDestroyWindow(display, frame.close_button);
}
if (frame.iconify_button) {
- openbox->removeWindowSearch(frame.iconify_button);
+ openbox.removeWindowSearch(frame.iconify_button);
XDestroyWindow(display, frame.iconify_button);
}
if (frame.maximize_button) {
- openbox->removeWindowSearch(frame.maximize_button);
+ openbox.removeWindowSearch(frame.maximize_button);
XDestroyWindow(display, frame.maximize_button);
}
if( frame.ulabel)
image_ctrl->removeImage(frame.ulabel);
- openbox->removeWindowSearch(frame.label);
- openbox->removeWindowSearch(frame.title);
+ openbox.removeWindowSearch(frame.label);
+ openbox.removeWindowSearch(frame.title);
XDestroyWindow(display, frame.label);
XDestroyWindow(display, frame.title);
}
if (frame.ugrip)
image_ctrl->removeImage(frame.ugrip);
- openbox->removeWindowSearch(frame.handle);
- openbox->removeWindowSearch(frame.right_grip);
- openbox->removeWindowSearch(frame.left_grip);
+ openbox.removeWindowSearch(frame.handle);
+ openbox.removeWindowSearch(frame.right_grip);
+ openbox.removeWindowSearch(frame.left_grip);
XDestroyWindow(display, frame.right_grip);
XDestroyWindow(display, frame.left_grip);
XDestroyWindow(display, frame.handle);
image_ctrl->removeImage(frame.pbutton);
if (frame.plate) {
- openbox->removeWindowSearch(frame.plate);
+ openbox.removeWindowSearch(frame.plate);
XDestroyWindow(display, frame.plate);
}
if (frame.window) {
- openbox->removeWindowSearch(frame.window);
+ openbox.removeWindowSearch(frame.window);
XDestroyWindow(display, frame.window);
}
if (flags.managed) {
- openbox->removeWindowSearch(client.window);
+ openbox.removeWindowSearch(client.window);
screen->removeNetizen(client.window);
}
}
&attrib_set);
#ifdef SHAPE
- if (openbox->hasShapeExtensions()) {
+ if (openbox.hasShapeExtensions()) {
XShapeSelectInput(display, client.window, ShapeNotifyMask);
int foo;
void OpenboxWindow::createCloseButton(void) {
if (decorations.close && frame.title != None) {
frame.close_button = createChildWindow(frame.title);
- openbox->saveWindowSearch(frame.close_button, this);
+ openbox.saveWindowSearch(frame.close_button, this);
}
}
void OpenboxWindow::createIconifyButton(void) {
if (decorations.iconify && frame.title != None) {
frame.iconify_button = createChildWindow(frame.title);
- openbox->saveWindowSearch(frame.iconify_button, this);
+ openbox.saveWindowSearch(frame.iconify_button, this);
}
}
void OpenboxWindow::createMaximizeButton(void) {
if (decorations.maximize && frame.title != None) {
frame.maximize_button = createChildWindow(frame.title);
- openbox->saveWindowSearch(frame.maximize_button, this);
+ openbox.saveWindowSearch(frame.maximize_button, this);
}
}
void OpenboxWindow::positionButtons(Bool redecorate_label) {
- const char *format = openbox->getTitleBarLayout();
+ const char *format = openbox.getTitleBarLayout();
const unsigned int bw = frame.bevel_w + 1;
const unsigned int by = frame.bevel_w + 1;
unsigned int bx = frame.bevel_w + 1;
}
if (!hasclose) {
- openbox->removeWindowSearch(frame.close_button);
+ openbox.removeWindowSearch(frame.close_button);
XDestroyWindow(display, frame.close_button);
}
if (!hasiconify) {
- openbox->removeWindowSearch(frame.iconify_button);
+ openbox.removeWindowSearch(frame.iconify_button);
XDestroyWindow(display, frame.iconify_button);
}
if (!hasmaximize) {
- openbox->removeWindowSearch(frame.maximize_button);
+ openbox.removeWindowSearch(frame.maximize_button);
XDestroyWindow(display, frame.maximize_button);
}
if (redecorate_label)
configure(frame.x, frame.y, frame.width, frame.height);
- if (! screen->isSloppyFocus())
- openbox->grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
+ if (! screen->sloppyFocus())
+ openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
GrabModeSync, GrabModeSync, None, None);
else
- openbox->ungrabButton(Button1, 0, frame.plate);
+ openbox.ungrabButton(Button1, 0, frame.plate);
if (windowmenu) {
windowmenu->move(windowmenu->getX(), frame.y + frame.title_h);
if (XGetWMProtocols(display, client.window, &proto, &num_return)) {
for (int i = 0; i < num_return; ++i) {
- if (proto[i] == openbox->getWMDeleteAtom())
+ if (proto[i] == openbox.getWMDeleteAtom())
functions.close = decorations.close = True;
- else if (proto[i] == openbox->getWMTakeFocusAtom())
+ else if (proto[i] == openbox.getWMTakeFocusAtom())
flags.send_focus_message = True;
- else if (proto[i] == openbox->getOpenboxStructureMessagesAtom())
- screen->addNetizen(new Netizen(screen, client.window));
+ else if (proto[i] == openbox.getOpenboxStructureMessagesAtom())
+ screen->addNetizen(new Netizen(*screen, client.window));
}
XFree(proto);
if (wmhint->flags & WindowGroupHint) {
if (! client.window_group) {
client.window_group = wmhint->window_group;
- openbox->saveGroupSearch(client.window_group, this);
+ openbox.saveGroupSearch(client.window_group, this);
}
} else {
client.window_group = None;
client.min_width = client.min_height =
client.base_width = client.base_height =
client.width_inc = client.height_inc = 1;
- client.max_width = screen->getWidth();
- client.max_height = screen->getHeight();
+ client.max_width = screen->size().w();
+ client.max_height = screen->size().h();
client.min_aspect_x = client.min_aspect_y =
client.max_aspect_x = client.max_aspect_y = 1;
client.win_gravity = NorthWestGravity;
unsigned long num, len;
int ret = XGetWindowProperty(display, client.window,
- openbox->getMotifWMHintsAtom(), 0,
+ openbox.getMotifWMHintsAtom(), 0,
PropMwmHintsElements, False,
- openbox->getMotifWMHintsAtom(), &atom_return,
+ openbox.getMotifWMHintsAtom(), &atom_return,
&format, &num, &len,
(unsigned char **) &client.mwm_hint);
unsigned long num, len;
int ret = XGetWindowProperty(display, client.window,
- openbox->getOpenboxHintsAtom(), 0,
+ openbox.getOpenboxHintsAtom(), 0,
PropOpenboxHintsElements, False,
- openbox->getOpenboxHintsAtom(), &atom_return,
+ openbox.getOpenboxHintsAtom(), &atom_return,
&format, &num, &len,
(unsigned char **) &client.openbox_hint);
if (ret != Success || !client.openbox_hint ||
downsize();
#ifdef SHAPE
- if (openbox->hasShapeExtensions() && flags.shaped) {
+ if (openbox.hasShapeExtensions() && flags.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
frame.mwm_border_w, frame.y_border +
frame.mwm_border_w, client.window,
if (((signed) (frame.x + frame.width)) < 0) {
if (((signed) (frame.y + frame.y_border)) < 0)
configure(frame.border_w, frame.border_w, frame.width, frame.height);
- else if (frame.y > (signed) screen->getHeight())
- configure(frame.border_w, screen->getHeight() - frame.height,
+ else if (frame.y > (signed) screen->size().h())
+ configure(frame.border_w, screen->size().h() - frame.height,
frame.width, frame.height);
else
configure(frame.border_w, frame.y + frame.border_w,
frame.width, frame.height);
- } else if (frame.x > (signed) screen->getWidth()) {
+ } else if (frame.x > (signed) screen->size().w()) {
if (((signed) (frame.y + frame.y_border)) < 0)
- configure(screen->getWidth() - frame.width, frame.border_w,
+ configure(screen->size().w() - frame.width, frame.border_w,
frame.width, frame.height);
- else if (frame.y > (signed) screen->getHeight())
- configure(screen->getWidth() - frame.width,
- screen->getHeight() - frame.height, frame.width, frame.height);
+ else if (frame.y > (signed) screen->size().h())
+ configure(screen->size().w() - frame.width,
+ screen->size().h() - frame.height, frame.width, frame.height);
else
- configure(screen->getWidth() - frame.width,
+ configure(screen->size().w() - frame.width,
frame.y + frame.border_w, frame.width, frame.height);
}
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return False;
Bool ret = False;
XSetInputFocus(display, screen->getRootWindow(),
RevertToNone, CurrentTime);
- openbox->setFocusedWindow(this);
+ openbox.setFocusedWindow(this);
if (flags.send_focus_message) {
XEvent ce;
ce.xclient.type = ClientMessage;
- ce.xclient.message_type = openbox->getWMProtocolsAtom();
+ ce.xclient.message_type = openbox.getWMProtocolsAtom();
ce.xclient.display = display;
ce.xclient.window = client.window;
ce.xclient.format = 32;
- ce.xclient.data.l[0] = openbox->getWMTakeFocusAtom();
- ce.xclient.data.l[1] = openbox->getLastTime();
+ ce.xclient.data.l[0] = openbox.getWMTakeFocusAtom();
+ ce.xclient.data.l[1] = openbox.getLastTime();
ce.xclient.data.l[2] = 0l;
ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l;
XSendEvent(display, client.window, False, NoEventMask, &ce);
}
- if (screen->isSloppyFocus() && screen->doAutoRaise())
+ if (screen->sloppyFocus() && screen->autoRaise())
timer->start();
ret = True;
}
- openbox->ungrab();
+ openbox.ungrab();
return ret;
}
XMapSubwindows(display, frame.window);
XMapWindow(display, frame.window);
- if (flags.iconic && screen->doFocusNew()) setInputFocus();
+ if (flags.iconic && screen->focusNew()) setInputFocus();
flags.visible = True;
flags.iconic = False;
void OpenboxWindow::close(void) {
XEvent ce;
ce.xclient.type = ClientMessage;
- ce.xclient.message_type = openbox->getWMProtocolsAtom();
+ ce.xclient.message_type = openbox.getWMProtocolsAtom();
ce.xclient.display = display;
ce.xclient.window = client.window;
ce.xclient.format = 32;
- ce.xclient.data.l[0] = openbox->getWMDeleteAtom();
+ ce.xclient.data.l[0] = openbox.getWMDeleteAtom();
ce.xclient.data.l[1] = CurrentTime;
ce.xclient.data.l[2] = 0l;
ce.xclient.data.l[3] = 0l;
openbox_attrib.premax_w = frame.width;
openbox_attrib.premax_h = frame.height;
- dw = screen->getWidth();
+ dw = screen->size().w();
dw -= frame.border_w * 2;
dw -= frame.mwm_border_w * 2;
dw -= client.base_width;
- dh = screen->getHeight();
+ dh = screen->size().h();
dh -= frame.border_w * 2;
dh -= frame.mwm_border_w * 2;
dh -= ((frame.handle_h + frame.border_w) * decorations.handle);
dh -= client.base_height;
dh -= frame.y_border;
- if (! screen->doFullMax())
+ if (! screen->fullMax())
dh -= screen->getToolbar()->getExposedHeight() + frame.border_w;
if (dw < client.min_width) dw = client.min_width;
dh += ((frame.handle_h + frame.border_w) * decorations.handle);
dh += frame.mwm_border_w * 2;
- dx += ((screen->getWidth() - dw) / 2) - frame.border_w;
+ dx += ((screen->size().w() - dw) / 2) - frame.border_w;
- if (screen->doFullMax()) {
- dy += ((screen->getHeight() - dh) / 2) - frame.border_w;
+ if (screen->fullMax()) {
+ dy += ((screen->size().h() - dh) / 2) - frame.border_w;
} else {
- dy += (((screen->getHeight() - screen->getToolbar()->getExposedHeight())
+ dy += (((screen->size().h() - screen->getToolbar()->getExposedHeight())
- dh) / 2) - frame.border_w;
- switch (screen->getToolbarPlacement()) {
+ switch (screen->getToolbar()->placement()) {
case Toolbar::TopLeft:
case Toolbar::TopCenter:
case Toolbar::TopRight:
XSetWindowBorder(display, frame.plate, frame.uborder_pixel);
}
- if (screen->isSloppyFocus() && screen->doAutoRaise() && timer->isTiming())
+ if (screen->sloppyFocus() && screen->autoRaise() && timer->isTiming())
timer->stop();
}
void OpenboxWindow::installColormap(Bool install) {
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
int i = 0, ncmap = 0;
XFree(cmaps);
}
- openbox->ungrab();
+ openbox.ungrab();
}
unsigned long state[2];
state[0] = (unsigned long) current_state;
state[1] = (unsigned long) None;
- XChangeProperty(display, client.window, openbox->getWMStateAtom(),
- openbox->getWMStateAtom(), 32, PropModeReplace,
+ XChangeProperty(display, client.window, openbox.getWMStateAtom(),
+ openbox.getWMStateAtom(), 32, PropModeReplace,
(unsigned char *) state, 2);
XChangeProperty(display, client.window,
- openbox->getOpenboxAttributesAtom(),
- openbox->getOpenboxAttributesAtom(), 32, PropModeReplace,
+ openbox.getOpenboxAttributesAtom(),
+ openbox.getOpenboxAttributesAtom(), 32, PropModeReplace,
(unsigned char *) &openbox_attrib,
PropOpenboxAttributesElements);
}
int foo;
unsigned long *state, ulfoo, nitems;
- if ((XGetWindowProperty(display, client.window, openbox->getWMStateAtom(),
- 0l, 2l, False, openbox->getWMStateAtom(),
+ if ((XGetWindowProperty(display, client.window, openbox.getWMStateAtom(),
+ 0l, 2l, False, openbox.getWMStateAtom(),
&atom_return, &foo, &nitems, &ulfoo,
(unsigned char **) &state) != Success) ||
(! state)) {
- openbox->ungrab();
+ openbox.ungrab();
return False;
}
OpenboxAttributes *net;
int ret = XGetWindowProperty(display, client.window,
- openbox->getOpenboxAttributesAtom(), 0l,
+ openbox.getOpenboxAttributesAtom(), 0l,
PropOpenboxAttributesElements, False,
- openbox->getOpenboxAttributesAtom(),
+ openbox.getOpenboxAttributesAtom(),
&atom_return, &foo, &nitems, &ulfoo,
(unsigned char **) &net);
if (ret != Success || !net || nitems != PropOpenboxAttributesElements)
}
if (((int) openbox_attrib.workspace != screen->getCurrentWorkspaceID()) &&
- ((int) openbox_attrib.workspace < screen->getCount())) {
+ ((int) openbox_attrib.workspace < screen->getWorkspaceCount())) {
screen->reassociateWindow(this, openbox_attrib.workspace, True);
if (current_state == NormalState) current_state = WithdrawnState;
client.window);
#endif // DEBUG
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
Bool get_state_ret = getState();
- if (! (get_state_ret && openbox->isStartup())) {
+ if (! (get_state_ret && openbox.isStartup())) {
if ((client.wm_hint_flags & StateHint) &&
(! (current_state == NormalState || current_state == IconicState)))
current_state = client.initial_state;
break;
}
- openbox->ungrab();
+ openbox.ungrab();
}
}
void OpenboxWindow::mapNotifyEvent(XMapEvent *ne) {
if ((ne->window == client.window) && (! ne->override_redirect)
&& (flags.visible)) {
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
if (decorations.titlebar) positionButtons();
redrawAllButtons();
- if (flags.transient || screen->doFocusNew())
+ if (flags.transient || screen->focusNew())
setInputFocus();
else
setFocusFlag(False);
flags.visible = True;
flags.iconic = False;
- openbox->ungrab();
+ openbox.ungrab();
}
}
client.window);
#endif // DEBUG
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask);
- XDeleteProperty(display, client.window, openbox->getWMStateAtom());
+ XDeleteProperty(display, client.window, openbox.getWMStateAtom());
XDeleteProperty(display, client.window,
- openbox->getOpenboxAttributesAtom());
+ openbox.getOpenboxAttributesAtom());
XUnmapWindow(display, frame.window);
XUnmapWindow(display, client.window);
XFlush(display);
- openbox->ungrab();
+ openbox.ungrab();
delete this;
}
void OpenboxWindow::propertyNotifyEvent(Atom atom) {
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
switch(atom) {
Window win;
if (XGetTransientForHint(display, client.window, &win)) {
if (win && (win != client.window)) {
- if ((client.transient_for = openbox->searchWindow(win))) {
+ if ((client.transient_for = openbox.searchWindow(win))) {
client.transient_for->client.transient = this;
flags.stuck = client.transient_for->flags.stuck;
flags.transient = True;
} else if (win == client.window_group) {
//jr This doesn't look quite right...
- if ((client.transient_for = openbox->searchGroup(win, this))) {
+ if ((client.transient_for = openbox.searchGroup(win, this))) {
client.transient_for->client.transient = this;
flags.stuck = client.transient_for->flags.stuck;
flags.transient = True;
}
default:
- if (atom == openbox->getWMProtocolsAtom()) {
+ if (atom == openbox.getWMProtocolsAtom()) {
getWMProtocols();
if (decorations.close && (! frame.close_button)) {
break;
}
- openbox->ungrab();
+ openbox.ungrab();
}
void OpenboxWindow::configureRequestEvent(XConfigureRequestEvent *cr) {
if (cr->window == client.window) {
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
int cx = frame.x, cy = frame.y;
}
}
- openbox->ungrab();
+ openbox.ungrab();
}
}
void OpenboxWindow::buttonPressEvent(XButtonEvent *be) {
- openbox->grab();
+ openbox.grab();
if (! validateClient())
return;
be->window == frame.label) {
// shade the window when the titlebar is double clicked
if ( (be->time - lastButtonPressTime) <=
- openbox->getDoubleClickInterval()) {
+ openbox.getDoubleClickInterval()) {
lastButtonPressTime = 0;
shade();
} else {
shade();
}
- if (! (flags.focused || screen->isSloppyFocus()) ) {
+ if (! (flags.focused || screen->sloppyFocus()) ) {
setInputFocus(); // any click focus' the window in 'click to focus'
}
if (stack_change < 0) {
screen->getWorkspace(workspace_number)->raiseWindow(this);
}
- openbox->ungrab();
+ openbox.ungrab();
}
void OpenboxWindow::buttonReleaseEvent(XButtonEvent *re) {
- openbox->grab();
+ openbox.grab();
if (! validateClient())
return;
(re->x >= 0) && ((unsigned) re->x <= frame.button_w) &&
(re->y >= 0) && ((unsigned) re->y <= frame.button_h)) {
close();
- } else {
- redrawCloseButton(False);
}
+ //we should always redraw the close button. some applications
+ //eg. acroread don't honour the close.
+ redrawCloseButton(False);
}
// middle button released
} else if (re->button == 2) {
if (flags.moving) {
flags.moving = False;
- openbox->maskWindowEvents(0, (OpenboxWindow *) 0);
- if (!screen->doOpaqueMove()) {
+ openbox.maskWindowEvents(0, (OpenboxWindow *) 0);
+ if (!screen->opaqueMove()) {
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
frame.move_x, frame.move_y, frame.resize_w - 1,
frame.resize_h - 1);
configure(frame.move_x, frame.move_y, frame.width, frame.height);
- openbox->ungrab();
+ openbox.ungrab();
} else {
configure(frame.x, frame.y, frame.width, frame.height);
}
configure(frame.resize_x, frame.resize_y,
frame.resize_w - (frame.border_w * 2),
frame.resize_h - (frame.border_w * 2));
- openbox->ungrab();
+ openbox.ungrab();
XUngrabPointer(display, CurrentTime);
resize_zone = 0;
}
- openbox->ungrab();
+ openbox.ungrab();
}
if (! flags.moving) {
XGrabPointer(display, me->window, False, Button1MotionMask |
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
- None, openbox->getMoveCursor(), CurrentTime);
+ None, openbox.getMoveCursor(), CurrentTime);
if (windowmenu && windowmenu->isVisible())
windowmenu->hide();
flags.moving = True;
- openbox->maskWindowEvents(client.window, this);
+ openbox.maskWindowEvents(client.window, this);
- if (! screen->doOpaqueMove()) {
- openbox->grab();
+ if (! screen->opaqueMove()) {
+ openbox.grab();
frame.move_x = frame.x;
frame.move_y = frame.y;
dx -= frame.border_w;
dy -= frame.border_w;
- int snap_distance = screen->getEdgeSnapThreshold();
+ int snap_distance = screen->edgeSnapThreshold();
+ // width/height of the snapping window
+ unsigned int snap_w = frame.width + (frame.border_w * 2);
+ unsigned int snap_h = size().h() + (frame.border_w * 2);
if (snap_distance) {
- int drx = screen->getWidth() - (dx + frame.snap_w);
+ int drx = screen->size().w() - (dx + snap_w);
if (dx < drx && (dx > 0 && dx < snap_distance) ||
(dx < 0 && dx > -snap_distance) )
dx = 0;
else if ( (drx > 0 && drx < snap_distance) ||
(drx < 0 && drx > -snap_distance) )
- dx = screen->getWidth() - frame.snap_w;
+ dx = screen->size().w() - snap_w;
int dtty, dbby, dty, dby;
- switch (screen->getToolbarPlacement()) {
+ switch (screen->getToolbar()->placement()) {
case Toolbar::TopLeft:
case Toolbar::TopCenter:
case Toolbar::TopRight:
dtty = screen->getToolbar()->getExposedHeight() +
frame.border_w;
- dbby = screen->getHeight();
+ dbby = screen->size().h();
break;
default:
}
dty = dy - dtty;
- dby = dbby - (dy + frame.snap_h);
+ dby = dbby - (dy + snap_h);
if ( (dy > 0 && dty < snap_distance) ||
(dy < 0 && dty > -snap_distance) )
dy = dtty;
else if ( (dby > 0 && dby < snap_distance) ||
(dby < 0 && dby > -snap_distance) )
- dy = dbby - frame.snap_h;
+ dy = dbby - snap_h;
}
- if (screen->doOpaqueMove()) {
+ if (screen->opaqueMove()) {
configure(dx, dy, frame.width, frame.height);
} else {
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
Cursor cursor;
if (resize_zone & ZoneTop)
cursor = (resize_zone & ZoneLeft) ?
- openbox->getUpperLeftAngleCursor() :
- openbox->getUpperRightAngleCursor();
+ openbox.getUpperLeftAngleCursor() :
+ openbox.getUpperRightAngleCursor();
else
cursor = (resize_zone & ZoneLeft) ?
- openbox->getLowerLeftAngleCursor() :
- openbox->getLowerRightAngleCursor();
+ openbox.getLowerLeftAngleCursor() :
+ openbox.getLowerRightAngleCursor();
XGrabPointer(display, me->window, False, ButtonMotionMask |
ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None,
cursor, CurrentTime);
flags.resizing = True;
- openbox->grab();
+ openbox.grab();
int gx, gy;
if (resize_zone & ZoneRight)
#ifdef SHAPE
void OpenboxWindow::shapeEvent(XShapeEvent *) {
- if (openbox->hasShapeExtensions()) {
+ if (openbox.hasShapeExtensions()) {
if (flags.shaped) {
- openbox->grab();
+ openbox.grab();
if (! validateClient()) return;
XShapeCombineShape(display, frame.window, ShapeBounding,
frame.mwm_border_w, frame.y_border +
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
xrect, num, ShapeUnion, Unsorted);
- openbox->ungrab();
+ openbox.ungrab();
}
}
}
if (XCheckTypedWindowEvent(display, client.window, DestroyNotify, &e) ||
XCheckTypedWindowEvent(display, client.window, UnmapNotify, &e)) {
XPutBackEvent(display, &e);
- openbox->ungrab();
+ openbox.ungrab();
return False;
}
frame.width = client.width + (frame.mwm_border_w * 2);
frame.height = frame.y_handle + frame.handle_h;
-
- frame.snap_w = frame.width + (frame.border_w * 2);
- frame.snap_h = frame.height + (frame.border_w * 2);
}
- frame.handle_h - (decorations.handle ? frame.border_w : 0);
frame.y_handle = frame.border_h + frame.y_border + frame.border_w;
-
- frame.snap_w = frame.width + (frame.border_w * 2);
- frame.snap_h = frame.height + (frame.border_w * 2);
}