X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FWindow.cc;h=5a28d23254053874f2bb3a565d2de027ed4c4458;hb=9f9cdf1194c82cc5aee2ec01d7db73551408d1d5;hp=33ea5c26c011a519db0636415944603a114d8d13;hpb=127252cc1049da41a9c858139f610bc1c68c49c6;p=chaz%2Fopenbox diff --git a/src/Window.cc b/src/Window.cc index 33ea5c26..5a28d232 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -56,6 +56,9 @@ #endif // SLIT #include "Util.h" +#include +using namespace std; + /* * Initializes the class with default values/the window's set initial values. */ @@ -1390,7 +1393,7 @@ Bool OpenboxWindow::setInputFocus(void) { XSetInputFocus(display, screen->getRootWindow(), RevertToNone, CurrentTime); - openbox.setFocusedWindow(this); + openbox.focusWindow(this); if (flags.send_focus_message) { XEvent ce; @@ -1452,7 +1455,7 @@ void OpenboxWindow::iconify(void) { } -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()) @@ -1470,14 +1473,8 @@ void OpenboxWindow::deiconify(Bool reassoc, Bool raise) { // 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; @@ -1533,6 +1530,9 @@ void OpenboxWindow::withdraw(void) { 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(); @@ -2208,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, @@ -2242,7 +2243,8 @@ void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) { case InactiveState: case ZoomState: default: - deiconify(False); + deiconify(False, True, True); // specify that we're initializing the + // window break; } @@ -2287,6 +2289,9 @@ void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { openbox.grab(); if (! validateClient()) return; + if (flags.moving) + endMove(); + XChangeSaveSet(display, client.window, SetModeDelete); XSelectInput(display, client.window, NoEventMask); @@ -2322,6 +2327,8 @@ void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) { void OpenboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) { if (de->window == client.window) { + if (flags.moving) + endMove(); XUnmapWindow(display, frame.window); delete this; @@ -2596,7 +2603,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) { @@ -2757,6 +2764,11 @@ void OpenboxWindow::buttonReleaseEvent(XButtonEvent *re) { 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); @@ -2785,6 +2797,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; } @@ -2874,6 +2887,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; } @@ -2887,11 +2905,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) ? @@ -2965,7 +2984,8 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) { screen->showGeometry(gx, gy); } - } + } else + cout << "MOTION " << client.window << " " << client.title << endl; } @@ -3091,21 +3111,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; }