< prev index next >

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

Print this page


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


  41 import java.awt.EventQueue;
  42 import java.awt.FileDialog;
  43 import java.awt.Frame;
  44 import java.awt.GraphicsConfiguration;
  45 import java.awt.GraphicsDevice;
  46 import java.awt.GraphicsEnvironment;
  47 import java.awt.HeadlessException;
  48 import java.awt.Image;
  49 import java.awt.Insets;
  50 import java.awt.JobAttributes;
  51 import java.awt.Label;
  52 import java.awt.Menu;
  53 import java.awt.MenuBar;
  54 import java.awt.MenuItem;
  55 import java.awt.PageAttributes;
  56 import java.awt.Panel;
  57 import java.awt.Point;
  58 import java.awt.PopupMenu;
  59 import java.awt.PrintJob;
  60 import java.awt.Rectangle;
  61 import java.awt.Robot;
  62 import java.awt.ScrollPane;
  63 import java.awt.Scrollbar;
  64 import java.awt.SystemColor;
  65 import java.awt.SystemTray;
  66 import java.awt.Taskbar;
  67 import java.awt.TextArea;
  68 import java.awt.TextField;
  69 import java.awt.Toolkit;
  70 import java.awt.TrayIcon;
  71 import java.awt.Window;
  72 import java.awt.datatransfer.Clipboard;
  73 import java.awt.dnd.DragGestureEvent;
  74 import java.awt.dnd.DragGestureListener;
  75 import java.awt.dnd.DragGestureRecognizer;
  76 import java.awt.dnd.DragSource;
  77 import java.awt.dnd.InvalidDnDOperationException;
  78 import java.awt.dnd.MouseDragGestureRecognizer;
  79 import java.awt.dnd.peer.DragSourceContextPeer;
  80 import java.awt.event.InputEvent;
  81 import java.awt.event.KeyEvent;


1060     }
1061     */
1062 
1063     // Need this for XMenuItemPeer.
1064     protected static Object targetToPeer(Object target) {
1065         Object p=null;
1066         if (target != null && !GraphicsEnvironment.isHeadless()) {
1067             p = specialPeerMap.get(target);
1068         }
1069         if (p != null) return p;
1070         else
1071             return SunToolkit.targetToPeer(target);
1072     }
1073 
1074     // Need this for XMenuItemPeer.
1075     protected static void targetDisposedPeer(Object target, Object peer) {
1076         SunToolkit.targetDisposedPeer(target, peer);
1077     }
1078 
1079     @Override
1080     public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
1081         return new XRobotPeer(screen.getDefaultConfiguration());



1082     }
1083 
1084 
1085   /*
1086      * On X, support for dynamic layout on resizing is governed by the
1087      * window manager.  If the window manager supports it, it happens
1088      * automatically.  The setter method for this property is
1089      * irrelevant on X.
1090      */
1091     @Override
1092     public void setDynamicLayout(boolean b) {
1093         dynamicLayoutSetting = b;
1094     }
1095 
1096     @Override
1097     protected boolean isDynamicLayoutSet() {
1098         return dynamicLayoutSetting;
1099     }
1100 
1101     /* Called from isDynamicLayoutActive() and from
1102      * lazilyLoadDynamicLayoutSupportedProperty()
1103      */


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


  41 import java.awt.EventQueue;
  42 import java.awt.FileDialog;
  43 import java.awt.Frame;
  44 import java.awt.GraphicsConfiguration;
  45 import java.awt.GraphicsDevice;
  46 import java.awt.GraphicsEnvironment;
  47 import java.awt.HeadlessException;
  48 import java.awt.Image;
  49 import java.awt.Insets;
  50 import java.awt.JobAttributes;
  51 import java.awt.Label;
  52 import java.awt.Menu;
  53 import java.awt.MenuBar;
  54 import java.awt.MenuItem;
  55 import java.awt.PageAttributes;
  56 import java.awt.Panel;
  57 import java.awt.Point;
  58 import java.awt.PopupMenu;
  59 import java.awt.PrintJob;
  60 import java.awt.Rectangle;

  61 import java.awt.ScrollPane;
  62 import java.awt.Scrollbar;
  63 import java.awt.SystemColor;
  64 import java.awt.SystemTray;
  65 import java.awt.Taskbar;
  66 import java.awt.TextArea;
  67 import java.awt.TextField;
  68 import java.awt.Toolkit;
  69 import java.awt.TrayIcon;
  70 import java.awt.Window;
  71 import java.awt.datatransfer.Clipboard;
  72 import java.awt.dnd.DragGestureEvent;
  73 import java.awt.dnd.DragGestureListener;
  74 import java.awt.dnd.DragGestureRecognizer;
  75 import java.awt.dnd.DragSource;
  76 import java.awt.dnd.InvalidDnDOperationException;
  77 import java.awt.dnd.MouseDragGestureRecognizer;
  78 import java.awt.dnd.peer.DragSourceContextPeer;
  79 import java.awt.event.InputEvent;
  80 import java.awt.event.KeyEvent;


1059     }
1060     */
1061 
1062     // Need this for XMenuItemPeer.
1063     protected static Object targetToPeer(Object target) {
1064         Object p=null;
1065         if (target != null && !GraphicsEnvironment.isHeadless()) {
1066             p = specialPeerMap.get(target);
1067         }
1068         if (p != null) return p;
1069         else
1070             return SunToolkit.targetToPeer(target);
1071     }
1072 
1073     // Need this for XMenuItemPeer.
1074     protected static void targetDisposedPeer(Object target, Object peer) {
1075         SunToolkit.targetDisposedPeer(target, peer);
1076     }
1077 
1078     @Override
1079     public RobotPeer createRobot(GraphicsDevice screen) throws AWTException {
1080         if (screen instanceof X11GraphicsDevice) {
1081             return new XRobotPeer((X11GraphicsDevice) screen);
1082         }
1083         return super.createRobot(screen);
1084     }

1085 
1086   /*
1087      * On X, support for dynamic layout on resizing is governed by the
1088      * window manager.  If the window manager supports it, it happens
1089      * automatically.  The setter method for this property is
1090      * irrelevant on X.
1091      */
1092     @Override
1093     public void setDynamicLayout(boolean b) {
1094         dynamicLayoutSetting = b;
1095     }
1096 
1097     @Override
1098     protected boolean isDynamicLayoutSet() {
1099         return dynamicLayoutSetting;
1100     }
1101 
1102     /* Called from isDynamicLayoutActive() and from
1103      * lazilyLoadDynamicLayoutSupportedProperty()
1104      */


< prev index next >