Skip to content

Commit 7f39433

Browse files
committed
fix: mutter hidpi
1 parent 3d59ba9 commit 7f39433

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

core/src/cn/harryh/arkpets/ArkPets.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ protected void onMouseDrag() {
249249
if (getMouseButton() != Input.Buttons.RIGHT) {
250250
// Update window position
251251
var pos = WindowSystem.getMousePos();
252-
int x = HdpiUtils.toBackBufferX(pos.x()) - getMouseX();
253-
int y = HdpiUtils.toBackBufferX(pos.y()) - getMouseY();
252+
int x = pos.x() - getMouseX();
253+
int y = pos.y() - getMouseY();
254254
plane.changePosition(Gdx.graphics.getDeltaTime(), x, -(cha.camera.getHeight() + y));
255255
windowPosition.setToEnd();
256256
tray.hideDialog();

core/src/cn/harryh/arkpets/platform/MutterHWndCtrlFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cn.harryh.arkpets.Const;
44
import cn.harryh.arkpets.rpc.MutterInterface;
55
import cn.harryh.arkpets.rpc.MutterPluginInterface;
6+
import cn.harryh.arkpets.utils.HdpiUtils;
67
import cn.harryh.arkpets.utils.Logger;
78
import org.freedesktop.dbus.connections.impl.DBusConnection;
89
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder;
@@ -60,7 +61,7 @@ public HWndCtrl getTopmostWindow() {
6061
@Override
6162
public HWndCtrl.MousePoint getMousePos() {
6263
MutterInterface.PointStruct pos = dBusInterface.Mouse();
63-
return new HWndCtrl.MousePoint(pos.x, pos.y);
64+
return new HWndCtrl.MousePoint(HdpiUtils.toBackBufferX(pos.x), HdpiUtils.toBackBufferY(pos.y));
6465
}
6566

6667
@Override

0 commit comments

Comments
 (0)