[autocomplete] 80/143: AutoComplete: Make popup decorations for main autocomplete windows optional separate from all other RSTA popups for performance reasons. Miscellaneous cleanup.
Benjamin Mesing
ben at alioth.debian.org
Sat Oct 19 12:53:21 UTC 2013
This is an automated email from the git hooks/post-receive script.
ben pushed a commit to branch master
in repository autocomplete.
commit d0dc53133dd7a4fd9bb59e093803e42b04121fa8
Author: bobbylight <robert at fifesoft.com>
Date: Tue May 1 23:32:52 2012 +0000
AutoComplete: Make popup decorations for main autocomplete windows optional separate from all other RSTA popups for performance reasons.
Miscellaneous cleanup.
---
build.xml | 3 ++-
.../ui/autocomplete/AutoCompleteDescWindow.java | 8 +++---
.../ui/autocomplete/AutoCompletePopupWindow.java | 8 +++---
src/org/fife/ui/autocomplete/Util.java | 27 ++++++++++++++++++++
4 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/build.xml b/build.xml
index efca7c1..6c22da0 100644
--- a/build.xml
+++ b/build.xml
@@ -23,7 +23,7 @@
<!-- Set global properties for this build. -->
- <property name="version" value="2.0.2"/>
+ <property name="version" value="2.0.3"/>
<property name="source-dir" location="src"/>
<property name="class-dir" location="ant-classes"/>
<property name="dist-dir" location="dist"/>
@@ -51,6 +51,7 @@
<jar destfile="${dist-dir}/autocomplete.jar">
<fileset dir="${class-dir}"/>
<fileset dir="${source-dir}">
+ <include name="**/*.dtd"/>
<include name="**/*.png"/>
</fileset>
<fileset dir="i18n"/>
diff --git a/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java b/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
index a7d5956..2c3fed0 100644
--- a/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
+++ b/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
@@ -188,9 +188,11 @@ class AutoCompleteDescWindow extends JWindow implements HyperlinkListener {
setFocusableWindowState(false);
// Give apps a chance to decorate us with drop shadows, etc.
- PopupWindowDecorator decorator = PopupWindowDecorator.get();
- if (decorator!=null) {
- decorator.decorate(this);
+ if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) {
+ PopupWindowDecorator decorator = PopupWindowDecorator.get();
+ if (decorator!=null) {
+ decorator.decorate(this);
+ }
}
history = new ArrayList(1); // Usually small
diff --git a/src/org/fife/ui/autocomplete/AutoCompletePopupWindow.java b/src/org/fife/ui/autocomplete/AutoCompletePopupWindow.java
index 6020710..a58be47 100644
--- a/src/org/fife/ui/autocomplete/AutoCompletePopupWindow.java
+++ b/src/org/fife/ui/autocomplete/AutoCompletePopupWindow.java
@@ -169,9 +169,11 @@ class AutoCompletePopupWindow extends JWindow implements CaretListener,
applyComponentOrientation(o);
// Give apps a chance to decorate us with drop shadows, etc.
- PopupWindowDecorator decorator = PopupWindowDecorator.get();
- if (decorator!=null) {
- decorator.decorate(this);
+ if (Util.getShouldAllowDecoratingMainAutoCompleteWindows()) {
+ PopupWindowDecorator decorator = PopupWindowDecorator.get();
+ if (decorator!=null) {
+ decorator.decorate(this);
+ }
}
pack();
diff --git a/src/org/fife/ui/autocomplete/Util.java b/src/org/fife/ui/autocomplete/Util.java
index d498069..5eef8db 100644
--- a/src/org/fife/ui/autocomplete/Util.java
+++ b/src/org/fife/ui/autocomplete/Util.java
@@ -16,6 +16,8 @@ import java.awt.Rectangle;
import java.lang.reflect.Method;
import java.net.URI;
+import org.fife.ui.rsyntaxtextarea.PopupWindowDecorator;
+
/**
* Utility methods for the auto-complete framework.
@@ -25,6 +27,17 @@ import java.net.URI;
*/
public class Util {
+ /**
+ * If this system property is <code>true</code>, then even the "main" two
+ * auto-complete windows will allow window decorations via
+ * {@link PopupWindowDecorator}. If this property is undefined or
+ * <code>false</code>, they won't honor such decorations. This is due to
+ * certain performance issues with translucent windows (used for drop
+ * shadows), even as of Java 7u2.
+ */
+ public static final String PROPERTY_ALLOW_DECORATED_AUTOCOMPLETE_WINDOWS =
+ "org.fife.ui.autocomplete.allowDecoratedAutoCompleteWindows";
+
private static boolean desktopCreationAttempted;
private static Object desktop;
private static final Object LOCK_DESKTOP_CREATION = new Object();
@@ -166,6 +179,20 @@ public class Util {
/**
+ * Give apps a chance to decorate us with drop shadows, etc. Since very
+ * scrolly things such as lists (of e.g. completions) are *very* slow when
+ * in per-pixel translucent windows, even as of Java 7u2, we force the user
+ * to specify an extra option for the two "main" auto-complete windows.
+ *
+ * @return Whether to allow decorating the main auto-complete windows.
+ * @see #PROPERTY_ALLOW_DECORATED_AUTOCOMPLETE_WINDOWS
+ */
+ public static boolean getShouldAllowDecoratingMainAutoCompleteWindows() {
+ return Boolean.getBoolean(PROPERTY_ALLOW_DECORATED_AUTOCOMPLETE_WINDOWS);
+ }
+
+
+ /**
* Returns whether <code>str</code> starts with <code>start</code>,
* ignoring case.
*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/autocomplete.git
More information about the pkg-java-commits
mailing list