Fix positioning issue for linux, change to new version nr for network and db

This commit is contained in:
Manfred Karrer 2016-02-10 23:14:12 +01:00
parent 0c465a9ec3
commit efc365f7e3
4 changed files with 19 additions and 11 deletions

View File

@ -28,10 +28,10 @@ public class Version {
// The version nr. for the objects sent over the network. A change will break the serialization of old objects.
// If objects are used for both network and database the network version is applied.
public static final long P2P_NETWORK_VERSION = 1;
public static final long P2P_NETWORK_VERSION = 2;
// The version nr. of the serialized data stored to disc. A change will break the serialization of old objects.
public static final long LOCAL_DB_VERSION = 1;
public static final long LOCAL_DB_VERSION = 2;
// The version nr. of the current protocol. The offer holds that version.
// A taker will check the version of the offers to see if his version is compatible.

View File

@ -114,7 +114,7 @@ public class Utilities {
return getOSName().contains("mac") || getOSName().contains("darwin");
}
private static boolean isLinux() {
public static boolean isLinux() {
return getOSName().contains("linux");
}

View File

@ -76,7 +76,7 @@ import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY;
public class BitsquareApp extends Application {
private static final Logger log = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(BitsquareApp.class);
public static final boolean DEV_MODE = true;
public static final boolean DEV_MODE = false;
public static final boolean IS_RELEASE_VERSION = !DEV_MODE && true;
private static Environment env;

View File

@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.util.Optional;
import java.util.Timer;
import static io.bitsquare.gui.util.FormBuilder.addCheckBox;
@ -72,6 +73,7 @@ public class Popup {
private String dontShowAgainId;
private Preferences preferences;
private ChangeListener<Number> positionListener;
private Timer centerTime;
///////////////////////////////////////////////////////////////////////////////////////////
@ -98,6 +100,14 @@ public class Popup {
}
public void hide() {
if (Utilities.isLinux() && owner != null && positionListener != null) {
owner.getScene().getWindow().xProperty().removeListener(positionListener);
owner.getScene().getWindow().yProperty().removeListener(positionListener);
}
if (centerTime != null)
centerTime.cancel();
MainView.removeBlur();
if (stage != null)
stage.hide();
@ -106,11 +116,6 @@ public class Popup {
cleanup();
PopupManager.isHidden(this);
if (Utilities.isUnix()) {
owner.getScene().getWindow().xProperty().removeListener(positionListener);
owner.getScene().getWindow().yProperty().removeListener(positionListener);
}
}
protected void cleanup() {
@ -250,14 +255,17 @@ public class Popup {
MainView.blurLight();
if (Utilities.isUnix()) {
if (Utilities.isLinux()) {
// On Linux the owner stage does not move the child stage as it does on Mac
// So we need to apply centerPopup. Further with fast movements the handler loses
// the latest position, with a delay it fixes that.
positionListener = (observable, oldValue, newValue) -> {
if (stage != null) {
centerPopup();
UserThread.runAfter(this::centerPopup, 3);
if (centerTime != null)
centerTime.cancel();
centerTime = UserThread.runAfter(this::centerPopup, 3);
}
};
owner.getScene().getWindow().xProperty().addListener(positionListener);