85 final static XAtom XA_OL_DECOR_CLOSE = new XAtom();
86
87 /* EWMH */
88 final static XAtom XA_NET_FRAME_EXTENTS = new XAtom();
89 final static XAtom XA_NET_REQUEST_FRAME_EXTENTS = new XAtom();
90
91 final static int
92 UNDETERMINED_WM = 1,
93 NO_WM = 2,
94 OTHER_WM = 3,
95 OPENLOOK_WM = 4,
96 MOTIF_WM = 5,
97 CDE_WM = 6,
98 ENLIGHTEN_WM = 7,
99 KDE2_WM = 8,
100 SAWFISH_WM = 9,
101 ICE_WM = 10,
102 METACITY_WM = 11,
103 COMPIZ_WM = 12,
104 LG3D_WM = 13,
105 CWM_WM = 14;
106 public String toString() {
107 switch (WMID) {
108 case NO_WM:
109 return "NO WM";
110 case OTHER_WM:
111 return "Other WM";
112 case OPENLOOK_WM:
113 return "OPENLOOK";
114 case MOTIF_WM:
115 return "MWM";
116 case CDE_WM:
117 return "DTWM";
118 case ENLIGHTEN_WM:
119 return "Enlightenment";
120 case KDE2_WM:
121 return "KWM2";
122 case SAWFISH_WM:
123 return "Sawfish";
124 case ICE_WM:
125 return "IceWM";
126 case METACITY_WM:
127 return "Metacity";
128 case COMPIZ_WM:
129 return "Compiz";
130 case LG3D_WM:
131 return "LookingGlass";
132 case CWM_WM:
133 return "CWM";
134 case UNDETERMINED_WM:
135 default:
136 return "Undetermined WM";
137 }
138 }
139
140
141 int WMID;
142 static final Insets zeroInsets = new Insets(0, 0, 0, 0);
143 static final Insets defaultInsets = new Insets(25, 5, 5, 5);
144
145 XWM(int WMID) {
146 this.WMID = WMID;
147 initializeProtocols();
148 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString());
149 }
150 int getID() {
151 return WMID;
152 }
153
556
557 static boolean isLookingGlass() {
558 return isNetWMName("LG3D");
559 }
560
561 static boolean isCWM() {
562 return isNetWMName("CWM");
563 }
564
565 /*
566 * Is Metacity running?
567 */
568 static boolean isMetacity() {
569 return isNetWMName("Metacity");
570 // || (
571 // XA_NET_SUPPORTING_WM_CHECK.
572 // getIntProperty(XToolkit.getDefaultRootWindow(), XA_NET_SUPPORTING_WM_CHECK.
573 // getIntProperty(XToolkit.getDefaultRootWindow(), XAtom.XA_CARDINAL)) == 0);
574 }
575
576 static boolean isNonReparentingWM() {
577 return (XWM.getWMID() == XWM.COMPIZ_WM || XWM.getWMID() == XWM.LG3D_WM || XWM.getWMID() == XWM.CWM_WM);
578 }
579
580 /*
581 * Prepare IceWM check.
582 *
583 * The only way to detect IceWM, seems to be by setting
584 * _ICEWM_WINOPTHINT(_ICEWM_WINOPTHINT/8) on root and checking if it
585 * was immediately deleted by IceWM.
586 *
587 * But messing with PropertyNotify here is way too much trouble, so
588 * approximate the check by setting the property in this function and
589 * checking if it still exists later on.
590 *
591 * Gaa, dirty dances...
592 */
593 static final XAtom XA_ICEWM_WINOPTHINT = new XAtom("_ICEWM_WINOPTHINT", false);
594 static final char opt[] = {
595 'A','W','T','_','I','C','E','W','M','_','T','E','S','T','\0',
725 // Later, WM will initialize its own version of protocol
726 XNETProtocol l_net_protocol = g_net_protocol = new XNETProtocol();
727 l_net_protocol.detect();
728 if (log.isLoggable(PlatformLogger.FINE) && l_net_protocol.active()) {
729 log.fine("_NET_WM_NAME is " + l_net_protocol.getWMName());
730 }
731 XWINProtocol win = g_win_protocol = new XWINProtocol();
732 win.detect();
733
734 /* actual check for IceWM to follow below */
735 boolean doIsIceWM = prepareIsIceWM(); /* and let IceWM to act */
736
737 /*
738 * Ok, some WM is out there. Check which one by testing for
739 * "distinguishing" atoms.
740 */
741 if (isEnlightenment()) {
742 awt_wmgr = XWM.ENLIGHTEN_WM;
743 } else if (isMetacity()) {
744 awt_wmgr = XWM.METACITY_WM;
745 } else if (isSawfish()) {
746 awt_wmgr = XWM.SAWFISH_WM;
747 } else if (isKDE2()) {
748 awt_wmgr =XWM.KDE2_WM;
749 } else if (isCompiz()) {
750 awt_wmgr = XWM.COMPIZ_WM;
751 } else if (isLookingGlass()) {
752 awt_wmgr = LG3D_WM;
753 } else if (isCWM()) {
754 awt_wmgr = CWM_WM;
755 } else if (doIsIceWM && isIceWM()) {
756 awt_wmgr = XWM.ICE_WM;
757 }
758 /*
759 * We don't check for legacy WM when we already know that WM
760 * supports WIN or _NET wm spec.
761 */
762 else if (l_net_protocol.active()) {
763 awt_wmgr = XWM.OTHER_WM;
764 } else if (win.active()) {
|
85 final static XAtom XA_OL_DECOR_CLOSE = new XAtom();
86
87 /* EWMH */
88 final static XAtom XA_NET_FRAME_EXTENTS = new XAtom();
89 final static XAtom XA_NET_REQUEST_FRAME_EXTENTS = new XAtom();
90
91 final static int
92 UNDETERMINED_WM = 1,
93 NO_WM = 2,
94 OTHER_WM = 3,
95 OPENLOOK_WM = 4,
96 MOTIF_WM = 5,
97 CDE_WM = 6,
98 ENLIGHTEN_WM = 7,
99 KDE2_WM = 8,
100 SAWFISH_WM = 9,
101 ICE_WM = 10,
102 METACITY_WM = 11,
103 COMPIZ_WM = 12,
104 LG3D_WM = 13,
105 CWM_WM = 14,
106 MUTTER_WM = 15;
107 public String toString() {
108 switch (WMID) {
109 case NO_WM:
110 return "NO WM";
111 case OTHER_WM:
112 return "Other WM";
113 case OPENLOOK_WM:
114 return "OPENLOOK";
115 case MOTIF_WM:
116 return "MWM";
117 case CDE_WM:
118 return "DTWM";
119 case ENLIGHTEN_WM:
120 return "Enlightenment";
121 case KDE2_WM:
122 return "KWM2";
123 case SAWFISH_WM:
124 return "Sawfish";
125 case ICE_WM:
126 return "IceWM";
127 case METACITY_WM:
128 return "Metacity";
129 case COMPIZ_WM:
130 return "Compiz";
131 case LG3D_WM:
132 return "LookingGlass";
133 case CWM_WM:
134 return "CWM";
135 case MUTTER_WM:
136 return "Mutter";
137 case UNDETERMINED_WM:
138 default:
139 return "Undetermined WM";
140 }
141 }
142
143
144 int WMID;
145 static final Insets zeroInsets = new Insets(0, 0, 0, 0);
146 static final Insets defaultInsets = new Insets(25, 5, 5, 5);
147
148 XWM(int WMID) {
149 this.WMID = WMID;
150 initializeProtocols();
151 if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString());
152 }
153 int getID() {
154 return WMID;
155 }
156
559
560 static boolean isLookingGlass() {
561 return isNetWMName("LG3D");
562 }
563
564 static boolean isCWM() {
565 return isNetWMName("CWM");
566 }
567
568 /*
569 * Is Metacity running?
570 */
571 static boolean isMetacity() {
572 return isNetWMName("Metacity");
573 // || (
574 // XA_NET_SUPPORTING_WM_CHECK.
575 // getIntProperty(XToolkit.getDefaultRootWindow(), XA_NET_SUPPORTING_WM_CHECK.
576 // getIntProperty(XToolkit.getDefaultRootWindow(), XAtom.XA_CARDINAL)) == 0);
577 }
578
579 static boolean isMutter() {
580 return isNetWMName("Mutter");
581 }
582
583 static boolean isNonReparentingWM() {
584 return (XWM.getWMID() == XWM.COMPIZ_WM || XWM.getWMID() == XWM.LG3D_WM || XWM.getWMID() == XWM.CWM_WM);
585 }
586
587 /*
588 * Prepare IceWM check.
589 *
590 * The only way to detect IceWM, seems to be by setting
591 * _ICEWM_WINOPTHINT(_ICEWM_WINOPTHINT/8) on root and checking if it
592 * was immediately deleted by IceWM.
593 *
594 * But messing with PropertyNotify here is way too much trouble, so
595 * approximate the check by setting the property in this function and
596 * checking if it still exists later on.
597 *
598 * Gaa, dirty dances...
599 */
600 static final XAtom XA_ICEWM_WINOPTHINT = new XAtom("_ICEWM_WINOPTHINT", false);
601 static final char opt[] = {
602 'A','W','T','_','I','C','E','W','M','_','T','E','S','T','\0',
732 // Later, WM will initialize its own version of protocol
733 XNETProtocol l_net_protocol = g_net_protocol = new XNETProtocol();
734 l_net_protocol.detect();
735 if (log.isLoggable(PlatformLogger.FINE) && l_net_protocol.active()) {
736 log.fine("_NET_WM_NAME is " + l_net_protocol.getWMName());
737 }
738 XWINProtocol win = g_win_protocol = new XWINProtocol();
739 win.detect();
740
741 /* actual check for IceWM to follow below */
742 boolean doIsIceWM = prepareIsIceWM(); /* and let IceWM to act */
743
744 /*
745 * Ok, some WM is out there. Check which one by testing for
746 * "distinguishing" atoms.
747 */
748 if (isEnlightenment()) {
749 awt_wmgr = XWM.ENLIGHTEN_WM;
750 } else if (isMetacity()) {
751 awt_wmgr = XWM.METACITY_WM;
752 } else if (isMutter()) {
753 awt_wmgr = XWM.MUTTER_WM;
754 } else if (isSawfish()) {
755 awt_wmgr = XWM.SAWFISH_WM;
756 } else if (isKDE2()) {
757 awt_wmgr =XWM.KDE2_WM;
758 } else if (isCompiz()) {
759 awt_wmgr = XWM.COMPIZ_WM;
760 } else if (isLookingGlass()) {
761 awt_wmgr = LG3D_WM;
762 } else if (isCWM()) {
763 awt_wmgr = CWM_WM;
764 } else if (doIsIceWM && isIceWM()) {
765 awt_wmgr = XWM.ICE_WM;
766 }
767 /*
768 * We don't check for legacy WM when we already know that WM
769 * supports WIN or _NET wm spec.
770 */
771 else if (l_net_protocol.active()) {
772 awt_wmgr = XWM.OTHER_WM;
773 } else if (win.active()) {
|