60 |
private boolean hasBeenShown = false; |
private boolean hasBeenShown = false; |
61 |
private int oldState = Frame.NORMAL; |
private int oldState = Frame.NORMAL; |
62 |
|
|
|
private boolean resizing = false; |
|
|
|
|
63 |
native void gtkWindowSetTitle (String title); |
native void gtkWindowSetTitle (String title); |
64 |
native void gtkWindowSetResizable (boolean resizable); |
native void gtkWindowSetResizable (boolean resizable); |
65 |
native void gtkWindowSetModal (boolean modal); |
native void gtkWindowSetModal (boolean modal); |
122 |
{ |
{ |
123 |
// prevent window_configure_cb -> awtComponent.setSize -> |
// prevent window_configure_cb -> awtComponent.setSize -> |
124 |
// peer.setBounds -> nativeSetBounds self-deadlock on GDK lock. |
// peer.setBounds -> nativeSetBounds self-deadlock on GDK lock. |
125 |
if (resizing && Thread.currentThread() == GtkToolkit.mainThread) |
if (Thread.currentThread() == GtkToolkit.mainThread) |
126 |
{ |
return; |
127 |
resizing = false; |
|
|
return; |
|
|
} |
|
128 |
nativeSetBounds (x, y, |
nativeSetBounds (x, y, |
129 |
width - insets.left - insets.right, |
width - insets.left - insets.right, |
130 |
height - insets.top - insets.bottom); |
height - insets.top - insets.bottom); |
163 |
insets.right = right; |
insets.right = right; |
164 |
} |
} |
165 |
|
|
166 |
|
// called back by native side: window_configure_cb |
167 |
|
// only called from GTK thread |
168 |
protected void postConfigureEvent (int x, int y, int width, int height) |
protected void postConfigureEvent (int x, int y, int width, int height) |
169 |
{ |
{ |
170 |
int frame_width = width + insets.left + insets.right; |
int frame_width = width + insets.left + insets.right; |
172 |
|
|
173 |
if (frame_width != awtComponent.getWidth() |
if (frame_width != awtComponent.getWidth() |
174 |
|| frame_height != awtComponent.getHeight()) |
|| frame_height != awtComponent.getHeight()) |
175 |
{ |
awtComponent.setSize(frame_width, frame_height); |
|
resizing = true; |
|
|
awtComponent.setSize(frame_width, frame_height); |
|
|
} |
|
176 |
|
|
177 |
int frame_x = x - insets.left; |
int frame_x = x - insets.left; |
178 |
int frame_y = y - insets.top; |
int frame_y = y - insets.top; |
184 |
} |
} |
185 |
} |
} |
186 |
|
|
187 |
native void nativeSetVisible (boolean b); |
public void show () |
|
public void setVisible (boolean b) |
|
|
{ |
|
|
// Prevent the window manager from automatically placing this |
|
|
// window when it is shown. |
|
|
if (b) |
|
|
setBounds (awtComponent.getX(), |
|
|
awtComponent.getY(), |
|
|
awtComponent.getWidth(), |
|
|
awtComponent.getHeight()); |
|
|
nativeSetVisible (b); |
|
|
} |
|
|
|
|
|
native void nativeSetVisibleUnlocked (boolean b); |
|
|
public void setVisibleUnlocked (boolean b) |
|
188 |
{ |
{ |
189 |
// Prevent the window manager from automatically placing this |
// Prevent the window manager from automatically placing this |
190 |
// window when it is shown. |
// window when it is shown. |
191 |
if (b) |
setBounds (awtComponent.getX(), |
192 |
setBoundsUnlocked (awtComponent.getX(), |
awtComponent.getY(), |
193 |
awtComponent.getY(), |
awtComponent.getWidth(), |
194 |
awtComponent.getWidth(), |
awtComponent.getHeight()); |
195 |
awtComponent.getHeight()); |
setVisible (true); |
|
nativeSetVisibleUnlocked (b); |
|
196 |
} |
} |
197 |
|
|
198 |
void postWindowEvent (int id, Window opposite, int newState) |
void postWindowEvent (int id, Window opposite, int newState) |