< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XWM.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 531                     }
 532                     return true;
 533                 } else {
 534                     // No DT_WORKSPACE, however in our tests MWM sometimes can be without desktop -
 535                     // and that is still MWM.  So simply check for the validity of this window
 536                     // (through WM_STATE property).
 537                     WindowPropertyGetter state_getter =
 538                         new WindowPropertyGetter(wmwin,
 539                                                  XA_WM_STATE,
 540                                                  0, 1, false,
 541                                                  XA_WM_STATE);
 542                     try {
 543                         if (state_getter.execute() == XConstants.Success &&
 544                             state_getter.getData() != 0 &&
 545                             state_getter.getActualType() == XA_WM_STATE.getAtom())
 546                         {
 547                             return true;
 548                         }
 549                     } finally {
 550                         state_getter.dispose();






 551                     }
 552                 }
 553             }
 554         } finally {
 555             getter.dispose();
 556         }
 557         return false;
 558     }
 559 
 560     /*
 561      * Is Sawfish running?
 562      */
 563     static boolean isSawfish() {
 564         return isNetWMName("Sawfish");
 565     }
 566 
 567     /*
 568      * Is KDE2 (KWin) running?
 569      */
 570     static boolean isKDE2() {


   1 /*
   2  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 531                     }
 532                     return true;
 533                 } else {
 534                     // No DT_WORKSPACE, however in our tests MWM sometimes can be without desktop -
 535                     // and that is still MWM.  So simply check for the validity of this window
 536                     // (through WM_STATE property).
 537                     WindowPropertyGetter state_getter =
 538                         new WindowPropertyGetter(wmwin,
 539                                                  XA_WM_STATE,
 540                                                  0, 1, false,
 541                                                  XA_WM_STATE);
 542                     try {
 543                         if (state_getter.execute() == XConstants.Success &&
 544                             state_getter.getData() != 0 &&
 545                             state_getter.getActualType() == XA_WM_STATE.getAtom())
 546                         {
 547                             return true;
 548                         }
 549                     } finally {
 550                         state_getter.dispose();
 551                     }
 552                     XQueryTree qt = new XQueryTree(wmwin);
 553                     try {
 554                         if (qt.execute() > 0) return true;
 555                     } finally {
 556                         qt.dispose();
 557                     }
 558                 }
 559             }
 560         } finally {
 561             getter.dispose();
 562         }
 563         return false;
 564     }
 565 
 566     /*
 567      * Is Sawfish running?
 568      */
 569     static boolean isSawfish() {
 570         return isNetWMName("Sawfish");
 571     }
 572 
 573     /*
 574      * Is KDE2 (KWin) running?
 575      */
 576     static boolean isKDE2() {


< prev index next >