42 BOUNDS = "bounds", // bounds of the window, Rectangle
43 OVERRIDE_REDIRECT = "overrideRedirect", // override_redirect setting, Boolean
44 EVENT_MASK = "event mask", // event mask, Integer
45 VALUE_MASK = "value mask", // value mask, Long
46 BORDER_PIXEL = "border pixel", // border pixel value, Integer
47 COLORMAP = "color map", // color map, Long
48 DEPTH = "visual depth", // depth, Integer
49 VISUAL_CLASS = "visual class", // visual class, Integer
50 VISUAL = "visual", // visual, Long
51 EMBEDDED = "embedded", // is embedded?, Boolean
52 DELAYED = "delayed", // is creation delayed?, Boolean
53 PARENT = "parent", // parent peer
54 BACKGROUND_PIXMAP = "pixmap", // background pixmap
55 VISIBLE = "visible", // whether it is visible by default
56 SAVE_UNDER = "save under", // save content under this window
57 BACKING_STORE = "backing store", // enables double buffering
58 BIT_GRAVITY = "bit gravity"; // copy old content on geometry change
59 private XCreateWindowParams delayedParams;
60
61 Set<Long> children = new HashSet<Long>();
62 long window;
63 boolean visible;
64 boolean mapped;
65 boolean embedded;
66 Rectangle maxBounds;
67 volatile XBaseWindow parentWindow;
68
69 private boolean disposed;
70
71 private long screen;
72 private XSizeHints hints;
73 private XWMHints wmHints;
74
75 final static int MIN_SIZE = 1;
76 final static int DEF_LOCATION = 1;
77
78 private static XAtom wm_client_leader;
79
80 static enum InitialiseState {
81 INITIALISING,
82 NOT_INITIALISED,
906
907 // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
908 void ungrabInputImpl() {
909 }
910
911 static void checkSecurity() {
912 if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
913 StackTraceElement stack[] = (new Throwable()).getStackTrace();
914 log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
915 }
916 }
917
918 public Set<Long> getChildren() {
919 synchronized (getStateLock()) {
920 return new HashSet<Long>(children);
921 }
922 }
923
924 // -------------- Event handling ----------------
925 public void handleMapNotifyEvent(XEvent xev) {
926 mapped = true;
927 }
928 public void handleUnmapNotifyEvent(XEvent xev) {
929 mapped = false;
930 }
931 public void handleReparentNotifyEvent(XEvent xev) {
932 if (eventLog.isLoggable(Level.FINER)) {
933 XReparentEvent msg = xev.get_xreparent();
934 eventLog.finer(msg.toString());
935 }
936 }
937 public void handlePropertyNotify(XEvent xev) {
938 XPropertyEvent msg = xev.get_xproperty();
939 if (XPropertyCache.isCachingSupported()) {
940 XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
941 }
942 if (eventLog.isLoggable(Level.FINER)) {
943 eventLog.log(Level.FINER, "{0}", new Object[] {msg});
944 }
945 }
946
947 public void handleDestroyNotify(XEvent xev) {
948 XAnyEvent xany = xev.get_xany();
949 if (xany.get_window() == getWindow()) {
950 XToolkit.removeFromWinMap(getWindow(), this);
1009 case XConstants.ButtonPress:
1010 if (buttonState == 0) {
1011 XAwtState.setAutoGrabWindow(this);
1012 }
1013 break;
1014 case XConstants.ButtonRelease:
1015 if (isFullRelease(buttonState, xbe.get_button())) {
1016 XAwtState.setAutoGrabWindow(null);
1017 }
1018 break;
1019 }
1020 }
1021 public void handleMotionNotify(XEvent xev) {
1022 }
1023 public void handleXCrossingEvent(XEvent xev) {
1024 }
1025 public void handleConfigureNotifyEvent(XEvent xev) {
1026 XConfigureEvent xe = xev.get_xconfigure();
1027 insLog.log(Level.FINER, "Configure, {0}",
1028 new Object[] {xe});
1029 x = xe.get_x();
1030 y = xe.get_y();
1031 width = xe.get_width();
1032 height = xe.get_height();
1033 }
1034 /**
1035 * Checks ButtonRelease released all Mouse buttons
1036 */
1037 static boolean isFullRelease(int buttonState, int button) {
1038 final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
1039
1040 if (button < 0 || button > buttonsNumber) {
1041 return buttonState == 0;
1042 } else {
1043 return buttonState == XConstants.buttonsMask[button - 1];
1044 }
1045 }
1046
1047 static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
1048 switch (ev.get_type()) {
|
42 BOUNDS = "bounds", // bounds of the window, Rectangle
43 OVERRIDE_REDIRECT = "overrideRedirect", // override_redirect setting, Boolean
44 EVENT_MASK = "event mask", // event mask, Integer
45 VALUE_MASK = "value mask", // value mask, Long
46 BORDER_PIXEL = "border pixel", // border pixel value, Integer
47 COLORMAP = "color map", // color map, Long
48 DEPTH = "visual depth", // depth, Integer
49 VISUAL_CLASS = "visual class", // visual class, Integer
50 VISUAL = "visual", // visual, Long
51 EMBEDDED = "embedded", // is embedded?, Boolean
52 DELAYED = "delayed", // is creation delayed?, Boolean
53 PARENT = "parent", // parent peer
54 BACKGROUND_PIXMAP = "pixmap", // background pixmap
55 VISIBLE = "visible", // whether it is visible by default
56 SAVE_UNDER = "save under", // save content under this window
57 BACKING_STORE = "backing store", // enables double buffering
58 BIT_GRAVITY = "bit gravity"; // copy old content on geometry change
59 private XCreateWindowParams delayedParams;
60
61 Set<Long> children = new HashSet<Long>();
62 long window = XConstants.None;
63 boolean visible;
64 boolean mapped;
65 boolean embedded;
66 Rectangle maxBounds;
67 volatile XBaseWindow parentWindow;
68
69 private boolean disposed;
70
71 private long screen;
72 private XSizeHints hints;
73 private XWMHints wmHints;
74
75 final static int MIN_SIZE = 1;
76 final static int DEF_LOCATION = 1;
77
78 private static XAtom wm_client_leader;
79
80 static enum InitialiseState {
81 INITIALISING,
82 NOT_INITIALISED,
906
907 // called from ungrabInput, used in popup windows to hide theirselfs in ungrabbing
908 void ungrabInputImpl() {
909 }
910
911 static void checkSecurity() {
912 if (XToolkit.isSecurityWarningEnabled() && XToolkit.isToolkitThread()) {
913 StackTraceElement stack[] = (new Throwable()).getStackTrace();
914 log.warning(stack[1] + ": Security violation: calling user code on toolkit thread");
915 }
916 }
917
918 public Set<Long> getChildren() {
919 synchronized (getStateLock()) {
920 return new HashSet<Long>(children);
921 }
922 }
923
924 // -------------- Event handling ----------------
925 public void handleMapNotifyEvent(XEvent xev) {
926 if (xev.get_xany().get_window() == getWindow()) {
927 mapped = true;
928 }
929 }
930 public void handleUnmapNotifyEvent(XEvent xev) {
931 if (xev.get_xany().get_window() == getWindow()) {
932 mapped = false;
933 }
934 }
935 public void handleReparentNotifyEvent(XEvent xev) {
936 if (eventLog.isLoggable(Level.FINER)) {
937 XReparentEvent msg = xev.get_xreparent();
938 eventLog.finer(msg.toString());
939 }
940 }
941 public void handlePropertyNotify(XEvent xev) {
942 XPropertyEvent msg = xev.get_xproperty();
943 if (XPropertyCache.isCachingSupported()) {
944 XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
945 }
946 if (eventLog.isLoggable(Level.FINER)) {
947 eventLog.log(Level.FINER, "{0}", new Object[] {msg});
948 }
949 }
950
951 public void handleDestroyNotify(XEvent xev) {
952 XAnyEvent xany = xev.get_xany();
953 if (xany.get_window() == getWindow()) {
954 XToolkit.removeFromWinMap(getWindow(), this);
1013 case XConstants.ButtonPress:
1014 if (buttonState == 0) {
1015 XAwtState.setAutoGrabWindow(this);
1016 }
1017 break;
1018 case XConstants.ButtonRelease:
1019 if (isFullRelease(buttonState, xbe.get_button())) {
1020 XAwtState.setAutoGrabWindow(null);
1021 }
1022 break;
1023 }
1024 }
1025 public void handleMotionNotify(XEvent xev) {
1026 }
1027 public void handleXCrossingEvent(XEvent xev) {
1028 }
1029 public void handleConfigureNotifyEvent(XEvent xev) {
1030 XConfigureEvent xe = xev.get_xconfigure();
1031 insLog.log(Level.FINER, "Configure, {0}",
1032 new Object[] {xe});
1033
1034 // Due to the SubstructureNotifyMask in the XWindow we should process
1035 // only those events that belong to us.
1036 if (xe.get_window() != getWindow()) {
1037 return;
1038 }
1039
1040 x = xe.get_x();
1041 y = xe.get_y();
1042 width = xe.get_width();
1043 height = xe.get_height();
1044 }
1045 /**
1046 * Checks ButtonRelease released all Mouse buttons
1047 */
1048 static boolean isFullRelease(int buttonState, int button) {
1049 final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
1050
1051 if (button < 0 || button > buttonsNumber) {
1052 return buttonState == 0;
1053 } else {
1054 return buttonState == XConstants.buttonsMask[button - 1];
1055 }
1056 }
1057
1058 static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
1059 switch (ev.get_type()) {
|