1 /* |
1 /* |
2 * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
37 |
37 |
38 /** |
38 /** |
39 * This class implements window which serves as content window for decorated frames. |
39 * This class implements window which serves as content window for decorated frames. |
40 * Its purpose to provide correct events dispatching for the complex |
40 * Its purpose to provide correct events dispatching for the complex |
41 * constructs such as decorated frames. |
41 * constructs such as decorated frames. |
|
42 * |
|
43 * It should always be located at (- left inset, - top inset) in the associated |
|
44 * decorated window. So coordinates in it would be the same as java coordinates. |
42 */ |
45 */ |
43 public class XContentWindow extends XWindow implements XConstants { |
46 public final class XContentWindow extends XWindow implements XConstants { |
44 private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow"); |
47 private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow"); |
45 |
48 |
46 XDecoratedPeer parentFrame; |
49 static XContentWindow createContent(XDecoratedPeer parentFrame) { |
|
50 final WindowDimensions dims = parentFrame.getDimensions(); |
|
51 Rectangle rec = dims.getBounds(); |
|
52 // Fix for - set the location of the content window to the (-left inset, -top inset) |
|
53 Insets ins = dims.getInsets(); |
|
54 if (ins != null) { |
|
55 rec.x = -ins.left; |
|
56 rec.y = -ins.top; |
|
57 } else { |
|
58 rec.x = 0; |
|
59 rec.y = 0; |
|
60 } |
|
61 final XContentWindow cw = new XContentWindow(parentFrame, rec); |
|
62 cw.xSetVisible(true); |
|
63 return cw; |
|
64 } |
|
65 |
|
66 private final XDecoratedPeer parentFrame; |
47 |
67 |
48 // A list of expose events that come when the parentFrame is iconified |
68 // A list of expose events that come when the parentFrame is iconified |
49 private java.util.List<SavedExposeEvent> iconifiedExposeEvents = new java.util.ArrayList<SavedExposeEvent>(); |
69 private final java.util.List<SavedExposeEvent> iconifiedExposeEvents = |
|
70 new java.util.ArrayList<SavedExposeEvent>(); |
50 |
71 |
51 XContentWindow(XDecoratedPeer parentFrame, Rectangle bounds) { |
72 private XContentWindow(XDecoratedPeer parentFrame, Rectangle bounds) { |
52 super((Component)parentFrame.getTarget(), parentFrame.getShell(), bounds); |
73 super((Component)parentFrame.getTarget(), parentFrame.getShell(), bounds); |
53 this.parentFrame = parentFrame; |
74 this.parentFrame = parentFrame; |
54 } |
75 } |
55 |
76 |
56 void preInit(XCreateWindowParams params) { |
77 void preInit(XCreateWindowParams params) { |
61 eventMask = eventMask & ~(StructureNotifyMask); |
82 eventMask = eventMask & ~(StructureNotifyMask); |
62 params.put(EVENT_MASK, eventMask); |
83 params.put(EVENT_MASK, eventMask); |
63 } |
84 } |
64 } |
85 } |
65 |
86 |
66 void initialize() { |
|
67 xSetVisible(true); |
|
68 } |
|
69 protected String getWMName() { |
87 protected String getWMName() { |
70 return "Content window"; |
88 return "Content window"; |
71 } |
89 } |
72 protected boolean isEventDisabled(XEvent e) { |
90 protected boolean isEventDisabled(XEvent e) { |
73 switch (e.get_type()) { |
91 switch (e.get_type()) { |