1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-28 06:03:25 +00:00

Updated notifybar on Windows, to allow moving on the X-axis within monitor bounds

This commit is contained in:
Bryan Roe
2019-12-10 13:37:52 -08:00
parent 29bd710972
commit 7c5075b481
2 changed files with 13 additions and 5 deletions

View File

@@ -82,14 +82,12 @@ function windows_notifybar_local(title)
barHeight = Math.floor(monHeight * 0.035);
offset = Math.floor(monWidth * 0.50) - Math.floor(barWidth * 0.50);
start = m[i].left + offset;
//console.log(' ' + start + ', ' + barWidth + ', ' + barHeight);
var options =
{
window:
{
winstyles: MessagePump.WindowStyles.WS_VISIBLE | MessagePump.WindowStyles.WS_BORDER | MessagePump.WindowStyles.WS_CAPTION | MessagePump.WindowStyles.WS_SYSMENU,
x: start, width: barWidth, height: barHeight, title: this.notifybar.title
x: start, y: m[i].top, left: m[i].left, right: m[i].right, width: barWidth, height: barHeight, title: this.notifybar.title
}
};
@@ -127,7 +125,17 @@ function windows_notifybar_local(title)
break;
case 8:
flags = msg.lparam_raw.Deref(32, 4).toBuffer().readUInt32LE() | 0x0002 // Set SWP_NOMOVE
msg.lparam_raw.Deref(32, 4).toBuffer().writeUInt32LE(flags);
if (msg.lparam_raw.Deref(16, 4).toBuffer().readInt32LE() < this._options.window.left ||
(msg.lparam_raw.Deref(16, 4).toBuffer().readInt32LE() + this._options.window.width) >= this._options.window.right)
{
// Disallow this move, because it will go out of bounds of the current monitor
msg.lparam_raw.Deref(32, 4).toBuffer().writeUInt32LE(flags);
}
else
{
// Allow the move, but only on the X-axis
msg.lparam_raw.Deref(20, 4).toBuffer().writeInt32LE(this._options.window.y);
}
break;
}
}