Skip to content

Commit d63ad98

Browse files
committed
remove all hidpi code,waiting for refactor
1 parent 7f39433 commit d63ad98

7 files changed

Lines changed: 17 additions & 76 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,8 @@ protected void onMouseDown() {
248248
protected void onMouseDrag() {
249249
if (getMouseButton() != Input.Buttons.RIGHT) {
250250
// Update window position
251-
var pos = WindowSystem.getMousePos();
252-
int x = pos.x() - getMouseX();
253-
int y = pos.y() - getMouseY();
251+
int x = (int) (windowPosition.now().x + getMouseDeltaX());
252+
int y = (int) (windowPosition.now().y + getMouseDeltaY());
254253
plane.changePosition(Gdx.graphics.getDeltaTime(), x, -(cha.camera.getHeight() + y));
255254
windowPosition.setToEnd();
256255
tray.hideDialog();

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package cn.harryh.arkpets.platform;
22

33
import cn.harryh.arkpets.rpc.KWinInterface;
4-
import cn.harryh.arkpets.utils.HdpiUtils;
54
import org.freedesktop.dbus.types.UInt32;
65

76
import static cn.harryh.arkpets.platform.KWinHWndCtrlFactory.dBusInterface;
8-
import static cn.harryh.arkpets.utils.HdpiUtils.toBackBufferX;
9-
import static cn.harryh.arkpets.utils.HdpiUtils.toBackBufferY;
107

118

129
public class KWinHWndCtrl extends WaylandHWndCtrl {
@@ -15,10 +12,10 @@ public class KWinHWndCtrl extends WaylandHWndCtrl {
1512

1613
protected KWinHWndCtrl(KWinInterface.DetailsStruct details) {
1714
super(details.title, new WindowRect(
18-
toBackBufferY(details.y),
19-
toBackBufferY(details.y + details.h.intValue()),
20-
toBackBufferX(details.x),
21-
toBackBufferX(details.x + details.w.intValue())));
15+
(details.y),
16+
(details.y + details.h.intValue()),
17+
(details.x),
18+
(details.x + details.w.intValue())));
2219
this.hWnd = details.id;
2320
this.details = details;
2421
}
@@ -50,8 +47,8 @@ public void setForeground() {
5047

5148
@Override
5249
public void setWindowPosition(HWndCtrl insertAfter, int x, int y, int w, int h) {
53-
dBusInterface.MoveResize(hWnd, HdpiUtils.toLogicalX(x), HdpiUtils.toLogicalY(y),
54-
new UInt32(HdpiUtils.toLogicalX(w)), new UInt32(HdpiUtils.toLogicalY(h)));
50+
dBusInterface.MoveResize(hWnd, (x), (y),
51+
new UInt32((w)), new UInt32((h)));
5552
}
5653

5754
@Override

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package cn.harryh.arkpets.platform;
22

33
import cn.harryh.arkpets.rpc.MutterInterface;
4-
import cn.harryh.arkpets.utils.HdpiUtils;
54
import org.freedesktop.dbus.types.UInt32;
65

76
import static cn.harryh.arkpets.platform.MutterHWndCtrlFactory.dBusInterface;
8-
import static cn.harryh.arkpets.utils.HdpiUtils.toBackBufferX;
9-
import static cn.harryh.arkpets.utils.HdpiUtils.toBackBufferY;
107

118

129
public class MutterHWndCtrl extends WaylandHWndCtrl {
@@ -15,10 +12,10 @@ public class MutterHWndCtrl extends WaylandHWndCtrl {
1512

1613
protected MutterHWndCtrl(MutterInterface.DetailsStruct details) {
1714
super(details.title, new WindowRect(
18-
toBackBufferY(details.y),
19-
toBackBufferY(details.y + details.h.intValue()),
20-
toBackBufferX(details.x),
21-
toBackBufferX(details.x + details.w.intValue())));
15+
(details.y),
16+
(details.y + details.h.intValue()),
17+
(details.x),
18+
(details.x + details.w.intValue())));
2219
this.hWnd = details.id;
2320
this.details = details;
2421
}
@@ -50,8 +47,8 @@ public void setForeground() {
5047

5148
@Override
5249
public void setWindowPosition(HWndCtrl insertAfter, int x, int y, int w, int h) {
53-
dBusInterface.MoveResize(hWnd, HdpiUtils.toLogicalX(x), HdpiUtils.toLogicalY(y),
54-
new UInt32(HdpiUtils.toLogicalX(w)), new UInt32(HdpiUtils.toLogicalY(h)));
50+
dBusInterface.MoveResize(hWnd, (x), (y),
51+
new UInt32((w)), new UInt32((h)));
5552
}
5653

5754
@Override

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
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;
76
import cn.harryh.arkpets.utils.Logger;
87
import org.freedesktop.dbus.connections.impl.DBusConnection;
98
import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder;
@@ -61,7 +60,7 @@ public HWndCtrl getTopmostWindow() {
6160
@Override
6261
public HWndCtrl.MousePoint getMousePos() {
6362
MutterInterface.PointStruct pos = dBusInterface.Mouse();
64-
return new HWndCtrl.MousePoint(HdpiUtils.toBackBufferX(pos.x), HdpiUtils.toBackBufferY(pos.y));
63+
return new HWndCtrl.MousePoint((pos.x), (pos.y));
6564
}
6665

6766
@Override

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import cn.harryh.arkpets.natives.CoreGraphics;
44
import cn.harryh.arkpets.natives.ObjCHelper;
5-
import cn.harryh.arkpets.utils.HdpiUtils;
65
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Graphics;
76
import com.sun.jna.Memory;
87
import com.sun.jna.Native;
@@ -93,8 +92,8 @@ public void setWindowPosition(HWndCtrl insertAfter, int x, int y, int w, int h)
9392
if (nsWin == null) return;
9493
newRect.origin.x = x;
9594
newRect.origin.y = currentScreenRect.getValue().size.height - y - h;
96-
newRect.size.width = HdpiUtils.toLogicalX(w);
97-
newRect.size.height = HdpiUtils.toLogicalY(h);
95+
newRect.size.width = (w);
96+
newRect.size.height = (h);
9897
ObjCHelper.msgSend.invokeVoid(new Object[]{
9998
nsWin,
10099
ObjCHelper.sel("performSelectorOnMainThread:withObject:waitUntilDone:"),

core/src/cn/harryh/arkpets/utils/HdpiUtils.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

core/src/cn/harryh/arkpets/utils/InputApplicationAdaptor.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ public final boolean isDownPressed() {
129129
@Deprecated
130130
@Override
131131
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
132-
screenX = HdpiUtils.toBackBufferX(screenX);
133-
screenY = HdpiUtils.toBackBufferY(screenY);
134132
lastActiveNanoTime = System.nanoTime();
135133
if (pointer <= 0) {
136134
Logger.debug("Input", "Click+ Btn " + button + " @ " + screenX + ", " + screenY);
@@ -148,8 +146,6 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
148146
@Deprecated
149147
@Override
150148
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
151-
screenX = HdpiUtils.toBackBufferX(screenX);
152-
screenY = HdpiUtils.toBackBufferY(screenY);
153149
lastActiveNanoTime = System.nanoTime();
154150
if (pointer <= 0) {
155151
Logger.debug("Input", "Click- Btn " + button + " @ " + screenX + ", " + screenY);
@@ -169,8 +165,6 @@ public boolean touchUp(int screenX, int screenY, int pointer, int button) {
169165
@Override
170166
public boolean touchDragged(int screenX, int screenY, int pointer) {
171167
lastActiveNanoTime = System.nanoTime();
172-
screenX = HdpiUtils.toBackBufferX(screenX);
173-
screenY = HdpiUtils.toBackBufferY(screenY);
174168
if (pointer <= 0) {
175169
mouseDeltaX = screenX - mouseX;
176170
mouseDeltaY = screenY - mouseY;
@@ -184,8 +178,6 @@ public boolean touchDragged(int screenX, int screenY, int pointer) {
184178
@Deprecated
185179
@Override
186180
public boolean mouseMoved(int screenX, int screenY) {
187-
screenX = HdpiUtils.toBackBufferX(screenX);
188-
screenY = HdpiUtils.toBackBufferY(screenY);
189181
mouseX = screenX;
190182
mouseY = screenY;
191183
onMouseMoved();

0 commit comments

Comments
 (0)