< prev index next >

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

Print this page


   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


 413     public void windowGainedFocus(WindowEvent e) {
 414         applicationActive = true;
 415         if (isXEmbedActive()) {
 416             xembedLog.fine("Sending WINDOW_ACTIVATE");
 417             xembed.sendMessage(xembed.handle, XEMBED_WINDOW_ACTIVATE);
 418         }
 419     }
 420 
 421     public void windowLostFocus(WindowEvent e) {
 422         applicationActive = false;
 423         if (isXEmbedActive()) {
 424             xembedLog.fine("Sending WINDOW_DEACTIVATE");
 425             xembed.sendMessage(xembed.handle, XEMBED_WINDOW_DEACTIVATE);
 426         }
 427     }
 428 
 429     void canvasFocusGained(FocusEvent e) {
 430         if (isXEmbedActive()) {
 431             xembedLog.fine("Forwarding FOCUS_GAINED");
 432             int flavor = XEMBED_FOCUS_CURRENT;
 433             if (e instanceof CausedFocusEvent) {
 434                 CausedFocusEvent ce = (CausedFocusEvent)e;
 435                 if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_FORWARD) {
 436                     flavor = XEMBED_FOCUS_FIRST;
 437                 } else if (ce.getCause() == CausedFocusEvent.Cause.TRAVERSAL_BACKWARD) {
 438                     flavor = XEMBED_FOCUS_LAST;
 439                 }
 440             }
 441             xembed.sendMessage(xembed.handle, XEMBED_FOCUS_IN, flavor, 0, 0);
 442         }
 443     }
 444 
 445     void canvasFocusLost(FocusEvent e) {
 446         if (isXEmbedActive() && !e.isTemporary()) {
 447             xembedLog.fine("Forwarding FOCUS_LOST");
 448             int num = 0;
 449             if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembed.testing"))) {
 450                 Component opp = e.getOppositeComponent();
 451                 try {
 452                     num = Integer.parseInt(opp.getName());
 453                 } catch (NumberFormatException nfe) {
 454                 }
 455             }
 456             xembed.sendMessage(xembed.handle, XEMBED_FOCUS_OUT, num, 0, 0);
 457         }
 458     }
 459 


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


 413     public void windowGainedFocus(WindowEvent e) {
 414         applicationActive = true;
 415         if (isXEmbedActive()) {
 416             xembedLog.fine("Sending WINDOW_ACTIVATE");
 417             xembed.sendMessage(xembed.handle, XEMBED_WINDOW_ACTIVATE);
 418         }
 419     }
 420 
 421     public void windowLostFocus(WindowEvent e) {
 422         applicationActive = false;
 423         if (isXEmbedActive()) {
 424             xembedLog.fine("Sending WINDOW_DEACTIVATE");
 425             xembed.sendMessage(xembed.handle, XEMBED_WINDOW_DEACTIVATE);
 426         }
 427     }
 428 
 429     void canvasFocusGained(FocusEvent e) {
 430         if (isXEmbedActive()) {
 431             xembedLog.fine("Forwarding FOCUS_GAINED");
 432             int flavor = XEMBED_FOCUS_CURRENT;
 433             if (e.getCause() == FocusEvent.Cause.TRAVERSAL_FORWARD) {


 434                 flavor = XEMBED_FOCUS_FIRST;
 435             } else if (e.getCause() == FocusEvent.Cause.TRAVERSAL_BACKWARD) {
 436                 flavor = XEMBED_FOCUS_LAST;

 437             }
 438             xembed.sendMessage(xembed.handle, XEMBED_FOCUS_IN, flavor, 0, 0);
 439         }
 440     }
 441 
 442     void canvasFocusLost(FocusEvent e) {
 443         if (isXEmbedActive() && !e.isTemporary()) {
 444             xembedLog.fine("Forwarding FOCUS_LOST");
 445             int num = 0;
 446             if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembed.testing"))) {
 447                 Component opp = e.getOppositeComponent();
 448                 try {
 449                     num = Integer.parseInt(opp.getName());
 450                 } catch (NumberFormatException nfe) {
 451                 }
 452             }
 453             xembed.sendMessage(xembed.handle, XEMBED_FOCUS_OUT, num, 0, 0);
 454         }
 455     }
 456 


< prev index next >