mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Get rid of animation and user notification in case of Remote Desktop
Problems we had: 1) Registry key was in wrong state and we proceed all animation anyway 2) Notification is too confusing while actual difference in UI is minor
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
|
||||
public abstract class RemoteDesktopService {
|
||||
public static RemoteDesktopService getInstance() {
|
||||
@@ -14,9 +12,5 @@ public abstract class RemoteDesktopService {
|
||||
return getInstance().isRemoteDesktopConnected();
|
||||
}
|
||||
|
||||
public static boolean isAnimationDisabled() {
|
||||
return (!SystemInfo.isWin8OrNewer || Registry.is("animation.disabled.on.remote.desktop")) && isRemoteSession();
|
||||
}
|
||||
|
||||
public abstract boolean isRemoteDesktopConnected();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.ui;
|
||||
|
||||
import com.intellij.ide.RemoteDesktopService;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.ui.components.JBLayeredPane;
|
||||
@@ -58,7 +59,7 @@ public class LoadingDecorator {
|
||||
setLoadingText("Loading...");
|
||||
|
||||
|
||||
myFadeOutAnimator = new Animator("Loading", 10, 500, false) {
|
||||
myFadeOutAnimator = new Animator("Loading", 10, RemoteDesktopService.isRemoteSession()? 2500 : 500, false) {
|
||||
public void paintNow(final int frame, final int totalFrames, final int cycle) {
|
||||
myLoadingLayer.setAlpha(1f - ((float)frame) / ((float)totalFrames));
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ final class ScrollSettings {
|
||||
Application application = getApplication();
|
||||
if (application == null || application.isUnitTestMode()) return false;
|
||||
if (PowerSaveMode.isEnabled()) return false;
|
||||
if (RemoteDesktopService.isAnimationDisabled()) return false;
|
||||
if (RemoteDesktopService.isRemoteSession()) return false;
|
||||
|
||||
UISettings settings = UISettings.getInstanceOrNull();
|
||||
return settings != null && settings.getSmoothScrolling();
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.notification.NotificationDisplayType;
|
||||
import com.intellij.notification.NotificationGroup;
|
||||
import com.intellij.notification.NotificationType;
|
||||
import com.intellij.notification.Notifications;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.sun.jna.platform.win32.User32;
|
||||
|
||||
public class RemoteDesktopDetector extends RemoteDesktopService {
|
||||
private static final Logger LOG = Logger.getInstance(RemoteDesktopDetector.class);
|
||||
private static final NotificationGroup NOTIFICATION_GROUP =
|
||||
new NotificationGroup("Remote Desktop", NotificationDisplayType.BALLOON, false);
|
||||
|
||||
private volatile boolean myFailureDetected;
|
||||
private volatile boolean myRemoteDesktopConnected;
|
||||
|
||||
@@ -31,19 +22,8 @@ public class RemoteDesktopDetector extends RemoteDesktopService {
|
||||
try {
|
||||
// This might not work in all cases, but hopefully is a more reliable method than the current one (checking for font smoothing)
|
||||
// see https://msdn.microsoft.com/en-us/library/aa380798%28v=vs.85%29.aspx
|
||||
boolean newValue = User32.INSTANCE.GetSystemMetrics(0x1000) != 0; // 0x1000 is SM_REMOTESESSION
|
||||
LOG.debug("Detected remote desktop: ", newValue);
|
||||
if (newValue != myRemoteDesktopConnected) {
|
||||
myRemoteDesktopConnected = newValue;
|
||||
if (myRemoteDesktopConnected) {
|
||||
// We postpone notification to avoid recursive initialization of RemoteDesktopDetector
|
||||
// (in case it's initialized by request from com.intellij.notification.EventLog)
|
||||
ApplicationManager.getApplication().invokeLater(() -> Notifications.Bus.notify(
|
||||
NOTIFICATION_GROUP
|
||||
.createNotification(ApplicationBundle.message("remote.desktop.detected.message"), NotificationType.INFORMATION)
|
||||
.setTitle(ApplicationBundle.message("remote.desktop.detected.title"))));
|
||||
}
|
||||
}
|
||||
myRemoteDesktopConnected = User32.INSTANCE.GetSystemMetrics(0x1000) != 0; // 0x1000 is SM_REMOTESESSION
|
||||
LOG.debug("Detected remote desktop: ", myRemoteDesktopConnected);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
myRemoteDesktopConnected = false;
|
||||
|
||||
@@ -329,7 +329,7 @@ public class ScrollingModelImpl implements ScrollingModelEx {
|
||||
VisibleEditorsTracker editorsTracker = VisibleEditorsTracker.getInstance();
|
||||
boolean useAnimation;
|
||||
//System.out.println("myCurrentCommandStart - myLastCommandFinish = " + (myCurrentCommandStart - myLastCommandFinish));
|
||||
if (!myEditor.getSettings().isAnimatedScrolling() || myAnimationDisabled || RemoteDesktopService.isAnimationDisabled()) {
|
||||
if (!myEditor.getSettings().isAnimatedScrolling() || myAnimationDisabled || RemoteDesktopService.isRemoteSession()) {
|
||||
useAnimation = false;
|
||||
}
|
||||
else if (CommandProcessor.getInstance().getCurrentCommand() == null) {
|
||||
|
||||
@@ -887,7 +887,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
public final void run() {
|
||||
try {
|
||||
// Show component.
|
||||
if (!myDirtyMode && UISettings.getInstance().getAnimateWindows() && !RemoteDesktopService.isAnimationDisabled()) {
|
||||
if (!myDirtyMode && UISettings.getInstance().getAnimateWindows() && !RemoteDesktopService.isRemoteSession()) {
|
||||
// Prepare top image. This image is scrolling over bottom image.
|
||||
final Image topImage = myLayeredPane.getTopImage();
|
||||
final Graphics topGraphics = topImage.getGraphics();
|
||||
@@ -1104,7 +1104,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi
|
||||
public final void run() {
|
||||
try {
|
||||
final UISettings uiSettings = UISettings.getInstance();
|
||||
if (!myDirtyMode && uiSettings.getAnimateWindows() && !RemoteDesktopService.isAnimationDisabled()) {
|
||||
if (!myDirtyMode && uiSettings.getAnimateWindows() && !RemoteDesktopService.isRemoteSession()) {
|
||||
final Rectangle bounds = myComponent.getBounds();
|
||||
// Prepare top image. This image is scrolling over bottom image. It contains
|
||||
// picture of component is being removed.
|
||||
|
||||
@@ -2014,7 +2014,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
}
|
||||
|
||||
public boolean isAnimationEnabled() {
|
||||
return myAnimationEnabled && myAnimationCycle > 0 && !RemoteDesktopService.isAnimationDisabled();
|
||||
return myAnimationEnabled && myAnimationCycle > 0 && !RemoteDesktopService.isRemoteSession();
|
||||
}
|
||||
|
||||
public boolean isBlockClicks() {
|
||||
|
||||
@@ -764,8 +764,6 @@ editorsearch.toomuch=More than {0} matches
|
||||
code.style.other.file.types=Other File Types
|
||||
code.style.other.label=Text files and unsupported file types\:
|
||||
|
||||
remote.desktop.detected.title=Remote desktop detected
|
||||
remote.desktop.detected.message=Animation disabled
|
||||
checkbox.line.comment.add.space=Add a space at comment start
|
||||
|
||||
quarantine.cleaner=Quarantine Cleaner
|
||||
|
||||
@@ -1595,9 +1595,6 @@ junit4.accept.inner.classes.description=If false, inner classes won't be include
|
||||
try.starting.dumb.mode.where.many.files.changed=true
|
||||
try.starting.dumb.mode.where.many.files.changed.description=Enables automatic start of dumb mode for all opened projects once more than certain number of files is changed
|
||||
|
||||
animation.disabled.on.remote.desktop=false
|
||||
animation.disabled.on.remote.desktop.description=Allows to stop animation via RDP
|
||||
|
||||
editor.highlight.foldings=true
|
||||
editor.highlight.foldings.description=Highlight folded regions containing certain highlighters (e.g. for search results)
|
||||
ide.hide.real.module.name=false
|
||||
|
||||
Reference in New Issue
Block a user