42 |
import java.awt.Dimension; |
import java.awt.Dimension; |
43 |
import java.awt.Insets; |
import java.awt.Insets; |
44 |
import java.awt.Window; |
import java.awt.Window; |
45 |
|
import java.awt.Frame; |
46 |
|
import java.awt.event.WindowEvent; |
47 |
import java.awt.peer.WindowPeer; |
import java.awt.peer.WindowPeer; |
48 |
|
|
49 |
public class GtkWindowPeer extends GtkContainerPeer |
public class GtkWindowPeer extends GtkContainerPeer |
58 |
static protected final int GDK_WINDOW_TYPE_HINT_DOCK = 6; |
static protected final int GDK_WINDOW_TYPE_HINT_DOCK = 6; |
59 |
static protected final int GDK_WINDOW_TYPE_HINT_DESKTOP = 7; |
static protected final int GDK_WINDOW_TYPE_HINT_DESKTOP = 7; |
60 |
|
|
61 |
|
private boolean hasBeenShown = false; |
62 |
|
private int oldState = Frame.NORMAL; |
63 |
|
|
64 |
// Unfortunately, X does not provide a clean way to calculate the |
// Unfortunately, X does not provide a clean way to calculate the |
65 |
// dimensions of a window's borders before it has been displayed. |
// dimensions of a window's borders before it has been displayed. |
66 |
// So when creating the application's first window we guess the |
// So when creating the application's first window we guess the |
216 |
awtComponent.getHeight()); |
awtComponent.getHeight()); |
217 |
nativeSetVisible (b); |
nativeSetVisible (b); |
218 |
} |
} |
219 |
|
|
220 |
|
void postWindowEvent (int id, Window opposite, int newState) |
221 |
|
{ |
222 |
|
if (id == WindowEvent.WINDOW_OPENED) |
223 |
|
{ |
224 |
|
// Post a WINDOW_OPENED event the first time this window is shown. |
225 |
|
if (!hasBeenShown) |
226 |
|
{ |
227 |
|
q.postEvent (new WindowEvent ((Window) awtComponent, id, |
228 |
|
opposite)); |
229 |
|
hasBeenShown = true; |
230 |
|
} |
231 |
|
} |
232 |
|
else if (id == WindowEvent.WINDOW_STATE_CHANGED) |
233 |
|
{ |
234 |
|
if (oldState != newState) |
235 |
|
{ |
236 |
|
q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite, |
237 |
|
oldState, newState)); |
238 |
|
oldState = newState; |
239 |
|
} |
240 |
|
} |
241 |
|
else |
242 |
|
q.postEvent (new WindowEvent ((Window) awtComponent, id, opposite)); |
243 |
|
} |
244 |
} |
} |