src/solaris/classes/sun/awt/X11/XWM.java
Print this page
*** 146,156 ****
static final Insets defaultInsets = new Insets(25, 5, 5, 5);
XWM(int WMID) {
this.WMID = WMID;
initializeProtocols();
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Window manager: " + toString());
}
}
int getID() {
return WMID;
--- 146,156 ----
static final Insets defaultInsets = new Insets(25, 5, 5, 5);
XWM(int WMID) {
this.WMID = WMID;
initializeProtocols();
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Window manager: " + toString());
}
}
int getID() {
return WMID;
*** 252,262 ****
/*
* Use NO_WM since in all other aspects eXcursion is like not
* having a window manager running. I.e. it does not reparent
* top level shells.
*/
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("eXcursion means NO_WM");
}
return true;
}
--- 252,262 ----
/*
* Use NO_WM since in all other aspects eXcursion is like not
* having a window manager running. I.e. it does not reparent
* top level shells.
*/
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("eXcursion means NO_WM");
}
return true;
}
*** 270,280 ****
final String selection_name = "WM_S" + default_screen_number;
long selection_owner =
XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(),
XAtom.get(selection_name).getAtom());
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("selection owner of " + selection_name
+ " is " + selection_owner);
}
if (selection_owner != XConstants.None) {
--- 270,280 ----
final String selection_name = "WM_S" + default_screen_number;
long selection_owner =
XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(),
XAtom.get(selection_name).getAtom());
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("selection owner of " + selection_name
+ " is " + selection_owner);
}
if (selection_owner != XConstants.None) {
*** 299,309 ****
substruct.set_event_mask(0);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
XConstants.CWEventMask,
substruct.pData);
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("It looks like there is no WM thus NO_WM");
}
}
return !winmgr_running;
--- 299,309 ----
substruct.set_event_mask(0);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
XConstants.CWEventMask,
substruct.pData);
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("It looks like there is no WM thus NO_WM");
}
}
return !winmgr_running;
*** 343,379 ****
// Convert data to String, ASCII
byte[] bytes = XlibWrapper.getStringBytes(getter.getData());
String id = new String(bytes);
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("ENLIGHTENMENT_COMMS is " + id);
}
// Parse WINID
Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})");
try {
Matcher match = winIdPat.matcher(id);
if (match.matches()) {
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Match group count: " + match.groupCount());
}
String longId = match.group(1);
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Match group 1 " + longId);
}
long winid = Long.parseLong(longId, 16);
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Enlightenment communication window " + winid);
}
return winid;
} else {
log.finer("ENLIGHTENMENT_COMMS has wrong format");
return 0;
}
} catch (Exception e) {
! if (log.isLoggable(PlatformLogger.FINER)) {
e.printStackTrace();
}
return 0;
}
} finally {
--- 343,379 ----
// Convert data to String, ASCII
byte[] bytes = XlibWrapper.getStringBytes(getter.getData());
String id = new String(bytes);
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("ENLIGHTENMENT_COMMS is " + id);
}
// Parse WINID
Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})");
try {
Matcher match = winIdPat.matcher(id);
if (match.matches()) {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Match group count: " + match.groupCount());
}
String longId = match.group(1);
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("Match group 1 " + longId);
}
long winid = Long.parseLong(longId, 16);
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Enlightenment communication window " + winid);
}
return winid;
} else {
log.finer("ENLIGHTENMENT_COMMS has wrong format");
return 0;
}
} catch (Exception e) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
e.printStackTrace();
}
return 0;
}
} finally {
*** 415,425 ****
static final XAtom XA_DT_SM_WINDOW_INFO = new XAtom("_DT_SM_WINDOW_INFO", false);
static final XAtom XA_DT_SM_STATE_INFO = new XAtom("_DT_SM_STATE_INFO", false);
static boolean isCDE() {
if (!XA_DT_SM_WINDOW_INFO.isInterned()) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO);
}
return false;
}
--- 415,425 ----
static final XAtom XA_DT_SM_WINDOW_INFO = new XAtom("_DT_SM_WINDOW_INFO", false);
static final XAtom XA_DT_SM_STATE_INFO = new XAtom("_DT_SM_STATE_INFO", false);
static boolean isCDE() {
if (!XA_DT_SM_WINDOW_INFO.isInterned()) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO);
}
return false;
}
*** 448,458 ****
return false;
}
/* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
if (!XA_DT_SM_STATE_INFO.isInterned()) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("{0} is not interned", XA_DT_SM_STATE_INFO);
}
return false;
}
WindowPropertyGetter getter2 =
--- 448,458 ----
return false;
}
/* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
if (!XA_DT_SM_STATE_INFO.isInterned()) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("{0} is not interned", XA_DT_SM_STATE_INFO);
}
return false;
}
WindowPropertyGetter getter2 =
*** 622,632 ****
* Choose something innocuous: "AWT_ICEWM_TEST allWorkspaces 0".
* IceWM expects "class\0option\0arg\0" with zero bytes as delimiters.
*/
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
}
return false;
}
--- 622,632 ----
* Choose something innocuous: "AWT_ICEWM_TEST allWorkspaces 0".
* IceWM expects "class\0option\0arg\0" with zero bytes as delimiters.
*/
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
}
return false;
}
*** 658,668 ****
* Note well: Only call this if awt_wm_prepareIsIceWM succeeded, or a
* false positive will be reported.
*/
static boolean isIceWM() {
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
}
return false;
}
--- 658,668 ----
* Note well: Only call this if awt_wm_prepareIsIceWM succeeded, or a
* false positive will be reported.
*/
static boolean isIceWM() {
if (!XA_ICEWM_WINOPTHINT.isInterned()) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT);
}
return false;
}
*** 671,681 ****
XA_ICEWM_WINOPTHINT, 0, 0xFFFF,
true, XA_ICEWM_WINOPTHINT);
try {
int status = getter.execute();
boolean res = (status == XConstants.Success && getter.getActualType() != 0);
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
}
return !res || isNetWMName("IceWM");
} finally {
getter.dispose();
--- 671,681 ----
XA_ICEWM_WINOPTHINT, 0, 0xFFFF,
true, XA_ICEWM_WINOPTHINT);
try {
int status = getter.execute();
boolean res = (status == XConstants.Success && getter.getActualType() != 0);
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
}
return !res || isNetWMName("IceWM");
} finally {
getter.dispose();
*** 727,737 ****
wm = new XWM(awt_wmgr = getWMID()/*XWM.OTHER_WM*/);
}
return wm;
}
static int getWMID() {
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("awt_wmgr = " + awt_wmgr);
}
/*
* Ideally, we should support cases when a different WM is started
* during a Java app lifetime.
--- 727,737 ----
wm = new XWM(awt_wmgr = getWMID()/*XWM.OTHER_WM*/);
}
return wm;
}
static int getWMID() {
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("awt_wmgr = " + awt_wmgr);
}
/*
* Ideally, we should support cases when a different WM is started
* during a Java app lifetime.
*** 751,761 ****
// Initialize _NET protocol - used to detect Window Manager.
// Later, WM will initialize its own version of protocol
XNETProtocol l_net_protocol = g_net_protocol = new XNETProtocol();
l_net_protocol.detect();
! if (log.isLoggable(PlatformLogger.FINE) && l_net_protocol.active()) {
log.fine("_NET_WM_NAME is " + l_net_protocol.getWMName());
}
XWINProtocol win = g_win_protocol = new XWINProtocol();
win.detect();
--- 751,761 ----
// Initialize _NET protocol - used to detect Window Manager.
// Later, WM will initialize its own version of protocol
XNETProtocol l_net_protocol = g_net_protocol = new XNETProtocol();
l_net_protocol.detect();
! if (log.isLoggable(PlatformLogger.Level.FINE) && l_net_protocol.active()) {
log.fine("_NET_WM_NAME is " + l_net_protocol.getWMName());
}
XWINProtocol win = g_win_protocol = new XWINProtocol();
win.detect();
*** 835,845 ****
if ((hints.get_flags() & mask) == 0) {
return;
}
hints.set_flags(hints.get_flags() & ~mask);
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
}
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(),
window.getWindow(),
hints.pData);
--- 835,845 ----
if ((hints.get_flags() & mask) == 0) {
return;
}
hints.set_flags(hints.get_flags() & ~mask);
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags()));
}
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(),
window.getWindow(),
hints.pData);
*** 894,904 ****
return;
}
XAtomList decorDel = new XAtomList();
decorations = normalizeMotifDecor(decorations);
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
}
if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
decorDel.add(XA_OL_DECOR_HEADER);
}
--- 894,904 ----
return;
}
XAtomList decorDel = new XAtomList();
decorations = normalizeMotifDecor(decorations);
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
}
if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
decorDel.add(XA_OL_DECOR_HEADER);
}
*** 913,923 ****
}
if (decorDel.size() == 0) {
insLog.finer("Deleting OL_DECOR");
XA_OL_DECOR_DEL.DeleteProperty(window);
} else {
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Setting OL_DECOR to " + decorDel);
}
XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel);
}
}
--- 913,923 ----
}
if (decorDel.size() == 0) {
insLog.finer("Deleting OL_DECOR");
XA_OL_DECOR_DEL.DeleteProperty(window);
} else {
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Setting OL_DECOR to " + decorDel);
}
XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel);
}
}
*** 943,953 ****
MWMConstants.MWM_HINTS_FUNCTIONS |
MWMConstants.MWM_HINTS_DECORATIONS);
hints.set_functions(functions);
hints.set_decorations(decorations);
! if (stateLog.isLoggable(PlatformLogger.FINER)) {
stateLog.finer("Setting MWM_HINTS to " + hints);
}
window.setMWMHints(hints);
}
--- 943,953 ----
MWMConstants.MWM_HINTS_FUNCTIONS |
MWMConstants.MWM_HINTS_DECORATIONS);
hints.set_functions(functions);
hints.set_decorations(decorations);
! if (stateLog.isLoggable(PlatformLogger.Level.FINER)) {
stateLog.finer("Setting MWM_HINTS to " + hints);
}
window.setMWMHints(hints);
}
*** 1007,1017 ****
/*
* Make specified shell resizable.
*/
static void setShellResizable(XDecoratedPeer window) {
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Setting shell resizable " + window);
}
XToolkit.awtLock();
try {
Rectangle shellBounds = window.getShellBounds();
--- 1007,1017 ----
/*
* Make specified shell resizable.
*/
static void setShellResizable(XDecoratedPeer window) {
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Setting shell resizable " + window);
}
XToolkit.awtLock();
try {
Rectangle shellBounds = window.getShellBounds();
*** 1039,1049 ****
* @param shellBounds bounds of the shell window
*/
static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds,
boolean justChangeSize)
{
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions +
", shellBounds " + shellBounds +", just change size: " + justChangeSize);
}
XToolkit.awtLock();
try {
--- 1039,1049 ----
* @param shellBounds bounds of the shell window
*/
static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds,
boolean justChangeSize)
{
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions +
", shellBounds " + shellBounds +", just change size: " + justChangeSize);
}
XToolkit.awtLock();
try {
*** 1173,1183 ****
int wm_state = window.getWMState();
if (wm_state == XUtilConstants.WithdrawnState) {
stateLog.finer("WithdrawnState");
return false;
} else {
! if (stateLog.isLoggable(PlatformLogger.FINER)) {
stateLog.finer("Window WM_STATE is " + wm_state);
}
}
boolean is_state_change = false;
if (e.get_atom() == XA_WM_STATE.getAtom()) {
--- 1173,1183 ----
int wm_state = window.getWMState();
if (wm_state == XUtilConstants.WithdrawnState) {
stateLog.finer("WithdrawnState");
return false;
} else {
! if (stateLog.isLoggable(PlatformLogger.Level.FINER)) {
stateLog.finer("Window WM_STATE is " + wm_state);
}
}
boolean is_state_change = false;
if (e.get_atom() == XA_WM_STATE.getAtom()) {
*** 1184,1194 ****
is_state_change = true;
}
for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
is_state_change |= proto.isStateChange(e);
! if (stateLog.isLoggable(PlatformLogger.FINEST)) {
stateLog.finest(proto + ": is state changed = " + is_state_change);
}
}
return is_state_change;
}
--- 1184,1194 ----
is_state_change = true;
}
for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
is_state_change |= proto.isStateChange(e);
! if (stateLog.isLoggable(PlatformLogger.Level.FINEST)) {
stateLog.finest(proto + ": is state changed = " + is_state_change);
}
}
return is_state_change;
}
*** 1338,1348 ****
case OPENLOOK_WM:
default:
res = defaultInsets;
}
}
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("WM guessed insets: " + res);
}
return res;
}
/*
--- 1338,1348 ----
case OPENLOOK_WM:
default:
res = defaultInsets;
}
}
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("WM guessed insets: " + res);
}
return res;
}
/*
*** 1409,1419 ****
return null;
}
XNETProtocol net_protocol = getWM().getNETProtocol();
if (net_protocol != null && net_protocol.active()) {
Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets);
}
if (insets != null) {
return insets;
--- 1409,1419 ----
return null;
}
XNETProtocol net_protocol = getWM().getNETProtocol();
if (net_protocol != null && net_protocol.active()) {
Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets);
}
if (insets != null) {
return insets;
*** 1552,1562 ****
* parent is a lining exactly the size of the client
* grandpa is the WM frame
* [mwm, e!, kwin, fvwm2 ... ]
*/
Insets correctWM = XWM.getInsetsFromExtents(window);
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Got insets from property: {0}", correctWM);
}
if (correctWM == null) {
correctWM = new Insets(0,0,0,0);
--- 1552,1562 ----
* parent is a lining exactly the size of the client
* grandpa is the WM frame
* [mwm, e!, kwin, fvwm2 ... ]
*/
Insets correctWM = XWM.getInsetsFromExtents(window);
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Got insets from property: {0}", correctWM);
}
if (correctWM == null) {
correctWM = new Insets(0,0,0,0);
*** 1615,1625 ****
correctWM.bottom = correctWM.left;
break;
}
case XWM.OTHER_WM:
default: { /* this is very similar to the E! case above */
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent);
}
syncTopLevelPos(parent, lwinAttr);
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, lwinAttr.pData);
--- 1615,1625 ----
correctWM.bottom = correctWM.left;
break;
}
case XWM.OTHER_WM:
default: { /* this is very similar to the E! case above */
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent);
}
syncTopLevelPos(parent, lwinAttr);
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, lwinAttr.pData);
*** 1644,1654 ****
*/
if (lwinAttr.get_x() == 0 && lwinAttr.get_y() == 0
&& lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
&& lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
{
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
lwinAttr, pattr, parent, window);
}
lwinAttr.set_x(pattr.get_x());
lwinAttr.set_y(pattr.get_y());
--- 1644,1654 ----
*/
if (lwinAttr.get_x() == 0 && lwinAttr.get_y() == 0
&& lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
&& lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
{
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
lwinAttr, pattr, parent, window);
}
lwinAttr.set_x(pattr.get_x());
lwinAttr.set_y(pattr.get_y());
*** 1674,1684 ****
* parent's border-width into account too, but the
* rest of the code is happily unaware about border
* widths and inner/outer distinction, so for the time
* being, just ignore it.
*/
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
lwinAttr, pattr, parent, window);
}
correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
lwinAttr.get_x() + lwinAttr.get_border_width(),
--- 1674,1684 ----
* parent's border-width into account too, but the
* rest of the code is happily unaware about border
* widths and inner/outer distinction, so for the time
* being, just ignore it.
*/
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
lwinAttr, pattr, parent, window);
}
correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
lwinAttr.get_x() + lwinAttr.get_border_width(),