Skip to content

Commit

Permalink
Merge pull request #5 from aksdb/fix_clientrect_manipulation
Browse files Browse the repository at this point in the history
Fix windows being moved during calculation
  • Loading branch information
tsoernes authored Jun 28, 2021
2 parents 54cb994 + e6c9231 commit 412d3fd
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions contents/code/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ function _GetScreenGeometry() {
}

function _GetClientGeometryOnScreen() {
var clientGeometry = workspace.activeClient.geometry
var screenGeometry = _GetScreenGeometry()
clientGeometry.x -= screenGeometry.x
clientGeometry.y -= screenGeometry.y
return clientGeometry
const clientGeometry = workspace.activeClient.geometry
const screenGeometry = _GetScreenGeometry()
const x = clientGeometry.x - screenGeometry.x
const y = clientGeometry.y - screenGeometry.y
return {x: x, y: y, width: clientGeometry.width, height: clientGeometry.height}
}

function _IsVerticallyMaximized() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.height === screenGeometry.height) {
return true
}
return false
}

function _IsHorizontallyMaximized() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.width === screenGeometry.width) {
return true
}
Expand All @@ -44,8 +44,8 @@ function _IsMaximized() {
}

function _IsTiledToTop() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.height === (screenGeometry.height / 2) && clientGeometry.y === 0) {
return true
}
Expand All @@ -57,8 +57,8 @@ function _IsTiledTop() {
}

function _IsTiledToBottom() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.height === (screenGeometry.height / 2) && clientGeometry.y === (screenGeometry.height / 2)) {
return true
}
Expand All @@ -70,8 +70,8 @@ function _IsTiledBottom() {
}

function _IsTiledToLeft() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.width === (screenGeometry.width / 2) && clientGeometry.x === 0) {
return true
}
Expand All @@ -83,8 +83,8 @@ function _IsTiledLeft() {
}

function _IsTiledToRight() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.width === (screenGeometry.width / 2) && clientGeometry.x === (screenGeometry.width / 2)) {
return true
}
Expand All @@ -96,8 +96,8 @@ function _IsTiledRight() {
}

function _IsTiledToQuadrant() {
var screenGeometry = _GetScreenGeometry()
var clientGeometry = _GetClientGeometryOnScreen()
const screenGeometry = _GetScreenGeometry()
const clientGeometry = _GetClientGeometryOnScreen()
if (clientGeometry.width === (screenGeometry.width / 2) && clientGeometry.height === (screenGeometry.height/ 2)) {
return true
}
Expand Down

0 comments on commit 412d3fd

Please sign in to comment.