提交 0ac8b85f 编写于 作者: D dav

6623459: Get rid of XConstant, XProtocolConstants and XUtilConstants antipattern

Summary: Access to interface's fiels via their name rather then implementation
Reviewed-by: volk, son
上级 aa8e63c1
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
package sun.awt.X11; package sun.awt.X11;
public interface MWMConstants { final public class MWMConstants {
private MWMConstants(){}
/* bit definitions for MwmHints.flags */ /* bit definitions for MwmHints.flags */
static final int MWM_HINTS_FUNCTIONS= (1 << 0); static final int MWM_HINTS_FUNCTIONS= (1 << 0);
......
...@@ -118,11 +118,11 @@ class MotifDnDConstants { ...@@ -118,11 +118,11 @@ class MotifDnDConstants {
XA_MOTIF_DRAG_WINDOW, XA_MOTIF_DRAG_WINDOW,
0, 1, 0, 1,
false, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg.getData() != 0 && wpg.getData() != 0 &&
wpg.getActualType() == XAtom.XA_WINDOW && wpg.getActualType() == XAtom.XA_WINDOW &&
wpg.getActualFormat() == 32 && wpg.getActualFormat() == 32 &&
...@@ -163,20 +163,20 @@ class MotifDnDConstants { ...@@ -163,20 +163,20 @@ class MotifDnDConstants {
XlibWrapper.XGrabServer(newDisplay); XlibWrapper.XGrabServer(newDisplay);
try { try {
XlibWrapper.XSetCloseDownMode(newDisplay, (int)XlibWrapper.RetainPermanent); XlibWrapper.XSetCloseDownMode(newDisplay, (int)XConstants.RetainPermanent);
XSetWindowAttributes xwa = new XSetWindowAttributes(); XSetWindowAttributes xwa = new XSetWindowAttributes();
try { try {
xwa.set_override_redirect(true); xwa.set_override_redirect(true);
xwa.set_event_mask(XlibWrapper.PropertyChangeMask); xwa.set_event_mask(XConstants.PropertyChangeMask);
motifWindow = XlibWrapper.XCreateWindow(newDisplay, defaultRootWindow, motifWindow = XlibWrapper.XCreateWindow(newDisplay, defaultRootWindow,
-10, -10, 1, 1, 0, 0, -10, -10, 1, 1, 0, 0,
XlibWrapper.InputOnly, XConstants.InputOnly,
XlibWrapper.CopyFromParent, XConstants.CopyFromParent,
(XlibWrapper.CWOverrideRedirect | (XConstants.CWOverrideRedirect |
XlibWrapper.CWEventMask), XConstants.CWEventMask),
xwa.pData); xwa.pData);
if (motifWindow == 0) { if (motifWindow == 0) {
...@@ -195,13 +195,13 @@ class MotifDnDConstants { ...@@ -195,13 +195,13 @@ class MotifDnDConstants {
defaultRootWindow, defaultRootWindow,
XA_MOTIF_DRAG_WINDOW.getAtom(), XA_MOTIF_DRAG_WINDOW.getAtom(),
XAtom.XA_WINDOW, 32, XAtom.XA_WINDOW, 32,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
data, 1); data, 1);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write motif drag window handle."); throw new XException("Cannot write motif drag window handle.");
} }
...@@ -282,7 +282,7 @@ class MotifDnDConstants { ...@@ -282,7 +282,7 @@ class MotifDnDConstants {
try { try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success if (status != XConstants.Success
|| wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom() || wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom()
|| wpg.getData() == 0) { || wpg.getData() == 0) {
...@@ -399,13 +399,13 @@ class MotifDnDConstants { ...@@ -399,13 +399,13 @@ class MotifDnDConstants {
motifWindow, motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(), XA_MOTIF_DRAG_TARGETS.getAtom(),
XA_MOTIF_DRAG_TARGETS.getAtom(), 8, XA_MOTIF_DRAG_TARGETS.getAtom(), 8,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
data, tableSize); data, tableSize);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
// Create a new motif window and retry. // Create a new motif window and retry.
motifWindow = createMotifWindow(); motifWindow = createMotifWindow();
...@@ -415,13 +415,13 @@ class MotifDnDConstants { ...@@ -415,13 +415,13 @@ class MotifDnDConstants {
motifWindow, motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(), XA_MOTIF_DRAG_TARGETS.getAtom(),
XA_MOTIF_DRAG_TARGETS.getAtom(), 8, XA_MOTIF_DRAG_TARGETS.getAtom(), 8,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
data, tableSize); data, tableSize);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write motif drag targets property."); throw new XException("Cannot write motif drag targets property.");
} }
} }
...@@ -538,12 +538,12 @@ class MotifDnDConstants { ...@@ -538,12 +538,12 @@ class MotifDnDConstants {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_ATOM_0.getAtom(), XA_MOTIF_ATOM_0.getAtom(),
XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(), XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
8, XlibWrapper.PropModeReplace, 8, XConstants.PropModeReplace,
structData, MOTIF_INITIATOR_INFO_SIZE); structData, MOTIF_INITIATOR_INFO_SIZE);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write drag initiator info"); throw new XException("Cannot write drag initiator info");
} }
} finally { } finally {
...@@ -571,12 +571,12 @@ class MotifDnDConstants { ...@@ -571,12 +571,12 @@ class MotifDnDConstants {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
8, XlibWrapper.PropModeReplace, 8, XConstants.PropModeReplace,
data, dataSize); data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property"); throw new XException("Cannot write Motif receiver info property");
} }
} finally { } finally {
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -44,7 +44,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -44,7 +44,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
private static final Unsafe unsafe = XlibWrapper.unsafe; private static final Unsafe unsafe = XlibWrapper.unsafe;
private long targetEnterServerTime = XlibWrapper.CurrentTime; private long targetEnterServerTime = XConstants.CurrentTime;
protected MotifDnDDragSourceProtocol(XDragSourceProtocolListener listener) { protected MotifDnDDragSourceProtocol(XDragSourceProtocolListener listener) {
super(listener); super(listener);
...@@ -86,7 +86,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -86,7 +86,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
if (!MotifDnDConstants.MotifDnDSelection.setOwner(contents, formatMap, if (!MotifDnDConstants.MotifDnDSelection.setOwner(contents, formatMap,
formats, formats,
XlibWrapper.CurrentTime)) { XConstants.CurrentTime)) {
cleanup(); cleanup();
throw new InvalidDnDOperationException("Cannot acquire selection ownership"); throw new InvalidDnDOperationException("Cannot acquire selection ownership");
} }
...@@ -137,7 +137,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -137,7 +137,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
long time = t; long time = t;
/* Discard events from the previous receiver. */ /* Discard events from the previous receiver. */
if (targetEnterServerTime == XlibWrapper.CurrentTime || if (targetEnterServerTime == XConstants.CurrentTime ||
time < targetEnterServerTime) { time < targetEnterServerTime) {
return true; return true;
} }
...@@ -181,7 +181,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -181,7 +181,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
new WindowPropertyGetter(window, new WindowPropertyGetter(window,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false, 0, 0xFFFF, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
...@@ -200,7 +200,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -200,7 +200,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
* CARD32 heap_offset B32; * CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct; * } xmDragReceiverInfoStruct;
*/ */
if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >= wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
...@@ -243,7 +243,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -243,7 +243,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(8); msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
...@@ -267,7 +267,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -267,7 +267,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -281,7 +281,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -281,7 +281,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(8); msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
...@@ -305,7 +305,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -305,7 +305,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -318,7 +318,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -318,7 +318,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(8); msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
...@@ -336,7 +336,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -336,7 +336,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -356,7 +356,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -356,7 +356,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(8); msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
...@@ -382,7 +382,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -382,7 +382,7 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -397,12 +397,12 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol ...@@ -397,12 +397,12 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
public void cleanupTargetInfo() { public void cleanupTargetInfo() {
super.cleanupTargetInfo(); super.cleanupTargetInfo();
targetEnterServerTime = XlibWrapper.CurrentTime; targetEnterServerTime = XConstants.CurrentTime;
} }
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.SelectionRequest: case XConstants.SelectionRequest:
XSelectionRequestEvent xsre = ev.get_xselectionrequest(); XSelectionRequestEvent xsre = ev.get_xselectionrequest();
long atom = xsre.get_selection(); long atom = xsre.get_selection();
......
...@@ -99,7 +99,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -99,7 +99,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(embedder, new WindowPropertyGetter(embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false, 0, 0xFFFF, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler); status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
...@@ -118,7 +118,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -118,7 +118,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
* CARD32 heap_offset B32; * CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct; * } xmDragReceiverInfoStruct;
*/ */
if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >= wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
...@@ -166,12 +166,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -166,12 +166,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
8, XlibWrapper.PropModeReplace, 8, XConstants.PropModeReplace,
data, dataSize); data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property"); throw new XException("Cannot write Motif receiver info property");
} }
} finally { } finally {
...@@ -201,7 +201,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -201,7 +201,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(embedder, new WindowPropertyGetter(embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false, 0, 0xFFFF, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler); status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
...@@ -220,7 +220,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -220,7 +220,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
* CARD32 heap_offset B32; * CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct; * } xmDragReceiverInfoStruct;
*/ */
if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >= wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
...@@ -240,12 +240,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -240,12 +240,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(), MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
8, XlibWrapper.PropModeReplace, 8, XConstants.PropModeReplace,
data, dataSize); data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property"); throw new XException("Cannot write Motif receiver info property");
} }
} }
...@@ -273,7 +273,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -273,7 +273,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(embedded, new WindowPropertyGetter(embedded,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false, 0, 0xFFFF, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler); status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
...@@ -292,7 +292,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -292,7 +292,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
* CARD32 heap_offset B32; * CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct; * } xmDragReceiverInfoStruct;
*/ */
if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >= wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
...@@ -322,12 +322,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -322,12 +322,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(window, new WindowPropertyGetter(window,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO, MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false, 0, 0xFFFF, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
if (status == (int)XlibWrapper.Success && wpg.getData() != 0 && if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 && wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >= wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) { MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
...@@ -377,7 +377,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -377,7 +377,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && wpg.getData() != 0 && if (status == XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() == wpg.getActualType() ==
MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom() && MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom() &&
wpg.getActualFormat() == 8 && wpg.getActualFormat() == 8 &&
...@@ -420,7 +420,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -420,7 +420,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed"); throw new XException("XGetWindowAttributes failed");
} }
...@@ -432,12 +432,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -432,12 +432,12 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask | source_win_mask |
XlibWrapper.StructureNotifyMask); XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed"); throw new XException("XSelectInput failed");
} }
...@@ -590,7 +590,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -590,7 +590,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XClientMessageEvent dummy = new XClientMessageEvent(); XClientMessageEvent dummy = new XClientMessageEvent();
try { try {
dummy.set_type(XlibWrapper.ClientMessage); dummy.set_type(XConstants.ClientMessage);
dummy.set_window(xclient.get_window()); dummy.set_window(xclient.get_window());
dummy.set_format(32); dummy.set_format(32);
dummy.set_message_type(0); dummy.set_message_type(0);
...@@ -600,7 +600,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -600,7 +600,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
dummy.set_data(3, 0); dummy.set_data(3, 0);
dummy.set_data(4, 0); dummy.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
proxy, false, XlibWrapper.NoEventMask, proxy, false, XConstants.NoEventMask,
dummy.pData); dummy.pData);
} finally { } finally {
dummy.dispose(); dummy.dispose();
...@@ -821,7 +821,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -821,7 +821,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_window(MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder)); msg.set_window(MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder));
msg.set_format(8); msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom()); msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
...@@ -878,7 +878,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -878,7 +878,7 @@ class MotifDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
msg.get_window(), msg.get_window(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -89,7 +89,7 @@ public class WindowPropertyGetter { ...@@ -89,7 +89,7 @@ public class WindowPropertyGetter {
if (isCachingSupported() && isCached()) { if (isCachingSupported() && isCached()) {
readFromCache(); readFromCache();
return XlibWrapper.Success; return XConstants.Success;
} }
// Fix for performance problem - IgnodeBadWindowHandler is // Fix for performance problem - IgnodeBadWindowHandler is
...@@ -106,7 +106,7 @@ public class WindowPropertyGetter { ...@@ -106,7 +106,7 @@ public class WindowPropertyGetter {
offset, length, (auto_delete?1:0), type, offset, length, (auto_delete?1:0), type,
actual_type, actual_format, nitems_ptr, actual_type, actual_format, nitems_ptr,
bytes_after, data); bytes_after, data);
if (isCachingSupported() && status == XlibWrapper.Success && getData() != 0 && isCacheableProperty(property)) { if (isCachingSupported() && status == XConstants.Success && getData() != 0 && isCacheableProperty(property)) {
// Property has some data, we cache them // Property has some data, we cache them
cacheProperty(); cacheProperty();
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -128,7 +128,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { ...@@ -128,7 +128,7 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
try { try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler); int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status ); if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status );
settings = null; settings = null;
} }
......
...@@ -370,7 +370,7 @@ public final class XAtom { ...@@ -370,7 +370,7 @@ public final class XAtom {
false, property_type); false, property_type);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return 0; return 0;
} }
if (getter.getActualType() != property_type || getter.getActualFormat() != 32) { if (getter.getActualType() != property_type || getter.getActualFormat() != 32) {
...@@ -401,7 +401,7 @@ public final class XAtom { ...@@ -401,7 +401,7 @@ public final class XAtom {
try { try {
Native.putCard32(XlibWrapper.larg1, value); Native.putCard32(XlibWrapper.larg1, value);
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
atom, XA_CARDINAL, 32, XlibWrapper.PropModeReplace, atom, XA_CARDINAL, 32, XConstants.PropModeReplace,
XlibWrapper.larg1, 1); XlibWrapper.larg1, 1);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -432,7 +432,7 @@ public final class XAtom { ...@@ -432,7 +432,7 @@ public final class XAtom {
false, this); false, this);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return false; return false;
} }
if (getter.getActualType() != atom if (getter.getActualType() != atom
...@@ -466,7 +466,7 @@ public final class XAtom { ...@@ -466,7 +466,7 @@ public final class XAtom {
false, type); false, type);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return false; return false;
} }
if (getter.getActualType() != type if (getter.getActualType() != type
...@@ -497,7 +497,7 @@ public final class XAtom { ...@@ -497,7 +497,7 @@ public final class XAtom {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
atom, atom, 32, XlibWrapper.PropModeReplace, atom, atom, 32, XConstants.PropModeReplace,
data_ptr, length); data_ptr, length);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -518,7 +518,7 @@ public final class XAtom { ...@@ -518,7 +518,7 @@ public final class XAtom {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
atom, type, 32, XlibWrapper.PropModeReplace, atom, type, 32, XConstants.PropModeReplace,
data_ptr, length); data_ptr, length);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -539,7 +539,7 @@ public final class XAtom { ...@@ -539,7 +539,7 @@ public final class XAtom {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
atom, type, 8, XlibWrapper.PropModeReplace, atom, type, 8, XConstants.PropModeReplace,
data_ptr, length); data_ptr, length);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -602,7 +602,7 @@ public final class XAtom { ...@@ -602,7 +602,7 @@ public final class XAtom {
false, property_type); false, property_type);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return null; return null;
} }
if (getter.getActualType() != property_type || getter.getActualFormat() != 8) { if (getter.getActualType() != property_type || getter.getActualFormat() != 8) {
...@@ -674,7 +674,7 @@ public final class XAtom { ...@@ -674,7 +674,7 @@ public final class XAtom {
false, XA_ATOM); false, XA_ATOM);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return emptyList; return emptyList;
} }
if (getter.getActualType() != XA_ATOM || getter.getActualFormat() != 32) { if (getter.getActualType() != XA_ATOM || getter.getActualFormat() != 32) {
...@@ -797,7 +797,7 @@ public final class XAtom { ...@@ -797,7 +797,7 @@ public final class XAtom {
try { try {
Native.putWindow(XlibWrapper.larg1, window_value); Native.putWindow(XlibWrapper.larg1, window_value);
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
atom, XA_WINDOW, 32, XlibWrapper.PropModeReplace, atom, XA_WINDOW, 32, XConstants.PropModeReplace,
XlibWrapper.larg1, 1); XlibWrapper.larg1, 1);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -821,7 +821,7 @@ public final class XAtom { ...@@ -821,7 +821,7 @@ public final class XAtom {
false, XA_WINDOW); false, XA_WINDOW);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return 0; return 0;
} }
if (getter.getActualType() != XA_WINDOW || getter.getActualFormat() != 32) { if (getter.getActualType() != XA_WINDOW || getter.getActualFormat() != 32) {
......
/* /*
* Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -885,14 +885,14 @@ abstract public class XBaseMenuWindow extends XWindow { ...@@ -885,14 +885,14 @@ abstract public class XBaseMenuWindow extends XWindow {
*/ */
protected boolean isEventDisabled(XEvent e) { protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) { switch (e.get_type()) {
case XlibWrapper.Expose : case XConstants.Expose :
case XlibWrapper.GraphicsExpose : case XConstants.GraphicsExpose :
case XlibWrapper.ButtonPress: case XConstants.ButtonPress:
case XlibWrapper.ButtonRelease: case XConstants.ButtonRelease:
case XlibWrapper.MotionNotify: case XConstants.MotionNotify:
case XlibWrapper.KeyPress: case XConstants.KeyPress:
case XlibWrapper.KeyRelease: case XConstants.KeyRelease:
case XlibWrapper.DestroyNotify: case XConstants.DestroyNotify:
return super.isEventDisabled(e); return super.isEventDisabled(e);
default: default:
return true; return true;
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,7 +30,7 @@ import sun.awt.*; ...@@ -30,7 +30,7 @@ import sun.awt.*;
import java.util.logging.*; import java.util.logging.*;
import java.util.*; import java.util.*;
public class XBaseWindow implements XConstants, XUtilConstants { public class XBaseWindow {
private static final Logger log = Logger.getLogger("sun.awt.X11.XBaseWindow"); private static final Logger log = Logger.getLogger("sun.awt.X11.XBaseWindow");
private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XBaseWindow"); private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XBaseWindow");
private static final Logger eventLog = Logger.getLogger("sun.awt.X11.event.XBaseWindow"); private static final Logger eventLog = Logger.getLogger("sun.awt.X11.event.XBaseWindow");
...@@ -148,7 +148,7 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -148,7 +148,7 @@ public class XBaseWindow implements XConstants, XUtilConstants {
Long eventMask = (Long)params.get(EVENT_MASK); Long eventMask = (Long)params.get(EVENT_MASK);
if (eventMask != null) { if (eventMask != null) {
long mask = eventMask.longValue(); long mask = eventMask.longValue();
mask |= SubstructureNotifyMask; mask |= XConstants.SubstructureNotifyMask;
params.put(EVENT_MASK, mask); params.put(EVENT_MASK, mask);
} }
...@@ -281,10 +281,10 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -281,10 +281,10 @@ public class XBaseWindow implements XConstants, XUtilConstants {
} }
params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow())); params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE)); params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
params.putIfNull(DEPTH, Integer.valueOf((int)XlibWrapper.CopyFromParent)); params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
params.putIfNull(VISUAL, Long.valueOf(XlibWrapper.CopyFromParent)); params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XlibWrapper.InputOnly)); params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOnly));
params.putIfNull(VALUE_MASK, Long.valueOf(XlibWrapper.CWEventMask)); params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
Rectangle bounds = (Rectangle)params.get(BOUNDS); Rectangle bounds = (Rectangle)params.get(BOUNDS);
bounds.width = Math.max(MIN_SIZE, bounds.width); bounds.width = Math.max(MIN_SIZE, bounds.width);
bounds.height = Math.max(MIN_SIZE, bounds.height); bounds.height = Math.max(MIN_SIZE, bounds.height);
...@@ -293,7 +293,7 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -293,7 +293,7 @@ public class XBaseWindow implements XConstants, XUtilConstants {
long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0; long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
// We use our own synthetic grab see XAwtState.getGrabWindow() // We use our own synthetic grab see XAwtState.getGrabWindow()
// (see X vol. 1, 8.3.3.2) // (see X vol. 1, 8.3.3.2)
eventMask |= PropertyChangeMask | OwnerGrabButtonMask; eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
params.put(EVENT_MASK, Long.valueOf(eventMask)); params.put(EVENT_MASK, Long.valueOf(eventMask));
} }
...@@ -312,23 +312,23 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -312,23 +312,23 @@ public class XBaseWindow implements XConstants, XUtilConstants {
Long eventMask = (Long)params.get(EVENT_MASK); Long eventMask = (Long)params.get(EVENT_MASK);
xattr.set_event_mask(eventMask.longValue()); xattr.set_event_mask(eventMask.longValue());
value_mask |= XlibWrapper.CWEventMask; value_mask |= XConstants.CWEventMask;
Long border_pixel = (Long)params.get(BORDER_PIXEL); Long border_pixel = (Long)params.get(BORDER_PIXEL);
if (border_pixel != null) { if (border_pixel != null) {
xattr.set_border_pixel(border_pixel.longValue()); xattr.set_border_pixel(border_pixel.longValue());
value_mask |= XlibWrapper.CWBorderPixel; value_mask |= XConstants.CWBorderPixel;
} }
Long colormap = (Long)params.get(COLORMAP); Long colormap = (Long)params.get(COLORMAP);
if (colormap != null) { if (colormap != null) {
xattr.set_colormap(colormap.longValue()); xattr.set_colormap(colormap.longValue());
value_mask |= XlibWrapper.CWColormap; value_mask |= XConstants.CWColormap;
} }
Long background_pixmap = (Long)params.get(BACKGROUND_PIXMAP); Long background_pixmap = (Long)params.get(BACKGROUND_PIXMAP);
if (background_pixmap != null) { if (background_pixmap != null) {
xattr.set_background_pixmap(background_pixmap.longValue()); xattr.set_background_pixmap(background_pixmap.longValue());
value_mask |= XlibWrapper.CWBackPixmap; value_mask |= XConstants.CWBackPixmap;
} }
Long parentWindow = (Long)params.get(PARENT_WINDOW); Long parentWindow = (Long)params.get(PARENT_WINDOW);
...@@ -339,25 +339,25 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -339,25 +339,25 @@ public class XBaseWindow implements XConstants, XUtilConstants {
Boolean overrideRedirect = (Boolean)params.get(OVERRIDE_REDIRECT); Boolean overrideRedirect = (Boolean)params.get(OVERRIDE_REDIRECT);
if (overrideRedirect != null) { if (overrideRedirect != null) {
xattr.set_override_redirect(overrideRedirect.booleanValue()); xattr.set_override_redirect(overrideRedirect.booleanValue());
value_mask |= XlibWrapper.CWOverrideRedirect; value_mask |= XConstants.CWOverrideRedirect;
} }
Boolean saveUnder = (Boolean)params.get(SAVE_UNDER); Boolean saveUnder = (Boolean)params.get(SAVE_UNDER);
if (saveUnder != null) { if (saveUnder != null) {
xattr.set_save_under(saveUnder.booleanValue()); xattr.set_save_under(saveUnder.booleanValue());
value_mask |= XlibWrapper.CWSaveUnder; value_mask |= XConstants.CWSaveUnder;
} }
Integer backingStore = (Integer)params.get(BACKING_STORE); Integer backingStore = (Integer)params.get(BACKING_STORE);
if (backingStore != null) { if (backingStore != null) {
xattr.set_backing_store(backingStore.intValue()); xattr.set_backing_store(backingStore.intValue());
value_mask |= XlibWrapper.CWBackingStore; value_mask |= XConstants.CWBackingStore;
} }
Integer bitGravity = (Integer)params.get(BIT_GRAVITY); Integer bitGravity = (Integer)params.get(BIT_GRAVITY);
if (bitGravity != null) { if (bitGravity != null) {
xattr.set_bit_gravity(bitGravity.intValue()); xattr.set_bit_gravity(bitGravity.intValue());
value_mask |= XlibWrapper.CWBitGravity; value_mask |= XConstants.CWBitGravity;
} }
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(Level.FINE)) {
...@@ -487,25 +487,25 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -487,25 +487,25 @@ public class XBaseWindow implements XConstants, XUtilConstants {
// Note: if PPosition is not set in flags this means that // Note: if PPosition is not set in flags this means that
// we want to reset PPosition in hints. This is necessary // we want to reset PPosition in hints. This is necessary
// for locationByPlatform functionality // for locationByPlatform functionality
if ((flags & XlibWrapper.PPosition) != 0) { if ((flags & XUtilConstants.PPosition) != 0) {
hints.set_x(x); hints.set_x(x);
hints.set_y(y); hints.set_y(y);
} }
if ((flags & XlibWrapper.PSize) != 0) { if ((flags & XUtilConstants.PSize) != 0) {
hints.set_width(width); hints.set_width(width);
hints.set_height(height); hints.set_height(height);
} else if ((hints.get_flags() & XlibWrapper.PSize) != 0) { } else if ((hints.get_flags() & XUtilConstants.PSize) != 0) {
flags |= XlibWrapper.PSize; flags |= XUtilConstants.PSize;
} }
if ((flags & XlibWrapper.PMinSize) != 0) { if ((flags & XUtilConstants.PMinSize) != 0) {
hints.set_min_width(width); hints.set_min_width(width);
hints.set_min_height(height); hints.set_min_height(height);
} else if ((hints.get_flags() & XlibWrapper.PMinSize) != 0) { } else if ((hints.get_flags() & XUtilConstants.PMinSize) != 0) {
flags |= XlibWrapper.PMinSize; flags |= XUtilConstants.PMinSize;
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We don't need to reset minimum size if it's already set //We don't need to reset minimum size if it's already set
} }
if ((flags & XlibWrapper.PMaxSize) != 0) { if ((flags & XUtilConstants.PMaxSize) != 0) {
if (maxBounds != null) { if (maxBounds != null) {
if (maxBounds.width != Integer.MAX_VALUE) { if (maxBounds.width != Integer.MAX_VALUE) {
hints.set_max_width(maxBounds.width); hints.set_max_width(maxBounds.width);
...@@ -521,8 +521,8 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -521,8 +521,8 @@ public class XBaseWindow implements XConstants, XUtilConstants {
hints.set_max_width(width); hints.set_max_width(width);
hints.set_max_height(height); hints.set_max_height(height);
} }
} else if ((hints.get_flags() & XlibWrapper.PMaxSize) != 0) { } else if ((hints.get_flags() & XUtilConstants.PMaxSize) != 0) {
flags |= XlibWrapper.PMaxSize; flags |= XUtilConstants.PMaxSize;
if (maxBounds != null) { if (maxBounds != null) {
if (maxBounds.width != Integer.MAX_VALUE) { if (maxBounds.width != Integer.MAX_VALUE) {
hints.set_max_width(maxBounds.width); hints.set_max_width(maxBounds.width);
...@@ -538,9 +538,9 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -538,9 +538,9 @@ public class XBaseWindow implements XConstants, XUtilConstants {
// Leave intact // Leave intact
} }
} }
flags |= XlibWrapper.PWinGravity; flags |= XUtilConstants.PWinGravity;
hints.set_flags(flags); hints.set_flags(flags);
hints.set_win_gravity((int)XlibWrapper.NorthWestGravity); hints.set_win_gravity((int)XConstants.NorthWestGravity);
if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
", values " + hints); ", values " + hints);
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
...@@ -552,7 +552,7 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -552,7 +552,7 @@ public class XBaseWindow implements XConstants, XUtilConstants {
public boolean isMinSizeSet() { public boolean isMinSizeSet() {
XSizeHints hints = getHints(); XSizeHints hints = getHints();
long flags = hints.get_flags(); long flags = hints.get_flags();
return ((flags & XlibWrapper.PMinSize) == XlibWrapper.PMinSize); return ((flags & XUtilConstants.PMinSize) == XUtilConstants.PMinSize);
} }
/** /**
...@@ -837,29 +837,29 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -837,29 +837,29 @@ public class XBaseWindow implements XConstants, XUtilConstants {
//6273031: PIT. Choice drop down does not close once it is right clicked to show a popup menu //6273031: PIT. Choice drop down does not close once it is right clicked to show a popup menu
//remember previous window having grab and if it's not null ungrab it. //remember previous window having grab and if it's not null ungrab it.
XBaseWindow prevGrabWindow = XAwtState.getGrabWindow(); XBaseWindow prevGrabWindow = XAwtState.getGrabWindow();
final int eventMask = (int) (ButtonPressMask | ButtonReleaseMask final int eventMask = (int) (XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
| EnterWindowMask | LeaveWindowMask | PointerMotionMask | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
| ButtonMotionMask); | XConstants.ButtonMotionMask);
final int ownerEvents = 1; final int ownerEvents = 1;
int ptrGrab = XlibWrapper.XGrabPointer(XToolkit.getDisplay(), int ptrGrab = XlibWrapper.XGrabPointer(XToolkit.getDisplay(),
getContentWindow(), ownerEvents, eventMask, GrabModeAsync, getContentWindow(), ownerEvents, eventMask, XConstants.GrabModeAsync,
GrabModeAsync, None, (XWM.isMotif() ? XToolkit.arrowCursor : None), XConstants.GrabModeAsync, XConstants.None, (XWM.isMotif() ? XToolkit.arrowCursor : XConstants.None),
CurrentTime); XConstants.CurrentTime);
// Check grab results to be consistent with X server grab // Check grab results to be consistent with X server grab
if (ptrGrab != GrabSuccess) { if (ptrGrab != XConstants.GrabSuccess) {
XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime); XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null); XAwtState.setGrabWindow(null);
grabLog.fine(" Grab Failure - mouse"); grabLog.fine(" Grab Failure - mouse");
return false; return false;
} }
int keyGrab = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(), int keyGrab = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(),
getContentWindow(), ownerEvents, GrabModeAsync, GrabModeAsync, getContentWindow(), ownerEvents, XConstants.GrabModeAsync, XConstants.GrabModeAsync,
CurrentTime); XConstants.CurrentTime);
if (keyGrab != GrabSuccess) { if (keyGrab != XConstants.GrabSuccess) {
XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime); XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime); XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null); XAwtState.setGrabWindow(null);
grabLog.fine(" Grab Failure - keyboard"); grabLog.fine(" Grab Failure - keyboard");
return false; return false;
...@@ -882,8 +882,8 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -882,8 +882,8 @@ public class XBaseWindow implements XConstants, XUtilConstants {
grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow}); grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow});
if (grabWindow != null) { if (grabWindow != null) {
grabWindow.ungrabInputImpl(); grabWindow.ungrabInputImpl();
XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime); XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime); XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null); XAwtState.setGrabWindow(null);
// we need to call XFlush() here to force ungrab // we need to call XFlush() here to force ungrab
// see 6384219 for details // see 6384219 for details
...@@ -979,15 +979,15 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -979,15 +979,15 @@ public class XBaseWindow implements XConstants, XUtilConstants {
*/ */
public void handleButtonPressRelease(XEvent xev) { public void handleButtonPressRelease(XEvent xev) {
XButtonEvent xbe = xev.get_xbutton(); XButtonEvent xbe = xev.get_xbutton();
final int buttonState = xbe.get_state() & (Button1Mask | Button2Mask final int buttonState = xbe.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask
| Button3Mask | Button4Mask | Button5Mask); | XConstants.Button3Mask | XConstants.Button4Mask | XConstants.Button5Mask);
switch (xev.get_type()) { switch (xev.get_type()) {
case ButtonPress: case XConstants.ButtonPress:
if (buttonState == 0) { if (buttonState == 0) {
XAwtState.setAutoGrabWindow(this); XAwtState.setAutoGrabWindow(this);
} }
break; break;
case ButtonRelease: case XConstants.ButtonRelease:
if (isFullRelease(buttonState, xbe.get_button())) { if (isFullRelease(buttonState, xbe.get_button())) {
XAwtState.setAutoGrabWindow(null); XAwtState.setAutoGrabWindow(null);
} }
...@@ -1012,30 +1012,30 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -1012,30 +1012,30 @@ public class XBaseWindow implements XConstants, XUtilConstants {
*/ */
static boolean isFullRelease(int buttonState, int button) { static boolean isFullRelease(int buttonState, int button) {
switch (button) { switch (button) {
case Button1: case XConstants.Button1:
return buttonState == Button1Mask; return buttonState == XConstants.Button1Mask;
case Button2: case XConstants.Button2:
return buttonState == Button2Mask; return buttonState == XConstants.Button2Mask;
case Button3: case XConstants.Button3:
return buttonState == Button3Mask; return buttonState == XConstants.Button3Mask;
case Button4: case XConstants.Button4:
return buttonState == Button4Mask; return buttonState == XConstants.Button4Mask;
case Button5: case XConstants.Button5:
return buttonState == Button5Mask; return buttonState == XConstants.Button5Mask;
} }
return buttonState == 0; return buttonState == 0;
} }
static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) { static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
switch (ev.get_type()) { switch (ev.get_type()) {
case ButtonPress: case XConstants.ButtonPress:
case ButtonRelease: case XConstants.ButtonRelease:
case MotionNotify: case XConstants.MotionNotify:
case KeyPress: case XConstants.KeyPress:
case KeyRelease: case XConstants.KeyRelease:
return true; return true;
case LeaveNotify: case XConstants.LeaveNotify:
case EnterNotify: case XConstants.EnterNotify:
// We shouldn't dispatch this events to the grabbed components (see 6317481) // We shouldn't dispatch this events to the grabbed components (see 6317481)
// But this logic is important if the grabbed component is top-level (see realSync) // But this logic is important if the grabbed component is top-level (see realSync)
return (target instanceof XWindowPeer); return (target instanceof XWindowPeer);
...@@ -1067,53 +1067,53 @@ public class XBaseWindow implements XConstants, XUtilConstants { ...@@ -1067,53 +1067,53 @@ public class XBaseWindow implements XConstants, XUtilConstants {
switch (type) switch (type)
{ {
case VisibilityNotify: case XConstants.VisibilityNotify:
handleVisibilityEvent(xev); handleVisibilityEvent(xev);
break; break;
case ClientMessage: case XConstants.ClientMessage:
handleClientMessage(xev); handleClientMessage(xev);
break; break;
case Expose : case XConstants.Expose :
case GraphicsExpose : case XConstants.GraphicsExpose :
handleExposeEvent(xev); handleExposeEvent(xev);
break; break;
case ButtonPress: case XConstants.ButtonPress:
case ButtonRelease: case XConstants.ButtonRelease:
handleButtonPressRelease(xev); handleButtonPressRelease(xev);
break; break;
case MotionNotify: case XConstants.MotionNotify:
handleMotionNotify(xev); handleMotionNotify(xev);
break; break;
case KeyPress: case XConstants.KeyPress:
handleKeyPress(xev); handleKeyPress(xev);
break; break;
case KeyRelease: case XConstants.KeyRelease:
handleKeyRelease(xev); handleKeyRelease(xev);
break; break;
case EnterNotify: case XConstants.EnterNotify:
case LeaveNotify: case XConstants.LeaveNotify:
handleXCrossingEvent(xev); handleXCrossingEvent(xev);
break; break;
case ConfigureNotify: case XConstants.ConfigureNotify:
handleConfigureNotifyEvent(xev); handleConfigureNotifyEvent(xev);
break; break;
case MapNotify: case XConstants.MapNotify:
handleMapNotifyEvent(xev); handleMapNotifyEvent(xev);
break; break;
case UnmapNotify: case XConstants.UnmapNotify:
handleUnmapNotifyEvent(xev); handleUnmapNotifyEvent(xev);
break; break;
case ReparentNotify: case XConstants.ReparentNotify:
handleReparentNotifyEvent(xev); handleReparentNotifyEvent(xev);
break; break;
case PropertyNotify: case XConstants.PropertyNotify:
handlePropertyNotify(xev); handlePropertyNotify(xev);
break; break;
case DestroyNotify: case XConstants.DestroyNotify:
handleDestroyNotify(xev); handleDestroyNotify(xev);
break; break;
case CreateNotify: case XConstants.CreateNotify:
handleCreateNotify(xev); handleCreateNotify(xev);
break; break;
} }
......
...@@ -185,7 +185,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener ...@@ -185,7 +185,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener
private static class SelectionNotifyHandler implements XEventDispatcher { private static class SelectionNotifyHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
if (ev.get_type() == XlibWrapper.SelectionNotify) { if (ev.get_type() == XConstants.SelectionNotify) {
final XSelectionEvent xse = ev.get_xselection(); final XSelectionEvent xse = ev.get_xselection();
XClipboard clipboard = null; XClipboard clipboard = null;
synchronized (XClipboard.classLock) { synchronized (XClipboard.classLock) {
...@@ -223,7 +223,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener ...@@ -223,7 +223,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener
XDataTransferer.TARGETS_ATOM.getAtom(), XDataTransferer.TARGETS_ATOM.getAtom(),
getTargetsPropertyAtom().getAtom(), getTargetsPropertyAtom().getAtom(),
XWindow.getXAWTRootWindow().getWindow(), XWindow.getXAWTRootWindow().getWindow(),
XlibWrapper.CurrentTime); XConstants.CurrentTime);
isSelectionNotifyProcessed = false; isSelectionNotifyProcessed = false;
} }
} finally { } finally {
...@@ -260,7 +260,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener ...@@ -260,7 +260,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener
long[] formats = null; long[] formats = null;
if (propertyAtom == XlibWrapper.None) { if (propertyAtom == XConstants.None) {
// We treat None property atom as "empty selection". // We treat None property atom as "empty selection".
formats = new long[0]; formats = new long[0];
} else { } else {
...@@ -268,7 +268,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener ...@@ -268,7 +268,7 @@ public final class XClipboard extends SunClipboard implements OwnershipListener
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(), new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
XAtom.get(propertyAtom), 0, XAtom.get(propertyAtom), 0,
XSelection.MAX_LENGTH, true, XSelection.MAX_LENGTH, true,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
targetsGetter.execute(); targetsGetter.execute();
formats = XSelection.getFormats(targetsGetter); formats = XSelection.getFormats(targetsGetter);
......
...@@ -72,7 +72,7 @@ import sun.awt.image.SunVolatileImage; ...@@ -72,7 +72,7 @@ import sun.awt.image.SunVolatileImage;
import sun.awt.image.ToolkitImage; import sun.awt.image.ToolkitImage;
import sun.java2d.pipe.Region; import sun.java2d.pipe.Region;
public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer, XConstants { public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer {
/* FIX ME: these constants copied from java.awt.KeyboardFocusManager */ /* FIX ME: these constants copied from java.awt.KeyboardFocusManager */
static final int SNFH_FAILURE = 0; static final int SNFH_FAILURE = 0;
static final int SNFH_SUCCESS_HANDLED = 1; static final int SNFH_SUCCESS_HANDLED = 1;
...@@ -718,7 +718,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -718,7 +718,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* handleJavaMouseEvent() would be more suitable place to do this * handleJavaMouseEvent() would be more suitable place to do this
* but we want Swing to have this functionality also. * but we want Swing to have this functionality also.
*/ */
if (xev.get_type() == ButtonPress) { if (xev.get_type() == XConstants.ButtonPress) {
final XWindowPeer parentXWindow = getParentTopLevel(); final XWindowPeer parentXWindow = getParentTopLevel();
Window parentWindow = (Window)parentXWindow.getTarget(); Window parentWindow = (Window)parentXWindow.getTarget();
if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() && if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() &&
...@@ -841,7 +841,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -841,7 +841,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
XSetWindowAttributes xwa = new XSetWindowAttributes(); XSetWindowAttributes xwa = new XSetWindowAttributes();
xwa.set_cursor(xcursor); xwa.set_cursor(xcursor);
long valuemask = XlibWrapper.CWCursor; long valuemask = XConstants.CWCursor;
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData); XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData);
XlibWrapper.XFlush(XToolkit.getDisplay()); XlibWrapper.XFlush(XToolkit.getDisplay());
...@@ -1342,20 +1342,20 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -1342,20 +1342,20 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")}); enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")});
if (!isEnabled()) { if (!isEnabled()) {
switch (e.get_type()) { switch (e.get_type()) {
case ButtonPress: case XConstants.ButtonPress:
case ButtonRelease: case XConstants.ButtonRelease:
case KeyPress: case XConstants.KeyPress:
case KeyRelease: case XConstants.KeyRelease:
case EnterNotify: case XConstants.EnterNotify:
case LeaveNotify: case XConstants.LeaveNotify:
case MotionNotify: case XConstants.MotionNotify:
enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e}); enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e});
return true; return true;
} }
} }
switch(e.get_type()) { switch(e.get_type()) {
case MapNotify: case XConstants.MapNotify:
case UnmapNotify: case XConstants.UnmapNotify:
return true; return true;
} }
return super.isEventDisabled(e); return super.isEventDisabled(e);
......
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
package sun.awt.X11; package sun.awt.X11;
public interface XConstants { final public class XConstants {
private XConstants(){}
public static final int X_PROTOCOL = 11 ; /* current protocol version */ public static final int X_PROTOCOL = 11 ; /* current protocol version */
public static final int X_PROTOCOL_REVISION = 0 ; /* current minor version */ public static final int X_PROTOCOL_REVISION = 0 ; /* current minor version */
...@@ -292,9 +295,9 @@ public interface XConstants { ...@@ -292,9 +295,9 @@ public interface XConstants {
public static final int RevertToParent = 2 ; public static final int RevertToParent = 2 ;
/* Used in XEventsQueued */ /* Used in XEventsQueued */
int QueuedAlready = 0; public static final int QueuedAlready = 0;
int QueuedAfterReading = 1; public static final int QueuedAfterReading = 1;
int QueuedAfterFlush = 2; public static final int QueuedAfterFlush = 2;
/***************************************************************** /*****************************************************************
......
...@@ -43,7 +43,7 @@ import sun.awt.ComponentAccessor; ...@@ -43,7 +43,7 @@ import sun.awt.ComponentAccessor;
* It should always be located at (- left inset, - top inset) in the associated * It should always be located at (- left inset, - top inset) in the associated
* decorated window. So coordinates in it would be the same as java coordinates. * decorated window. So coordinates in it would be the same as java coordinates.
*/ */
public final class XContentWindow extends XWindow implements XConstants { public final class XContentWindow extends XWindow {
private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow"); private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow");
static XContentWindow createContent(XDecoratedPeer parentFrame) { static XContentWindow createContent(XDecoratedPeer parentFrame) {
...@@ -76,10 +76,10 @@ public final class XContentWindow extends XWindow implements XConstants { ...@@ -76,10 +76,10 @@ public final class XContentWindow extends XWindow implements XConstants {
void preInit(XCreateWindowParams params) { void preInit(XCreateWindowParams params) {
super.preInit(params); super.preInit(params);
params.putIfNull(BIT_GRAVITY, Integer.valueOf(NorthWestGravity)); params.putIfNull(BIT_GRAVITY, Integer.valueOf(XConstants.NorthWestGravity));
Long eventMask = (Long)params.get(EVENT_MASK); Long eventMask = (Long)params.get(EVENT_MASK);
if (eventMask != null) { if (eventMask != null) {
eventMask = eventMask & ~(StructureNotifyMask); eventMask = eventMask & ~(XConstants.StructureNotifyMask);
params.put(EVENT_MASK, eventMask); params.put(EVENT_MASK, eventMask);
} }
} }
...@@ -90,15 +90,15 @@ public final class XContentWindow extends XWindow implements XConstants { ...@@ -90,15 +90,15 @@ public final class XContentWindow extends XWindow implements XConstants {
protected boolean isEventDisabled(XEvent e) { protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) { switch (e.get_type()) {
// Override parentFrame to receive MouseEnter/Exit // Override parentFrame to receive MouseEnter/Exit
case EnterNotify: case XConstants.EnterNotify:
case LeaveNotify: case XConstants.LeaveNotify:
return false; return false;
// We handle ConfigureNotify specifically in XDecoratedPeer // We handle ConfigureNotify specifically in XDecoratedPeer
case ConfigureNotify: case XConstants.ConfigureNotify:
return true; return true;
// We don't want SHOWN/HIDDEN on content window since it will duplicate XDecoratedPeer // We don't want SHOWN/HIDDEN on content window since it will duplicate XDecoratedPeer
case MapNotify: case XConstants.MapNotify:
case UnmapNotify: case XConstants.UnmapNotify:
return true; return true;
default: default:
return super.isEventDisabled(e) || parentFrame.isEventDisabled(e); return super.isEventDisabled(e) || parentFrame.isEventDisabled(e);
......
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
package sun.awt.X11; package sun.awt.X11;
public interface XCursorFontConstants { final public class XCursorFontConstants {
private XCursorFontConstants(){}
/* cursorfont defines */ /* cursorfont defines */
static final int XC_num_glyphs=154; static final int XC_num_glyphs=154;
static final int XC_X_cursor=0; static final int XC_X_cursor=0;
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -83,7 +83,7 @@ public class XCustomCursor extends X11CustomCursor { ...@@ -83,7 +83,7 @@ public class XCustomCursor extends X11CustomCursor {
long colormap = XToolkit.getDefaultXColormap(); long colormap = XToolkit.getDefaultXColormap();
XColor fore_color = new XColor(); XColor fore_color = new XColor();
fore_color.set_flags((byte) (XlibWrapper.DoRed | XlibWrapper.DoGreen | XlibWrapper.DoBlue)); fore_color.set_flags((byte) (XConstants.DoRed | XConstants.DoGreen | XConstants.DoBlue));
fore_color.set_red((short)(((fcolor >> 16) & 0x000000ff) << 8)); fore_color.set_red((short)(((fcolor >> 16) & 0x000000ff) << 8));
fore_color.set_green((short) (((fcolor >> 8) & 0x000000ff) << 8)); fore_color.set_green((short) (((fcolor >> 8) & 0x000000ff) << 8));
fore_color.set_blue((short)(((fcolor >> 0) & 0x000000ff) << 8)); fore_color.set_blue((short)(((fcolor >> 0) & 0x000000ff) << 8));
...@@ -92,7 +92,7 @@ public class XCustomCursor extends X11CustomCursor { ...@@ -92,7 +92,7 @@ public class XCustomCursor extends X11CustomCursor {
XColor back_color = new XColor(); XColor back_color = new XColor();
back_color.set_flags((byte) (XlibWrapper.DoRed | XlibWrapper.DoGreen | XlibWrapper.DoBlue)); back_color.set_flags((byte) (XConstants.DoRed | XConstants.DoGreen | XConstants.DoBlue));
back_color.set_red((short) (((bcolor >> 16) & 0x000000ff) << 8)); back_color.set_red((short) (((bcolor >> 16) & 0x000000ff) << 8));
back_color.set_green((short) (((bcolor >> 8) & 0x000000ff) << 8)); back_color.set_green((short) (((bcolor >> 8) & 0x000000ff) << 8));
......
/* /*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -89,7 +89,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -89,7 +89,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
// Deny default processing of these events on the shell - proxy will take care of // Deny default processing of these events on the shell - proxy will take care of
// them instead // them instead
Long eventMask = (Long)params.get(EVENT_MASK); Long eventMask = (Long)params.get(EVENT_MASK);
params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(FocusChangeMask | KeyPressMask | KeyReleaseMask))); params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)));
} }
void postInit(XCreateWindowParams params) { void postInit(XCreateWindowParams params) {
...@@ -131,7 +131,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -131,7 +131,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
int minHeight = minimumSize.height - insets.top - insets.bottom; int minHeight = minimumSize.height - insets.top - insets.bottom;
if (minWidth < 0) minWidth = 0; if (minWidth < 0) minWidth = 0;
if (minHeight < 0) minHeight = 0; if (minHeight < 0) minHeight = 0;
setSizeHints(XlibWrapper.PMinSize | (isLocationByPlatform()?0:(XlibWrapper.PPosition | XlibWrapper.USPosition)), setSizeHints(XUtilConstants.PMinSize | (isLocationByPlatform()?0:(XUtilConstants.PPosition | XUtilConstants.USPosition)),
getX(), getY(), minWidth, minHeight); getX(), getY(), minWidth, minHeight);
if (isVisible()) { if (isVisible()) {
Rectangle bounds = getShellBounds(); Rectangle bounds = getShellBounds();
...@@ -143,7 +143,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -143,7 +143,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
} else { } else {
boolean isMinSizeSet = isMinSizeSet(); boolean isMinSizeSet = isMinSizeSet();
XWM.removeSizeHints(this, XlibWrapper.PMinSize); XWM.removeSizeHints(this, XUtilConstants.PMinSize);
/* Some WMs need remap to redecorate the window */ /* Some WMs need remap to redecorate the window */
if (isMinSizeSet && isShowing() && XWM.needRemap(this)) { if (isMinSizeSet && isShowing() && XWM.needRemap(this)) {
/* /*
...@@ -365,7 +365,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -365,7 +365,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
return; return;
} }
if ((getHints().get_flags() & (USPosition | PPosition)) != 0) { if ((getHints().get_flags() & (XUtilConstants.USPosition | XUtilConstants.PPosition)) != 0) {
reshape(dimensions, SET_BOUNDS, false); reshape(dimensions, SET_BOUNDS, false);
} else { } else {
reshape(dimensions, SET_SIZE, false); reshape(dimensions, SET_SIZE, false);
...@@ -841,10 +841,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -841,10 +841,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
setReparented(false); setReparented(false);
} }
winAttr.isResizable = resizable; winAttr.isResizable = resizable;
if ((fs & MWM_FUNC_ALL) != 0) { if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
fs &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE); fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else { } else {
fs |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE); fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} }
winAttr.functions = fs; winAttr.functions = fs;
XWM.setShellResizable(this); XWM.setShellResizable(this);
...@@ -855,10 +855,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -855,10 +855,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
setReparented(false); setReparented(false);
} }
winAttr.isResizable = resizable; winAttr.isResizable = resizable;
if ((fs & MWM_FUNC_ALL) != 0) { if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
fs |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE); fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else { } else {
fs &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE); fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} }
winAttr.functions = fs; winAttr.functions = fs;
XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false); XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
...@@ -936,10 +936,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -936,10 +936,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
protected boolean isEventDisabled(XEvent e) { protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) { switch (e.get_type()) {
// Do not generate MOVED/RESIZED events since we generate them by ourselves // Do not generate MOVED/RESIZED events since we generate them by ourselves
case ConfigureNotify: case XConstants.ConfigureNotify:
return true; return true;
case EnterNotify: case XConstants.EnterNotify:
case LeaveNotify: case XConstants.LeaveNotify:
// Disable crossing event on outer borders of Frame so // Disable crossing event on outer borders of Frame so
// we receive only one set of cross notifications(first set is from content window) // we receive only one set of cross notifications(first set is from content window)
return true; return true;
...@@ -964,7 +964,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -964,7 +964,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
if (winAttr.isResizable) { if (winAttr.isResizable) {
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We need to update frame's minimum size, not to reset it //We need to update frame's minimum size, not to reset it
XWM.removeSizeHints(this, XlibWrapper.PMaxSize); XWM.removeSizeHints(this, XUtilConstants.PMaxSize);
updateMinimumSize(); updateMinimumSize();
} }
} else { } else {
......
/* /*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -51,7 +51,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer { ...@@ -51,7 +51,7 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
} else { } else {
winAttr.decorations = winAttr.AWT_DECOR_NONE; winAttr.decorations = winAttr.AWT_DECOR_NONE;
} }
winAttr.functions = MWM_FUNC_ALL; winAttr.functions = MWMConstants.MWM_FUNC_ALL;
winAttr.isResizable = true; //target.isResizable(); winAttr.isResizable = true; //target.isResizable();
winAttr.initialResizability = target.isResizable(); winAttr.initialResizability = target.isResizable();
winAttr.title = target.getTitle(); winAttr.title = target.getTitle();
...@@ -100,10 +100,10 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer { ...@@ -100,10 +100,10 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
int getDecorations() { int getDecorations() {
int d = super.getDecorations(); int d = super.getDecorations();
// remove minimize and maximize buttons for dialogs // remove minimize and maximize buttons for dialogs
if ((d & MWM_DECOR_ALL) != 0) { if ((d & MWMConstants.MWM_DECOR_ALL) != 0) {
d |= (MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE); d |= (MWMConstants.MWM_DECOR_MINIMIZE | MWMConstants.MWM_DECOR_MAXIMIZE);
} else { } else {
d &= ~(MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE); d &= ~(MWMConstants.MWM_DECOR_MINIMIZE | MWMConstants.MWM_DECOR_MAXIMIZE);
} }
return d; return d;
} }
...@@ -111,10 +111,10 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer { ...@@ -111,10 +111,10 @@ class XDialogPeer extends XDecoratedPeer implements DialogPeer {
int getFunctions() { int getFunctions() {
int f = super.getFunctions(); int f = super.getFunctions();
// remove minimize and maximize functions for dialogs // remove minimize and maximize functions for dialogs
if ((f & MWM_FUNC_ALL) != 0) { if ((f & MWMConstants.MWM_FUNC_ALL) != 0) {
f |= (MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE); f |= (MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else { } else {
f &= ~(MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE); f &= ~(MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} }
return f; return f;
} }
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -103,7 +103,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -103,7 +103,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
cleanup(); cleanup();
throw new XException("Cannot write XdndActionList property"); throw new XException("Cannot write XdndActionList property");
} }
...@@ -124,7 +124,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -124,7 +124,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
cleanup(); cleanup();
throw new XException("Cannot write XdndActionList property"); throw new XException("Cannot write XdndActionList property");
} }
...@@ -134,7 +134,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -134,7 +134,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
} }
if (!XDnDConstants.XDnDSelection.setOwner(contents, formatMap, formats, if (!XDnDConstants.XDnDSelection.setOwner(contents, formatMap, formats,
XlibWrapper.CurrentTime)) { XConstants.CurrentTime)) {
cleanup(); cleanup();
throw new InvalidDnDOperationException("Cannot acquire selection ownership"); throw new InvalidDnDOperationException("Cannot acquire selection ownership");
} }
...@@ -193,11 +193,11 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -193,11 +193,11 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
WindowPropertyGetter wpg1 = WindowPropertyGetter wpg1 =
new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1, new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
false, XlibWrapper.AnyPropertyType); false, XConstants.AnyPropertyType);
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
int targetVersion = (int)Native.getLong(wpg1.getData()); int targetVersion = (int)Native.getLong(wpg1.getData());
...@@ -217,7 +217,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -217,7 +217,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
try { try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler); status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg2.getData() != 0 && wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) { wpg2.getActualType() == XAtom.XA_WINDOW) {
...@@ -235,7 +235,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -235,7 +235,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
try { try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler); status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg3.getData() == 0 || wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW || wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) { Native.getLong(wpg3.getData()) != proxy) {
...@@ -246,12 +246,12 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -246,12 +246,12 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
new WindowPropertyGetter(proxy, new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware, XDnDConstants.XA_XdndAware,
0, 1, false, 0, 1, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler); status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg4.getData() == 0 || wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) { wpg4.getActualType() != XAtom.XA_ATOM) {
...@@ -283,7 +283,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -283,7 +283,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndEnter.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndEnter.getAtom());
...@@ -297,7 +297,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -297,7 +297,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
msg.set_data(4, formats.length > 2 ? formats[2] : 0); msg.set_data(4, formats.length > 2 ? formats[2] : 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -311,7 +311,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -311,7 +311,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndPosition.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndPosition.getAtom());
...@@ -322,7 +322,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -322,7 +322,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(sourceAction)); msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(sourceAction));
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -335,7 +335,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -335,7 +335,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndLeave.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndLeave.getAtom());
...@@ -346,7 +346,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -346,7 +346,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
msg.set_data(4, 0); msg.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -361,7 +361,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -361,7 +361,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow()); msg.set_window(getTargetWindow());
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndDrop.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndDrop.getAtom());
...@@ -372,7 +372,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -372,7 +372,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
msg.set_data(4, 0); msg.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(), getTargetProxyWindow(),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
msg.dispose(); msg.dispose();
...@@ -406,7 +406,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol { ...@@ -406,7 +406,7 @@ class XDnDDragSourceProtocol extends XDragSourceProtocol {
assert XToolkit.isAWTLockHeldByCurrentThread(); assert XToolkit.isAWTLockHeldByCurrentThread();
XlibWrapper.XSendEvent(XToolkit.getDisplay(), sourceWindow, XlibWrapper.XSendEvent(XToolkit.getDisplay(), sourceWindow,
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
xclient.pData); xclient.pData);
return true; return true;
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -93,7 +93,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -93,7 +93,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write XdndAware property"); throw new XException("Cannot write XdndAware property");
} }
} finally { } finally {
...@@ -119,12 +119,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -119,12 +119,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
WindowPropertyGetter wpg1 = WindowPropertyGetter wpg1 =
new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndAware, 0, 1, new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndAware, 0, 1,
false, XlibWrapper.AnyPropertyType); false, XConstants.AnyPropertyType);
try { try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
overriden = true; overriden = true;
...@@ -143,7 +143,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -143,7 +143,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler); status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg2.getData() != 0 && wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) { wpg2.getActualType() == XAtom.XA_WINDOW) {
...@@ -161,7 +161,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -161,7 +161,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler); status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg3.getData() == 0 || wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW || wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) { Native.getLong(wpg3.getData()) != proxy) {
...@@ -172,12 +172,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -172,12 +172,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(proxy, new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware, XDnDConstants.XA_XdndAware,
0, 1, false, 0, 1, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler); status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg4.getData() == 0 || wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) { wpg4.getActualType() != XAtom.XA_ATOM) {
...@@ -212,7 +212,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -212,7 +212,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndAware property"); throw new XException("Cannot write XdndAware property");
} }
...@@ -226,7 +226,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -226,7 +226,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndProxy property"); throw new XException("Cannot write XdndProxy property");
} }
...@@ -239,7 +239,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -239,7 +239,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndAware property"); throw new XException("Cannot write XdndAware property");
} }
...@@ -252,7 +252,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -252,7 +252,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndProxy property"); throw new XException("Cannot write XdndProxy property");
} }
} finally { } finally {
...@@ -285,7 +285,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -285,7 +285,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndAware property"); throw new XException("Cannot write XdndAware property");
} }
...@@ -298,7 +298,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -298,7 +298,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XToolkit.saved_error.get_error_code() !=
XlibWrapper.Success) { XConstants.Success) {
throw new XException("Cannot write XdndProxy property"); throw new XException("Cannot write XdndProxy property");
} }
} finally { } finally {
...@@ -326,12 +326,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -326,12 +326,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
WindowPropertyGetter wpg1 = WindowPropertyGetter wpg1 =
new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndAware, 0, 1, new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndAware, 0, 1,
false, XlibWrapper.AnyPropertyType); false, XConstants.AnyPropertyType);
try { try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
overriden = true; overriden = true;
...@@ -350,7 +350,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -350,7 +350,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler); status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg2.getData() != 0 && wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) { wpg2.getActualType() == XAtom.XA_WINDOW) {
...@@ -368,7 +368,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -368,7 +368,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler); status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg3.getData() == 0 || wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW || wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) { Native.getLong(wpg3.getData()) != proxy) {
...@@ -379,12 +379,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -379,12 +379,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
new WindowPropertyGetter(proxy, new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware, XDnDConstants.XA_XdndAware,
0, 1, false, 0, 1, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler); status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || if (status != XConstants.Success ||
wpg4.getData() == 0 || wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) { wpg4.getActualType() != XAtom.XA_ATOM) {
...@@ -408,12 +408,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -408,12 +408,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
WindowPropertyGetter wpg1 = WindowPropertyGetter wpg1 =
new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1, new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
false, XlibWrapper.AnyPropertyType); false, XConstants.AnyPropertyType);
try { try {
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler); int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
if (status == XlibWrapper.Success && if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) { wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
return true; return true;
...@@ -523,7 +523,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -523,7 +523,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
long j; long j;
if ((j = xclient.get_data(2 + i)) != XlibWrapper.None) { if ((j = xclient.get_data(2 + i)) != XConstants.None) {
formats3[countFormats++] = j; formats3[countFormats++] = j;
} }
} }
...@@ -549,7 +549,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -549,7 +549,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed"); throw new XException("XGetWindowAttributes failed");
} }
...@@ -561,12 +561,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -561,12 +561,12 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win, XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask | source_win_mask |
XlibWrapper.StructureNotifyMask); XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed"); throw new XException("XSelectInput failed");
} }
...@@ -581,7 +581,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -581,7 +581,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
} }
private boolean processXdndPosition(XClientMessageEvent xclient) { private boolean processXdndPosition(XClientMessageEvent xclient) {
long time_stamp = (int)XlibWrapper.CurrentTime; long time_stamp = (int)XConstants.CurrentTime;
long xdnd_action = 0; long xdnd_action = 0;
int java_action = DnDConstants.ACTION_NONE; int java_action = DnDConstants.ACTION_NONE;
int x = 0; int x = 0;
...@@ -748,7 +748,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -748,7 +748,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
long data3, long data4) { long data3, long data4) {
XClientMessageEvent enter = new XClientMessageEvent(); XClientMessageEvent enter = new XClientMessageEvent();
try { try {
enter.set_type((int)XlibWrapper.ClientMessage); enter.set_type((int)XConstants.ClientMessage);
enter.set_window(toplevel); enter.set_window(toplevel);
enter.set_format(32); enter.set_format(32);
enter.set_message_type(XDnDConstants.XA_XdndEnter.getAtom()); enter.set_message_type(XDnDConstants.XA_XdndEnter.getAtom());
...@@ -774,7 +774,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -774,7 +774,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
long sourceWindow) { long sourceWindow) {
XClientMessageEvent leave = new XClientMessageEvent(); XClientMessageEvent leave = new XClientMessageEvent();
try { try {
leave.set_type((int)XlibWrapper.ClientMessage); leave.set_type((int)XConstants.ClientMessage);
leave.set_window(toplevel); leave.set_window(toplevel);
leave.set_format(32); leave.set_format(32);
leave.set_message_type(XDnDConstants.XA_XdndLeave.getAtom()); leave.set_message_type(XDnDConstants.XA_XdndLeave.getAtom());
...@@ -804,7 +804,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -804,7 +804,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(xclient.get_data(0)); msg.set_window(xclient.get_data(0));
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
...@@ -826,7 +826,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -826,7 +826,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
xclient.get_data(0), xclient.get_data(0),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -842,7 +842,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -842,7 +842,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
throws IllegalArgumentException, IOException { throws IllegalArgumentException, IOException {
XClientMessageEvent xclient = new XClientMessageEvent(ctxt); XClientMessageEvent xclient = new XClientMessageEvent(ctxt);
long message_type = xclient.get_message_type(); long message_type = xclient.get_message_type();
long time_stamp = XlibWrapper.CurrentTime; long time_stamp = XConstants.CurrentTime;
// NOTE: we assume that the source supports at least version 1, so we // NOTE: we assume that the source supports at least version 1, so we
// can use the time stamp // can use the time stamp
...@@ -892,7 +892,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -892,7 +892,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
try { try {
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(xclient.get_data(0)); msg.set_window(xclient.get_data(0));
msg.set_format(32); msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndFinished.getAtom()); msg.set_message_type(XDnDConstants.XA_XdndFinished.getAtom());
...@@ -914,7 +914,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -914,7 +914,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
xclient.get_data(0), xclient.get_data(0),
false, XlibWrapper.NoEventMask, false, XConstants.NoEventMask,
msg.pData); msg.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -1119,7 +1119,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol { ...@@ -1119,7 +1119,7 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
if (logger.isLoggable(Level.WARNING)) { if (logger.isLoggable(Level.WARNING)) {
logger.warning("Cannot set XdndTypeList on the proxy window"); logger.warning("Cannot set XdndTypeList on the proxy window");
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -55,11 +55,11 @@ public final class XDragSourceContextPeer ...@@ -55,11 +55,11 @@ public final class XDragSourceContextPeer
Logger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer"); Logger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer");
/* The events selected on the root window when the drag begins. */ /* The events selected on the root window when the drag begins. */
private static final int ROOT_EVENT_MASK = (int)XlibWrapper.ButtonMotionMask | private static final int ROOT_EVENT_MASK = (int)XConstants.ButtonMotionMask |
(int)XlibWrapper.KeyPressMask | (int)XlibWrapper.KeyReleaseMask; (int)XConstants.KeyPressMask | (int)XConstants.KeyReleaseMask;
/* The events to be delivered during grab. */ /* The events to be delivered during grab. */
private static final int GRAB_EVENT_MASK = (int)XlibWrapper.ButtonPressMask | private static final int GRAB_EVENT_MASK = (int)XConstants.ButtonPressMask |
(int)XlibWrapper.ButtonMotionMask | (int)XlibWrapper.ButtonReleaseMask; (int)XConstants.ButtonMotionMask | (int)XConstants.ButtonReleaseMask;
/* The event mask of the root window before the drag operation starts. */ /* The event mask of the root window before the drag operation starts. */
private long rootEventMask = 0; private long rootEventMask = 0;
...@@ -196,11 +196,11 @@ public final class XDragSourceContextPeer ...@@ -196,11 +196,11 @@ public final class XDragSourceContextPeer
status = XlibWrapper.XGrabPointer(XToolkit.getDisplay(), rootWindow, status = XlibWrapper.XGrabPointer(XToolkit.getDisplay(), rootWindow,
0, GRAB_EVENT_MASK, 0, GRAB_EVENT_MASK,
XlibWrapper.GrabModeAsync, XConstants.GrabModeAsync,
XlibWrapper.GrabModeAsync, XConstants.GrabModeAsync,
XlibWrapper.None, xcursor, timeStamp); XConstants.None, xcursor, timeStamp);
if (status != XlibWrapper.GrabSuccess) { if (status != XConstants.GrabSuccess) {
cleanup(timeStamp); cleanup(timeStamp);
throwGrabFailureException("Cannot grab pointer", status); throwGrabFailureException("Cannot grab pointer", status);
return; return;
...@@ -208,11 +208,11 @@ public final class XDragSourceContextPeer ...@@ -208,11 +208,11 @@ public final class XDragSourceContextPeer
status = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(), rootWindow, status = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(), rootWindow,
0, 0,
XlibWrapper.GrabModeAsync, XConstants.GrabModeAsync,
XlibWrapper.GrabModeAsync, XConstants.GrabModeAsync,
timeStamp); timeStamp);
if (status != XlibWrapper.GrabSuccess) { if (status != XConstants.GrabSuccess) {
cleanup(timeStamp); cleanup(timeStamp);
throwGrabFailureException("Cannot grab keyboard", status); throwGrabFailureException("Cannot grab keyboard", status);
return; return;
...@@ -276,7 +276,7 @@ public final class XDragSourceContextPeer ...@@ -276,7 +276,7 @@ public final class XDragSourceContextPeer
XlibWrapper.XChangeActivePointerGrab(XToolkit.getDisplay(), XlibWrapper.XChangeActivePointerGrab(XToolkit.getDisplay(),
GRAB_EVENT_MASK, GRAB_EVENT_MASK,
xcursor, xcursor,
XlibWrapper.CurrentTime); XConstants.CurrentTime);
} }
protected boolean needsBogusExitBeforeDrop() { protected boolean needsBogusExitBeforeDrop() {
...@@ -287,10 +287,10 @@ public final class XDragSourceContextPeer ...@@ -287,10 +287,10 @@ public final class XDragSourceContextPeer
throws InvalidDnDOperationException { throws InvalidDnDOperationException {
String msgCause = ""; String msgCause = "";
switch (grabStatus) { switch (grabStatus) {
case XlibWrapper.GrabNotViewable: msgCause = "not viewable"; break; case XConstants.GrabNotViewable: msgCause = "not viewable"; break;
case XlibWrapper.AlreadyGrabbed: msgCause = "already grabbed"; break; case XConstants.AlreadyGrabbed: msgCause = "already grabbed"; break;
case XlibWrapper.GrabInvalidTime: msgCause = "invalid time"; break; case XConstants.GrabInvalidTime: msgCause = "invalid time"; break;
case XlibWrapper.GrabFrozen: msgCause = "grab frozen"; break; case XConstants.GrabFrozen: msgCause = "grab frozen"; break;
default: msgCause = "unknown failure"; break; default: msgCause = "unknown failure"; break;
} }
throw new InvalidDnDOperationException(msg + ": " + msgCause); throw new InvalidDnDOperationException(msg + ": " + msgCause);
...@@ -537,7 +537,7 @@ public final class XDragSourceContextPeer ...@@ -537,7 +537,7 @@ public final class XDragSourceContextPeer
return false; return false;
} }
if (ev.get_type() != (int)XlibWrapper.ClientMessage) { if (ev.get_type() != (int)XConstants.ClientMessage) {
return false; return false;
} }
...@@ -579,18 +579,18 @@ public final class XDragSourceContextPeer ...@@ -579,18 +579,18 @@ public final class XDragSourceContextPeer
} }
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.ClientMessage: { case XConstants.ClientMessage: {
XClientMessageEvent xclient = ev.get_xclient(); XClientMessageEvent xclient = ev.get_xclient();
return processClientMessage(xclient); return processClientMessage(xclient);
} }
case XlibWrapper.DestroyNotify: { case XConstants.DestroyNotify: {
XDestroyWindowEvent xde = ev.get_xdestroywindow(); XDestroyWindowEvent xde = ev.get_xdestroywindow();
/* Target crashed during drop processing - cleanup. */ /* Target crashed during drop processing - cleanup. */
if (!dragInProgress && if (!dragInProgress &&
dragProtocol != null && dragProtocol != null &&
xde.get_window() == dragProtocol.getTargetWindow()) { xde.get_window() == dragProtocol.getTargetWindow()) {
cleanup(XlibWrapper.CurrentTime); cleanup(XConstants.CurrentTime);
return true; return true;
} }
/* Pass along */ /* Pass along */
...@@ -604,14 +604,14 @@ public final class XDragSourceContextPeer ...@@ -604,14 +604,14 @@ public final class XDragSourceContextPeer
/* Process drag-only messages. */ /* Process drag-only messages. */
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.KeyRelease: case XConstants.KeyRelease:
case XlibWrapper.KeyPress: { case XConstants.KeyPress: {
XKeyEvent xkey = ev.get_xkey(); XKeyEvent xkey = ev.get_xkey();
long keysym = XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), long keysym = XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(),
xkey.get_keycode(), 0); xkey.get_keycode(), 0);
switch ((int)keysym) { switch ((int)keysym) {
case (int)XKeySymConstants.XK_Escape: { case (int)XKeySymConstants.XK_Escape: {
if (ev.get_type() == (int)XlibWrapper.KeyRelease) { if (ev.get_type() == (int)XConstants.KeyRelease) {
cleanup(xkey.get_time()); cleanup(xkey.get_time());
} }
break; break;
...@@ -631,7 +631,7 @@ public final class XDragSourceContextPeer ...@@ -631,7 +631,7 @@ public final class XDragSourceContextPeer
XlibWrapper.larg7); // modifiers XlibWrapper.larg7); // modifiers
XMotionEvent xmotion = new XMotionEvent(); XMotionEvent xmotion = new XMotionEvent();
try { try {
xmotion.set_type(XlibWrapper.MotionNotify); xmotion.set_type(XConstants.MotionNotify);
xmotion.set_serial(xkey.get_serial()); xmotion.set_serial(xkey.get_serial());
xmotion.set_send_event(xkey.get_send_event()); xmotion.set_send_event(xkey.get_send_event());
xmotion.set_display(xkey.get_display()); xmotion.set_display(xkey.get_display());
...@@ -658,12 +658,12 @@ public final class XDragSourceContextPeer ...@@ -658,12 +658,12 @@ public final class XDragSourceContextPeer
} }
return true; return true;
} }
case XlibWrapper.ButtonPress: case XConstants.ButtonPress:
return true; return true;
case XlibWrapper.MotionNotify: case XConstants.MotionNotify:
processMouseMove(ev.get_xmotion()); processMouseMove(ev.get_xmotion());
return true; return true;
case XlibWrapper.ButtonRelease: { case XConstants.ButtonRelease: {
XButtonEvent xbutton = ev.get_xbutton(); XButtonEvent xbutton = ev.get_xbutton();
/* /*
* On some X servers it could happen that ButtonRelease coordinates * On some X servers it could happen that ButtonRelease coordinates
...@@ -672,7 +672,7 @@ public final class XDragSourceContextPeer ...@@ -672,7 +672,7 @@ public final class XDragSourceContextPeer
*/ */
XMotionEvent xmotion = new XMotionEvent(); XMotionEvent xmotion = new XMotionEvent();
try { try {
xmotion.set_type(XlibWrapper.MotionNotify); xmotion.set_type(XConstants.MotionNotify);
xmotion.set_serial(xbutton.get_serial()); xmotion.set_serial(xbutton.get_serial());
xmotion.set_send_event(xbutton.get_send_event()); xmotion.set_send_event(xbutton.get_send_event());
xmotion.set_display(xbutton.get_display()); xmotion.set_display(xbutton.get_display());
...@@ -694,8 +694,8 @@ public final class XDragSourceContextPeer ...@@ -694,8 +694,8 @@ public final class XDragSourceContextPeer
} finally { } finally {
xmotion.dispose(); xmotion.dispose();
} }
if (xbutton.get_button() == XlibWrapper.Button1 if (xbutton.get_button() == XConstants.Button1
|| xbutton.get_button() == XlibWrapper.Button2) { || xbutton.get_button() == XConstants.Button2) {
// drag is initiated with Button1 or Button2 pressed and // drag is initiated with Button1 or Button2 pressed and
// ended on release of either of these buttons (as the same // ended on release of either of these buttons (as the same
// behavior was with our old Motif DnD-based implementation) // behavior was with our old Motif DnD-based implementation)
...@@ -789,6 +789,6 @@ public final class XDragSourceContextPeer ...@@ -789,6 +789,6 @@ public final class XDragSourceContextPeer
dragDropFinished(success, action, x, y); dragDropFinished(success, action, x, y);
dndInProgress = false; dndInProgress = false;
cleanup(XlibWrapper.CurrentTime); cleanup(XConstants.CurrentTime);
} }
} }
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -189,7 +189,7 @@ abstract class XDragSourceProtocol { ...@@ -189,7 +189,7 @@ abstract class XDragSourceProtocol {
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed"); throw new XException("XGetWindowAttributes failed");
} }
...@@ -201,12 +201,12 @@ abstract class XDragSourceProtocol { ...@@ -201,12 +201,12 @@ abstract class XDragSourceProtocol {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow, XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
targetWindowMask | targetWindowMask |
XlibWrapper.StructureNotifyMask); XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed"); throw new XException("XSelectInput failed");
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -43,7 +43,7 @@ final class XDropTargetEventProcessor { ...@@ -43,7 +43,7 @@ final class XDropTargetEventProcessor {
private XDropTargetEventProcessor() {} private XDropTargetEventProcessor() {}
private boolean doProcessEvent(XEvent ev) { private boolean doProcessEvent(XEvent ev) {
if (ev.get_type() == (int)XlibWrapper.DestroyNotify && if (ev.get_type() == (int)XConstants.DestroyNotify &&
protocol != null && protocol != null &&
ev.get_xany().get_window() == protocol.getSourceWindow()) { ev.get_xany().get_window() == protocol.getSourceWindow()) {
protocol.cleanup(); protocol.cleanup();
...@@ -51,7 +51,7 @@ final class XDropTargetEventProcessor { ...@@ -51,7 +51,7 @@ final class XDropTargetEventProcessor {
return false; return false;
} }
if (ev.get_type() == (int)XlibWrapper.PropertyNotify) { if (ev.get_type() == (int)XConstants.PropertyNotify) {
XPropertyEvent xproperty = ev.get_xproperty(); XPropertyEvent xproperty = ev.get_xproperty();
if (xproperty.get_atom() == if (xproperty.get_atom() ==
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom()) { MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom()) {
...@@ -60,7 +60,7 @@ final class XDropTargetEventProcessor { ...@@ -60,7 +60,7 @@ final class XDropTargetEventProcessor {
} }
} }
if (ev.get_type() != (int)XlibWrapper.ClientMessage) { if (ev.get_type() != (int)XConstants.ClientMessage) {
return false; return false;
} }
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -149,7 +149,7 @@ abstract class XDropTargetProtocol { ...@@ -149,7 +149,7 @@ abstract class XDropTargetProtocol {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), proxy, false, XlibWrapper.XSendEvent(XToolkit.getDisplay(), proxy, false,
XlibWrapper.NoEventMask, xclient.pData); XConstants.NoEventMask, xclient.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
......
/* /*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,18 +27,14 @@ package sun.awt.X11; ...@@ -27,18 +27,14 @@ package sun.awt.X11;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.logging.*; import java.util.logging.*;
import java.awt.Point; import java.awt.Point;
import sun.awt.dnd.SunDropTargetContextPeer;
import sun.awt.dnd.SunDropTargetEvent;
/** /**
* The class responsible for registration/deregistration of drop sites. * The class responsible for registration/deregistration of drop sites.
...@@ -179,11 +175,11 @@ final class XDropTargetRegistry { ...@@ -179,11 +175,11 @@ final class XDropTargetRegistry {
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
continue; continue;
} }
if (wattr.get_map_state() != XlibWrapper.IsUnmapped if (wattr.get_map_state() != XConstants.IsUnmapped
&& dest_x < wattr.get_width() && dest_x < wattr.get_width()
&& dest_y < wattr.get_height()) { && dest_y < wattr.get_height()) {
return window; return window;
...@@ -233,7 +229,7 @@ final class XDropTargetRegistry { ...@@ -233,7 +229,7 @@ final class XDropTargetRegistry {
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed"); throw new XException("XGetWindowAttributes failed");
} }
...@@ -243,14 +239,14 @@ final class XDropTargetRegistry { ...@@ -243,14 +239,14 @@ final class XDropTargetRegistry {
wattr.dispose(); wattr.dispose();
} }
if ((event_mask & XlibWrapper.PropertyChangeMask) == 0) { if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder, XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
event_mask | XlibWrapper.PropertyChangeMask); event_mask | XConstants.PropertyChangeMask);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed"); throw new XException("XSelectInput failed");
} }
} }
...@@ -397,14 +393,14 @@ final class XDropTargetRegistry { ...@@ -397,14 +393,14 @@ final class XDropTargetRegistry {
long event_mask = entry.getEventMask(); long event_mask = entry.getEventMask();
/* Restore the original event mask for the embedder. */ /* Restore the original event mask for the embedder. */
if ((event_mask & XlibWrapper.PropertyChangeMask) == 0) { if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler); XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder, XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
event_mask); event_mask);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed"); throw new XException("XSelectInput failed");
} }
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -81,10 +81,10 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -81,10 +81,10 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
super.preInit(params); super.preInit(params);
params.put(EVENT_MASK, params.put(EVENT_MASK,
KeyPressMask | KeyReleaseMask XConstants.KeyPressMask | XConstants.KeyReleaseMask
| FocusChangeMask | ButtonPressMask | ButtonReleaseMask | XConstants.FocusChangeMask | XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
| EnterWindowMask | LeaveWindowMask | PointerMotionMask | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
| ButtonMotionMask | ExposureMask | StructureNotifyMask | SubstructureNotifyMask); | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask | XConstants.SubstructureNotifyMask);
} }
...@@ -134,7 +134,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -134,7 +134,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
try { try {
XToolkit.addEventDispatcher(xembed.handle, xembed); XToolkit.addEventDispatcher(xembed.handle, xembed);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), xembed.handle, XlibWrapper.XSelectInput(XToolkit.getDisplay(), xembed.handle,
XlibWrapper.StructureNotifyMask | XlibWrapper.PropertyChangeMask); XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
XDropTargetRegistry.getRegistry().registerXEmbedClient(getWindow(), xembed.handle); XDropTargetRegistry.getRegistry().registerXEmbedClient(getWindow(), xembed.handle);
} finally { } finally {
...@@ -194,7 +194,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -194,7 +194,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
super.dispatchEvent(ev); super.dispatchEvent(ev);
switch (ev.get_type()) { switch (ev.get_type()) {
case CreateNotify: case XConstants.CreateNotify:
XCreateWindowEvent cr = ev.get_xcreatewindow(); XCreateWindowEvent cr = ev.get_xcreatewindow();
if (xembedLog.isLoggable(Level.FINEST)) { if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + cr); xembedLog.finest("Message on embedder: " + cr);
...@@ -205,7 +205,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -205,7 +205,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
embedChild(cr.get_window()); embedChild(cr.get_window());
break; break;
case DestroyNotify: case XConstants.DestroyNotify:
XDestroyWindowEvent dn = ev.get_xdestroywindow(); XDestroyWindowEvent dn = ev.get_xdestroywindow();
if (xembedLog.isLoggable(Level.FINEST)) { if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + dn); xembedLog.finest("Message on embedder: " + dn);
...@@ -215,7 +215,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -215,7 +215,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
childDestroyed(); childDestroyed();
break; break;
case ReparentNotify: case XConstants.ReparentNotify:
XReparentEvent rep = ev.get_xreparent(); XReparentEvent rep = ev.get_xreparent();
if (xembedLog.isLoggable(Level.FINEST)) { if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + rep); xembedLog.finest("Message on embedder: " + rep);
...@@ -309,7 +309,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -309,7 +309,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
if (status == 0 || if (status == 0 ||
(XToolkit.saved_error != null && (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) { XToolkit.saved_error.get_error_code() != XConstants.Success)) {
return null; return null;
} }
...@@ -480,7 +480,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -480,7 +480,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding native key event: " + ke); if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding native key event: " + ke);
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XlibWrapper.NoEventMask, data); XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
...@@ -742,7 +742,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -742,7 +742,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
version = Native.getCard32(xembed_info_data, 0); version = Native.getCard32(xembed_info_data, 0);
flags = Native.getCard32(xembed_info_data, 1); flags = Native.getCard32(xembed_info_data, 1);
boolean new_mapped = (flags & XEMBED_MAPPED) != 0; boolean new_mapped = (flags & XEMBED_MAPPED) != 0;
boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XlibWrapper.IsUnmapped; boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped;
if (new_mapped != currently_mapped) { if (new_mapped != currently_mapped) {
if (xembedLog.isLoggable(Level.FINER)) if (xembedLog.isLoggable(Level.FINER))
xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped); xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped);
...@@ -803,13 +803,13 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -803,13 +803,13 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
public void dispatchEvent(XEvent xev) { public void dispatchEvent(XEvent xev) {
int type = xev.get_type(); int type = xev.get_type();
switch (type) { switch (type) {
case PropertyNotify: case XConstants.PropertyNotify:
handlePropertyNotify(xev); handlePropertyNotify(xev);
break; break;
case ConfigureNotify: case XConstants.ConfigureNotify:
handleConfigureNotify(xev); handleConfigureNotify(xev);
break; break;
case ClientMessage: case XConstants.ClientMessage:
handleClientMessage(xev); handleClientMessage(xev);
break; break;
} }
...@@ -844,7 +844,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener ...@@ -844,7 +844,7 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
XKeyEvent ke = new XKeyEvent(data); XKeyEvent ke = new XKeyEvent(data);
// We recognize only these masks // We recognize only these masks
modifiers = ke.get_state() & (ShiftMask | ControlMask | LockMask); modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask);
if (xembedLog.isLoggable(Level.FINEST)) xembedLog.finest("Mapped " + e + " to " + this); if (xembedLog.isLoggable(Level.FINEST)) xembedLog.finest("Mapped " + e + " to " + this);
} finally { } finally {
XlibWrapper.unsafe.freeMemory(data); XlibWrapper.unsafe.freeMemory(data);
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -53,7 +53,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{ ...@@ -53,7 +53,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
try { try {
XToolkit.addEventDispatcher(handle, this); XToolkit.addEventDispatcher(handle, this);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), handle, XlibWrapper.XSelectInput(XToolkit.getDisplay(), handle,
XlibWrapper.StructureNotifyMask | XlibWrapper.PropertyChangeMask); XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
} }
finally { finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -341,10 +341,10 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{ ...@@ -341,10 +341,10 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
public void dispatchEvent(XEvent xev) { public void dispatchEvent(XEvent xev) {
int type = xev.get_type(); int type = xev.get_type();
switch (type) { switch (type) {
case XlibWrapper.PropertyNotify: case XConstants.PropertyNotify:
handlePropertyNotify(xev); handlePropertyNotify(xev);
break; break;
case XlibWrapper.ConfigureNotify: case XConstants.ConfigureNotify:
handleConfigureNotify(xev); handleConfigureNotify(xev);
break; break;
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -145,10 +145,10 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher ...@@ -145,10 +145,10 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher
public void dispatchEvent(XEvent xev) { public void dispatchEvent(XEvent xev) {
switch(xev.get_type()) { switch(xev.get_type()) {
case XlibWrapper.ClientMessage: case XConstants.ClientMessage:
handleClientMessage(xev); handleClientMessage(xev);
break; break;
case XlibWrapper.ReparentNotify: case XConstants.ReparentNotify:
handleReparentNotify(xev); handleReparentNotify(xev);
break; break;
} }
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -94,7 +94,7 @@ public class XEmbedHelper { ...@@ -94,7 +94,7 @@ public class XEmbedHelper {
} }
void sendMessage(long window, int message, long detail, long data1, long data2) { void sendMessage(long window, int message, long detail, long data1, long data2) {
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
msg.set_type((int)XlibWrapper.ClientMessage); msg.set_type((int)XConstants.ClientMessage);
msg.set_window(window); msg.set_window(window);
msg.set_message_type(XEmbed.getAtom()); msg.set_message_type(XEmbed.getAtom());
msg.set_format(32); msg.set_format(32);
...@@ -106,7 +106,7 @@ public class XEmbedHelper { ...@@ -106,7 +106,7 @@ public class XEmbedHelper {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg)); if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg));
XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XlibWrapper.NoEventMask, msg.pData); XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
} }
finally { finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -260,7 +260,7 @@ public class XEmbedServerTester implements XEventDispatcher { ...@@ -260,7 +260,7 @@ public class XEmbedServerTester implements XEventDispatcher {
mapped = 0; mapped = 0;
embedCompletely(); embedCompletely();
sleep(1000); sleep(1000);
if (XlibUtil.getWindowMapState(window.getWindow()) != XlibWrapper.IsUnmapped) { if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
throw new RuntimeException("Client has been mapped"); throw new RuntimeException("Client has been mapped");
} }
} }
...@@ -613,12 +613,12 @@ public class XEmbedServerTester implements XEventDispatcher { ...@@ -613,12 +613,12 @@ public class XEmbedServerTester implements XEventDispatcher {
} }
} }
private void checkMapped() { private void checkMapped() {
if (XlibUtil.getWindowMapState(window.getWindow()) == XlibWrapper.IsUnmapped) { if (XlibUtil.getWindowMapState(window.getWindow()) == IsUnmapped) {
throw new RuntimeException("Client is not mapped"); throw new RuntimeException("Client is not mapped");
} }
} }
private void checkNotMapped() { private void checkNotMapped() {
if (XlibUtil.getWindowMapState(window.getWindow()) != XlibWrapper.IsUnmapped) { if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
throw new RuntimeException("Client is mapped"); throw new RuntimeException("Client is mapped");
} }
} }
......
/* /*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -114,8 +114,8 @@ public class XEmbeddedFramePeer extends XFramePeer { ...@@ -114,8 +114,8 @@ public class XEmbeddedFramePeer extends XFramePeer {
protected boolean isEventDisabled(XEvent e) { protected boolean isEventDisabled(XEvent e) {
if (embedder != null && embedder.isActive()) { if (embedder != null && embedder.isActive()) {
switch (e.get_type()) { switch (e.get_type()) {
case FocusIn: case XConstants.FocusIn:
case FocusOut: case XConstants.FocusOut:
return true; return true;
} }
} }
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -121,7 +121,7 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche ...@@ -121,7 +121,7 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche
} }
public void dispatchEvent(XEvent xev) { public void dispatchEvent(XEvent xev) {
switch(xev.get_type()) { switch(xev.get_type()) {
case XlibWrapper.ClientMessage: case XConstants.ClientMessage:
handleClientMessage(xev); handleClientMessage(xev);
break; break;
} }
...@@ -149,7 +149,7 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche ...@@ -149,7 +149,7 @@ public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatche
ke.set_window(child); ke.set_window(child);
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), child, false, XlibWrapper.NoEventMask, data); XlibWrapper.XSendEvent(XToolkit.getDisplay(), child, false, XConstants.NoEventMask, data);
} }
finally { finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -41,7 +41,7 @@ public class XFocusProxyWindow extends XBaseWindow { ...@@ -41,7 +41,7 @@ public class XFocusProxyWindow extends XBaseWindow {
super(new XCreateWindowParams(new Object[] { super(new XCreateWindowParams(new Object[] {
BOUNDS, new Rectangle(-1, -1, 1, 1), BOUNDS, new Rectangle(-1, -1, 1, 1),
PARENT_WINDOW, new Long(owner.getWindow()), PARENT_WINDOW, new Long(owner.getWindow()),
EVENT_MASK, new Long(FocusChangeMask | KeyPressMask | KeyReleaseMask) EVENT_MASK, new Long(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)
})); }));
this.owner = owner; this.owner = owner;
} }
...@@ -67,8 +67,8 @@ public class XFocusProxyWindow extends XBaseWindow { ...@@ -67,8 +67,8 @@ public class XFocusProxyWindow extends XBaseWindow {
int type = ev.get_type(); int type = ev.get_type();
switch (type) switch (type)
{ {
case XlibWrapper.FocusIn: case XConstants.FocusIn:
case XlibWrapper.FocusOut: case XConstants.FocusOut:
handleFocusEvent(ev); handleFocusEvent(ev);
break; break;
} }
......
...@@ -37,7 +37,7 @@ import java.awt.peer.FramePeer; ...@@ -37,7 +37,7 @@ import java.awt.peer.FramePeer;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants { class XFramePeer extends XDecoratedPeer implements FramePeer {
private static Logger log = Logger.getLogger("sun.awt.X11.XFramePeer"); private static Logger log = Logger.getLogger("sun.awt.X11.XFramePeer");
private static Logger stateLog = Logger.getLogger("sun.awt.X11.states"); private static Logger stateLog = Logger.getLogger("sun.awt.X11.states");
private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XFramePeer"); private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XFramePeer");
...@@ -71,7 +71,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants { ...@@ -71,7 +71,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
} else { } else {
winAttr.decorations = winAttr.AWT_DECOR_NONE; winAttr.decorations = winAttr.AWT_DECOR_NONE;
} }
winAttr.functions = MWM_FUNC_ALL; winAttr.functions = MWMConstants.MWM_FUNC_ALL;
winAttr.isResizable = true; // target.isResizable(); winAttr.isResizable = true; // target.isResizable();
winAttr.title = target.getTitle(); winAttr.title = target.getTitle();
winAttr.initialResizability = target.isResizable(); winAttr.initialResizability = target.isResizable();
...@@ -109,9 +109,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants { ...@@ -109,9 +109,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
state = winAttr.initialState; state = winAttr.initialState;
} }
if ((state & Frame.ICONIFIED) != 0) { if ((state & Frame.ICONIFIED) != 0) {
setInitialState(IconicState); setInitialState(XUtilConstants.IconicState);
} else { } else {
setInitialState(NormalState); setInitialState(XUtilConstants.NormalState);
} }
setExtendedState(state); setExtendedState(state);
} }
...@@ -221,7 +221,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants { ...@@ -221,7 +221,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XSizeHints hints = getHints(); XSizeHints hints = getHints();
hints.set_flags(hints.get_flags() | (int)XlibWrapper.PMaxSize); hints.set_flags(hints.get_flags() | (int)XUtilConstants.PMaxSize);
if (b.width != Integer.MAX_VALUE) { if (b.width != Integer.MAX_VALUE) {
hints.set_max_width(b.width); hints.set_max_width(b.width);
} else { } else {
...@@ -344,7 +344,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants { ...@@ -344,7 +344,7 @@ class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XWMHints hints = getWMHints(); XWMHints hints = getWMHints();
hints.set_flags((int)XlibWrapper.StateHint | hints.get_flags()); hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags());
hints.set_initial_state(wm_state); hints.set_initial_state(wm_state);
if (stateLog.isLoggable(Level.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state); if (stateLog.isLoggable(Level.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData); XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -229,46 +229,46 @@ public final class XGlobalCursorManager extends GlobalCursorManager { ...@@ -229,46 +229,46 @@ public final class XGlobalCursorManager extends GlobalCursorManager {
int cursorType = 0; int cursorType = 0;
switch (type) { switch (type) {
case Cursor.DEFAULT_CURSOR: case Cursor.DEFAULT_CURSOR:
cursorType = XlibWrapper.XC_left_ptr; cursorType = XCursorFontConstants.XC_left_ptr;
break; break;
case Cursor.CROSSHAIR_CURSOR: case Cursor.CROSSHAIR_CURSOR:
cursorType = XlibWrapper.XC_crosshair; cursorType = XCursorFontConstants.XC_crosshair;
break; break;
case Cursor.TEXT_CURSOR: case Cursor.TEXT_CURSOR:
cursorType = XlibWrapper.XC_xterm; cursorType = XCursorFontConstants.XC_xterm;
break; break;
case Cursor.WAIT_CURSOR: case Cursor.WAIT_CURSOR:
cursorType = XlibWrapper.XC_watch; cursorType = XCursorFontConstants.XC_watch;
break; break;
case Cursor.SW_RESIZE_CURSOR: case Cursor.SW_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_bottom_left_corner; cursorType = XCursorFontConstants.XC_bottom_left_corner;
break; break;
case Cursor.NW_RESIZE_CURSOR: case Cursor.NW_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_top_left_corner; cursorType = XCursorFontConstants.XC_top_left_corner;
break; break;
case Cursor.SE_RESIZE_CURSOR: case Cursor.SE_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_bottom_right_corner; cursorType = XCursorFontConstants.XC_bottom_right_corner;
break; break;
case Cursor.NE_RESIZE_CURSOR: case Cursor.NE_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_top_right_corner; cursorType = XCursorFontConstants.XC_top_right_corner;
break; break;
case Cursor.S_RESIZE_CURSOR: case Cursor.S_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_bottom_side; cursorType = XCursorFontConstants.XC_bottom_side;
break; break;
case Cursor.N_RESIZE_CURSOR: case Cursor.N_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_top_side; cursorType = XCursorFontConstants.XC_top_side;
break; break;
case Cursor.W_RESIZE_CURSOR: case Cursor.W_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_left_side; cursorType = XCursorFontConstants.XC_left_side;
break; break;
case Cursor.E_RESIZE_CURSOR: case Cursor.E_RESIZE_CURSOR:
cursorType = XlibWrapper.XC_right_side; cursorType = XCursorFontConstants.XC_right_side;
break; break;
case Cursor.HAND_CURSOR: case Cursor.HAND_CURSOR:
cursorType = XlibWrapper.XC_hand2; cursorType = XCursorFontConstants.XC_hand2;
break; break;
case Cursor.MOVE_CURSOR: case Cursor.MOVE_CURSOR:
cursorType = XlibWrapper.XC_fleur; cursorType = XCursorFontConstants.XC_fleur;
break; break;
} }
......
/* /*
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -293,7 +293,7 @@ public class XIconWindow extends XBaseWindow { ...@@ -293,7 +293,7 @@ public class XIconWindow extends XBaseWindow {
long dst = XlibWrapper.XCreateImage(XToolkit.getDisplay(), long dst = XlibWrapper.XCreateImage(XToolkit.getDisplay(),
visInfo.get_visual(), visInfo.get_visual(),
(int)awtImage.get_Depth(), (int)awtImage.get_Depth(),
(int)XlibWrapper.ZPixmap, (int)XConstants.ZPixmap,
0, 0,
bytes, bytes,
iconWidth, iconWidth,
...@@ -470,9 +470,9 @@ public class XIconWindow extends XBaseWindow { ...@@ -470,9 +470,9 @@ public class XIconWindow extends XBaseWindow {
params.add(BACKGROUND_PIXMAP, iconPixmap); params.add(BACKGROUND_PIXMAP, iconPixmap);
params.add(COLORMAP, adata.get_awt_cmap()); params.add(COLORMAP, adata.get_awt_cmap());
params.add(DEPTH, awtImage.get_Depth()); params.add(DEPTH, awtImage.get_Depth());
params.add(VISUAL_CLASS, (int)XlibWrapper.InputOutput); params.add(VISUAL_CLASS, (int)XConstants.InputOutput);
params.add(VISUAL, visInfo.get_visual()); params.add(VISUAL, visInfo.get_visual());
params.add(VALUE_MASK, XlibWrapper.CWBorderPixel | XlibWrapper.CWColormap | XlibWrapper.CWBackPixmap); params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen())); params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight)); params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
params.remove(DELAYED); params.remove(DELAYED);
...@@ -488,9 +488,9 @@ public class XIconWindow extends XBaseWindow { ...@@ -488,9 +488,9 @@ public class XIconWindow extends XBaseWindow {
XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow()); XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
} }
// Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate // Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
long newFlags = hints.get_flags() | XlibWrapper.IconPixmapHint | XlibWrapper.IconMaskHint; long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
if (getWindow() != 0) { if (getWindow() != 0) {
newFlags |= XlibWrapper.IconWindowHint; newFlags |= XUtilConstants.IconWindowHint;
} }
hints.set_flags(newFlags); hints.set_flags(newFlags);
hints.set_icon_pixmap(iconPixmap); hints.set_icon_pixmap(iconPixmap);
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -98,7 +98,7 @@ public class XMSelection { ...@@ -98,7 +98,7 @@ public class XMSelection {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
long root = XlibWrapper.RootWindow(display,screen); long root = XlibWrapper.RootWindow(display,screen);
XlibWrapper.XSelectInput(display, root, XlibWrapper.StructureNotifyMask); XlibWrapper.XSelectInput(display, root, XConstants.StructureNotifyMask);
XToolkit.addEventDispatcher(root, XToolkit.addEventDispatcher(root,
new XEventDispatcher() { new XEventDispatcher() {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
...@@ -130,7 +130,7 @@ public class XMSelection { ...@@ -130,7 +130,7 @@ public class XMSelection {
synchronized(this) { synchronized(this) {
setOwner(owner, screen); setOwner(owner, screen);
if (log.isLoggable(Level.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner ); if (log.isLoggable(Level.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner );
XlibWrapper.XSelectInput(display, owner, XlibWrapper.StructureNotifyMask | eventMask); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask);
XToolkit.addEventDispatcher(owner, XToolkit.addEventDispatcher(owner,
new XEventDispatcher() { new XEventDispatcher() {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
...@@ -162,7 +162,7 @@ public class XMSelection { ...@@ -162,7 +162,7 @@ public class XMSelection {
if (owner != 0) { if (owner != 0) {
setOwner(owner, screen); setOwner(owner, screen);
if (log.isLoggable(Level.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner ); if (log.isLoggable(Level.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner );
XlibWrapper.XSelectInput(display, owner, XlibWrapper.StructureNotifyMask | extra_mask); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask);
XToolkit.addEventDispatcher(owner, XToolkit.addEventDispatcher(owner,
new XEventDispatcher() { new XEventDispatcher() {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
...@@ -205,7 +205,7 @@ public class XMSelection { ...@@ -205,7 +205,7 @@ public class XMSelection {
static boolean processRootEvent(XEvent xev, int screen) { static boolean processRootEvent(XEvent xev, int screen) {
switch (xev.get_type()) { switch (xev.get_type()) {
case XlibWrapper.ClientMessage: { case XConstants.ClientMessage: {
return processClientMessage(xev, screen); return processClientMessage(xev, screen);
} }
} }
...@@ -225,7 +225,7 @@ public class XMSelection { ...@@ -225,7 +225,7 @@ public class XMSelection {
*/ */
public XMSelection (String selname) { public XMSelection (String selname) {
this(selname, XlibWrapper.PropertyChangeMask); this(selname, XConstants.PropertyChangeMask);
} }
...@@ -319,11 +319,11 @@ public class XMSelection { ...@@ -319,11 +319,11 @@ public class XMSelection {
void dispatchSelectionEvent(XEvent xev, int screen) { void dispatchSelectionEvent(XEvent xev, int screen) {
if (log.isLoggable(Level.FINE)) log.fine("Event =" + xev); if (log.isLoggable(Level.FINE)) log.fine("Event =" + xev);
if (xev.get_type() == XlibWrapper.DestroyNotify) { if (xev.get_type() == XConstants.DestroyNotify) {
XDestroyWindowEvent de = xev.get_xdestroywindow(); XDestroyWindowEvent de = xev.get_xdestroywindow();
dispatchOwnerDeath( de, screen); dispatchOwnerDeath( de, screen);
} }
else if (xev.get_type() == XlibWrapper.PropertyNotify) { else if (xev.get_type() == XConstants.PropertyNotify) {
XPropertyEvent xpe = xev.get_xproperty(); XPropertyEvent xpe = xev.get_xproperty();
dispatchSelectionChanged( xpe, screen); dispatchSelectionChanged( xpe, screen);
} }
......
...@@ -99,7 +99,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -99,7 +99,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
return; return;
} }
if (log.isLoggable(Level.FINE)) log.fine("Requesting state on " + window + " for " + state); if (log.isLoggable(Level.FINE)) log.fine("Requesting state on " + window + " for " + state);
req.set_type((int)XlibWrapper.ClientMessage); req.set_type((int)XConstants.ClientMessage);
req.set_window(window.getWindow()); req.set_window(window.getWindow());
req.set_message_type(XA_NET_WM_STATE.getAtom()); req.set_message_type(XA_NET_WM_STATE.getAtom());
req.set_format(32); req.set_format(32);
...@@ -109,7 +109,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -109,7 +109,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()), XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
false, false,
XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask, XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData); req.pData);
} }
finally { finally {
...@@ -183,7 +183,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -183,7 +183,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
if (window.isShowing()) { if (window.isShowing()) {
XClientMessageEvent req = new XClientMessageEvent(); XClientMessageEvent req = new XClientMessageEvent();
try { try {
req.set_type((int)XlibWrapper.ClientMessage); req.set_type((int)XConstants.ClientMessage);
req.set_window(window.getWindow()); req.set_window(window.getWindow());
req.set_message_type(XA_NET_WM_STATE.getAtom()); req.set_message_type(XA_NET_WM_STATE.getAtom());
req.set_format(32); req.set_format(32);
...@@ -195,7 +195,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -195,7 +195,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()), XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
false, false,
XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask, XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData); req.pData);
} }
finally { finally {
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -42,7 +42,7 @@ class XProtocol { ...@@ -42,7 +42,7 @@ class XProtocol {
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() { static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) { public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err); XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XlibWrapper.X_ChangeProperty) { if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0; return 0;
} else { } else {
return XToolkit.SAVED_ERROR_HANDLER(display, err); return XToolkit.SAVED_ERROR_HANDLER(display, err);
......
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
package sun.awt.X11; package sun.awt.X11;
public interface XProtocolConstants { final public class XProtocolConstants {
private XProtocolConstants(){}
/* Reply codes */ /* Reply codes */
public static final int X_Reply = 1 ; /* Normal reply */ public static final int X_Reply = 1 ; /* Normal reply */
public static final int X_Error = 0 ; /* Error */ public static final int X_Error = 0 ; /* Error */
......
...@@ -141,7 +141,7 @@ public final class XSelection { ...@@ -141,7 +141,7 @@ public final class XSelection {
long selection = selectionAtom.getAtom(); long selection = selectionAtom.getAtom();
// ICCCM prescribes that CurrentTime should not be used for SetSelectionOwner. // ICCCM prescribes that CurrentTime should not be used for SetSelectionOwner.
if (time == XlibWrapper.CurrentTime) { if (time == XConstants.CurrentTime) {
time = XToolkit.getCurrentServerTime(); time = XToolkit.getCurrentServerTime();
} }
...@@ -199,7 +199,7 @@ public final class XSelection { ...@@ -199,7 +199,7 @@ public final class XSelection {
WindowPropertyGetter targetsGetter = WindowPropertyGetter targetsGetter =
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(), new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom, 0, MAX_LENGTH, selectionPropertyAtom, 0, MAX_LENGTH,
true, XlibWrapper.AnyPropertyType); true, XConstants.AnyPropertyType);
try { try {
XToolkit.awtLock(); XToolkit.awtLock();
...@@ -274,7 +274,7 @@ public final class XSelection { ...@@ -274,7 +274,7 @@ public final class XSelection {
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(), new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom, 0, MAX_LENGTH, selectionPropertyAtom, 0, MAX_LENGTH,
false, // don't delete to handle INCR properly. false, // don't delete to handle INCR properly.
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
XToolkit.awtLock(); XToolkit.awtLock();
...@@ -353,7 +353,7 @@ public final class XSelection { ...@@ -353,7 +353,7 @@ public final class XSelection {
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(), new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom, selectionPropertyAtom,
0, MAX_LENGTH, false, 0, MAX_LENGTH, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
XToolkit.awtLock(); XToolkit.awtLock();
...@@ -520,7 +520,7 @@ public final class XSelection { ...@@ -520,7 +520,7 @@ public final class XSelection {
try { try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor, property, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor, property,
format, dataFormat, format, dataFormat,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
nativeDataPtr, count); nativeDataPtr, count);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -543,14 +543,14 @@ public final class XSelection { ...@@ -543,14 +543,14 @@ public final class XSelection {
boolean conversionSucceeded = false; boolean conversionSucceeded = false;
if (ownershipTime != 0 && if (ownershipTime != 0 &&
(requestTime == XlibWrapper.CurrentTime || requestTime >= ownershipTime)) (requestTime == XConstants.CurrentTime || requestTime >= ownershipTime))
{ {
// Handle MULTIPLE requests as per ICCCM. // Handle MULTIPLE requests as per ICCCM.
if (format == XDataTransferer.MULTIPLE_ATOM.getAtom()) { if (format == XDataTransferer.MULTIPLE_ATOM.getAtom()) {
conversionSucceeded = handleMultipleRequest(requestor, property); conversionSucceeded = handleMultipleRequest(requestor, property);
} else { } else {
// Support for obsolete clients as per ICCCM. // Support for obsolete clients as per ICCCM.
if (property == XlibWrapper.None) { if (property == XConstants.None) {
property = format; property = format;
} }
...@@ -564,12 +564,12 @@ public final class XSelection { ...@@ -564,12 +564,12 @@ public final class XSelection {
if (!conversionSucceeded) { if (!conversionSucceeded) {
// None property indicates conversion failure. // None property indicates conversion failure.
property = XlibWrapper.None; property = XConstants.None;
} }
XSelectionEvent xse = new XSelectionEvent(); XSelectionEvent xse = new XSelectionEvent();
try { try {
xse.set_type(XlibWrapper.SelectionNotify); xse.set_type(XConstants.SelectionNotify);
xse.set_send_event(true); xse.set_send_event(true);
xse.set_requestor(requestor); xse.set_requestor(requestor);
xse.set_selection(selectionAtom.getAtom()); xse.set_selection(selectionAtom.getAtom());
...@@ -580,7 +580,7 @@ public final class XSelection { ...@@ -580,7 +580,7 @@ public final class XSelection {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), requestor, false, XlibWrapper.XSendEvent(XToolkit.getDisplay(), requestor, false,
XlibWrapper.NoEventMask, xse.pData); XConstants.NoEventMask, xse.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
...@@ -590,7 +590,7 @@ public final class XSelection { ...@@ -590,7 +590,7 @@ public final class XSelection {
} }
private boolean handleMultipleRequest(final long requestor, long property) { private boolean handleMultipleRequest(final long requestor, long property) {
if (XlibWrapper.None == property) { if (XConstants.None == property) {
// The property cannot be None for a MULTIPLE request. // The property cannot be None for a MULTIPLE request.
return false; return false;
} }
...@@ -601,7 +601,7 @@ public final class XSelection { ...@@ -601,7 +601,7 @@ public final class XSelection {
WindowPropertyGetter wpg = WindowPropertyGetter wpg =
new WindowPropertyGetter(requestor, XAtom.get(property), new WindowPropertyGetter(requestor, XAtom.get(property),
0, MAX_LENGTH, false, 0, MAX_LENGTH, false,
XlibWrapper.AnyPropertyType); XConstants.AnyPropertyType);
try { try {
wpg.execute(); wpg.execute();
...@@ -629,7 +629,7 @@ public final class XSelection { ...@@ -629,7 +629,7 @@ public final class XSelection {
property, property,
wpg.getActualType(), wpg.getActualType(),
wpg.getActualFormat(), wpg.getActualFormat(),
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
wpg.getData(), wpg.getData(),
wpg.getNumberOfItems()); wpg.getNumberOfItems());
} finally { } finally {
...@@ -673,7 +673,7 @@ public final class XSelection { ...@@ -673,7 +673,7 @@ public final class XSelection {
try { try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor, XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor,
property, XAtom.XA_ATOM, dataFormat, property, XAtom.XA_ATOM, dataFormat,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
nativeDataPtr, count); nativeDataPtr, count);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -712,7 +712,7 @@ public final class XSelection { ...@@ -712,7 +712,7 @@ public final class XSelection {
private static class SelectionEventHandler implements XEventDispatcher { private static class SelectionEventHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.SelectionNotify: { case XConstants.SelectionNotify: {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XSelectionEvent xse = ev.get_xselection(); XSelectionEvent xse = ev.get_xselection();
...@@ -733,7 +733,7 @@ public final class XSelection { ...@@ -733,7 +733,7 @@ public final class XSelection {
} }
break; break;
} }
case XlibWrapper.SelectionRequest: { case XConstants.SelectionRequest: {
XSelectionRequestEvent xsre = ev.get_xselectionrequest(); XSelectionRequestEvent xsre = ev.get_xselectionrequest();
long atom = xsre.get_selection(); long atom = xsre.get_selection();
XSelection selection = XSelection.getSelection(XAtom.get(atom)); XSelection selection = XSelection.getSelection(XAtom.get(atom));
...@@ -743,7 +743,7 @@ public final class XSelection { ...@@ -743,7 +743,7 @@ public final class XSelection {
} }
break; break;
} }
case XlibWrapper.SelectionClear: { case XConstants.SelectionClear: {
XSelectionClearEvent xsce = ev.get_xselectionclear(); XSelectionClearEvent xsce = ev.get_xselectionclear();
long atom = xsce.get_selection(); long atom = xsce.get_selection();
XSelection selection = XSelection.getSelection(XAtom.get(atom)); XSelection selection = XSelection.getSelection(XAtom.get(atom));
...@@ -793,7 +793,7 @@ public final class XSelection { ...@@ -793,7 +793,7 @@ public final class XSelection {
wattr.pData); wattr.pData);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), requestor, XlibWrapper.XSelectInput(XToolkit.getDisplay(), requestor,
wattr.get_your_event_mask() | wattr.get_your_event_mask() |
XlibWrapper.PropertyChangeMask); XConstants.PropertyChangeMask);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
...@@ -805,10 +805,10 @@ public final class XSelection { ...@@ -805,10 +805,10 @@ public final class XSelection {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.PropertyNotify: case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty(); XPropertyEvent xpe = ev.get_xproperty();
if (xpe.get_window() == requestor && if (xpe.get_window() == requestor &&
xpe.get_state() == XlibWrapper.PropertyDelete && xpe.get_state() == XConstants.PropertyDelete &&
xpe.get_atom() == property) { xpe.get_atom() == property) {
int count = data.length - offset; int count = data.length - offset;
...@@ -834,7 +834,7 @@ public final class XSelection { ...@@ -834,7 +834,7 @@ public final class XSelection {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
requestor, property, requestor, property,
target, format, target, format,
XlibWrapper.PropModeReplace, XConstants.PropModeReplace,
nativeDataPtr, count); nativeDataPtr, count);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -853,9 +853,9 @@ public final class XSelection { ...@@ -853,9 +853,9 @@ public final class XSelection {
private static class IncrementalTransferHandler implements XEventDispatcher { private static class IncrementalTransferHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) { switch (ev.get_type()) {
case XlibWrapper.PropertyNotify: case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty(); XPropertyEvent xpe = ev.get_xproperty();
if (xpe.get_state() == XlibWrapper.PropertyNewValue && if (xpe.get_state() == XConstants.PropertyNewValue &&
xpe.get_atom() == selectionPropertyAtom.getAtom()) { xpe.get_atom() == selectionPropertyAtom.getAtom()) {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
......
/* /*
* Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -131,7 +131,7 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener { ...@@ -131,7 +131,7 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
XClientMessageEvent xev = new XClientMessageEvent(); XClientMessageEvent xev = new XClientMessageEvent();
try { try {
xev.set_type(XlibWrapper.ClientMessage); xev.set_type(XConstants.ClientMessage);
xev.set_window(win); xev.set_window(win);
xev.set_format(32); xev.set_format(32);
xev.set_message_type(_NET_SYSTEM_TRAY_OPCODE.getAtom()); xev.set_message_type(_NET_SYSTEM_TRAY_OPCODE.getAtom());
...@@ -144,7 +144,7 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener { ...@@ -144,7 +144,7 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), win, false, XlibWrapper.XSendEvent(XToolkit.getDisplay(), win, false,
XlibWrapper.NoEventMask, xev.pData); XConstants.NoEventMask, xev.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
......
...@@ -54,8 +54,7 @@ import sun.font.FontManager; ...@@ -54,8 +54,7 @@ import sun.font.FontManager;
import sun.misc.PerformanceLogger; import sun.misc.PerformanceLogger;
import sun.print.PrintJob2D; import sun.print.PrintJob2D;
public final class XToolkit extends UNIXToolkit implements Runnable, XConstants public final class XToolkit extends UNIXToolkit implements Runnable {
{
private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit"); private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit");
private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XToolkit"); private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XToolkit");
private static final Logger timeoutTaskLog = Logger.getLogger("sun.awt.X11.timeoutTask.XToolkit"); private static final Logger timeoutTaskLog = Logger.getLogger("sun.awt.X11.timeoutTask.XToolkit");
...@@ -169,7 +168,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -169,7 +168,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() { static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() {
public int handleError(long display, XErrorEvent err) { public int handleError(long display, XErrorEvent err) {
XERROR_SAVE(err); XERROR_SAVE(err);
if (err.get_error_code() == BadWindow) { if (err.get_error_code() == XConstants.BadWindow) {
return 0; return 0;
} else { } else {
return SAVED_ERROR_HANDLER(display, err); return SAVED_ERROR_HANDLER(display, err);
...@@ -425,7 +424,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -425,7 +424,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
// Only our windows guaranteely generate MotionNotify, so we // Only our windows guaranteely generate MotionNotify, so we
// should track enter/leave, to catch the moment when to // should track enter/leave, to catch the moment when to
// switch to XQueryPointer // switch to XQueryPointer
if (e.get_type() == MotionNotify) { if (e.get_type() == XConstants.MotionNotify) {
XMotionEvent ev = e.get_xmotion(); XMotionEvent ev = e.get_xmotion();
awtLock(); awtLock();
try { try {
...@@ -437,7 +436,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -437,7 +436,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
} finally { } finally {
awtUnlock(); awtUnlock();
} }
} else if (e.get_type() == LeaveNotify) { } else if (e.get_type() == XConstants.LeaveNotify) {
// Leave from our window // Leave from our window
awtLock(); awtLock();
try { try {
...@@ -445,7 +444,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -445,7 +444,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
} finally { } finally {
awtUnlock(); awtUnlock();
} }
} else if (e.get_type() == EnterNotify) { } else if (e.get_type() == XConstants.EnterNotify) {
// Entrance into our window // Entrance into our window
XCrossingEvent ev = e.get_xcrossing(); XCrossingEvent ev = e.get_xcrossing();
awtLock(); awtLock();
...@@ -492,7 +491,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -492,7 +491,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
final XAnyEvent xany = ev.get_xany(); final XAnyEvent xany = ev.get_xany();
if (windowToXWindow(xany.get_window()) != null && if (windowToXWindow(xany.get_window()) != null &&
(ev.get_type() == MotionNotify || ev.get_type() == EnterNotify || ev.get_type() == LeaveNotify)) (ev.get_type() == XConstants.MotionNotify || ev.get_type() == XConstants.EnterNotify || ev.get_type() == XConstants.LeaveNotify))
{ {
processGlobalMotionEvent(ev); processGlobalMotionEvent(ev);
} }
...@@ -549,15 +548,15 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -549,15 +548,15 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
// If no events are queued, waitForEvents() causes calls to // If no events are queued, waitForEvents() causes calls to
// awtUnlock(), awtJNI_ThreadYield, poll, awtLock(), // awtUnlock(), awtJNI_ThreadYield, poll, awtLock(),
// so it spends most of its time in poll, without holding the lock. // so it spends most of its time in poll, without holding the lock.
while ((XlibWrapper.XEventsQueued(getDisplay(), XlibWrapper.QueuedAfterReading) == 0) && while ((XlibWrapper.XEventsQueued(getDisplay(), XConstants.QueuedAfterReading) == 0) &&
(XlibWrapper.XEventsQueued(getDisplay(), XlibWrapper.QueuedAfterFlush) == 0)) { (XlibWrapper.XEventsQueued(getDisplay(), XConstants.QueuedAfterFlush) == 0)) {
callTimeoutTasks(); callTimeoutTasks();
waitForEvents(getNextTaskTime()); waitForEvents(getNextTaskTime());
} }
XlibWrapper.XNextEvent(getDisplay(),ev.pData); XlibWrapper.XNextEvent(getDisplay(),ev.pData);
} }
if (ev.get_type() != NoExpose) { if (ev.get_type() != XConstants.NoExpose) {
eventNumber++; eventNumber++;
} }
...@@ -582,13 +581,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -582,13 +581,13 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
} }
} }
} }
if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == KeyPress || ev.get_type() == KeyRelease) ) { if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) {
keyEventLog.fine("before XFilterEvent:"+ev); keyEventLog.fine("before XFilterEvent:"+ev);
} }
if (XlibWrapper.XFilterEvent(ev.getPData(), w)) { if (XlibWrapper.XFilterEvent(ev.getPData(), w)) {
continue; continue;
} }
if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == KeyPress || ev.get_type() == KeyRelease) ) { if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) {
keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT? keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT?
} }
...@@ -750,7 +749,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -750,7 +749,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
* _NET_WM_STRUT[_PARTIAL] hints for iconified windows * _NET_WM_STRUT[_PARTIAL] hints for iconified windows
* are not included to the screen insets. * are not included to the screen insets.
*/ */
if (XlibUtil.getWindowMapState(window) == XlibWrapper.IsUnmapped) if (XlibUtil.getWindowMapState(window) == XConstants.IsUnmapped)
{ {
continue; continue;
} }
...@@ -1289,7 +1288,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -1289,7 +1288,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
new XEventDispatcher() { new XEventDispatcher() {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) { switch (ev.get_type()) {
case PropertyNotify: case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty(); XPropertyEvent xpe = ev.get_xproperty();
awtLock(); awtLock();
...@@ -1322,7 +1321,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -1322,7 +1321,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
XBaseWindow.getXAWTRootWindow().getWindow(), XBaseWindow.getXAWTRootWindow().getWindow(),
_XA_JAVA_TIME_PROPERTY_ATOM.getAtom(), XAtom.XA_ATOM, 32, _XA_JAVA_TIME_PROPERTY_ATOM.getAtom(), XAtom.XA_ATOM, 32,
PropModeAppend, XConstants.PropModeAppend,
0, 0); 0, 0);
XlibWrapper.XFlush(XToolkit.getDisplay()); XlibWrapper.XFlush(XToolkit.getDisplay());
...@@ -1539,8 +1538,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -1539,8 +1538,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
final int shiftLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Shift_Lock); final int shiftLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Shift_Lock);
final int capsLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Caps_Lock); final int capsLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Caps_Lock);
final int modmask[] = { ShiftMask, LockMask, ControlMask, Mod1Mask, final int modmask[] = { XConstants.ShiftMask, XConstants.LockMask, XConstants.ControlMask, XConstants.Mod1Mask,
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; XConstants.Mod2Mask, XConstants.Mod3Mask, XConstants.Mod4Mask, XConstants.Mod5Mask };
log.fine("In setupModifierMap"); log.fine("In setupModifierMap");
awtLock(); awtLock();
...@@ -2047,7 +2046,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -2047,7 +2046,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
if (oops_waiter == null) { if (oops_waiter == null) {
oops_waiter = new XEventDispatcher() { oops_waiter = new XEventDispatcher() {
public void dispatchEvent(XEvent e) { public void dispatchEvent(XEvent e) {
if (e.get_type() == SelectionNotify) { if (e.get_type() == XConstants.SelectionNotify) {
XSelectionEvent pe = e.get_xselection(); XSelectionEvent pe = e.get_xselection();
if (pe.get_property() == oops.getAtom()) { if (pe.get_property() == oops.getAtom()) {
oops_updated = true; oops_updated = true;
...@@ -2083,7 +2082,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants ...@@ -2083,7 +2082,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())}); eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())});
XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(), XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
XAtom.get("VERSION").getAtom(), oops.getAtom(), XAtom.get("VERSION").getAtom(), oops.getAtom(),
win.getWindow(), XlibWrapper.CurrentTime); win.getWindow(), XConstants.CurrentTime);
XSync(); XSync();
......
...@@ -98,7 +98,7 @@ public class XTrayIconPeer implements TrayIconPeer { ...@@ -98,7 +98,7 @@ public class XTrayIconPeer implements TrayIconPeer {
parentXED = new XEventDispatcher() { parentXED = new XEventDispatcher() {
// It's executed under AWTLock. // It's executed under AWTLock.
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
if (isDisposed() || ev.get_type() != XlibWrapper.ConfigureNotify) { if (isDisposed() || ev.get_type() != XConstants.ConfigureNotify) {
return; return;
} }
...@@ -194,7 +194,7 @@ public class XTrayIconPeer implements TrayIconPeer { ...@@ -194,7 +194,7 @@ public class XTrayIconPeer implements TrayIconPeer {
XTrayIconPeer xtiPeer = XTrayIconPeer.this; XTrayIconPeer xtiPeer = XTrayIconPeer.this;
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
if (isDisposed() || ev.get_type() != XlibWrapper.ReparentNotify) { if (isDisposed() || ev.get_type() != XConstants.ReparentNotify) {
return; return;
} }
...@@ -214,7 +214,7 @@ public class XTrayIconPeer implements TrayIconPeer { ...@@ -214,7 +214,7 @@ public class XTrayIconPeer implements TrayIconPeer {
} }
if (!isTrayIconDisplayed) { if (!isTrayIconDisplayed) {
addXED(eframeParentID, parentXED, XlibWrapper.StructureNotifyMask); addXED(eframeParentID, parentXED, XConstants.StructureNotifyMask);
isTrayIconDisplayed = true; isTrayIconDisplayed = true;
XToolkit.awtLockNotifyAll(); XToolkit.awtLockNotifyAll();
...@@ -222,7 +222,7 @@ public class XTrayIconPeer implements TrayIconPeer { ...@@ -222,7 +222,7 @@ public class XTrayIconPeer implements TrayIconPeer {
} }
}; };
addXED(getWindow(), eframeXED, XlibWrapper.StructureNotifyMask); addXED(getWindow(), eframeXED, XConstants.StructureNotifyMask);
XSystemTrayPeer.getPeerInstance().addTrayIcon(this); // throws AWTException XSystemTrayPeer.getPeerInstance().addTrayIcon(this); // throws AWTException
......
/* /*
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,10 @@ ...@@ -25,7 +25,10 @@
package sun.awt.X11; package sun.awt.X11;
public interface XUtilConstants { final public class XUtilConstants {
private XUtilConstants(){}
/* /*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string. * value (x, y, width, height) was found in the parsed string.
......
/* /*
* Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -58,7 +58,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { ...@@ -58,7 +58,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
} }
XClientMessageEvent req = new XClientMessageEvent(); XClientMessageEvent req = new XClientMessageEvent();
req.set_type(XlibWrapper.ClientMessage); req.set_type(XConstants.ClientMessage);
req.set_window(window.getWindow()); req.set_window(window.getWindow());
req.set_message_type(XA_WIN_STATE.getAtom()); req.set_message_type(XA_WIN_STATE.getAtom());
req.set_format(32); req.set_format(32);
...@@ -71,7 +71,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { ...@@ -71,7 +71,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
XlibWrapper.RootWindow(XToolkit.getDisplay(), XlibWrapper.RootWindow(XToolkit.getDisplay(),
window.getScreenNumber()), window.getScreenNumber()),
false, false,
XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask, XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData); req.pData);
} }
finally { finally {
...@@ -150,7 +150,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { ...@@ -150,7 +150,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
public void setLayer(XWindowPeer window, int layer) { public void setLayer(XWindowPeer window, int layer) {
if (window.isShowing()) { if (window.isShowing()) {
XClientMessageEvent req = new XClientMessageEvent(); XClientMessageEvent req = new XClientMessageEvent();
req.set_type(XlibWrapper.ClientMessage); req.set_type(XConstants.ClientMessage);
req.set_window(window.getWindow()); req.set_window(window.getWindow());
req.set_message_type(XA_WIN_LAYER.getAtom()); req.set_message_type(XA_WIN_LAYER.getAtom());
req.set_format(32); req.set_format(32);
...@@ -164,7 +164,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { ...@@ -164,7 +164,7 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
XlibWrapper.RootWindow(XToolkit.getDisplay(), XlibWrapper.RootWindow(XToolkit.getDisplay(),
window.getScreenNumber()), window.getScreenNumber()),
false, false,
/*XlibWrapper.SubstructureRedirectMask | */XlibWrapper.SubstructureNotifyMask, /*XConstants.SubstructureRedirectMask | */XConstants.SubstructureNotifyMask,
req.pData); req.pData);
} }
finally { finally {
......
...@@ -46,7 +46,7 @@ import java.util.regex.Pattern; ...@@ -46,7 +46,7 @@ import java.util.regex.Pattern;
* Class incapsulating knowledge about window managers in general * Class incapsulating knowledge about window managers in general
* Descendants should provide some information about specific window manager. * Descendants should provide some information about specific window manager.
*/ */
final class XWM implements MWMConstants, XUtilConstants final class XWM
{ {
private final static Logger log = Logger.getLogger("sun.awt.X11.XWM"); private final static Logger log = Logger.getLogger("sun.awt.X11.XWM");
...@@ -274,12 +274,12 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -274,12 +274,12 @@ final class XWM implements MWMConstants, XUtilConstants
} }
winmgr_running = false; winmgr_running = false;
substruct.set_event_mask(XlibWrapper.SubstructureRedirectMask); substruct.set_event_mask(XConstants.SubstructureRedirectMask);
XToolkit.WITH_XERROR_HANDLER(DetectWMHandler); XToolkit.WITH_XERROR_HANDLER(DetectWMHandler);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(), XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
XlibWrapper.CWEventMask, XConstants.CWEventMask,
substruct.pData); substruct.pData);
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
...@@ -291,7 +291,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -291,7 +291,7 @@ final class XWM implements MWMConstants, XUtilConstants
substruct.set_event_mask(0); substruct.set_event_mask(0);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(), XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
XlibWrapper.CWEventMask, XConstants.CWEventMask,
substruct.pData); substruct.pData);
if (insLog.isLoggable(Level.FINE)) { if (insLog.isLoggable(Level.FINE)) {
insLog.finer("It looks like there is no WM thus NO_WM"); insLog.finer("It looks like there is no WM thus NO_WM");
...@@ -322,7 +322,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -322,7 +322,7 @@ final class XWM implements MWMConstants, XUtilConstants
XAtom.XA_STRING); XAtom.XA_STRING);
try { try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler); int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return 0; return 0;
} }
...@@ -411,7 +411,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -411,7 +411,7 @@ final class XWM implements MWMConstants, XUtilConstants
false, XA_DT_SM_WINDOW_INFO); false, XA_DT_SM_WINDOW_INFO);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
log.finer("Getting of _DT_SM_WINDOW_INFO is not successfull"); log.finer("Getting of _DT_SM_WINDOW_INFO is not successfull");
return false; return false;
} }
...@@ -442,7 +442,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -442,7 +442,7 @@ final class XWM implements MWMConstants, XUtilConstants
status = getter2.execute(XToolkit.IgnoreBadWindowHandler); status = getter2.execute(XToolkit.IgnoreBadWindowHandler);
if (status != XlibWrapper.Success || getter2.getData() == 0) { if (status != XConstants.Success || getter2.getData() == 0) {
log.finer("Getting of _DT_SM_STATE_INFO is not successfull"); log.finer("Getting of _DT_SM_STATE_INFO is not successfull");
return false; return false;
} }
...@@ -480,18 +480,18 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -480,18 +480,18 @@ final class XWM implements MWMConstants, XUtilConstants
WindowPropertyGetter getter = WindowPropertyGetter getter =
new WindowPropertyGetter(XToolkit.getDefaultRootWindow(), new WindowPropertyGetter(XToolkit.getDefaultRootWindow(),
XA_MOTIF_WM_INFO, 0, XA_MOTIF_WM_INFO, 0,
PROP_MOTIF_WM_INFO_ELEMENTS, MWMConstants.PROP_MOTIF_WM_INFO_ELEMENTS,
false, XA_MOTIF_WM_INFO); false, XA_MOTIF_WM_INFO);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return false; return false;
} }
if (getter.getActualType() != XA_MOTIF_WM_INFO.getAtom() if (getter.getActualType() != XA_MOTIF_WM_INFO.getAtom()
|| getter.getActualFormat() != 32 || getter.getActualFormat() != 32
|| getter.getNumberOfItems() != PROP_MOTIF_WM_INFO_ELEMENTS || getter.getNumberOfItems() != MWMConstants.PROP_MOTIF_WM_INFO_ELEMENTS
|| getter.getBytesAfter() != 0) || getter.getBytesAfter() != 0)
{ {
return false; return false;
...@@ -516,7 +516,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -516,7 +516,7 @@ final class XWM implements MWMConstants, XUtilConstants
0, 1, false, 0, 1, false,
XA_WM_STATE); XA_WM_STATE);
try { try {
if (state_getter.execute() == XlibWrapper.Success && if (state_getter.execute() == XConstants.Success &&
state_getter.getData() != 0 && state_getter.getData() != 0 &&
state_getter.getActualType() == XA_WM_STATE.getAtom()) state_getter.getActualType() == XA_WM_STATE.getAtom())
{ {
...@@ -577,7 +577,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -577,7 +577,7 @@ final class XWM implements MWMConstants, XUtilConstants
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() { static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) { public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err); XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XlibWrapper.X_ChangeProperty) { if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0; return 0;
} else { } else {
return XToolkit.SAVED_ERROR_HANDLER(display, err); return XToolkit.SAVED_ERROR_HANDLER(display, err);
...@@ -621,11 +621,11 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -621,11 +621,11 @@ final class XWM implements MWMConstants, XUtilConstants
XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
XA_ICEWM_WINOPTHINT.getAtom(), XA_ICEWM_WINOPTHINT.getAtom(),
XA_ICEWM_WINOPTHINT.getAtom(), XA_ICEWM_WINOPTHINT.getAtom(),
8, XlibWrapper.PropModeReplace, 8, XConstants.PropModeReplace,
new String(opt)); new String(opt));
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XlibWrapper.Success) { if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XConstants.Success) {
log.finer("Erorr getting XA_ICEWM_WINOPTHINT property"); log.finer("Erorr getting XA_ICEWM_WINOPTHINT property");
return false; return false;
} }
...@@ -654,7 +654,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -654,7 +654,7 @@ final class XWM implements MWMConstants, XUtilConstants
true, XA_ICEWM_WINOPTHINT); true, XA_ICEWM_WINOPTHINT);
try { try {
int status = getter.execute(); int status = getter.execute();
boolean res = (status == XlibWrapper.Success && getter.getActualType() != 0); boolean res = (status == XConstants.Success && getter.getActualType() != 0);
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res); log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
return !res || isNetWMName("IceWM"); return !res || isNetWMName("IceWM");
} finally { } finally {
...@@ -686,8 +686,8 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -686,8 +686,8 @@ final class XWM implements MWMConstants, XUtilConstants
static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() { static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) { public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err); XToolkit.XERROR_SAVE(err);
if (err.get_request_code() == XlibWrapper.X_ChangeWindowAttributes if (err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes
&& err.get_error_code() == XlibWrapper.BadAccess) && err.get_error_code() == XConstants.BadAccess)
{ {
winmgr_running = true; winmgr_running = true;
return 0; return 0;
...@@ -804,7 +804,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -804,7 +804,7 @@ final class XWM implements MWMConstants, XUtilConstants
* XXX: Why do we need this in the first place??? * XXX: Why do we need this in the first place???
*/ */
static void removeSizeHints(XDecoratedPeer window, long mask) { static void removeSizeHints(XDecoratedPeer window, long mask) {
mask &= PMaxSize | PMinSize; mask &= XUtilConstants.PMaxSize | XUtilConstants.PMinSize;
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
...@@ -830,13 +830,13 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -830,13 +830,13 @@ final class XWM implements MWMConstants, XUtilConstants
* rest of the code. * rest of the code.
*/ */
static int normalizeMotifDecor(int decorations) { static int normalizeMotifDecor(int decorations) {
if ((decorations & MWM_DECOR_ALL) == 0) { if ((decorations & MWMConstants.MWM_DECOR_ALL) == 0) {
return decorations; return decorations;
} }
int d = MWM_DECOR_BORDER | MWM_DECOR_RESIZEH int d = MWMConstants.MWM_DECOR_BORDER | MWMConstants.MWM_DECOR_RESIZEH
| MWM_DECOR_TITLE | MWMConstants.MWM_DECOR_TITLE
| MWM_DECOR_MENU | MWM_DECOR_MINIMIZE | MWMConstants.MWM_DECOR_MENU | MWMConstants.MWM_DECOR_MINIMIZE
| MWM_DECOR_MAXIMIZE; | MWMConstants.MWM_DECOR_MAXIMIZE;
d &= ~decorations; d &= ~decorations;
return d; return d;
} }
...@@ -848,14 +848,14 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -848,14 +848,14 @@ final class XWM implements MWMConstants, XUtilConstants
* rest of the code. * rest of the code.
*/ */
static int normalizeMotifFunc(int functions) { static int normalizeMotifFunc(int functions) {
if ((functions & MWM_FUNC_ALL) == 0) { if ((functions & MWMConstants.MWM_FUNC_ALL) == 0) {
return functions; return functions;
} }
int f = MWM_FUNC_RESIZE | int f = MWMConstants.MWM_FUNC_RESIZE |
MWM_FUNC_MOVE | MWMConstants.MWM_FUNC_MOVE |
MWM_FUNC_MAXIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE |
MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MINIMIZE |
MWM_FUNC_CLOSE; MWMConstants.MWM_FUNC_CLOSE;
f &= ~functions; f &= ~functions;
return f; return f;
} }
...@@ -872,15 +872,15 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -872,15 +872,15 @@ final class XWM implements MWMConstants, XUtilConstants
XAtomList decorDel = new XAtomList(); XAtomList decorDel = new XAtomList();
decorations = normalizeMotifDecor(decorations); decorations = normalizeMotifDecor(decorations);
if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations)); if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
if ((decorations & MWM_DECOR_TITLE) == 0) { if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
decorDel.add(XA_OL_DECOR_HEADER); decorDel.add(XA_OL_DECOR_HEADER);
} }
if ((decorations & (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE)) == 0) { if ((decorations & (MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE)) == 0) {
decorDel.add(XA_OL_DECOR_RESIZE); decorDel.add(XA_OL_DECOR_RESIZE);
} }
if ((decorations & (MWM_DECOR_MENU | if ((decorations & (MWMConstants.MWM_DECOR_MENU |
MWM_DECOR_MAXIMIZE | MWMConstants.MWM_DECOR_MAXIMIZE |
MWM_DECOR_MINIMIZE)) == 0) MWMConstants.MWM_DECOR_MINIMIZE)) == 0)
{ {
decorDel.add(XA_OL_DECOR_CLOSE); decorDel.add(XA_OL_DECOR_CLOSE);
} }
...@@ -898,19 +898,21 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -898,19 +898,21 @@ final class XWM implements MWMConstants, XUtilConstants
*/ */
static void setMotifDecor(XWindowPeer window, boolean resizable, int decorations, int functions) { static void setMotifDecor(XWindowPeer window, boolean resizable, int decorations, int functions) {
/* Apparently some WMs don't implement MWM_*_ALL semantic correctly */ /* Apparently some WMs don't implement MWM_*_ALL semantic correctly */
if ((decorations & MWM_DECOR_ALL) != 0 if ((decorations & MWMConstants.MWM_DECOR_ALL) != 0
&& (decorations != MWM_DECOR_ALL)) && (decorations != MWMConstants.MWM_DECOR_ALL))
{ {
decorations = normalizeMotifDecor(decorations); decorations = normalizeMotifDecor(decorations);
} }
if ((functions & MWM_FUNC_ALL) != 0 if ((functions & MWMConstants.MWM_FUNC_ALL) != 0
&& (functions != MWM_FUNC_ALL)) && (functions != MWMConstants.MWM_FUNC_ALL))
{ {
functions = normalizeMotifFunc(functions); functions = normalizeMotifFunc(functions);
} }
PropMwmHints hints = window.getMWMHints(); PropMwmHints hints = window.getMWMHints();
hints.set_flags(hints.get_flags() | MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS); hints.set_flags(hints.get_flags() |
MWMConstants.MWM_HINTS_FUNCTIONS |
MWMConstants.MWM_HINTS_DECORATIONS);
hints.set_functions(functions); hints.set_functions(functions);
hints.set_decorations(decorations); hints.set_decorations(decorations);
...@@ -950,10 +952,10 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -950,10 +952,10 @@ final class XWM implements MWMConstants, XUtilConstants
boolean resizable = window.isResizable(); boolean resizable = window.isResizable();
if (!resizable) { if (!resizable) {
if ((decorations & MWM_DECOR_ALL) != 0) { if ((decorations & MWMConstants.MWM_DECOR_ALL) != 0) {
decorations |= MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE; decorations |= MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE;
} else { } else {
decorations &= ~(MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE); decorations &= ~(MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE);
} }
} }
setMotifDecor(window, resizable, decorations, functions); setMotifDecor(window, resizable, decorations, functions);
...@@ -988,7 +990,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -988,7 +990,7 @@ final class XWM implements MWMConstants, XUtilConstants
/* REMINDER: will need to revisit when setExtendedStateBounds is added */ /* REMINDER: will need to revisit when setExtendedStateBounds is added */
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. //Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We need to update frame's minimum size, not to reset it //We need to update frame's minimum size, not to reset it
removeSizeHints(window, PMaxSize); removeSizeHints(window, XUtilConstants.PMaxSize);
window.updateMinimumSize(); window.updateMinimumSize();
/* Restore decorations */ /* Restore decorations */
...@@ -1134,7 +1136,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -1134,7 +1136,7 @@ final class XWM implements MWMConstants, XUtilConstants
} }
int wm_state = window.getWMState(); int wm_state = window.getWMState();
if (wm_state == XlibWrapper.WithdrawnState) { if (wm_state == XUtilConstants.WithdrawnState) {
stateLog.finer("WithdrawnState"); stateLog.finer("WithdrawnState");
return false; return false;
} else { } else {
...@@ -1158,7 +1160,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -1158,7 +1160,7 @@ final class XWM implements MWMConstants, XUtilConstants
int getState(XDecoratedPeer window) { int getState(XDecoratedPeer window) {
int res = 0; int res = 0;
final int wm_state = window.getWMState(); final int wm_state = window.getWMState();
if (wm_state == XlibWrapper.IconicState) { if (wm_state == XUtilConstants.IconicState) {
res = Frame.ICONIFIED; res = Frame.ICONIFIED;
} else { } else {
res = Frame.NORMAL; res = Frame.NORMAL;
...@@ -1397,7 +1399,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -1397,7 +1399,7 @@ final class XWM implements MWMConstants, XUtilConstants
new WindowPropertyGetter(window, atom, new WindowPropertyGetter(window, atom,
0, 4, false, XAtom.XA_CARDINAL); 0, 4, false, XAtom.XA_CARDINAL);
try { try {
if (getter.execute() != XlibWrapper.Success if (getter.execute() != XConstants.Success
|| getter.getData() == 0 || getter.getData() == 0
|| getter.getActualType() != XAtom.XA_CARDINAL || getter.getActualType() != XAtom.XA_CARDINAL
|| getter.getActualFormat() != 32) || getter.getActualFormat() != 32)
...@@ -1426,7 +1428,7 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -1426,7 +1428,7 @@ final class XWM implements MWMConstants, XUtilConstants
XClientMessageEvent msg = new XClientMessageEvent(); XClientMessageEvent msg = new XClientMessageEvent();
msg.zero(); msg.zero();
msg.set_type(XlibWrapper.ClientMessage); msg.set_type(XConstants.ClientMessage);
msg.set_display(XToolkit.getDisplay()); msg.set_display(XToolkit.getDisplay());
msg.set_window(window); msg.set_window(window);
msg.set_format(32); msg.set_format(32);
...@@ -1436,13 +1438,15 @@ final class XWM implements MWMConstants, XUtilConstants ...@@ -1436,13 +1438,15 @@ final class XWM implements MWMConstants, XUtilConstants
if (net_protocol != null && net_protocol.active()) { if (net_protocol != null && net_protocol.active()) {
msg.set_message_type(XA_NET_REQUEST_FRAME_EXTENTS.getAtom()); msg.set_message_type(XA_NET_REQUEST_FRAME_EXTENTS.getAtom());
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
false, XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask, false,
XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
msg.getPData()); msg.getPData());
} }
if (getWMID() == XWM.KDE2_WM) { if (getWMID() == XWM.KDE2_WM) {
msg.set_message_type(XA_KDE_NET_WM_FRAME_STRUT.getAtom()); msg.set_message_type(XA_KDE_NET_WM_FRAME_STRUT.getAtom());
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
false, XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask, false,
XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
msg.getPData()); msg.getPData());
} }
// XXX: should we wait for response? XIfEvent() would be useful here :) // XXX: should we wait for response? XIfEvent() would be useful here :)
......
...@@ -178,10 +178,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -178,10 +178,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
AwtGraphicsConfigData gData = getGraphicsConfigurationData(); AwtGraphicsConfigData gData = getGraphicsConfigurationData();
X11GraphicsConfig config = (X11GraphicsConfig) getGraphicsConfiguration(); X11GraphicsConfig config = (X11GraphicsConfig) getGraphicsConfiguration();
XVisualInfo visInfo = gData.get_awt_visInfo(); XVisualInfo visInfo = gData.get_awt_visInfo();
params.putIfNull(EVENT_MASK, KeyPressMask | KeyReleaseMask params.putIfNull(EVENT_MASK, XConstants.KeyPressMask | XConstants.KeyReleaseMask
| FocusChangeMask | ButtonPressMask | ButtonReleaseMask | XConstants.FocusChangeMask | XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
| EnterWindowMask | LeaveWindowMask | PointerMotionMask | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
| ButtonMotionMask | ExposureMask | StructureNotifyMask); | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask);
if (target != null) { if (target != null) {
params.putIfNull(BOUNDS, target.getBounds()); params.putIfNull(BOUNDS, target.getBounds());
...@@ -192,9 +192,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -192,9 +192,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
getColorModel(); // fix 4948833: this call forces the color map to be initialized getColorModel(); // fix 4948833: this call forces the color map to be initialized
params.putIfNull(COLORMAP, gData.get_awt_cmap()); params.putIfNull(COLORMAP, gData.get_awt_cmap());
params.putIfNull(DEPTH, gData.get_awt_depth()); params.putIfNull(DEPTH, gData.get_awt_depth());
params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XlibWrapper.InputOutput)); params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOutput));
params.putIfNull(VISUAL, visInfo.get_visual()); params.putIfNull(VISUAL, visInfo.get_visual());
params.putIfNull(VALUE_MASK, XlibWrapper.CWBorderPixel | XlibWrapper.CWEventMask | XlibWrapper.CWColormap); params.putIfNull(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWEventMask | XConstants.CWColormap);
Long parentWindow = (Long)params.get(PARENT_WINDOW); Long parentWindow = (Long)params.get(PARENT_WINDOW);
if (parentWindow == null || parentWindow.longValue() == 0) { if (parentWindow == null || parentWindow.longValue() == 0) {
XToolkit.awtLock(); XToolkit.awtLock();
...@@ -553,10 +553,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -553,10 +553,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
static int getModifiers(int state, int button, int keyCode) { static int getModifiers(int state, int button, int keyCode) {
int modifiers = 0; int modifiers = 0;
if (((state & XlibWrapper.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) { if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
modifiers |= InputEvent.SHIFT_DOWN_MASK; modifiers |= InputEvent.SHIFT_DOWN_MASK;
} }
if (((state & XlibWrapper.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) { if (((state & XConstants.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) {
modifiers |= InputEvent.CTRL_DOWN_MASK; modifiers |= InputEvent.CTRL_DOWN_MASK;
} }
if (((state & XToolkit.metaMask) != 0) ^ (keyCode == KeyEvent.VK_META)) { if (((state & XToolkit.metaMask) != 0) ^ (keyCode == KeyEvent.VK_META)) {
...@@ -568,13 +568,13 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -568,13 +568,13 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (((state & XToolkit.modeSwitchMask) != 0) ^ (keyCode == KeyEvent.VK_ALT_GRAPH)) { if (((state & XToolkit.modeSwitchMask) != 0) ^ (keyCode == KeyEvent.VK_ALT_GRAPH)) {
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK; modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
} }
if (((state & XlibWrapper.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) { if (((state & XConstants.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) {
modifiers |= InputEvent.BUTTON1_DOWN_MASK; modifiers |= InputEvent.BUTTON1_DOWN_MASK;
} }
if (((state & XlibWrapper.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) { if (((state & XConstants.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) {
modifiers |= InputEvent.BUTTON2_DOWN_MASK; modifiers |= InputEvent.BUTTON2_DOWN_MASK;
} }
if (((state & XlibWrapper.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) { if (((state & XConstants.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) {
modifiers |= InputEvent.BUTTON3_DOWN_MASK; modifiers |= InputEvent.BUTTON3_DOWN_MASK;
} }
return modifiers; return modifiers;
...@@ -584,10 +584,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -584,10 +584,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
int mods = stroke.getModifiers(); int mods = stroke.getModifiers();
int res = 0; int res = 0;
if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) { if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
res |= XToolkit.ShiftMask; res |= XConstants.ShiftMask;
} }
if ((mods & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) { if ((mods & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
res |= XToolkit.ControlMask; res |= XConstants.ControlMask;
} }
if ((mods & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) { if ((mods & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
res |= XToolkit.altMask; res |= XToolkit.altMask;
...@@ -602,12 +602,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -602,12 +602,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
private static int getButtonMask(long mouseButton) { private static int getButtonMask(long mouseButton) {
if (mouseButton == XlibWrapper.Button1) { if (mouseButton == XConstants.Button1) {
return XlibWrapper.Button1Mask; return XConstants.Button1Mask;
} else if (mouseButton == XlibWrapper.Button2) { } else if (mouseButton == XConstants.Button2) {
return XlibWrapper.Button2Mask; return XConstants.Button2Mask;
} else if (mouseButton == XlibWrapper.Button3) { } else if (mouseButton == XConstants.Button3) {
return XlibWrapper.Button3Mask; return XConstants.Button3Mask;
} }
return 0; return 0;
} }
...@@ -659,7 +659,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -659,7 +659,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
y = localXY.y; y = localXY.y;
} }
if (type == XlibWrapper.ButtonPress) { if (type == XConstants.ButtonPress) {
XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null); XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
/* /*
multiclick checking multiclick checking
...@@ -689,16 +689,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -689,16 +689,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
} }
if (lbutton == XlibWrapper.Button1) if (lbutton == XConstants.Button1)
button = MouseEvent.BUTTON1; button = MouseEvent.BUTTON1;
else if (lbutton == XlibWrapper.Button2 ) else if (lbutton == XConstants.Button2 )
button = MouseEvent.BUTTON2; button = MouseEvent.BUTTON2;
else if (lbutton == XlibWrapper.Button3) else if (lbutton == XConstants.Button3)
button = MouseEvent.BUTTON3; button = MouseEvent.BUTTON3;
else if (lbutton == XlibWrapper.Button4) { else if (lbutton == XConstants.Button4) {
button = 4; button = 4;
wheel_mouse = true; wheel_mouse = true;
} else if (lbutton == XlibWrapper.Button5) { } else if (lbutton == XConstants.Button5) {
button = 5; button = 5;
wheel_mouse = true; wheel_mouse = true;
} }
...@@ -707,7 +707,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -707,7 +707,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (!wheel_mouse) { if (!wheel_mouse) {
MouseEvent me = new MouseEvent((Component)getEventSource(), MouseEvent me = new MouseEvent((Component)getEventSource(),
type == XlibWrapper.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED, type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y, jWhen,modifiers, x, y,
xbe.get_x_root(), xbe.get_x_root(),
xbe.get_y_root(), xbe.get_y_root(),
...@@ -716,7 +716,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -716,7 +716,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
postEventToEventQueue(me); postEventToEventQueue(me);
if (((mouseDragState & getButtonMask(lbutton)) == 0) && // No up-button in the drag-state if (((mouseDragState & getButtonMask(lbutton)) == 0) && // No up-button in the drag-state
(type == XlibWrapper.ButtonRelease)) (type == XConstants.ButtonRelease))
{ {
postEventToEventQueue(me = new MouseEvent((Component)getEventSource(), postEventToEventQueue(me = new MouseEvent((Component)getEventSource(),
MouseEvent.MOUSE_CLICKED, MouseEvent.MOUSE_CLICKED,
...@@ -731,7 +731,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -731,7 +731,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
else { else {
if (xev.get_type() == XlibWrapper.ButtonPress) { if (xev.get_type() == XConstants.ButtonPress) {
MouseWheelEvent mwe = new MouseWheelEvent((Component)getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen, MouseWheelEvent mwe = new MouseWheelEvent((Component)getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
modifiers, modifiers,
x, y, x, y,
...@@ -753,7 +753,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -753,7 +753,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
return; return;
} }
int mouseKeyState = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask)); int mouseKeyState = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask));
boolean isDragging = (mouseKeyState != 0); boolean isDragging = (mouseKeyState != 0);
int mouseEventType = 0; int mouseEventType = 0;
...@@ -823,10 +823,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -823,10 +823,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
// accordingly. This leads to impossibility to make a double click on Component (6404708) // accordingly. This leads to impossibility to make a double click on Component (6404708)
XWindowPeer toplevel = getToplevelXWindow(); XWindowPeer toplevel = getToplevelXWindow();
if (toplevel != null && !toplevel.isModalBlocked()){ if (toplevel != null && !toplevel.isModalBlocked()){
if (xce.get_mode() != NotifyNormal) { if (xce.get_mode() != XConstants.NotifyNormal) {
// 6404708 : need update cursor in accordance with skipping Leave/EnterNotify event // 6404708 : need update cursor in accordance with skipping Leave/EnterNotify event
// whereas it doesn't need to handled further. // whereas it doesn't need to handled further.
if (xce.get_type() == EnterNotify) { if (xce.get_type() == XConstants.EnterNotify) {
XAwtState.setComponentMouseEntered(getEventSource()); XAwtState.setComponentMouseEntered(getEventSource());
XGlobalCursorManager.nativeUpdateCursor(getEventSource()); XGlobalCursorManager.nativeUpdateCursor(getEventSource());
} else { // LeaveNotify: } else { // LeaveNotify:
...@@ -840,7 +840,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -840,7 +840,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
// From java point the event is bogus as ancestor is obscured, so if // From java point the event is bogus as ancestor is obscured, so if
// the child can get java event itself, we skip it on ancestor. // the child can get java event itself, we skip it on ancestor.
long childWnd = xce.get_subwindow(); long childWnd = xce.get_subwindow();
if (childWnd != None) { if (childWnd != XConstants.None) {
XBaseWindow child = XToolkit.windowToXWindow(childWnd); XBaseWindow child = XToolkit.windowToXWindow(childWnd);
if (child != null && child instanceof XWindow && if (child != null && child instanceof XWindow &&
!child.isEventDisabled(xev)) !child.isEventDisabled(xev))
...@@ -853,7 +853,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -853,7 +853,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
final Component compWithMouse = XAwtState.getComponentMouseEntered(); final Component compWithMouse = XAwtState.getComponentMouseEntered();
if (toplevel != null) { if (toplevel != null) {
if(!toplevel.isModalBlocked()){ if(!toplevel.isModalBlocked()){
if (xce.get_type() == EnterNotify) { if (xce.get_type() == XConstants.EnterNotify) {
// Change XAwtState's component mouse entered to the up-to-date one before requesting // Change XAwtState's component mouse entered to the up-to-date one before requesting
// to update the cursor since XAwtState.getComponentMouseEntered() is used when the // to update the cursor since XAwtState.getComponentMouseEntered() is used when the
// cursor is updated (in XGlobalCursorManager.findHeavyweightUnderCursor()). // cursor is updated (in XGlobalCursorManager.findHeavyweightUnderCursor()).
...@@ -895,7 +895,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -895,7 +895,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
eventLog.finest("Clearing last window ref"); eventLog.finest("Clearing last window ref");
lastWindowRef = null; lastWindowRef = null;
} }
if (xce.get_type() == EnterNotify) { if (xce.get_type() == XConstants.EnterNotify) {
MouseEvent me = new MouseEvent(getEventSource(), MouseEvent.MOUSE_ENTERED, MouseEvent me = new MouseEvent(getEventSource(), MouseEvent.MOUSE_ENTERED,
jWhen, modifiers, xce.get_x(), xce.get_y(), xce.get_x_root(), xce.get_y_root(), clickCount, jWhen, modifiers, xce.get_x(), xce.get_y(), xce.get_x_root(), xce.get_y_root(), clickCount,
popupTrigger, MouseEvent.NOBUTTON); popupTrigger, MouseEvent.NOBUTTON);
...@@ -990,7 +990,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -990,7 +990,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
final void handleKeyPress(XKeyEvent ev) { final void handleKeyPress(XKeyEvent ev) {
long keysym[] = new long[2]; long keysym[] = new long[2];
char unicodeKey = 0; char unicodeKey = 0;
keysym[0] = NoSymbol; keysym[0] = XConstants.NoSymbol;
if (keyEventLog.isLoggable(Level.FINE)) { if (keyEventLog.isLoggable(Level.FINE)) {
logIncomingKeyEvent( ev ); logIncomingKeyEvent( ev );
...@@ -1073,7 +1073,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1073,7 +1073,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
private void handleKeyRelease(XKeyEvent ev) { private void handleKeyRelease(XKeyEvent ev) {
long keysym[] = new long[2]; long keysym[] = new long[2];
char unicodeKey = 0; char unicodeKey = 0;
keysym[0] = NoSymbol; keysym[0] = XConstants.NoSymbol;
if (keyEventLog.isLoggable(Level.FINE)) { if (keyEventLog.isLoggable(Level.FINE)) {
logIncomingKeyEvent( ev ); logIncomingKeyEvent( ev );
...@@ -1153,10 +1153,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1153,10 +1153,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
void updateSizeHints(int x, int y, int width, int height) { void updateSizeHints(int x, int y, int width, int height) {
long flags = XlibWrapper.PSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition)); long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
if (!isResizable()) { if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
} else { } else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
} }
...@@ -1164,10 +1164,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1164,10 +1164,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
void updateSizeHints(int x, int y) { void updateSizeHints(int x, int y) {
long flags = isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition); long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
if (!isResizable()) { if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize | XlibWrapper.PSize; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
} else { } else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
} }
......
...@@ -50,7 +50,7 @@ import sun.awt.X11GraphicsDevice; ...@@ -50,7 +50,7 @@ import sun.awt.X11GraphicsDevice;
import sun.awt.X11GraphicsEnvironment; import sun.awt.X11GraphicsEnvironment;
class XWindowPeer extends XPanelPeer implements WindowPeer, class XWindowPeer extends XPanelPeer implements WindowPeer,
DisplayChangedListener, MWMConstants { DisplayChangedListener {
private static final Logger log = Logger.getLogger("sun.awt.X11.XWindowPeer"); private static final Logger log = Logger.getLogger("sun.awt.X11.XWindowPeer");
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindowPeer"); private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindowPeer");
...@@ -133,9 +133,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -133,9 +133,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
params.put(REPARENTED, params.put(REPARENTED,
Boolean.valueOf(isOverrideRedirect() || isSimpleWindow())); Boolean.valueOf(isOverrideRedirect() || isSimpleWindow()));
super.preInit(params); super.preInit(params);
params.putIfNull(BIT_GRAVITY, Integer.valueOf(NorthWestGravity)); params.putIfNull(BIT_GRAVITY, Integer.valueOf(XConstants.NorthWestGravity));
savedState = WithdrawnState; savedState = XUtilConstants.WithdrawnState;
XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE"); XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");
winAttr = new XWindowAttributesData(); winAttr = new XWindowAttributesData();
...@@ -239,7 +239,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -239,7 +239,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// Set group leader // Set group leader
XWMHints hints = getWMHints(); XWMHints hints = getWMHints();
hints.set_flags(hints.get_flags() | (int)XlibWrapper.WindowGroupHint); hints.set_flags(hints.get_flags() | (int)XUtilConstants.WindowGroupHint);
hints.set_window_group(ownerWindow); hints.set_window_group(ownerWindow);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData); XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
} }
...@@ -503,7 +503,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -503,7 +503,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
Rectangle bounds = getBounds(); Rectangle bounds = getBounds();
XSizeHints hints = getHints(); XSizeHints hints = getHints();
setSizeHints(hints.get_flags() | XlibWrapper.PPosition | XlibWrapper.PSize, setSizeHints(hints.get_flags() | XUtilConstants.PPosition | XUtilConstants.PSize,
bounds.x, bounds.y, bounds.width, bounds.height); bounds.x, bounds.y, bounds.width, bounds.height);
XWM.setMotifDecor(this, false, 0, 0); XWM.setMotifDecor(this, false, 0, 0);
...@@ -531,7 +531,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -531,7 +531,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XWMHints hints = getWMHints(); XWMHints hints = getWMHints();
hints.set_flags(hints.get_flags() | (int)XlibWrapper.InputHint); hints.set_flags(hints.get_flags() | (int)XUtilConstants.InputHint);
hints.set_input(false/*isNativelyNonFocusableWindow() ? (0):(1)*/); hints.set_input(false/*isNativelyNonFocusableWindow() ? (0):(1)*/);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData); XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
} }
...@@ -821,12 +821,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -821,12 +821,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
if (xev.get_type() == XlibWrapper.FocusIn) if (xev.get_type() == XConstants.FocusIn)
{ {
// If this window is non-focusable don't post any java focus event // If this window is non-focusable don't post any java focus event
if (focusAllowedFor()) { if (focusAllowedFor()) {
if (xfe.get_mode() == XlibWrapper.NotifyNormal // Normal notify if (xfe.get_mode() == XConstants.NotifyNormal // Normal notify
|| xfe.get_mode() == XlibWrapper.NotifyWhileGrabbed) // Alt-Tab notify || xfe.get_mode() == XConstants.NotifyWhileGrabbed) // Alt-Tab notify
{ {
handleWindowFocusIn(xfe.get_serial()); handleWindowFocusIn(xfe.get_serial());
} }
...@@ -834,8 +834,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -834,8 +834,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
else else
{ {
if (xfe.get_mode() == XlibWrapper.NotifyNormal // Normal notify if (xfe.get_mode() == XConstants.NotifyNormal // Normal notify
|| xfe.get_mode() == XlibWrapper.NotifyWhileGrabbed) // Alt-Tab notify || xfe.get_mode() == XConstants.NotifyWhileGrabbed) // Alt-Tab notify
{ {
// If this window is non-focusable don't post any java focus event // If this window is non-focusable don't post any java focus event
if (!isNativelyNonFocusableWindow()) { if (!isNativelyNonFocusableWindow()) {
...@@ -1022,7 +1022,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1022,7 +1022,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
try { try {
Rectangle bounds = getBounds(); Rectangle bounds = getBounds();
XSizeHints hints = getHints(); XSizeHints hints = getHints();
setSizeHints(hints.get_flags() & ~(USPosition | PPosition), setSizeHints(hints.get_flags() & ~(XUtilConstants.USPosition | XUtilConstants.PPosition),
bounds.x, bounds.y, bounds.width, bounds.height); bounds.x, bounds.y, bounds.width, bounds.height);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
...@@ -1059,10 +1059,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1059,10 +1059,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XUnmapEvent unmap = new XUnmapEvent(); XUnmapEvent unmap = new XUnmapEvent();
unmap.set_window(window); unmap.set_window(window);
unmap.set_event(XToolkit.getDefaultRootWindow()); unmap.set_event(XToolkit.getDefaultRootWindow());
unmap.set_type((int)XlibWrapper.UnmapNotify); unmap.set_type((int)XConstants.UnmapNotify);
unmap.set_from_configure(false); unmap.set_from_configure(false);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
false, XlibWrapper.SubstructureNotifyMask | XlibWrapper.SubstructureRedirectMask, false, XConstants.SubstructureNotifyMask | XConstants.SubstructureRedirectMask,
unmap.pData); unmap.pData);
unmap.dispose(); unmap.dispose();
} }
...@@ -1305,12 +1305,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1305,12 +1305,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XWM.XA_WM_STATE); XWM.XA_WM_STATE);
try { try {
int status = getter.execute(); int status = getter.execute();
if (status != XlibWrapper.Success || getter.getData() == 0) { if (status != XConstants.Success || getter.getData() == 0) {
return savedState = XlibWrapper.WithdrawnState; return savedState = XUtilConstants.WithdrawnState;
} }
if (getter.getActualType() != XWM.XA_WM_STATE.getAtom() && getter.getActualFormat() != 32) { if (getter.getActualType() != XWM.XA_WM_STATE.getAtom() && getter.getActualFormat() != 32) {
return savedState = XlibWrapper.WithdrawnState; return savedState = XUtilConstants.WithdrawnState;
} }
savedState = (int)Native.getCard32(getter.getData()); savedState = (int)Native.getCard32(getter.getData());
} finally { } finally {
...@@ -1321,7 +1321,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1321,7 +1321,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
boolean isWithdrawn() { boolean isWithdrawn() {
return getWMState() == XlibWrapper.WithdrawnState; return getWMState() == XUtilConstants.WithdrawnState;
} }
boolean hasDecorations(int decor) { boolean hasDecorations(int decor) {
...@@ -1818,14 +1818,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1818,14 +1818,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if( rootPropertyEventDispatcher == null ) { if( rootPropertyEventDispatcher == null ) {
rootPropertyEventDispatcher = new XEventDispatcher() { rootPropertyEventDispatcher = new XEventDispatcher() {
public void dispatchEvent(XEvent ev) { public void dispatchEvent(XEvent ev) {
if( ev.get_type() == PropertyNotify ) { if( ev.get_type() == XConstants.PropertyNotify ) {
handleRootPropertyNotify( ev ); handleRootPropertyNotify( ev );
} }
} }
}; };
XlibWrapper.XSelectInput( XToolkit.getDisplay(), XlibWrapper.XSelectInput( XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
XlibWrapper.PropertyChangeMask); XConstants.PropertyChangeMask);
XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(), XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(),
rootPropertyEventDispatcher); rootPropertyEventDispatcher);
} }
...@@ -1860,7 +1860,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1860,7 +1860,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public PropMwmHints getMWMHints() { public PropMwmHints getMWMHints() {
if (mwm_hints == null) { if (mwm_hints == null) {
mwm_hints = new PropMwmHints(); mwm_hints = new PropMwmHints();
if (!XWM.XA_MWM_HINTS.getAtomData(getWindow(), mwm_hints.pData, PROP_MWM_HINTS_ELEMENTS)) { if (!XWM.XA_MWM_HINTS.getAtomData(getWindow(), mwm_hints.pData, MWMConstants.PROP_MWM_HINTS_ELEMENTS)) {
mwm_hints.zero(); mwm_hints.zero();
} }
} }
...@@ -1870,7 +1870,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1870,7 +1870,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void setMWMHints(PropMwmHints hints) { public void setMWMHints(PropMwmHints hints) {
mwm_hints = hints; mwm_hints = hints;
if (hints != null) { if (hints != null) {
XWM.XA_MWM_HINTS.setAtomData(getWindow(), mwm_hints.pData, PROP_MWM_HINTS_ELEMENTS); XWM.XA_MWM_HINTS.setAtomData(getWindow(), mwm_hints.pData, MWMConstants.PROP_MWM_HINTS_ELEMENTS);
} }
} }
...@@ -1960,7 +1960,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1960,7 +1960,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())}); new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())});
} }
if (isGrabbed()) { if (isGrabbed()) {
boolean dragging = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask)) != 0; boolean dragging = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask)) != 0;
// When window is grabbed, all events are dispatched to // When window is grabbed, all events are dispatched to
// it. Retarget them to the corresponding windows (notice // it. Retarget them to the corresponding windows (notice
// that XBaseWindow.dispatchEvent does the opposite // that XBaseWindow.dispatchEvent does the opposite
...@@ -2014,12 +2014,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -2014,12 +2014,12 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
try { try {
grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget}); grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget});
if (xbe.get_type() == XConstants.ButtonPress if (xbe.get_type() == XConstants.ButtonPress
&& xbe.get_button() == XlibWrapper.Button1) && xbe.get_button() == XConstants.Button1)
{ {
// need to keep it to retarget mouse release // need to keep it to retarget mouse release
pressTarget = target; pressTarget = target;
} else if (xbe.get_type() == XConstants.ButtonRelease } else if (xbe.get_type() == XConstants.ButtonRelease
&& xbe.get_button() == XlibWrapper.Button1 && xbe.get_button() == XConstants.Button1
&& pressTarget != target) && pressTarget != target)
{ {
// during grab we do receive mouse release on different component (not on the source // during grab we do receive mouse release on different component (not on the source
......
/* /*
* Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -152,7 +152,7 @@ public class XlibUtil ...@@ -152,7 +152,7 @@ public class XlibUtil
int status = xtc.execute(XToolkit.IgnoreBadWindowHandler); int status = xtc.execute(XToolkit.IgnoreBadWindowHandler);
if ((status != 0) && if ((status != 0) &&
((XToolkit.saved_error == null) || ((XToolkit.saved_error == null) ||
(XToolkit.saved_error.get_error_code() == XlibWrapper.Success))) (XToolkit.saved_error.get_error_code() == XConstants.Success)))
{ {
translated = new Point(xtc.get_dest_x(), xtc.get_dest_y()); translated = new Point(xtc.get_dest_x(), xtc.get_dest_y());
} }
...@@ -351,7 +351,7 @@ public class XlibUtil ...@@ -351,7 +351,7 @@ public class XlibUtil
XToolkit.RESTORE_XERROR_HANDLER(); XToolkit.RESTORE_XERROR_HANDLER();
if ((status != 0) && if ((status != 0) &&
((XToolkit.saved_error == null) || ((XToolkit.saved_error == null) ||
(XToolkit.saved_error.get_error_code() == XlibWrapper.Success))) (XToolkit.saved_error.get_error_code() == XConstants.Success)))
{ {
return wattr.get_map_state(); return wattr.get_map_state();
} }
...@@ -362,7 +362,7 @@ public class XlibUtil ...@@ -362,7 +362,7 @@ public class XlibUtil
XToolkit.awtUnlock(); XToolkit.awtUnlock();
} }
return XlibWrapper.IsUnmapped; return XConstants.IsUnmapped;
} }
/** /**
......
/* /*
* Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,8 +29,7 @@ import java.security.AccessController; ...@@ -29,8 +29,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import sun.misc.*; import sun.misc.*;
public class XlibWrapper implements XConstants, XUtilConstants, XProtocolConstants, final public class XlibWrapper
XCursorFontConstants
{ {
static Unsafe unsafe = Unsafe.getUnsafe(); static Unsafe unsafe = Unsafe.getUnsafe();
// strange constants // strange constants
...@@ -321,7 +320,7 @@ static native String XSetLocaleModifiers(String modifier_list); ...@@ -321,7 +320,7 @@ static native String XSetLocaleModifiers(String modifier_list);
if (XPropertyCache.isCachingSupported() && if (XPropertyCache.isCachingSupported() &&
XToolkit.windowToXWindow(window) != null && XToolkit.windowToXWindow(window) != null &&
WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) && WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) &&
mode == PropModeReplace) mode == XConstants.PropModeReplace)
{ {
int length = (format / 8) * nelements; int length = (format / 8) * nelements;
XPropertyCache.storeCache( XPropertyCache.storeCache(
...@@ -585,25 +584,25 @@ static native String XSetLocaleModifiers(String modifier_list); ...@@ -585,25 +584,25 @@ static native String XSetLocaleModifiers(String modifier_list);
static String hintsToString(long flags) { static String hintsToString(long flags) {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
if ((flags & PMaxSize) != 0) { if ((flags & XUtilConstants.PMaxSize) != 0) {
buf.append("PMaxSize "); buf.append("PMaxSize ");
} }
if ((flags & PMinSize) != 0) { if ((flags & XUtilConstants.PMinSize) != 0) {
buf.append("PMinSize "); buf.append("PMinSize ");
} }
if ((flags & USSize) != 0) { if ((flags & XUtilConstants.USSize) != 0) {
buf.append("USSize "); buf.append("USSize ");
} }
if ((flags & USPosition) != 0) { if ((flags & XUtilConstants.USPosition) != 0) {
buf.append("USPosition "); buf.append("USPosition ");
} }
if ((flags & PPosition) != 0) { if ((flags & XUtilConstants.PPosition) != 0) {
buf.append("PPosition "); buf.append("PPosition ");
} }
if ((flags & PSize) != 0) { if ((flags & XUtilConstants.PSize) != 0) {
buf.append("PSize "); buf.append("PSize ");
} }
if ((flags & PWinGravity) != 0) { if ((flags & XUtilConstants.PWinGravity) != 0) {
buf.append("PWinGravity "); buf.append("PWinGravity ");
} }
return buf.toString(); return buf.toString();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册