< prev index next >
src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
Print this page
@@ -27,10 +27,13 @@
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.WindowEvent;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import sun.awt.IconInfo;
import sun.util.logging.PlatformLogger;
import sun.awt.AWTAccessor;
@@ -50,10 +53,12 @@
XIconWindow iconWindow;
WindowDimensions dimensions;
XContentWindow content;
Insets currentInsets;
XFocusProxyWindow focusProxy;
+ static final Map<Class<?>,Insets> lastKnownInsets =
+ Collections.synchronizedMap(new HashMap<>());
XDecoratedPeer(Window target) {
super(target);
}
@@ -72,10 +77,13 @@
void preInit(XCreateWindowParams params) {
super.preInit(params);
winAttr.initialFocus = true;
currentInsets = new Insets(0,0,0,0);
+ if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+ currentInsets = lastKnownInsets.get(getClass());
+ }
applyGuessedInsets();
Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect());
@@ -295,11 +303,29 @@
XPropertyEvent ev = xev.get_xproperty();
if (ev.get_atom() == XWM.XA_KDE_NET_WM_FRAME_STRUT.getAtom()
|| ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
{
+ if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
getWMSetInsets(XAtom.get(ev.get_atom()));
+ } else {
+ if(!isReparented()) {
+ return;
+ }
+ wm_set_insets = null;
+ Insets in = getWMSetInsets(XAtom.get(ev.get_atom()));
+ if (isNull(in)) {
+ return;
+ }
+ if (!isEmbedded() && !isTargetUndecorated()) {
+ lastKnownInsets.put(getClass(), in);
+ }
+ if (!in.equals(dimensions.getInsets())) {
+ handleCorrectInsets(in);
+ }
+ insets_corrected = true;
+ }
}
}
long reparent_serial = 0;
@@ -368,11 +394,11 @@
insLog.finer("correctWM insets are not available, waiting for configureNotify");
}
}
}
- if (correctWM != null) {
+ if (correctWM != null && XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
handleCorrectInsets(correctWM);
}
}
} finally {
XToolkit.awtUnlock();
@@ -662,10 +688,13 @@
content.setContentBounds(dims);
}
boolean no_reparent_artifacts = false;
public void handleConfigureNotifyEvent(XEvent xev) {
+ if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM && !insets_corrected) {
+ return;
+ }
assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure();
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Configure notify {0}", xe);
}
< prev index next >