src/solaris/classes/sun/awt/X11/XEmbedHelper.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


  82     XEmbedHelper() {
  83         if (XEmbed == null) {
  84             XEmbed = XAtom.get("_XEMBED");
  85             if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
  86                 xembedLog.finer("Created atom " + XEmbed.toString());
  87             }
  88         }
  89         if (XEmbedInfo == null) {
  90             XEmbedInfo = XAtom.get("_XEMBED_INFO");
  91             if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
  92                 xembedLog.finer("Created atom " + XEmbedInfo.toString());
  93             }
  94         }
  95     }
  96 
  97     void sendMessage(long window, int message) {
  98         sendMessage(window, message, 0, 0, 0);
  99     }
 100     void sendMessage(long window, int message, long detail, long data1, long data2) {
 101         XClientMessageEvent msg = new XClientMessageEvent();
 102         msg.set_type((int)XConstants.ClientMessage);
 103         msg.set_window(window);
 104         msg.set_message_type(XEmbed.getAtom());
 105         msg.set_format(32);
 106         msg.set_data(0, XToolkit.getCurrentServerTime());
 107         msg.set_data(1, message);
 108         msg.set_data(2, detail);
 109         msg.set_data(3, data1);
 110         msg.set_data(4, data2);
 111         XToolkit.awtLock();
 112         try {
 113             if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
 114                 xembedLog.fine("Sending " + XEmbedMessageToString(msg));
 115             }
 116             XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
 117         }
 118         finally {
 119             XToolkit.awtUnlock();
 120         }
 121         msg.dispose();
 122     }


   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


  82     XEmbedHelper() {
  83         if (XEmbed == null) {
  84             XEmbed = XAtom.get("_XEMBED");
  85             if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
  86                 xembedLog.finer("Created atom " + XEmbed.toString());
  87             }
  88         }
  89         if (XEmbedInfo == null) {
  90             XEmbedInfo = XAtom.get("_XEMBED_INFO");
  91             if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
  92                 xembedLog.finer("Created atom " + XEmbedInfo.toString());
  93             }
  94         }
  95     }
  96 
  97     void sendMessage(long window, int message) {
  98         sendMessage(window, message, 0, 0, 0);
  99     }
 100     void sendMessage(long window, int message, long detail, long data1, long data2) {
 101         XClientMessageEvent msg = new XClientMessageEvent();
 102         msg.set_type(XConstants.ClientMessage);
 103         msg.set_window(window);
 104         msg.set_message_type(XEmbed.getAtom());
 105         msg.set_format(32);
 106         msg.set_data(0, XToolkit.getCurrentServerTime());
 107         msg.set_data(1, message);
 108         msg.set_data(2, detail);
 109         msg.set_data(3, data1);
 110         msg.set_data(4, data2);
 111         XToolkit.awtLock();
 112         try {
 113             if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
 114                 xembedLog.fine("Sending " + XEmbedMessageToString(msg));
 115             }
 116             XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
 117         }
 118         finally {
 119             XToolkit.awtUnlock();
 120         }
 121         msg.dispose();
 122     }