Fixed mouse movement on maxmize

This commit is contained in:
Fmstrat
2020-01-03 12:28:08 -05:00
parent 32b33c4134
commit 99e9ac5cae

View File

@@ -133,14 +133,25 @@ function unMaximizeIfMaximized(app) {
} }
} }
function initApp(app) { function initApp(app, maximized=false) {
app.wintile = { _log('initApp')
origFrame: app.get_frame_rect() || getDefaultFloatingRectangle(), if (!maximized) {
row: -1, app.wintile = {
col: -1, origFrame: app.get_frame_rect() || getDefaultFloatingRectangle(),
height: -1, row: -1,
width: -1 col: -1,
}; height: -1,
width: -1
};
} else {
app.wintile = {
origFrame: app.origFrameRect || getDefaultFloatingRectangle(),
row: 0,
col: 0,
height: 2,
width: config.cols
};
}
} }
function getDefaultFloatingRectangle() { function getDefaultFloatingRectangle() {
@@ -572,15 +583,16 @@ function requestMove(direction) {
}); });
} }
function checkForMove(curFrameBefore, app) { function checkForMove(x, y, app) {
_log('checkForMove') _log('checkForMove')
if (windowMoving) { if (windowMoving) {
Mainloop.timeout_add(10, function () { Mainloop.timeout_add(10, function () {
var curFrameAfter = app.get_frame_rect(); var curFrameAfter = app.get_frame_rect();
if (curFrameBefore.x != curFrameAfter.x || curFrameBefore.y != curFrameBefore.y) { let [xAfter, yAfter, mask] = global.get_pointer();
if (x != xAfter || y != yAfter) {
restoreApp(app, false); restoreApp(app, false);
} else { } else {
checkForMove(curFrameBefore, app); checkForMove(x, y, app);
} }
}); });
} }
@@ -592,9 +604,11 @@ function windowGrabBegin(meta_display, meta_screen, meta_window, meta_grab_op, g
windowMoving = true; windowMoving = true;
var app = global.display.focus_window; var app = global.display.focus_window;
if (app.wintile) { if (app.wintile) {
checkForMove(app.get_frame_rect(), app); let [x, y, mask] = global.get_pointer();
checkForMove(x, y, app);
} }
if (meta_window.resizeable && config.preview.enabled) { if (meta_window.resizeable && config.preview.enabled) {
app.origFrameRect = app.get_frame_rect();
Mainloop.timeout_add(500, function () { Mainloop.timeout_add(500, function () {
checkIfNearGrid(app); checkIfNearGrid(app);
}); });
@@ -613,6 +627,14 @@ function windowGrabEnd(meta_display, meta_screen, meta_window, meta_grab_op, gpo
initApp(app) initApp(app)
moveApp(app, { "row": preview.loc.row, "col": preview.loc.col, "height": preview.loc.height, "width": preview.loc.width, "mouse": true }); moveApp(app, { "row": preview.loc.row, "col": preview.loc.col, "height": preview.loc.height, "width": preview.loc.width, "mouse": true });
hidePreview(); hidePreview();
} else {
// If maximize button was pressed or double clicked on title bar, make the wintile var
Mainloop.timeout_add(500, function () {
var app = global.display.focus_window;
if (app.maximized_horizontally && app.maximized_vertically) {
initApp(app, true)
}
});
} }
} }
} }