} else if (! flags.focused) {
if (focus_mode == F_LocallyActive || focus_mode == F_Passive)
XSetInputFocus(display, client.window,
- RevertToPointerRoot, CurrentTime);
+ RevertToPointerRoot, CurrentTime);
else
XSetInputFocus(display, screen->getRootWindow(),
RevertToNone, CurrentTime);
- openbox.setFocusedWindow(this);
+ openbox.focusWindow(this);
if (flags.send_focus_message) {
XEvent ce;
}
-void OpenboxWindow::deiconify(Bool reassoc, Bool raise) {
+void OpenboxWindow::deiconify(bool reassoc, bool raise, bool initial) {
if (flags.iconic || reassoc)
screen->reassociateWindow(this, -1, False);
else if (workspace_number != screen->getCurrentWorkspace()->getWorkspaceID())
// if we're using the click to place placement type, then immediately
// after the window is mapped, we need to start interactively moving it
- if (screen->placementPolicy() == BScreen::ClickMousePlacement &&
- place_window && !(flags.iconic || reassoc)) {
- // if the last window wasn't placed yet, or we're just moving a window
- // already, finish off that move cleanly
- OpenboxWindow *w = openbox.getFocusedWindow();
- if (w != (OpenboxWindow *) 0 && w->flags.moving)
- w->endMove();
-
+ if (initial && place_window &&
+ screen->placementPolicy() == BScreen::ClickMousePlacement) {
int x, y, rx, ry;
Window c, r;
unsigned int m;
void OpenboxWindow::maximize(unsigned int button) {
+ if (flags.moving)
+ endMove();
+
// handle case where menu is open then the max button is used instead
if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) {
- cout << "MAP REQUEST " << client.window << " " << client.title << endl;
if (re->window == client.window) {
#ifdef DEBUG
fprintf(stderr, i18n->getMessage(WindowSet, WindowMapRequest,
case InactiveState:
case ZoomState:
default:
- deiconify(False);
+ deiconify(False, True, True); // specify that we're initializing the
+ // window
break;
}
openbox.grab();
if (! validateClient()) return;
+ if (flags.moving)
+ endMove();
+
XChangeSaveSet(display, client.window, SetModeDelete);
XSelectInput(display, client.window, NoEventMask);
void OpenboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
if (de->window == client.window) {
+ if (flags.moving)
+ endMove();
XUnmapWindow(display, frame.window);
delete this;
void OpenboxWindow::startMove(int x, int y) {
ASSERT(!flags.moving);
+ // make sure only one window is moving at a time
+ OpenboxWindow *w = openbox.getMaskedWindow();
+ if (w != (OpenboxWindow *) 0 && w->flags.moving)
+ w->endMove();
+
XGrabPointer(display, frame.window, False, PointerMotionMask |
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
None, openbox.getMoveCursor(), CurrentTime);
}
frame.grab_x = x - frame.x - frame.border_w;
frame.grab_y = y - frame.y - frame.border_w;
- cout << "START MOVE " << client.window << " " << client.title << endl;
}
// cause problems
XEvent e;
while (XCheckTypedWindowEvent(display, frame.window, MotionNotify, &e));
- cout << "END MOVE " << client.window << " " << client.title << endl;
}
Bool left = resize_zone & ZoneLeft;
if (! flags.resizing) {
- cout << "START RESIZE " << client.window << " " << client.title << endl;
Cursor cursor;
if (resize_zone & ZoneTop)
cursor = (resize_zone & ZoneLeft) ?
screen->showGeometry(gx, gy);
}
- } else
- cout << "MOTION " << client.window << " " << client.title << endl;
+ }
}
XMapWindow(display, client.window);
XFlush(display);
+
+ delete this;
}