new functions pause/resumeMoving and fixed non-opaque moving across workspace
This commit is contained in:
parent
d86785056d
commit
e954ecc72a
2 changed files with 87 additions and 40 deletions
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Window.cc,v 1.72 2002/08/30 13:08:35 fluxgen Exp $
|
||||
// $Id: Window.cc,v 1.73 2002/08/30 14:06:40 fluxgen Exp $
|
||||
|
||||
#include "Window.hh"
|
||||
|
||||
|
@ -3258,18 +3258,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
|
|||
else if (dby > 0 && dby < screen->getEdgeSnapThreshold())
|
||||
dy = dbby - frame.snap_h;
|
||||
}
|
||||
|
||||
if (! screen->doOpaqueMove()) {
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w, frame.resize_h);
|
||||
|
||||
frame.move_x = dx;
|
||||
frame.move_y = dy;
|
||||
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w,
|
||||
frame.resize_h);
|
||||
} else {
|
||||
// Warp to next or previous workspace?
|
||||
if (screen->isWorkspaceWarping()) {
|
||||
int cur_id = screen->getCurrentWorkspaceID();
|
||||
|
@ -3287,30 +3275,36 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent *me) {
|
|||
dx = screen->getWidth() - me->x_root;
|
||||
}
|
||||
if (new_id != cur_id) {
|
||||
frame.x += dx;
|
||||
XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0);
|
||||
screen->reassociateWindow(this, new_id, true);
|
||||
|
||||
//if the window has a tab and is in a group
|
||||
//reassociate those windows too
|
||||
if (hasTab() && (getTab()->next() || getTab()->prev())) {
|
||||
Tab *tab_it = getTab()->first();
|
||||
for (; tab_it; tab_it = tab_it->next()) {
|
||||
screen->reassociateWindow(tab_it->getWindow(), new_id, true);
|
||||
}
|
||||
}
|
||||
screen->changeWorkspaceID(new_id);
|
||||
setInputFocus();
|
||||
screen->raiseFocus();
|
||||
|
||||
if (!screen->doOpaqueMove()) {
|
||||
dx += frame.move_x; // for rectangle in correct position
|
||||
} else {
|
||||
dx += frame.x; // for window in correct position
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! screen->doOpaqueMove()) {
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w, frame.resize_h);
|
||||
|
||||
frame.move_x = dx;
|
||||
frame.move_y = dy;
|
||||
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w,
|
||||
frame.resize_h);
|
||||
} else {
|
||||
configure(dx, dy, frame.width, frame.height);
|
||||
}
|
||||
|
||||
if (screen->doShowWindowPos())
|
||||
screen->showPosition(dx, dy);
|
||||
}
|
||||
} // end if moving
|
||||
} else if (functions.resize &&
|
||||
(((me->state & Button1Mask) && (me->window == frame.right_grip ||
|
||||
me->window == frame.left_grip)) ||
|
||||
|
@ -3484,6 +3478,7 @@ void FluxboxWindow::startMoving(Window win) {
|
|||
|
||||
frame.move_x = frame.x;
|
||||
frame.move_y = frame.y;
|
||||
frame.move_ws = screen->getCurrentWorkspaceID();
|
||||
frame.resize_w = frame.width + screen->getBorderWidth2x();
|
||||
frame.resize_h = ((shaded) ? frame.title_h : frame.height) +
|
||||
screen->getBorderWidth2x();
|
||||
|
@ -3519,6 +3514,56 @@ void FluxboxWindow::stopMoving() {
|
|||
XSync(display, False); //make sure the redraw is made before we continue
|
||||
}
|
||||
|
||||
void FluxboxWindow::pauseMoving() {
|
||||
screen->hideGeometry(); // otherwise our window gets raised above it
|
||||
if (screen->doOpaqueMove()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove old rectangle
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w, frame.resize_h);
|
||||
|
||||
Fluxbox::instance()->ungrab();
|
||||
if (workspace_number != frame.move_ws) {
|
||||
// get it out of view
|
||||
frame.save_x = frame.x;
|
||||
frame.save_y = frame.y;
|
||||
frame.x = screen->getWidth()/2;
|
||||
frame.y = screen->getHeight()+screen->getTabHeight()+10; // +10 to be safe
|
||||
configure(frame.x, frame.y, frame.width, frame.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FluxboxWindow::resumeMoving() {
|
||||
if (screen->doOpaqueMove()) {
|
||||
setInputFocus();
|
||||
screen->raiseFocus();
|
||||
if (screen->doShowWindowPos())
|
||||
screen->showPosition(frame.x, frame.y);
|
||||
return;
|
||||
}
|
||||
|
||||
if (workspace_number != frame.move_ws) {
|
||||
frame.x = frame.save_x;
|
||||
frame.y = frame.save_y;
|
||||
} else {
|
||||
// back on home workspace, display window
|
||||
configure(frame.x, frame.y, frame.width, frame.height);
|
||||
}
|
||||
Fluxbox::instance()->grab();
|
||||
setInputFocus();
|
||||
screen->raiseFocus();
|
||||
if (screen->doShowWindowPos())
|
||||
screen->showPosition(frame.move_x, frame.move_y);
|
||||
XSync(display,false);
|
||||
XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(),
|
||||
frame.move_x, frame.move_y, frame.resize_w,
|
||||
frame.resize_h);
|
||||
}
|
||||
|
||||
|
||||
void FluxboxWindow::startResizing(XMotionEvent *me, bool left) {
|
||||
resizing = true;
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: Window.hh,v 1.28 2002/08/16 10:44:17 fluxgen Exp $
|
||||
// $Id: Window.hh,v 1.29 2002/08/30 14:06:40 fluxgen Exp $
|
||||
|
||||
#ifndef WINDOW_HH
|
||||
#define WINDOW_HH
|
||||
|
@ -202,6 +202,8 @@ public:
|
|||
void changeBlackboxHints(BaseDisplay::BlackboxHints *bh);
|
||||
void restoreAttributes();
|
||||
void showMenu(int mx, int my);
|
||||
void pauseMoving();
|
||||
void resumeMoving();
|
||||
|
||||
void buttonPressEvent(XButtonEvent *be);
|
||||
void buttonReleaseEvent(XButtonEvent *be);
|
||||
|
@ -324,10 +326,10 @@ private:
|
|||
right_grip, left_grip;
|
||||
|
||||
int x, y, resize_x, resize_y, move_x, move_y, grab_x, grab_y,
|
||||
y_border, y_handle;
|
||||
y_border, y_handle, save_x, save_y;
|
||||
unsigned int width, height, title_h, label_w, label_h, handle_h,
|
||||
button_w, button_h, grip_w, grip_h, mwm_border_w, border_h,
|
||||
bevel_w, resize_w, resize_h, snap_w, snap_h;
|
||||
bevel_w, resize_w, resize_h, snap_w, snap_h, move_ws;
|
||||
} frame;
|
||||
|
||||
enum { F_NOINPUT = 0, F_PASSIVE, F_LOCALLYACTIVE, F_GLOBALLYACTIVE };
|
||||
|
|
Loading…
Reference in a new issue