59 |
import java.awt.image.ImageObserver; |
import java.awt.image.ImageObserver; |
60 |
import java.awt.image.ImageProducer; |
import java.awt.image.ImageProducer; |
61 |
import java.awt.peer.*; |
import java.awt.peer.*; |
62 |
|
import java.io.InputStream; |
63 |
import java.net.URL; |
import java.net.URL; |
64 |
import java.text.AttributedString; |
import java.text.AttributedString; |
65 |
import java.util.HashMap; |
import java.util.HashMap; |
66 |
import java.util.HashSet; |
import java.util.HashSet; |
67 |
import java.util.Hashtable; |
import java.util.Hashtable; |
68 |
import java.util.Iterator; |
import java.util.Iterator; |
69 |
|
import java.util.LinkedHashMap; |
70 |
import java.util.Map; |
import java.util.Map; |
71 |
import java.util.MissingResourceException; |
import java.util.MissingResourceException; |
72 |
import java.util.Properties; |
import java.util.Properties; |
73 |
|
import javax.imageio.spi.IIORegistry; |
74 |
|
|
75 |
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer(). |
/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer(). |
76 |
This merits comment. We are basically calling Sun's bluff on this one. |
This merits comment. We are basically calling Sun's bluff on this one. |
89 |
public class GtkToolkit extends gnu.java.awt.ClasspathToolkit |
public class GtkToolkit extends gnu.java.awt.ClasspathToolkit |
90 |
implements EmbeddedWindowSupport |
implements EmbeddedWindowSupport |
91 |
{ |
{ |
|
GtkMainThread main; |
|
92 |
Hashtable containers = new Hashtable(); |
Hashtable containers = new Hashtable(); |
93 |
static EventQueue q = new EventQueue(); |
static EventQueue q; |
94 |
static Clipboard systemClipboard; |
static Clipboard systemClipboard; |
95 |
static boolean useGraphics2dSet; |
static boolean useGraphics2dSet; |
96 |
static boolean useGraphics2d; |
static boolean useGraphics2d; |
105 |
return useGraphics2d; |
return useGraphics2d; |
106 |
} |
} |
107 |
|
|
108 |
|
static native void gtkInit(int portableNativeSync); |
109 |
|
|
110 |
static |
static |
111 |
{ |
{ |
112 |
if (Configuration.INIT_LOAD_LIBRARY) |
if (Configuration.INIT_LOAD_LIBRARY) |
113 |
System.loadLibrary("gtkpeer"); |
System.loadLibrary("gtkpeer"); |
114 |
|
|
115 |
|
int portableNativeSync; |
116 |
|
String portNatSyncProp = |
117 |
|
System.getProperty("gnu.classpath.awt.gtk.portable.native.sync"); |
118 |
|
|
119 |
|
if (portNatSyncProp == null) |
120 |
|
portableNativeSync = -1; // unset |
121 |
|
else if (Boolean.valueOf(portNatSyncProp).booleanValue()) |
122 |
|
portableNativeSync = 1; // true |
123 |
|
else |
124 |
|
portableNativeSync = 0; // false |
125 |
|
|
126 |
|
gtkInit(portableNativeSync); |
127 |
} |
} |
128 |
|
|
129 |
public GtkToolkit () |
public GtkToolkit () |
130 |
{ |
{ |
|
main = new GtkMainThread (); |
|
131 |
systemClipboard = new GtkClipboard (); |
systemClipboard = new GtkClipboard (); |
|
GtkGenericPeer.enableQueue (q); |
|
132 |
} |
} |
133 |
|
|
134 |
native public void beep (); |
native public void beep (); |
135 |
native private void getScreenSizeDimensions (int[] xy); |
native private void getScreenSizeDimensions (int[] xy); |
136 |
|
|
328 |
"SansSerif" }); |
"SansSerif" }); |
329 |
} |
} |
330 |
|
|
331 |
private class LRUCache extends java.util.LinkedHashMap |
private class LRUCache extends LinkedHashMap |
332 |
{ |
{ |
333 |
int max_entries; |
int max_entries; |
334 |
public LRUCache(int max) |
public LRUCache(int max) |
609 |
|
|
610 |
protected EventQueue getSystemEventQueueImpl() |
protected EventQueue getSystemEventQueueImpl() |
611 |
{ |
{ |
612 |
|
synchronized (GtkToolkit.class) |
613 |
|
{ |
614 |
|
if (q == null) |
615 |
|
{ |
616 |
|
q = new EventQueue(); |
617 |
|
GtkGenericPeer.enableQueue (q); |
618 |
|
} |
619 |
|
} |
620 |
return q; |
return q; |
621 |
} |
} |
622 |
|
|
636 |
|
|
637 |
public GraphicsEnvironment getLocalGraphicsEnvironment() |
public GraphicsEnvironment getLocalGraphicsEnvironment() |
638 |
{ |
{ |
639 |
GraphicsEnvironment ge; |
return new GdkGraphicsEnvironment(); |
640 |
ge = new GdkGraphicsEnvironment (); |
} |
641 |
return ge; |
|
642 |
|
public Font createFont(int format, InputStream stream) |
643 |
|
{ |
644 |
|
throw new UnsupportedOperationException(); |
645 |
|
} |
646 |
|
|
647 |
|
public RobotPeer createRobot (GraphicsDevice screen) throws AWTException |
648 |
|
{ |
649 |
|
return new GdkRobotPeer (screen); |
650 |
} |
} |
651 |
|
|
652 |
public Font createFont(int format, java.io.InputStream stream) |
public void registerImageIOSpis(IIORegistry reg) |
653 |
{ |
{ |
654 |
throw new java.lang.UnsupportedOperationException (); |
GdkPixbufDecoder.registerSpis(reg); |
655 |
} |
} |
656 |
|
|
657 |
|
public native boolean nativeQueueEmpty(); |
658 |
|
public native void wakeNativeQueue(); |
659 |
|
public native void iterateNativeQueue(EventQueue locked); |
660 |
|
|
661 |
} // class GtkToolkit |
} // class GtkToolkit |