Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Formatting; nicer error message if in headless mode; fixes #164
Browse files Browse the repository at this point in the history
  • Loading branch information
binwiederhier committed Aug 8, 2014
1 parent 04da8b0 commit 4c4cb58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ Change Log
- Developer/alpha release (**STILL NOT FOR PRODUCTION USE!**)
- Bugfixes and other things:
+ Added 'type' attribute to database header (DEFAULT/PURGE) #181
+ Prevent standby/hibernate if uploading/downloading #164

### Syncany 0.1.8-alpha (Date: 10 Aug 2014)
- Developer/alpha release (**STILL NOT FOR PRODUCTION USE!**)
Expand Down
Expand Up @@ -145,17 +145,23 @@ private synchronized void renewActionFile() {
private void preventStandby() {
try {
Robot robot = new Robot();

Point currentMousePosition = MouseInfo.getPointerInfo().getLocation();
Point tempMousePosition = (currentMousePosition.x > 0) ? new Point(currentMousePosition.x-10, currentMousePosition.y) : new Point(currentMousePosition.x+10, currentMousePosition.y);

logger.log(Level.INFO, "Standby prevention: Moving mouse 1px (and back): " + currentMousePosition);

robot.mouseMove(tempMousePosition.x, tempMousePosition.y);
robot.mouseMove(currentMousePosition.x, currentMousePosition.y);
}

Point currentMousePosition = MouseInfo.getPointerInfo().getLocation();
Point tempMousePosition = (currentMousePosition.x > 0) ? new Point(currentMousePosition.x - 10, currentMousePosition.y) : new Point(
currentMousePosition.x + 10, currentMousePosition.y);

logger.log(Level.INFO, "Standby prevention: Moving mouse 1px (and back): " + currentMousePosition);

robot.mouseMove(tempMousePosition.x, tempMousePosition.y);
robot.mouseMove(currentMousePosition.x, currentMousePosition.y);
}
catch (Exception e) {
logger.log(Level.WARNING, "Standby prevention failed (headless mode?).", e);
if (e.getMessage() != null && e.getMessage().contains("headless")) {
logger.log(Level.INFO, "Cannot prevent standby, because headless mode is enabled (no GUI environment)");
}
else {
logger.log(Level.WARNING, "Standby prevention failed (headless mode?).", e);
}
}
}
}

0 comments on commit 4c4cb58

Please sign in to comment.