-// Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
-// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
+// Copyright (c) 2002 - 2002 Ben Jansens (ben at orodu.net)
+// Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry (shaleh at debian.org)
+// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
- fprintf(stderr, i18n->getMessage(WindowSet, WindowCreating,
- "OpenboxWindow::OpenboxWindow(): creating 0x%lx\n"),
- w);
+ fprintf(stderr, i18n(WindowSet, WindowCreating,
+ "OpenboxWindow::OpenboxWindow(): creating 0x%lx\n"),
+ w);
- i18n->getMessage(WindowSet, WindowXGetWindowAttributesFail,
- "OpenboxWindow::OpenboxWindow(): XGetWindowAttributes "
- "failed\n"));
+ i18n(WindowSet, WindowXGetWindowAttributesFail,
+ "OpenboxWindow::OpenboxWindow(): XGetWindowAttributes "
+ "failed\n"));
- fprintf(stderr, i18n->getMessage(WindowSet, WindowCannotFindScreen,
- "OpenboxWindow::OpenboxWindow(): can't find screen\n"
- "\tfor root window 0x%lx\n"),
- RootWindowOfScreen(wattrib.screen));
+ fprintf(stderr, i18n(WindowSet, WindowCannotFindScreen,
+ "OpenboxWindow::OpenboxWindow(): can't find screen\n"
+ "\tfor root window 0x%lx\n"),
+ RootWindowOfScreen(wattrib.screen));
- 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;
+ 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;
- if ((tr = openbox.searchGroup(win, this))) {
- 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;
- }
+ if ((tr = openbox.searchGroup(win, this))) {
+ 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;
+ }
client.max_height <= client.min_height) {
decorations.maximize = decorations.handle =
functions.resize = functions.maximize = False;
client.max_height <= client.min_height) {
decorations.maximize = decorations.handle =
functions.resize = functions.maximize = False;
- (frame.x >= 0 &&
- (signed) (frame.y + frame.y_border) >= 0 &&
- frame.x <= (signed) screen->size().w() &&
- frame.y <= (signed) screen->size().h()))
+ (frame.x >= 0 &&
+ (signed) (frame.y + frame.y_border) >= 0 &&
+ frame.x <= (signed) screen->size().w() &&
+ frame.y <= (signed) screen->size().h()))
place_window = false;
}
frame.window = createToplevelWindow(frame.x, frame.y, frame.width,
place_window = false;
}
frame.window = createToplevelWindow(frame.x, frame.y, frame.width,
openbox.saveWindowSearch(frame.window, this);
frame.plate = createChildWindow(frame.window);
openbox.saveWindowSearch(frame.window, this);
frame.plate = createChildWindow(frame.window);
if (! screen->sloppyFocus())
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
if (! screen->sloppyFocus())
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
- GrabModeSync, GrabModeSync, None, None);
+ GrabModeSync, GrabModeSync, frame.plate, None);
openbox.grabButton(Button1, Mod1Mask, frame.window, True,
openbox.grabButton(Button1, Mod1Mask, frame.window, True,
- ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
- GrabModeAsync, None, openbox.getMoveCursor());
+ ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
+ GrabModeAsync, frame.window, openbox.getMoveCursor());
openbox.grabButton(Button2, Mod1Mask, frame.window, True,
openbox.grabButton(Button2, Mod1Mask, frame.window, True,
- ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
+ ButtonReleaseMask, GrabModeAsync, GrabModeAsync, frame.window, None);
openbox.grabButton(Button3, Mod1Mask, frame.window, True,
openbox.grabButton(Button3, Mod1Mask, frame.window, True,
- ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
- GrabModeAsync, None, None);
+ ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
+ GrabModeAsync, frame.window, None);
- if (workspace_number != -1 && window_number != -1)
- screen->getWorkspace(workspace_number)->removeWindow(this);
- else if (flags.iconic)
+ if (workspace_number != -1 && window_number != -1) {
+ if (flags.stuck) {
+ // make sure no other workspaces think that we're focused
+ for (int i=0; i < screen->getWorkspaceCount(); i++)
+ screen->getWorkspace(i)->removeWindow(this);
+ } else
+ screen->getWorkspace(workspace_number)->removeWindow(this);
+ } else if (flags.iconic)
* Returns: the newly created window
*/
Window OpenboxWindow::createToplevelWindow(int x, int y, unsigned int width,
* Returns: the newly created window
*/
Window OpenboxWindow::createToplevelWindow(int x, int y, unsigned int width,
{
XSetWindowAttributes attrib_create;
unsigned long create_mask = CWBackPixmap | CWBorderPixel | CWColormap |
{
XSetWindowAttributes attrib_create;
unsigned long create_mask = CWBackPixmap | CWBorderPixel | CWColormap |
attrib_create.background_pixmap = None;
attrib_create.colormap = screen->getColormap();
attrib_create.override_redirect = True;
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
attrib_create.background_pixmap = None;
attrib_create.colormap = screen->getColormap();
attrib_create.override_redirect = True;
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
return XCreateWindow(display, screen->getRootWindow(), x, y, width, height,
return XCreateWindow(display, screen->getRootWindow(), x, y, width, height,
- borderwidth, screen->getDepth(), InputOutput,
- screen->getVisual(), create_mask,
- &attrib_create);
+ borderwidth, screen->getDepth(), InputOutput,
+ screen->getVisual(), create_mask,
+ &attrib_create);
Window OpenboxWindow::createChildWindow(Window parent, Cursor cursor) {
XSetWindowAttributes attrib_create;
unsigned long create_mask = CWBackPixmap | CWBorderPixel |
Window OpenboxWindow::createChildWindow(Window parent, Cursor cursor) {
XSetWindowAttributes attrib_create;
unsigned long create_mask = CWBackPixmap | CWBorderPixel |
attrib_create.background_pixmap = None;
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
attrib_create.background_pixmap = None;
attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
}
return XCreateWindow(display, parent, 0, 0, 1, 1, 0, screen->getDepth(),
}
return XCreateWindow(display, parent, 0, 0, 1, 1, 0, screen->getDepth(),
- InputOutput, screen->getVisual(), create_mask,
- &attrib_create);
+ InputOutput, screen->getVisual(), create_mask,
+ &attrib_create);
XChangeWindowAttributes(display, client.window, CWEventMask|CWDontPropagate,
&attrib_set);
XChangeWindowAttributes(display, client.window, CWEventMask|CWDontPropagate,
&attrib_set);
unsigned int ufoo;
XShapeQueryExtents(display, client.window, &flags.shaped, &foo, &foo,
unsigned int ufoo;
XShapeQueryExtents(display, client.window, &flags.shaped, &foo, &foo,
- &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
+ &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
if (flags.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
if (flags.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
- frame.mwm_border_w, frame.y_border +
- frame.mwm_border_w, client.window,
- ShapeBounding, ShapeSet);
+ frame.mwm_border_w, frame.y_border +
+ frame.mwm_border_w, client.window,
+ ShapeBounding, ShapeSet);
- xrect[1].x = 0;
- xrect[1].y = frame.y_handle;
- xrect[1].width = frame.width;
- xrect[1].height = frame.handle_h + frame.border_w;
- num++;
+ xrect[1].x = 0;
+ xrect[1].y = frame.y_handle;
+ xrect[1].width = frame.width;
+ xrect[1].height = frame.handle_h + frame.border_w;
+ num++;
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
- xrect, num, ShapeUnion, Unsorted);
+ xrect, num, ShapeUnion, Unsorted);
bool hasclose, hasiconify, hasmaximize;
hasclose = hasiconify = hasmaximize = false;
bool hasclose, hasiconify, hasmaximize;
hasclose = hasiconify = hasmaximize = false;
if (!hasclose && frame.close_button) {
openbox.removeWindowSearch(frame.close_button);
XDestroyWindow(display, frame.close_button);
if (!hasclose && frame.close_button) {
openbox.removeWindowSearch(frame.close_button);
XDestroyWindow(display, frame.close_button);
}
if (!hasiconify && frame.iconify_button) {
openbox.removeWindowSearch(frame.iconify_button);
XDestroyWindow(display, frame.iconify_button);
}
if (!hasiconify && frame.iconify_button) {
openbox.removeWindowSearch(frame.iconify_button);
XDestroyWindow(display, frame.iconify_button);
}
if (!hasmaximize && frame.iconify_button) {
openbox.removeWindowSearch(frame.maximize_button);
XDestroyWindow(display, frame.maximize_button);
}
if (!hasmaximize && frame.iconify_button) {
openbox.removeWindowSearch(frame.maximize_button);
XDestroyWindow(display, frame.maximize_button);
client.x = frame.x + frame.mwm_border_w + frame.border_w;
client.y = frame.y + frame.y_border + frame.mwm_border_w +
client.x = frame.x + frame.mwm_border_w + frame.border_w;
client.y = frame.y + frame.y_border + frame.mwm_border_w +
- client.title, client.title_len, &ink, &logical);
+ client.title, client.title_len, &ink, &logical);
client.title_text_w = logical.width;
} else {
client.title_text_w = XTextWidth(screen->getWindowStyle()->font,
client.title_text_w = logical.width;
} else {
client.title_text_w = XTextWidth(screen->getWindowStyle()->font,
if (! screen->sloppyFocus())
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
if (! screen->sloppyFocus())
openbox.grabButton(Button1, 0, frame.plate, True, ButtonPressMask,
- GrabModeSync, GrabModeSync, None, None);
+ GrabModeSync, GrabModeSync, None, None);
windowmenu->move(windowmenu->getX(), frame.y + frame.title_h);
windowmenu->reconfigure();
}
windowmenu->move(windowmenu->getX(), frame.y + frame.title_h);
windowmenu->reconfigure();
}
if (decorations.titlebar) {
XSetWindowBorderWidth(display, frame.title, frame.border_w);
XMoveResizeWindow(display, frame.title, -frame.border_w,
if (decorations.titlebar) {
XSetWindowBorderWidth(display, frame.title, frame.border_w);
XMoveResizeWindow(display, frame.title, -frame.border_w,
XMoveResizeWindow(display, frame.handle, -frame.border_w,
frame.y_handle - frame.border_w,
XMoveResizeWindow(display, frame.handle, -frame.border_w,
frame.y_handle - frame.border_w,
XMoveResizeWindow(display, frame.left_grip, -frame.border_w,
XMoveResizeWindow(display, frame.left_grip, -frame.border_w,
-frame.border_w, frame.grip_w, frame.grip_h);
XMapSubwindows(display, frame.handle);
} else if (frame.handle) {
-frame.border_w, frame.grip_w, frame.grip_h);
XMapSubwindows(display, frame.handle);
} else if (frame.handle) {
if (XGetWMName(display, client.window, &text_prop)) {
if (text_prop.value && text_prop.nitems > 0) {
if (text_prop.encoding != XA_STRING) {
if (XGetWMName(display, client.window, &text_prop)) {
if (text_prop.value && text_prop.nitems > 0) {
if (text_prop.encoding != XA_STRING) {
- text_prop.nitems = strlen((char *) text_prop.value);
-
- if ((XmbTextPropertyToTextList(display, &text_prop,
- &list, &num) == Success) &&
- (num > 0) && *list) {
- client.title = bstrdup(*list);
- XFreeStringList(list);
- } else {
- client.title = bstrdup((char *) text_prop.value);
- }
+ text_prop.nitems = strlen((char *) text_prop.value);
+
+ if ((XmbTextPropertyToTextList(display, &text_prop,
+ &list, &num) == Success) &&
+ (num > 0) && *list) {
+ client.title = bstrdup(*list);
+ XFreeStringList(list);
+ } else {
+ client.title = bstrdup((char *) text_prop.value);
+ }
- client.title, client.title_len, &ink, &logical);
+ client.title, client.title_len, &ink, &logical);
client.title_text_w = logical.width;
} else {
client.title_len = strlen(client.title);
client.title_text_w = XTextWidth(screen->getWindowStyle()->font,
client.title_text_w = logical.width;
} else {
client.title_len = strlen(client.title);
client.title_text_w = XTextWidth(screen->getWindowStyle()->font,
if (XGetWMIconName(display, client.window, &text_prop)) {
if (text_prop.value && text_prop.nitems > 0) {
if (text_prop.encoding != XA_STRING) {
if (XGetWMIconName(display, client.window, &text_prop)) {
if (text_prop.value && text_prop.nitems > 0) {
if (text_prop.encoding != XA_STRING) {
- text_prop.nitems = strlen((char *) text_prop.value);
-
- if ((XmbTextPropertyToTextList(display, &text_prop,
- &list, &num) == Success) &&
- (num > 0) && *list) {
- client.icon_title = bstrdup(*list);
- XFreeStringList(list);
- } else {
- client.icon_title = bstrdup((char *) text_prop.value);
- }
+ text_prop.nitems = strlen((char *) text_prop.value);
+
+ if ((XmbTextPropertyToTextList(display, &text_prop,
+ &list, &num) == Success) &&
+ (num > 0) && *list) {
+ client.icon_title = bstrdup(*list);
+ XFreeStringList(list);
+ } else {
+ client.icon_title = bstrdup((char *) text_prop.value);
+ }
if (XGetWMProtocols(display, client.window, &proto, &num_return)) {
for (int i = 0; i < num_return; ++i) {
if (proto[i] == openbox.getWMDeleteAtom())
if (XGetWMProtocols(display, client.window, &proto, &num_return)) {
for (int i = 0; i < num_return; ++i) {
if (proto[i] == openbox.getWMDeleteAtom())
else if (proto[i] == openbox.getWMTakeFocusAtom())
flags.send_focus_message = True;
else if (proto[i] == openbox.getOpenboxStructureMessagesAtom())
else if (proto[i] == openbox.getWMTakeFocusAtom())
flags.send_focus_message = True;
else if (proto[i] == openbox.getOpenboxStructureMessagesAtom())
if (wmhint->flags & InputHint) {
if (wmhint->input == True) {
if (flags.send_focus_message)
if (wmhint->flags & InputHint) {
if (wmhint->input == True) {
if (flags.send_focus_message)
- openbox.getMotifWMHintsAtom(), 0,
- PropMwmHintsElements, False,
- openbox.getMotifWMHintsAtom(), &atom_return,
- &format, &num, &len,
- (unsigned char **) &client.mwm_hint);
+ openbox.getMotifWMHintsAtom(), 0,
+ PropMwmHintsElements, False,
+ openbox.getMotifWMHintsAtom(), &atom_return,
+ &format, &num, &len,
+ (unsigned char **) &client.mwm_hint);
if (client.mwm_hint->flags & MwmHintsDecorations) {
if (client.mwm_hint->decorations & MwmDecorAll) {
decorations.titlebar = decorations.handle = decorations.border =
if (client.mwm_hint->flags & MwmHintsDecorations) {
if (client.mwm_hint->decorations & MwmDecorAll) {
decorations.titlebar = decorations.handle = decorations.border =
}
}
if (client.mwm_hint->flags & MwmHintsFunctions) {
if (client.mwm_hint->functions & MwmFuncAll) {
functions.resize = functions.move = functions.iconify =
}
}
if (client.mwm_hint->flags & MwmHintsFunctions) {
if (client.mwm_hint->functions & MwmFuncAll) {
functions.resize = functions.move = functions.iconify =
- openbox.getOpenboxHintsAtom(), 0,
- PropOpenboxHintsElements, False,
- openbox.getOpenboxHintsAtom(), &atom_return,
- &format, &num, &len,
- (unsigned char **) &client.openbox_hint);
+ openbox.getOpenboxHintsAtom(), 0,
+ PropOpenboxHintsElements, False,
+ openbox.getOpenboxHintsAtom(), &atom_return,
+ &format, &num, &len,
+ (unsigned char **) &client.openbox_hint);
if ((client.openbox_hint->flags & AttribMaxHoriz) &&
(client.openbox_hint->flags & AttribMaxVert))
flags.maximized = (client.openbox_hint->attrib &
if ((client.openbox_hint->flags & AttribMaxHoriz) &&
(client.openbox_hint->flags & AttribMaxVert))
flags.maximized = (client.openbox_hint->attrib &
else if (client.openbox_hint->flags & AttribMaxVert)
flags.maximized = (client.openbox_hint->attrib & AttribMaxVert) ? 2 : 0;
else if (client.openbox_hint->flags & AttribMaxHoriz)
else if (client.openbox_hint->flags & AttribMaxVert)
flags.maximized = (client.openbox_hint->attrib & AttribMaxVert) ? 2 : 0;
else if (client.openbox_hint->flags & AttribMaxHoriz)
switch (client.openbox_hint->decoration) {
case DecorNone:
decorations.titlebar = decorations.border = decorations.handle =
switch (client.openbox_hint->decoration) {
case DecorNone:
decorations.titlebar = decorations.border = decorations.handle =
break;
case DecorTool:
decorations.titlebar = decorations.menu = functions.move = True;
decorations.iconify = decorations.border = decorations.handle =
break;
case DecorTool:
decorations.titlebar = decorations.menu = functions.move = True;
decorations.iconify = decorations.border = decorations.handle =
Bool send_event = (frame.x != dx || frame.y != dy);
if ((dw != frame.width) || (dh != frame.height)) {
Bool send_event = (frame.x != dx || frame.y != dy);
if ((dw != frame.width) || (dh != frame.height)) {
#ifdef SHAPE
if (openbox.hasShapeExtensions() && flags.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
#ifdef SHAPE
if (openbox.hasShapeExtensions() && flags.shaped) {
XShapeCombineShape(display, frame.window, ShapeBounding,
- frame.mwm_border_w, frame.y_border +
- frame.mwm_border_w, client.window,
- ShapeBounding, ShapeSet);
+ frame.mwm_border_w, frame.y_border +
+ frame.mwm_border_w, client.window,
+ ShapeBounding, ShapeSet);
- xrect[1].x = 0;
- xrect[1].y = frame.y_handle;
- xrect[1].width = frame.width;
- xrect[1].height = frame.handle_h + frame.border_w;
- num++;
+ xrect[1].x = 0;
+ xrect[1].y = frame.y_handle;
+ xrect[1].width = frame.width;
+ xrect[1].height = frame.handle_h + frame.border_w;
+ num++;
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
- xrect, num, ShapeUnion, Unsorted);
+ xrect, num, ShapeUnion, Unsorted);
if (send_event && ! flags.moving) {
client.x = dx + frame.mwm_border_w + frame.border_w;
client.y = dy + frame.y_border + frame.mwm_border_w +
if (send_event && ! flags.moving) {
client.x = dx + frame.mwm_border_w + frame.border_w;
client.y = dy + frame.y_border + frame.mwm_border_w +
frame.width, frame.height);
else if (frame.y > (signed) screen->size().h())
configure(screen->size().w() - frame.width,
frame.width, frame.height);
else if (frame.y > (signed) screen->size().h())
configure(screen->size().w() - frame.width,
else
configure(screen->size().w() - frame.width,
frame.y + frame.border_w, frame.width, frame.height);
else
configure(screen->size().w() - frame.width,
frame.y + frame.border_w, frame.width, frame.height);
} else if (! flags.focused) {
if (focus_mode == F_LocallyActive || focus_mode == F_Passive) {
XSetInputFocus(display, client.window,
} else if (! flags.focused) {
if (focus_mode == F_LocallyActive || focus_mode == F_Passive) {
XSetInputFocus(display, client.window,
&r, &c, &rx, &ry, &x, &y, &m);
startMove(rx, ry);
}
&r, &c, &rx, &ry, &x, &y, &m);
startMove(rx, ry);
}
// handle case where menu is open then the max button is used instead
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
// handle case where menu is open then the max button is used instead
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
// so we do not need to call configure() because resizing will handle it
if (!flags.resizing)
configure(openbox_attrib.premax_x, openbox_attrib.premax_y,
// so we do not need to call configure() because resizing will handle it
if (!flags.resizing)
configure(openbox_attrib.premax_x, openbox_attrib.premax_y,
openbox_attrib.premax_x = openbox_attrib.premax_y = 0;
openbox_attrib.premax_w = openbox_attrib.premax_h = 0;
openbox_attrib.premax_x = openbox_attrib.premax_y = 0;
openbox_attrib.premax_w = openbox_attrib.premax_h = 0;
Rect space = screen->availableArea();
unsigned int dw = space.w(),
Rect space = screen->availableArea();
unsigned int dw = space.w(),
dh += frame.mwm_border_w * 2;
int dx = space.x() + ((space.w() - dw) / 2) - frame.border_w,
dh += frame.mwm_border_w * 2;
int dx = space.x() + ((space.w() - dw) / 2) - frame.border_w,
- // install the window's colormap
- for (i = 0; i < ncmap; i++) {
- if (*(cmaps + i) == wattrib.colormap)
- // this window is using an installed color map... do not install
- install = False;
- }
- // otherwise, install the window's colormap
- if (install)
- XInstallColormap(display, wattrib.colormap);
+ // install the window's colormap
+ for (i = 0; i < ncmap; i++) {
+ if (*(cmaps + i) == wattrib.colormap)
+ // this window is using an installed color map... do not install
+ install = False;
+ }
+ // otherwise, install the window's colormap
+ if (install)
+ XInstallColormap(display, wattrib.colormap);
- // uninstall the window's colormap
- for (i = 0; i < ncmap; i++) {
- if (*(cmaps + i) == wattrib.colormap)
- // we found the colormap to uninstall
- XUninstallColormap(display, wattrib.colormap);
- }
+ // uninstall the window's colormap
+ for (i = 0; i < ncmap; i++) {
+ if (*(cmaps + i) == wattrib.colormap)
+ // we found the colormap to uninstall
+ XUninstallColormap(display, wattrib.colormap);
+ }
state[0] = (unsigned long) current_state;
state[1] = (unsigned long) None;
XChangeProperty(display, client.window, openbox.getWMStateAtom(),
state[0] = (unsigned long) current_state;
state[1] = (unsigned long) None;
XChangeProperty(display, client.window, openbox.getWMStateAtom(),
- openbox.getWMStateAtom(), 32, PropModeReplace,
- (unsigned char *) state, 2);
+ openbox.getWMStateAtom(), 32, PropModeReplace,
+ (unsigned char *) state, 2);
openbox.getOpenboxAttributesAtom(), 32, PropModeReplace,
(unsigned char *) &openbox_attrib,
openbox.getOpenboxAttributesAtom(), 32, PropModeReplace,
(unsigned char *) &openbox_attrib,
unsigned long *state, ulfoo, nitems;
if ((XGetWindowProperty(display, client.window, openbox.getWMStateAtom(),
unsigned long *state, ulfoo, nitems;
if ((XGetWindowProperty(display, client.window, openbox.getWMStateAtom(),
- 0l, 2l, False, openbox.getWMStateAtom(),
- &atom_return, &foo, &nitems, &ulfoo,
- (unsigned char **) &state) != Success) ||
+ 0l, 2l, False, openbox.getWMStateAtom(),
+ &atom_return, &foo, &nitems, &ulfoo,
+ (unsigned char **) &state) != Success) ||
- openbox.getOpenboxAttributesAtom(), 0l,
- PropOpenboxAttributesElements, False,
- openbox.getOpenboxAttributesAtom(),
- &atom_return, &foo, &nitems, &ulfoo,
- (unsigned char **) &net);
+ openbox.getOpenboxAttributesAtom(), 0l,
+ PropOpenboxAttributesElements, False,
+ openbox.getOpenboxAttributesAtom(),
+ &atom_return, &foo, &nitems, &ulfoo,
+ (unsigned char **) &net);
- if (i18n->multibyte()) {
- XRectangle ink, logical;
- XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen,
- &ink, &logical);
- l = logical.width;
+ if (i18n.multibyte()) {
+ XRectangle ink, logical;
+ XmbTextExtents(screen->getWindowStyle()->fontset, client.title, dlen,
+ &ink, &logical);
+ l = logical.width;
WindowStyle *style = screen->getWindowStyle();
GC text_gc = (flags.focused) ? style->l_text_focus_gc :
style->l_text_unfocus_gc;
WindowStyle *style = screen->getWindowStyle();
GC text_gc = (flags.focused) ? style->l_text_focus_gc :
style->l_text_unfocus_gc;
XmbDrawString(display, frame.label, style->fontset, text_gc, dx,
XmbDrawString(display, frame.label, style->fontset, text_gc, dx,
else
XDrawString(display, frame.label, text_gc, dx,
else
XDrawString(display, frame.label, text_gc, dx,
XClearWindow(display, frame.iconify_button);
XDrawRectangle(display, frame.iconify_button,
XClearWindow(display, frame.iconify_button);
XDrawRectangle(display, frame.iconify_button,
- ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
- screen->getWindowStyle()->b_pic_unfocus_gc),
- 2, (frame.button_h - 5), (frame.button_w - 5), 2);
+ ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
+ screen->getWindowStyle()->b_pic_unfocus_gc),
+ 2, (frame.button_h - 5), (frame.button_w - 5), 2);
}
XClearWindow(display, frame.maximize_button);
XDrawRectangle(display, frame.maximize_button,
}
XClearWindow(display, frame.maximize_button);
XDrawRectangle(display, frame.maximize_button,
- ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
- screen->getWindowStyle()->b_pic_unfocus_gc),
- 2, 2, (frame.button_w - 5), (frame.button_h - 5));
+ ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
+ screen->getWindowStyle()->b_pic_unfocus_gc),
+ 2, 2, (frame.button_w - 5), (frame.button_h - 5));
- ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
- screen->getWindowStyle()->b_pic_unfocus_gc),
- 2, 3, (frame.button_w - 3), 3);
+ ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
+ screen->getWindowStyle()->b_pic_unfocus_gc),
+ 2, 3, (frame.button_w - 3), 3);
XClearWindow(display, frame.close_button);
XDrawLine(display, frame.close_button,
XClearWindow(display, frame.close_button);
XDrawLine(display, frame.close_button,
- ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
- screen->getWindowStyle()->b_pic_unfocus_gc), 2, 2,
+ ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
+ screen->getWindowStyle()->b_pic_unfocus_gc), 2, 2,
(frame.button_w - 3), (frame.button_h - 3));
XDrawLine(display, frame.close_button,
(frame.button_w - 3), (frame.button_h - 3));
XDrawLine(display, frame.close_button,
- ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
- screen->getWindowStyle()->b_pic_unfocus_gc), 2,
- (frame.button_h - 3),
+ ((flags.focused) ? screen->getWindowStyle()->b_pic_focus_gc :
+ screen->getWindowStyle()->b_pic_unfocus_gc), 2,
+ (frame.button_h - 3),
- fprintf(stderr, i18n->getMessage(WindowSet, WindowMapRequest,
- "OpenboxWindow::mapRequestEvent() for 0x%lx\n"),
+ fprintf(stderr, i18n(WindowSet, WindowMapRequest,
+ "OpenboxWindow::mapRequestEvent() for 0x%lx\n"),
- fprintf(stderr, i18n->getMessage(WindowSet, WindowUnmapNotify,
- "OpenboxWindow::unmapNotifyEvent() for 0x%lx\n"),
+ fprintf(stderr, i18n(WindowSet, WindowUnmapNotify,
+ "OpenboxWindow::unmapNotifyEvent() for 0x%lx\n"),
XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask);
XDeleteProperty(display, client.window, openbox.getWMStateAtom());
XDeleteProperty(display, client.window,
XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask);
XDeleteProperty(display, client.window, openbox.getWMStateAtom());
XDeleteProperty(display, client.window,
XUnmapWindow(display, frame.window);
XUnmapWindow(display, client.window);
XEvent dummy;
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
XUnmapWindow(display, frame.window);
XUnmapWindow(display, client.window);
XEvent dummy;
if (! XCheckTypedWindowEvent(display, client.window, ReparentNotify,
- fprintf(stderr, i18n->getMessage(WindowSet, WindowUnmapNotifyReparent,
- "OpenboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
- "root.\n"), client.window);
+ fprintf(stderr, i18n(WindowSet, WindowUnmapNotifyReparent,
+ "OpenboxWindow::unmapNotifyEvent(): reparent 0x%lx to "
+ "root.\n"), client.window);
#endif // DEBUG
restoreGravity();
XReparentWindow(display, client.window, screen->getRootWindow(),
#endif // DEBUG
restoreGravity();
XReparentWindow(display, client.window, screen->getRootWindow(),
if ((client.transient_for = openbox.searchGroup(win, this))) {
client.transient_for->client.transient = this;
flags.stuck = client.transient_for->flags.stuck;
if ((client.transient_for = openbox.searchGroup(win, this))) {
client.transient_for->client.transient = this;
flags.stuck = client.transient_for->flags.stuck;
if (client.max_width <= client.min_width &&
client.max_height <= client.min_height)
decorations.maximize = decorations.handle =
if (client.max_width <= client.min_width &&
client.max_height <= client.min_height)
decorations.maximize = decorations.handle =
// alt + left/right click begins interactively moving/resizing the window
// when the mouse is moved
if (be->state == Mod1Mask && (be->button == 1 || be->button == 3)) {
// alt + left/right click begins interactively moving/resizing the window
// when the mouse is moved
if (be->state == Mod1Mask && (be->button == 1 || be->button == 3)) {
} else if (be->state == ControlMask && be->button == 1) {
if (be->window == frame.title ||
be->window == frame.label)
shade();
} else if (be->state == ControlMask && be->button == 1) {
if (be->window == frame.title ||
be->window == frame.label)
shade();
be->window == frame.label) {
// shade the window when the titlebar is double clicked
if ( (be->time - lastButtonPressTime) <=
be->window == frame.label) {
// shade the window when the titlebar is double clicked
if ( (be->time - lastButtonPressTime) <=
} else if (be->state == 0 && be->button == 2) {
if (be->window == frame.maximize_button) {
redrawMaximizeButton(True);
} else if (be->state == 0 && be->button == 2) {
if (be->window == frame.maximize_button) {
redrawMaximizeButton(True);
- // a middle click anywhere on the window's frame except for on the buttons
- // will lower the window
+ // a middle click anywhere on the window's frame except for on the buttons
+ // will lower the window
} else if (be->state == 0 && be->button == 3) {
if (be->window == frame.maximize_button) {
redrawMaximizeButton(True);
} else if (be->state == 0 && be->button == 3) {
if (be->window == frame.maximize_button) {
redrawMaximizeButton(True);
} else if (be->window == frame.title ||
be->window == frame.label ||
be->window == frame.handle ||
} else if (be->window == frame.title ||
be->window == frame.label ||
be->window == frame.handle ||
mx = frame.x + frame.width - windowmenu->getWidth();
} else if (mx < frame.x) {
mx = frame.x;
}
if (my > (signed) (frame.y + frame.y_handle -
mx = frame.x + frame.width - windowmenu->getWidth();
} else if (mx < frame.x) {
mx = frame.x;
}
if (my > (signed) (frame.y + frame.y_handle -
if (re->window == frame.window) {
XUngrabPointer(display, CurrentTime); // why? i dont know
}
if (re->window == frame.window) {
XUngrabPointer(display, CurrentTime); // why? i dont know
}
} else if (re->button == 1) {
if (re->window == frame.maximize_button) {
if (re->state == Button1Mask && // only the left button was depressed
} else if (re->button == 1) {
if (re->window == frame.maximize_button) {
if (re->state == Button1Mask && // only the left button was depressed
if (re->state == Button1Mask && // only the left button was depressed
(re->x >= 0) && ((unsigned) re->x <= frame.button_w) &&
(re->y >= 0) && ((unsigned) re->y <= frame.button_h)) {
if (re->state == Button1Mask && // only the left button was depressed
(re->x >= 0) && ((unsigned) re->x <= frame.button_w) &&
(re->y >= 0) && ((unsigned) re->y <= frame.button_h)) {
}
//we should always redraw the close button. some applications
//eg. acroread don't honour the close.
redrawCloseButton(False);
}
}
//we should always redraw the close button. some applications
//eg. acroread don't honour the close.
redrawCloseButton(False);
}
} else if (re->button == 2) {
if (re->window == frame.maximize_button) {
if (re->state == Button2Mask && // only the middle button was depressed
} else if (re->button == 2) {
if (re->window == frame.maximize_button) {
if (re->state == Button2Mask && // only the middle button was depressed
} else if (re->button == 3) {
if (re->window == frame.maximize_button) {
if (re->state == Button3Mask && // only the right button was depressed
} else if (re->button == 3) {
if (re->window == frame.maximize_button) {
if (re->state == Button3Mask && // only the right button was depressed
} else if (flags.resizing) {
flags.resizing = False;
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
} else if (flags.resizing) {
flags.resizing = False;
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
if (resize_zone & ZoneLeft) {
left_fixsize();
} else { // when resizing with "Alt+Button3", the resize is the same as if
if (resize_zone & ZoneLeft) {
left_fixsize();
} else { // when resizing with "Alt+Button3", the resize is the same as if
}
configure(frame.resize_x, frame.resize_y,
frame.resize_w - (frame.border_w * 2),
}
configure(frame.resize_x, frame.resize_y,
frame.resize_w - (frame.border_w * 2),
XGrabPointer(display, frame.window, False, PointerMotionMask |
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
None, openbox.getMoveCursor(), CurrentTime);
XGrabPointer(display, frame.window, False, PointerMotionMask |
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
None, openbox.getMoveCursor(), CurrentTime);
- (frame.title == me->window || frame.label == me->window ||
- frame.handle == me->window || frame.window == me->window))
+ (frame.title == me->window || frame.label == me->window ||
+ frame.handle == me->window || frame.window == me->window))
startMove(me->x_root, me->y_root);
else if (functions.resize &&
startMove(me->x_root, me->y_root);
else if (functions.resize &&
- (((me->state & Button1Mask) && (me->window == frame.right_grip ||
- me->window == frame.left_grip)) ||
- (me->state == (Mod1Mask | Button3Mask) &&
- me->window == frame.window))) {
+ (((me->state & Button1Mask) && (me->window == frame.right_grip ||
+ me->window == frame.left_grip)) ||
+ (me->state == (Mod1Mask | Button3Mask) &&
+ me->window == frame.window))) {
screen->showGeometry(gx, gy);
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
screen->showGeometry(gx, gy);
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
- frame.resize_x, frame.resize_y,
- frame.resize_w - 1, frame.resize_h - 1);
+ frame.resize_x, frame.resize_y,
+ frame.resize_w - 1, frame.resize_h - 1);
} else {
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
} else {
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
- frame.resize_x, frame.resize_y,
- frame.resize_w - 1, frame.resize_h - 1);
+ frame.resize_x, frame.resize_y,
+ frame.resize_w - 1, frame.resize_h - 1);
- frame.resize_w = frame.width + (me->x - frame.grab_x);
- if (frame.resize_w < 1) frame.resize_w = 1;
+ frame.resize_w = frame.width + (me->x - frame.grab_x);
+ if (frame.resize_w < 1) frame.resize_w = 1;
}
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
}
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
- frame.resize_x, frame.resize_y,
- frame.resize_w - 1, frame.resize_h - 1);
+ frame.resize_x, frame.resize_y,
+ frame.resize_w - 1, frame.resize_h - 1);
openbox.grab();
if (! validateClient()) return;
XShapeCombineShape(display, frame.window, ShapeBounding,
openbox.grab();
if (! validateClient()) return;
XShapeCombineShape(display, frame.window, ShapeBounding,
- frame.mwm_border_w, frame.y_border +
- frame.mwm_border_w, client.window,
- ShapeBounding, ShapeSet);
+ frame.mwm_border_w, frame.y_border +
+ frame.mwm_border_w, client.window,
+ ShapeBounding, ShapeSet);
- xrect[1].x = 0;
- xrect[1].y = frame.y_handle;
- xrect[1].width = frame.width;
- xrect[1].height = frame.handle_h + frame.border_w;
- num++;
+ xrect[1].x = 0;
+ xrect[1].y = frame.y_handle;
+ xrect[1].width = frame.width;
+ xrect[1].height = frame.handle_h + frame.border_w;
+ num++;
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
}
XShapeCombineRectangles(display, frame.window, ShapeBounding, 0, 0,
- xrect, num, ShapeUnion, Unsorted);
+ xrect, num, ShapeUnion, Unsorted);
// the height of the titlebar is based upon the height of the font being
// used to display the window's title
WindowStyle *style = screen->getWindowStyle();
// the height of the titlebar is based upon the height of the font being
// used to display the window's title
WindowStyle *style = screen->getWindowStyle();
frame.label_h = frame.title_h - (frame.bevel_w * 2);
frame.button_w = frame.button_h = (frame.label_h - 2);
frame.label_h = frame.title_h - (frame.bevel_w * 2);
frame.button_w = frame.button_h = (frame.label_h - 2);
frame.width = client.width + (frame.mwm_border_w * 2);
frame.height = frame.y_handle + frame.handle_h;
}
frame.width = client.width + (frame.mwm_border_w * 2);
frame.height = frame.y_handle + frame.handle_h;
}
void OpenboxWindow::right_fixsize(int *gx, int *gy) {
// calculate the size of the client window and conform it to the
// size specified by the size hints of the client window...
void OpenboxWindow::right_fixsize(int *gx, int *gy) {
// calculate the size of the client window and conform it to the
// size specified by the size hints of the client window...
dx = (dx * client.width_inc) + client.base_width;
dy = (dy * client.height_inc) + client.base_height;
dx = (dx * client.width_inc) + client.base_width;
dy = (dy * client.height_inc) + client.base_height;
if (resize_zone & ZoneTop)
frame.resize_y = frame.y + frame.height - frame.resize_h +
screen->getBorderWidth() * 2;
if (resize_zone & ZoneTop)
frame.resize_y = frame.y + frame.height - frame.resize_h +
screen->getBorderWidth() * 2;
void OpenboxWindow::left_fixsize(int *gx, int *gy) {
// calculate the size of the client window and conform it to the
// size specified by the size hints of the client window...
void OpenboxWindow::left_fixsize(int *gx, int *gy) {
// calculate the size of the client window and conform it to the
// size specified by the size hints of the client window...
dx = (dx * client.width_inc) + client.base_width;
dy = (dy * client.height_inc) + client.base_height;
dx = (dx * client.width_inc) + client.base_width;
dy = (dy * client.height_inc) + client.base_height;
if (resize_zone & ZoneTop)
frame.resize_y = frame.y + frame.height - frame.resize_h +
screen->getBorderWidth() * 2;
if (resize_zone & ZoneTop)
frame.resize_y = frame.y + frame.height - frame.resize_h +
screen->getBorderWidth() * 2;