client.normal_hint_flags & (PPosition|USPosition)) {
applyGravity(frame.rect);
- if (blackbox->isStartup() ||
- client.rect.intersects(screen->availableArea()))
+ if (blackbox->isStartup() || client.rect.intersects(screen->getRect()))
place_window = False;
}
}
#endif // SHAPE
- grabButtons();
-
windowmenu = new Windowmenu(this);
if (blackbox_attrib.workspace >= screen->getWorkspaceCount())
positionWindows();
decorate();
+ grabButtons();
XMapSubwindows(blackbox->getXDisplay(), frame.window);
void BlackboxWindow::reconfigure(void) {
+ restoreGravity(client.rect);
upsize();
-
+ applyGravity(frame.rect);
positionWindows();
decorate();
-
redrawWindowFrame();
+ ungrabButtons();
+ grabButtons();
+
if (windowmenu) {
windowmenu->move(windowmenu->getX(), frame.rect.y() + frame.title_h);
windowmenu->reconfigure();
if (functions & Func_Resize)
blackbox->grabButton(Button3, Mod1Mask, frame.window, True,
ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
- GrabModeAsync, frame.window,
- blackbox->getLowerRightAngleCursor());
+ GrabModeAsync, frame.window, None);
// alt+middle lowers the window
blackbox->grabButton(Button2, Mod1Mask, frame.window, True,
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
XMoveResizeWindow(blackbox->getXDisplay(), client.window,
0, 0, client.rect.width(), client.rect.height());
// ensure client.rect contains the real location
- client.rect.setCoords(frame.rect.left() + frame.margin.left,
- frame.rect.top() + frame.margin.top,
- frame.rect.right() - frame.margin.right,
- frame.rect.bottom() - frame.margin.bottom);
+ client.rect.setPos(frame.rect.left() + frame.margin.left,
+ frame.rect.top() + frame.margin.top);
if (decorations & Decor_Titlebar) {
if (frame.title == None) createTitlebar();
} else if (frame.handle) {
destroyHandle();
}
+ XSync(blackbox->getXDisplay(), False);
}
client.min_width = client.min_height =
client.width_inc = client.height_inc = 1;
client.base_width = client.base_height = 0;
+ client.win_gravity = NorthWestGravity;
+#if 0
+ client.min_aspect_x = client.min_aspect_y =
+ client.max_aspect_x = client.max_aspect_y = 1;
+#endif
/*
use the full screen, not the strut modified size. otherwise when the
*/
const Rect& screen_area = screen->getRect();
client.max_width = screen_area.width();
-
client.max_height = screen_area.height();
- client.min_aspect_x = client.min_aspect_y =
- client.max_aspect_x = client.max_aspect_y = 1;
- client.win_gravity = NorthWestGravity;
if (! XGetWMNormalHints(blackbox->getXDisplay(), client.window,
&sizehint, &icccm_mask))
client.normal_hint_flags = sizehint.flags;
if (sizehint.flags & PMinSize) {
- client.min_width = sizehint.min_width;
- client.min_height = sizehint.min_height;
+ if (sizehint.min_width >= 0)
+ client.min_width = sizehint.min_width;
+ if (sizehint.min_height >= 0)
+ client.min_height = sizehint.min_height;
}
if (sizehint.flags & PMaxSize) {
- client.max_width = sizehint.max_width;
- client.max_height = sizehint.max_height;
+ if (sizehint.max_width > static_cast<signed>(client.min_width))
+ client.max_width = sizehint.max_width;
+ else
+ client.max_width = client.min_width;
+
+ if (sizehint.max_height > static_cast<signed>(client.min_height))
+ client.max_height = sizehint.max_height;
+ else
+ client.max_height = client.min_height;
}
if (sizehint.flags & PResizeInc) {
client.height_inc = sizehint.height_inc;
}
+#if 0 // we do not support this at the moment
if (sizehint.flags & PAspect) {
client.min_aspect_x = sizehint.min_aspect.x;
client.min_aspect_y = sizehint.min_aspect.y;
client.max_aspect_x = sizehint.max_aspect.x;
client.max_aspect_y = sizehint.max_aspect.y;
}
+#endif
if (sizehint.flags & PBaseSize) {
client.base_width = sizehint.base_width;
*/
void BlackboxWindow::configure(int dx, int dy,
unsigned int dw, unsigned int dh) {
- bool send_event = (frame.rect.x() != dx || frame.rect.y() != dy);
+ bool send_event = ((frame.rect.x() != dx || frame.rect.y() != dy) &&
+ ! flags.moving);
if (dw != frame.rect.width() || dh != frame.rect.height()) {
frame.rect.setRect(dx, dy, dw, dh);
XMoveWindow(blackbox->getXDisplay(), frame.window,
frame.rect.x(), frame.rect.y());
+ /*
+ we may have been called just after an opaque window move, so even though
+ the old coords match the new ones no ConfigureNotify has been sent yet.
+ There are likely other times when this will be relevant as well.
+ */
+ if (! flags.moving) send_event = True;
}
- if (send_event && ! flags.moving) {
+ if (send_event) {
// if moving, the update and event will occur when the move finishes
client.rect.setPos(frame.rect.left() + frame.margin.left,
frame.rect.top() + frame.margin.top);
XSendEvent(blackbox->getXDisplay(), client.window, False,
StructureNotifyMask, &event);
screen->updateNetizenConfigNotify(&event);
+ XFlush(blackbox->getXDisplay());
}
}
ce.xclient.data.l[4] = 0l;
XSendEvent(blackbox->getXDisplay(), client.window, False,
NoEventMask, &ce);
+ XFlush(blackbox->getXDisplay());
}
return ret;
if (! (*it)->flags.iconic) (*it)->iconify();
}
}
+ screen->updateStackingList();
}
ce.xclient.data.l[3] = 0l;
ce.xclient.data.l[4] = 0l;
XSendEvent(blackbox->getXDisplay(), client.window, False, NoEventMask, &ce);
+ XFlush(blackbox->getXDisplay());
}
void BlackboxWindow::setWorkspace(unsigned int n) {
blackbox_attrib.flags |= AttribWorkspace;
blackbox_attrib.workspace = n;
+ if (n == BSENTINEL) { // iconified window
+ /*
+ we set the workspace to 'all workspaces' so that taskbars will show the
+ window. otherwise, it made uniconifying a window imposible without the
+ blackbox workspace menu
+ */
+ n = 0xffffffff;
+ }
xatom->setValue(client.window, XAtom::net_wm_desktop, XAtom::cardinal, n);
}
decorations &= ~(Decor_Maximize | Decor_Handle);
functions &= ~(Func_Resize | Func_Maximize);
} else {
- decorations |= Decor_Maximize | Decor_Handle;
- functions |= Func_Resize | Func_Maximize;
+ if (! isTransient()) {
+ decorations |= Decor_Maximize | Decor_Handle;
+ functions |= Func_Maximize;
+ }
+ functions |= Func_Resize;
}
grabButtons();
setAllowedActions();
if (frame.title == be->window || frame.label == be->window) {
if (((be->time - lastButtonPressTime) <=
blackbox->getDoubleClickInterval()) ||
- (be->state & ControlMask)) {
+ (be->state == ControlMask)) {
lastButtonPressTime = 0;
shade();
} else {
} else if (flags.resizing) {
doResize(me->x_root, me->y_root);
} else {
- if (! flags.resizing && (me->state & Button1Mask) &&
- (functions & Func_Move) &&
+ if (!flags.resizing && me->state & Button1Mask && (functions & Func_Move) &&
(frame.title == me->window || frame.label == me->window ||
frame.handle == me->window || frame.window == me->window)) {
beginMove(me->x_root, me->y_root);
} else if ((functions & Func_Resize) &&
- (((me->state & Button1Mask) &&
- (me->window == frame.right_grip ||
- me->window == frame.left_grip)) ||
- (me->state & (Mod1Mask | Button3Mask) &&
- me->window == frame.window))) {
- beginResize(me->x_root, me->y_root,
- (me->window == frame.left_grip) ? BottomLeft : BottomRight);
+ (me->state & Button1Mask && (me->window == frame.right_grip ||
+ me->window == frame.left_grip)) ||
+ (me->state & Button3Mask && me->state & Mod1Mask &&
+ me->window == frame.window)) {
+ unsigned int zones = screen->getResizeZones();
+ Corner corner;
+
+ if (me->window == frame.left_grip) {
+ corner = BottomLeft;
+ } else if (me->window == frame.right_grip || zones == 1) {
+ corner = BottomRight;
+ } else {
+ bool top;
+ bool left = (me->x_root - frame.rect.x() <=
+ static_cast<signed>(frame.rect.width() / 2));
+ if (zones == 2)
+ top = False;
+ else // (zones == 4)
+ top = (me->y_root - frame.rect.y() <=
+ static_cast<signed>(frame.rect.height() / 2));
+ corner = (top ? (left ? TopLeft : TopRight) :
+ (left ? BottomLeft : BottomRight));
+ }
+
+ beginResize(me->x_root, me->y_root, corner);
}
}
}