src/solaris/classes/sun/awt/X11/XEmbedServerTester.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2008, 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


 630         if (XlibUtil.getWindowMapState(window.getWindow()) == IsUnmapped) {
 631             throw new RuntimeException("Client is not mapped");
 632         }
 633     }
 634     private void checkNotMapped() {
 635         if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
 636             throw new RuntimeException("Client is mapped");
 637         }
 638     }
 639 
 640     private void sendMessage(int message) {
 641         xembed.sendMessage(parent, message);
 642     }
 643     private void sendMessage(int message, int detail, long data1, long data2) {
 644         xembed.sendMessage(parent, message, detail, data1, data2);
 645     }
 646 
 647     public void dispatchEvent(XEvent ev) {
 648         if (ev.get_type() == ClientMessage) {
 649             XClientMessageEvent msg = ev.get_xclient();
 650             if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
 651                 if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
 652                     xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1)));
 653                 }
 654                 switch ((int)msg.get_data(1)) {
 655                   case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
 656                       xembedActive = true;
 657                       server_version = (int)msg.get_data(3);
 658                       break;
 659                   case XEmbedHelper.XEMBED_WINDOW_ACTIVATE:
 660                       windowActive = true;
 661                       break;
 662                   case XEmbedHelper.XEMBED_WINDOW_DEACTIVATE:
 663                       windowActive = false;
 664                       break;
 665                   case XEmbedHelper.XEMBED_FOCUS_IN: // We got focus!
 666                       focused = true;
 667                       focusedKind = (int)msg.get_data(2);
 668                       break;
 669                   case XEmbedHelper.XEMBED_FOCUS_OUT:
 670                       focused = false;


   1 /*
   2  * Copyright (c) 2003, 2014, 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


 630         if (XlibUtil.getWindowMapState(window.getWindow()) == IsUnmapped) {
 631             throw new RuntimeException("Client is not mapped");
 632         }
 633     }
 634     private void checkNotMapped() {
 635         if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
 636             throw new RuntimeException("Client is mapped");
 637         }
 638     }
 639 
 640     private void sendMessage(int message) {
 641         xembed.sendMessage(parent, message);
 642     }
 643     private void sendMessage(int message, int detail, long data1, long data2) {
 644         xembed.sendMessage(parent, message, detail, data1, data2);
 645     }
 646 
 647     public void dispatchEvent(XEvent ev) {
 648         if (ev.get_type() == ClientMessage) {
 649             XClientMessageEvent msg = ev.get_xclient();
 650             if (msg.get_message_type() == XEmbedHelper.XEmbed.getAtom()) {
 651                 if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
 652                     xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1)));
 653                 }
 654                 switch ((int)msg.get_data(1)) {
 655                   case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
 656                       xembedActive = true;
 657                       server_version = (int)msg.get_data(3);
 658                       break;
 659                   case XEmbedHelper.XEMBED_WINDOW_ACTIVATE:
 660                       windowActive = true;
 661                       break;
 662                   case XEmbedHelper.XEMBED_WINDOW_DEACTIVATE:
 663                       windowActive = false;
 664                       break;
 665                   case XEmbedHelper.XEMBED_FOCUS_IN: // We got focus!
 666                       focused = true;
 667                       focusedKind = (int)msg.get_data(2);
 668                       break;
 669                   case XEmbedHelper.XEMBED_FOCUS_OUT:
 670                       focused = false;