1 /*
2 * Copyright (c) 2003, 2016, 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
64 if (!b) {
65 XToolkit.awtLock();
66 try {
67 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), handle);
68 }
69 finally {
70 XToolkit.awtUnlock();
71 }
72 } else {
73 XToolkit.awtLock();
74 try {
75 XlibWrapper.XMapWindow(XToolkit.getDisplay(), handle);
76 }
77 finally {
78 XToolkit.awtUnlock();
79 }
80 }
81 }
82 public void setEnabled(boolean b) {}
83 public void paint(Graphics g) {}
84 public void repaint(long tm, int x, int y, int width, int height) {}
85 public void print(Graphics g) {}
86 public void setBounds(int x, int y, int width, int height, int op) {
87 // Unimplemeneted: Check for min/max hints for non-resizable
88 XToolkit.awtLock();
89 try {
90 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), handle, x, y, width, height);
91 }
92 finally {
93 XToolkit.awtUnlock();
94 }
95 }
96 public void handleEvent(AWTEvent e) {
97 switch (e.getID()) {
98 case FocusEvent.FOCUS_GAINED:
99 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(proxy);
100 container.focusGained(handle);
101 break;
102 case FocusEvent.FOCUS_LOST:
103 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
104 container.focusLost(handle);
252 public Image createImage(ImageProducer producer) { return null; }
253 public Image createImage(int width, int height) { return null; }
254 public VolatileImage createVolatileImage(int width, int height) { return null; }
255 public boolean prepareImage(Image img, int w, int h, ImageObserver o) { return false; }
256 public int checkImage(Image img, int w, int h, ImageObserver o) { return 0; }
257 public GraphicsConfiguration getGraphicsConfiguration() { return null; }
258 public boolean handlesWheelScrolling() { return true; }
259 public void createBuffers(int numBuffers, BufferCapabilities caps)
260 throws AWTException { }
261 public Image getBackBuffer() { return null; }
262 public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) { }
263 public void destroyBuffers() { }
264
265 /**
266 * Used by lightweight implementations to tell a ComponentPeer to layout
267 * its sub-elements. For instance, a lightweight Checkbox needs to layout
268 * the box, as well as the text label.
269 */
270 public void layout() {}
271
272 /**
273 * DEPRECATED: Replaced by getPreferredSize().
274 */
275 public Dimension preferredSize() {
276 return getPreferredSize();
277 }
278
279 /**
280 * DEPRECATED: Replaced by getMinimumSize().
281 */
282 public Dimension minimumSize() {
283 return getMinimumSize();
284 }
285
286 /**
287 * DEPRECATED: Replaced by setVisible(boolean).
288 */
289 public void show() {
290 setVisible(true);
291 }
292
293 /**
294 * DEPRECATED: Replaced by setVisible(boolean).
295 */
296 public void hide() {
297 setVisible(false);
298 }
299
300 /**
301 * DEPRECATED: Replaced by setEnabled(boolean).
302 */
303 public void enable() {}
304
305 /**
306 * DEPRECATED: Replaced by setEnabled(boolean).
307 */
308 public void disable() {}
309
310 /**
311 * DEPRECATED: Replaced by setBounds(int, int, int, int).
312 */
313 public void reshape(int x, int y, int width, int height) {
314 setBounds(x, y, width, height, SET_BOUNDS);
315 }
316
317 Window getTopLevel(Component comp) {
318 while (comp != null && !(comp instanceof Window)) {
319 comp = comp.getParent();
320 }
321 return (Window)comp;
322 }
323
324 void childResized() {
325 XToolkit.postEvent(XToolkit.targetToAppContext(proxy), new ComponentEvent(proxy, ComponentEvent.COMPONENT_RESIZED));
326 container.childResized(proxy);
327 // XToolkit.postEvent(XToolkit.targetToAppContext(proxy), new InvocationEvent(proxy, new Runnable() {
328 // public void run() {
329 // getTopLevel(proxy).invalidate();
330 // getTopLevel(proxy).pack();
331 // }
332 // }));
333 }
334 void handlePropertyNotify(XEvent xev) {
335 XPropertyEvent ev = xev.get_xproperty();
336 if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) {
|
1 /*
2 * Copyright (c) 2003, 2018, 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
64 if (!b) {
65 XToolkit.awtLock();
66 try {
67 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), handle);
68 }
69 finally {
70 XToolkit.awtUnlock();
71 }
72 } else {
73 XToolkit.awtLock();
74 try {
75 XlibWrapper.XMapWindow(XToolkit.getDisplay(), handle);
76 }
77 finally {
78 XToolkit.awtUnlock();
79 }
80 }
81 }
82 public void setEnabled(boolean b) {}
83 public void paint(Graphics g) {}
84 public void print(Graphics g) {}
85 public void setBounds(int x, int y, int width, int height, int op) {
86 // Unimplemeneted: Check for min/max hints for non-resizable
87 XToolkit.awtLock();
88 try {
89 XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), handle, x, y, width, height);
90 }
91 finally {
92 XToolkit.awtUnlock();
93 }
94 }
95 public void handleEvent(AWTEvent e) {
96 switch (e.getID()) {
97 case FocusEvent.FOCUS_GAINED:
98 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(proxy);
99 container.focusGained(handle);
100 break;
101 case FocusEvent.FOCUS_LOST:
102 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
103 container.focusLost(handle);
251 public Image createImage(ImageProducer producer) { return null; }
252 public Image createImage(int width, int height) { return null; }
253 public VolatileImage createVolatileImage(int width, int height) { return null; }
254 public boolean prepareImage(Image img, int w, int h, ImageObserver o) { return false; }
255 public int checkImage(Image img, int w, int h, ImageObserver o) { return 0; }
256 public GraphicsConfiguration getGraphicsConfiguration() { return null; }
257 public boolean handlesWheelScrolling() { return true; }
258 public void createBuffers(int numBuffers, BufferCapabilities caps)
259 throws AWTException { }
260 public Image getBackBuffer() { return null; }
261 public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) { }
262 public void destroyBuffers() { }
263
264 /**
265 * Used by lightweight implementations to tell a ComponentPeer to layout
266 * its sub-elements. For instance, a lightweight Checkbox needs to layout
267 * the box, as well as the text label.
268 */
269 public void layout() {}
270
271 Window getTopLevel(Component comp) {
272 while (comp != null && !(comp instanceof Window)) {
273 comp = comp.getParent();
274 }
275 return (Window)comp;
276 }
277
278 void childResized() {
279 XToolkit.postEvent(XToolkit.targetToAppContext(proxy), new ComponentEvent(proxy, ComponentEvent.COMPONENT_RESIZED));
280 container.childResized(proxy);
281 // XToolkit.postEvent(XToolkit.targetToAppContext(proxy), new InvocationEvent(proxy, new Runnable() {
282 // public void run() {
283 // getTopLevel(proxy).invalidate();
284 // getTopLevel(proxy).pack();
285 // }
286 // }));
287 }
288 void handlePropertyNotify(XEvent xev) {
289 XPropertyEvent ev = xev.get_xproperty();
290 if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) {
|