Skip to content

Commit 3af6288

Browse files
Jetz72Hanmac
authored andcommitted
Remove wake lock on desktop
1 parent 79e1d0a commit 3af6288

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

forge-gui/src/main/java/forge/util/OperatingSystem.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package forge.util;
22

3-
import forge.gui.FThreads;
4-
5-
import java.awt.event.KeyEvent;
6-
73
public class OperatingSystem {
84
private static String os = System.getProperty("os.name").toLowerCase();
95

@@ -24,10 +20,16 @@ public static boolean isSolaris() {
2420
}
2521

2622
//utility for preventing system from sleeping
27-
private static boolean preventSleep;
28-
private static java.util.concurrent.ScheduledFuture<?> delayedKeepAwakeTask;
23+
//private static boolean preventSleep;
24+
//private static java.util.concurrent.ScheduledFuture<?> delayedKeepAwakeTask;
2925

3026
public static void preventSystemSleep(boolean preventSleep0) {
27+
//Disabling this for now. Mashing a key every 30 seconds has become a problematic solution for preventing sleep
28+
//on modern devices which sometimes do handle keys like "F15".
29+
//We could possibly implement the mouse-movement based solution here as an alternative: https://stackoverflow.com/a/53419439
30+
//It's possible though that we don't actually need it. Supposedly modern OSes can use network traffic as
31+
//an indication that the computer shouldn't put the CPU to sleep.
32+
/*
3133
if (preventSleep == preventSleep0) { return; }
3234
preventSleep = preventSleep0;
3335
@@ -38,9 +40,10 @@ public static void preventSystemSleep(boolean preventSleep0) {
3840
3941
if (preventSleep) { //ensure task scheduled from EDT thread
4042
FThreads.invokeInEdtNowOrLater(keepSystemAwake);
41-
}
43+
}*/
4244
}
4345

46+
/*
4447
private static Runnable keepSystemAwake = new Runnable() {
4548
@Override
4649
public void run() {
@@ -63,4 +66,5 @@ public void run() {
6366
}
6467
}
6568
};
69+
*/
6670
}

0 commit comments

Comments
 (0)