X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FWindow.cc;h=dca583b32c52b373504a98dc557fdc6cb9e1539a;hb=5705ea361305e03bd557896b449f0672005f9159;hp=7ce182dcb409e8a04b1da86916d66ddbadb4516f;hpb=1789f16af9d853e3961cbb7c0c753e0e12263969;p=chaz%2Fopenbox diff --git a/src/Window.cc b/src/Window.cc index 7ce182dc..dca583b3 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -216,7 +216,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) { } upsize(); - Bool place_window = True; + place_window = true; if (openbox.isStartup() || flags.transient || client.normal_hint_flags & (PPosition|USPosition)) { setGravityOffsets(); @@ -226,7 +226,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) { (signed) (frame.y + frame.y_border) >= 0 && frame.x <= (signed) screen->size().w() && frame.y <= (signed) screen->size().h())) - place_window = False; + place_window = false; } frame.window = createToplevelWindow(frame.x, frame.y, frame.width, @@ -1422,6 +1422,9 @@ Bool OpenboxWindow::setInputFocus(void) { void OpenboxWindow::iconify(void) { if (flags.iconic) return; + if (flags.moving) + endMove(); + if (windowmenu) windowmenu->hide(); setState(IconicState); @@ -1465,6 +1468,24 @@ void OpenboxWindow::deiconify(Bool reassoc, Bool raise) { XMapSubwindows(display, frame.window); XMapWindow(display, frame.window); + // 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(); + + int x, y, rx, ry; + Window c, r; + unsigned int m; + XQueryPointer(openbox.getXDisplay(), screen->getRootWindow(), + &r, &c, &rx, &ry, &x, &y, &m); + startMove(rx, ry); + } + if (flags.iconic && screen->focusNew()) setInputFocus(); flags.visible = True; @@ -1725,6 +1746,7 @@ void OpenboxWindow::setFocusFlag(Bool focus) { if (screen->sloppyFocus() && screen->autoRaise() && timer->isTiming()) timer->stop(); + } @@ -2186,6 +2208,7 @@ void OpenboxWindow::redrawCloseButton(Bool pressed) { 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, @@ -2574,7 +2597,7 @@ void OpenboxWindow::buttonPressEvent(XButtonEvent *be) { mx = be->x_root - windowmenu->getWidth() / 2; if (be->window == frame.title || be->window == frame.label) { my = frame.y + frame.title_h; - } else if (be->window = frame.handle) { + } else if (be->window == frame.handle) { my = frame.y + frame.y_handle - windowmenu->getHeight(); } else { // (be->window == frame.window) if (be->y <= (signed) frame.bevel_w) { @@ -2763,6 +2786,7 @@ void OpenboxWindow::startMove(int x, int y) { } 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; } @@ -2852,6 +2876,11 @@ void OpenboxWindow::endMove() { } screen->hideGeometry(); XUngrabPointer(display, CurrentTime); + // if there are any left over motions from the move, drop them now cuz they + // cause problems + XEvent e; + while (XCheckTypedWindowEvent(display, frame.window, MotionNotify, &e)); + cout << "END MOVE " << client.window << " " << client.title << endl; } @@ -2865,11 +2894,12 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { else if (functions.resize && (((me->state & Button1Mask) && (me->window == frame.right_grip || me->window == frame.left_grip)) || - (me->state & (Mod1Mask | Button3Mask) && + (me->state == (Mod1Mask | Button3Mask) && me->window == frame.window))) { 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) ? @@ -2943,7 +2973,8 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { screen->showGeometry(gx, gy); } - } + } else + cout << "MOTION " << client.window << " " << client.title << endl; } @@ -3069,21 +3100,25 @@ void OpenboxWindow::changeOpenboxHints(OpenboxHints *net) { default: case DecorNormal: - decorations.titlebar = decorations.border = decorations.handle = - decorations.iconify = decorations.maximize = decorations.menu = True; + decorations.titlebar = decorations.iconify = decorations.menu = + decorations.border = True; + decorations.handle = (functions.resize && !flags.transient); + decorations.maximize = functions.maximize; break; case DecorTiny: decorations.titlebar = decorations.iconify = decorations.menu = True; - decorations.border = decorations.handle = decorations.maximize = False; - + decorations.border = decorations.border = decorations.handle = False; + decorations.maximize = functions.maximize; + break; case DecorTool: - decorations.titlebar = decorations.menu = functions.move = True; - decorations.iconify = decorations.border = decorations.handle = - decorations.maximize = False; + decorations.titlebar = decorations.menu = True; + decorations.iconify = decorations.border = False; + decorations.handle = (functions.resize && !flags.transient); + decorations.maximize = functions.maximize; break; }