Skip to content

Commit

Permalink
wait for MAXIMIZED_BOTH to be done
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisMot committed Mar 29, 2022
1 parent 9feae3a commit 1998125
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/fr/lgi2p/digit/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ public void windowClosing(WindowEvent windowEvent) {
frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // done AFTER the content is drawn ?? looks better... indeed
frame.setVisible(true);

// we have to wait for the window to be maximized...
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}

configuration.calibration.setScreenCalibration(frame);
configuration.calibration.toWindow();
}
Expand Down Expand Up @@ -365,7 +372,6 @@ private void mouseMovedOrDragged(MouseEvent mouseEvent) {
X = X - configuration.getFrameInsets().left;
Y = Y - configuration.getFrameInsets().top;


// make event relative to center of circle
int dx = configuration.getCenterX() - X;
int dy = configuration.getCenterY() - Y;
Expand Down Expand Up @@ -450,7 +456,7 @@ public void keyPressed(KeyEvent keyEvent) {
@Override
public void keyTyped(KeyEvent keyEvent) {
// 2 things to do : forward key pressed to the marker stream + do action
String message = "KeyTyped=" + (int) keyEvent.getKeyChar() + " ASCI=" + keyEvent.getKeyChar() +" ";
String message = "KeyTyped=" + (int) keyEvent.getKeyChar() + " ASCI=" + keyEvent.getKeyChar() + " ";

switch (keyEvent.getKeyChar()) {
// specific key => perform action + inform
Expand All @@ -473,9 +479,9 @@ public void keyTyped(KeyEvent keyEvent) {
case 'w':
if (configuration.getTaskString().equals("circular")) {
actionPerformed(
new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "DoToggleDisplayEffectiveTolerance"));
new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "DoToggleDisplayEffectiveTolerance"));
}
// default => forward key pressed to the marker stream
// default => forward key pressed to the marker stream
default:
outputMouse.writeMarker(message);
}
Expand Down

0 comments on commit 1998125

Please sign in to comment.