GtkDialogPeer.java (create()): Create a top-level GTK window.
2003-09-19 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/awt/peer/gtk/GtkDialogPeer.java (create()): Create a top-level GTK window. (getArgs): Add "title" property. * gnu/java/awt/peer/gtk/GtkWindowPeer.java (setResizable): Use "allow_shrink" and "allow_grow" properties. * java/awt/Dialog.java: Initialize resizable to true and change comments accordingly. Initialize visible to false in constructors. * java/awt/Frame.java (dispose): Remove method. * java/awt/Window.java (ownedWindows): New field. (Window(Window,GraphicsConfiguration)): Add a weak reference to owner's ownedWindows vector. (finalize): Remove method. (hide): Hide owned windows. (dispose): Dispose of owned windows. (getOwnedWindows): Implement. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c: Remove unused GtkArg code. (set(String,boolean)): Clamp gboolean parameter to g_object_set to TRUE or FALSE. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c (create): Set window's size requisition. (connectHooks): Fix indentation. (setResizable): Remove function. (static setBounds): Likewise. (setBounds): Replace call to setBounds with GTK size requisition and resize calls. From-SVN: r71585
This commit is contained in:
parent
9e3bfa9b75
commit
5ec47f6049
9 changed files with 158 additions and 129 deletions
|
@ -1,3 +1,33 @@
|
||||||
|
2003-09-19 Thomas Fitzsimmons <fitzsim@redhat.com>
|
||||||
|
|
||||||
|
* gnu/java/awt/peer/gtk/GtkDialogPeer.java (create()): Create a
|
||||||
|
top-level GTK window.
|
||||||
|
(getArgs): Add "title" property.
|
||||||
|
* gnu/java/awt/peer/gtk/GtkWindowPeer.java (setResizable): Use
|
||||||
|
"allow_shrink" and "allow_grow" properties.
|
||||||
|
* java/awt/Dialog.java: Initialize resizable to true and change
|
||||||
|
comments accordingly. Initialize visible to false in
|
||||||
|
constructors.
|
||||||
|
* java/awt/Frame.java (dispose): Remove method.
|
||||||
|
* java/awt/Window.java (ownedWindows): New field.
|
||||||
|
(Window(Window,GraphicsConfiguration)): Add a weak reference to
|
||||||
|
owner's ownedWindows vector.
|
||||||
|
(finalize): Remove method.
|
||||||
|
(hide): Hide owned windows.
|
||||||
|
(dispose): Dispose of owned windows.
|
||||||
|
(getOwnedWindows): Implement.
|
||||||
|
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c: Remove
|
||||||
|
unused GtkArg code.
|
||||||
|
(set(String,boolean)): Clamp gboolean parameter to g_object_set
|
||||||
|
to TRUE or FALSE.
|
||||||
|
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
|
||||||
|
(create): Set window's size requisition.
|
||||||
|
(connectHooks): Fix indentation.
|
||||||
|
(setResizable): Remove function.
|
||||||
|
(static setBounds): Likewise.
|
||||||
|
(setBounds): Replace call to setBounds with GTK size requisition
|
||||||
|
and resize calls.
|
||||||
|
|
||||||
2003-09-19 Mohan Embar <gnustuff@thisiscool.com>
|
2003-09-19 Mohan Embar <gnustuff@thisiscool.com>
|
||||||
|
|
||||||
* win32-threads.cc: (ensure_interrupt_event_initialized) New
|
* win32-threads.cc: (ensure_interrupt_event_initialized) New
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class GtkDialogPeer extends GtkWindowPeer
|
||||||
|
|
||||||
void create ()
|
void create ()
|
||||||
{
|
{
|
||||||
create (GTK_WINDOW_POPUP,
|
create (GTK_WINDOW_TOPLEVEL,
|
||||||
awtComponent.getWidth(),
|
awtComponent.getWidth(),
|
||||||
awtComponent.getHeight());
|
awtComponent.getHeight());
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ public class GtkDialogPeer extends GtkWindowPeer
|
||||||
|
|
||||||
Dialog dialog = (Dialog) component;
|
Dialog dialog = (Dialog) component;
|
||||||
|
|
||||||
|
args.add ("title", dialog.getTitle ());
|
||||||
args.add ("modal", dialog.isModal ());
|
args.add ("modal", dialog.isModal ());
|
||||||
args.add ("allow_shrink", dialog.isResizable ());
|
args.add ("allow_shrink", dialog.isResizable ());
|
||||||
args.add ("allow_grow", dialog.isResizable ());
|
args.add ("allow_grow", dialog.isResizable ());
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class GtkFramePeer extends GtkWindowPeer
|
||||||
args.add ("allow_shrink", frame.isResizable ());
|
args.add ("allow_shrink", frame.isResizable ());
|
||||||
args.add ("allow_grow", frame.isResizable ());
|
args.add ("allow_grow", frame.isResizable ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIconImage (Image image)
|
public void setIconImage (Image image)
|
||||||
{
|
{
|
||||||
/* TODO: Waiting on Toolkit Image routines */
|
/* TODO: Waiting on Toolkit Image routines */
|
||||||
|
|
|
@ -53,7 +53,9 @@ public class GtkWindowPeer extends GtkContainerPeer
|
||||||
|
|
||||||
void create (int type)
|
void create (int type)
|
||||||
{
|
{
|
||||||
create (type, awtComponent.getWidth(), awtComponent.getHeight());
|
create (type,
|
||||||
|
awtComponent.getWidth(),
|
||||||
|
awtComponent.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void create ()
|
void create ()
|
||||||
|
@ -75,7 +77,7 @@ public class GtkWindowPeer extends GtkContainerPeer
|
||||||
args.add ("visible", component.isVisible ());
|
args.add ("visible", component.isVisible ());
|
||||||
args.add ("sensitive", component.isEnabled ());
|
args.add ("sensitive", component.isEnabled ());
|
||||||
}
|
}
|
||||||
|
|
||||||
native public void toBack ();
|
native public void toBack ();
|
||||||
native public void toFront ();
|
native public void toFront ();
|
||||||
|
|
||||||
|
@ -86,7 +88,11 @@ public class GtkWindowPeer extends GtkContainerPeer
|
||||||
set ("title", title);
|
set ("title", title);
|
||||||
}
|
}
|
||||||
|
|
||||||
native public void setResizable (boolean r);
|
public void setResizable (boolean resizable)
|
||||||
|
{
|
||||||
|
set ("allow_shrink", resizable);
|
||||||
|
set ("allow_grow", resizable);
|
||||||
|
}
|
||||||
|
|
||||||
protected void postConfigureEvent (int x, int y, int width, int height,
|
protected void postConfigureEvent (int x, int y, int width, int height,
|
||||||
int top, int left, int bottom, int right)
|
int top, int left, int bottom, int right)
|
||||||
|
|
|
@ -70,7 +70,7 @@ private boolean modal;
|
||||||
/**
|
/**
|
||||||
* @serial Indicates whether or not this dialog box is resizable.
|
* @serial Indicates whether or not this dialog box is resizable.
|
||||||
*/
|
*/
|
||||||
private boolean resizable;
|
private boolean resizable = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @serial The title string for this dialog box, which can be
|
* @serial The title string for this dialog box, which can be
|
||||||
|
@ -91,7 +91,7 @@ private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified
|
* Initializes a new instance of <code>Dialog</code> with the specified
|
||||||
* parent, that is not resizable and not modal, and which has no title.
|
* parent, that is resizable and not modal, and which has no title.
|
||||||
*
|
*
|
||||||
* @param parent The parent frame of this dialog box.
|
* @param parent The parent frame of this dialog box.
|
||||||
*
|
*
|
||||||
|
@ -109,7 +109,7 @@ Dialog(Frame parent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified
|
* Initializes a new instance of <code>Dialog</code> with the specified
|
||||||
* parent and modality, that is not resizable and which has no title.
|
* parent and modality, that is resizable and which has no title.
|
||||||
*
|
*
|
||||||
* @param parent The parent frame of this dialog box.
|
* @param parent The parent frame of this dialog box.
|
||||||
* @param modal <true> if this dialog box is modal, <code>false</code>
|
* @param modal <true> if this dialog box is modal, <code>false</code>
|
||||||
|
@ -129,7 +129,7 @@ Dialog(Frame parent, boolean modal)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified
|
* Initializes a new instance of <code>Dialog</code> with the specified
|
||||||
* parent, that is not resizable and not modal, and which has the specified
|
* parent, that is resizable and not modal, and which has the specified
|
||||||
* title.
|
* title.
|
||||||
*
|
*
|
||||||
* @param parent The parent frame of this dialog box.
|
* @param parent The parent frame of this dialog box.
|
||||||
|
@ -149,7 +149,7 @@ Dialog(Frame parent, String title)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent, title, and modality, that is not resizable.
|
* parent, title, and modality, that is resizable.
|
||||||
*
|
*
|
||||||
* @param parent The parent frame of this dialog box.
|
* @param parent The parent frame of this dialog box.
|
||||||
* @param title The title string for this dialog box.
|
* @param title The title string for this dialog box.
|
||||||
|
@ -168,7 +168,7 @@ Dialog(Frame parent, String title, boolean modal)
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent, title, modality and <code>GraphicsConfiguration</code>,
|
* parent, title, modality and <code>GraphicsConfiguration</code>,
|
||||||
* that is not resizable.
|
* that is resizable.
|
||||||
*
|
*
|
||||||
* @param parent The parent frame of this dialog box.
|
* @param parent The parent frame of this dialog box.
|
||||||
* @param title The title string for this dialog box.
|
* @param title The title string for this dialog box.
|
||||||
|
@ -189,14 +189,14 @@ Dialog (Frame parent, String title, boolean modal, GraphicsConfiguration gc)
|
||||||
|
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.modal = modal;
|
this.modal = modal;
|
||||||
resizable = false;
|
visible = false;
|
||||||
|
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent, that is not resizable.
|
* parent, that is resizable.
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException If parent is null. This exception is
|
* @exception IllegalArgumentException If parent is null. This exception is
|
||||||
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
||||||
|
@ -211,7 +211,7 @@ Dialog (Dialog owner)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent and title, that is not resizable.
|
* parent and title, that is resizable.
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException If parent is null. This exception is
|
* @exception IllegalArgumentException If parent is null. This exception is
|
||||||
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
||||||
|
@ -226,7 +226,7 @@ Dialog (Dialog owner, String title)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent, title and modality, that is not resizable.
|
* parent, title and modality, that is resizable.
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException If parent is null. This exception is
|
* @exception IllegalArgumentException If parent is null. This exception is
|
||||||
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
* always thrown when GraphicsEnvironment.isHeadless() returns true.
|
||||||
|
@ -242,7 +242,7 @@ Dialog (Dialog owner, String title, boolean modal)
|
||||||
/**
|
/**
|
||||||
* Initializes a new instance of <code>Dialog</code> with the specified,
|
* Initializes a new instance of <code>Dialog</code> with the specified,
|
||||||
* parent, title, modality and <code>GraphicsConfiguration</code>,
|
* parent, title, modality and <code>GraphicsConfiguration</code>,
|
||||||
* that is not resizable.
|
* that is resizable.
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException If parent is null, the
|
* @exception IllegalArgumentException If parent is null, the
|
||||||
* GraphicsConfiguration is not a screen device or
|
* GraphicsConfiguration is not a screen device or
|
||||||
|
@ -255,10 +255,10 @@ Dialog (Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
|
||||||
{
|
{
|
||||||
super (parent, parent.getGraphicsConfiguration ());
|
super (parent, parent.getGraphicsConfiguration ());
|
||||||
|
|
||||||
this.modal = modal;
|
|
||||||
this.title = title;
|
this.title = title;
|
||||||
resizable = false;
|
this.modal = modal;
|
||||||
|
visible = false;
|
||||||
|
|
||||||
setLayout (new BorderLayout ());
|
setLayout (new BorderLayout ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -437,25 +437,6 @@ addNotify()
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroys any resources associated with this frame. This includes
|
|
||||||
* all components in the frame and all owned toplevel windows.
|
|
||||||
*/
|
|
||||||
public void
|
|
||||||
dispose()
|
|
||||||
{
|
|
||||||
Enumeration e = ownedWindows.elements();
|
|
||||||
while(e.hasMoreElements())
|
|
||||||
{
|
|
||||||
Window w = (Window)e.nextElement();
|
|
||||||
w.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a debugging string describing this window.
|
* Returns a debugging string describing this window.
|
||||||
*
|
*
|
||||||
|
@ -472,8 +453,6 @@ getFrames()
|
||||||
{
|
{
|
||||||
//Frame[] array = new Frames[frames.size()];
|
//Frame[] array = new Frames[frames.size()];
|
||||||
//return frames.toArray(array);
|
//return frames.toArray(array);
|
||||||
|
|
||||||
// see finalize() comment
|
|
||||||
String msg = "FIXME: can't be implemented without weak references";
|
String msg = "FIXME: can't be implemented without weak references";
|
||||||
throw new UnsupportedOperationException(msg);
|
throw new UnsupportedOperationException(msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,13 @@ import java.awt.event.WindowFocusListener;
|
||||||
import java.awt.event.WindowListener;
|
import java.awt.event.WindowListener;
|
||||||
import java.awt.event.WindowStateListener;
|
import java.awt.event.WindowStateListener;
|
||||||
import java.awt.peer.WindowPeer;
|
import java.awt.peer.WindowPeer;
|
||||||
|
import java.lang.ref.Reference;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
import java.util.Vector;
|
||||||
import javax.accessibility.Accessible;
|
import javax.accessibility.Accessible;
|
||||||
import javax.accessibility.AccessibleContext;
|
import javax.accessibility.AccessibleContext;
|
||||||
|
|
||||||
|
@ -69,6 +73,9 @@ public class Window extends Container implements Accessible
|
||||||
/** @since 1.4 */
|
/** @since 1.4 */
|
||||||
private boolean focusableWindowState = true;
|
private boolean focusableWindowState = true;
|
||||||
|
|
||||||
|
// A list of other top-level windows owned by this window.
|
||||||
|
private transient Vector ownedWindows = new Vector();
|
||||||
|
|
||||||
private transient WindowListener windowListener;
|
private transient WindowListener windowListener;
|
||||||
private transient WindowFocusListener windowFocusListener;
|
private transient WindowFocusListener windowFocusListener;
|
||||||
private transient WindowStateListener windowStateListener;
|
private transient WindowStateListener windowStateListener;
|
||||||
|
@ -139,11 +146,13 @@ public class Window extends Container implements Accessible
|
||||||
if (owner == null)
|
if (owner == null)
|
||||||
throw new IllegalArgumentException ("owner must not be null");
|
throw new IllegalArgumentException ("owner must not be null");
|
||||||
|
|
||||||
this.parent = owner;
|
parent = owner;
|
||||||
|
|
||||||
// FIXME: add to owner's "owned window" list
|
synchronized (owner.ownedWindows)
|
||||||
//owner.owned.add(this); // this should be a weak reference
|
{
|
||||||
|
owner.ownedWindows.add(new WeakReference(this));
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: make this text visible in the window.
|
// FIXME: make this text visible in the window.
|
||||||
SecurityManager s = System.getSecurityManager();
|
SecurityManager s = System.getSecurityManager();
|
||||||
if (s != null && ! s.checkTopLevelWindow(this))
|
if (s != null && ! s.checkTopLevelWindow(this))
|
||||||
|
@ -170,18 +179,6 @@ public class Window extends Container implements Accessible
|
||||||
return super.getGraphicsConfigurationImpl();
|
return super.getGraphicsConfigurationImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Disposes of the input methods and context, and removes the WeakReference
|
|
||||||
* which formerly pointed to this Window from the parent's owned Window list.
|
|
||||||
*
|
|
||||||
* @exception Throwable The Exception raised by this method.
|
|
||||||
*/
|
|
||||||
protected void finalize() throws Throwable
|
|
||||||
{
|
|
||||||
// FIXME: remove from owner's "owned window" list (Weak References)
|
|
||||||
super.finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the native peer for this window.
|
* Creates the native peer for this window.
|
||||||
*/
|
*/
|
||||||
|
@ -227,7 +224,23 @@ public class Window extends Container implements Accessible
|
||||||
|
|
||||||
public void hide()
|
public void hide()
|
||||||
{
|
{
|
||||||
// FIXME: call hide() on any "owned" children here.
|
synchronized (ownedWindows)
|
||||||
|
{
|
||||||
|
Iterator e = ownedWindows.iterator();
|
||||||
|
while(e.hasNext())
|
||||||
|
{
|
||||||
|
Window w = (Window)(((Reference) e.next()).get());
|
||||||
|
if (w != null)
|
||||||
|
w.hide();
|
||||||
|
else
|
||||||
|
// Remove null weak reference from ownedWindows.
|
||||||
|
// Unfortunately this can't be done in the Window's
|
||||||
|
// finalize method because there is no way to guarantee
|
||||||
|
// synchronous access to ownedWindows there.
|
||||||
|
e.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
super.hide();
|
super.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,15 +252,26 @@ public class Window extends Container implements Accessible
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to free any resource associated with this window.
|
* Destroys any resources associated with this window. This includes
|
||||||
|
* all components in the window and all owned top-level windows.
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
Window[] list = getOwnedWindows();
|
synchronized (ownedWindows)
|
||||||
for (int i=0; i<list.length; i++)
|
{
|
||||||
list[i].dispose();
|
Iterator e = ownedWindows.iterator();
|
||||||
|
while(e.hasNext())
|
||||||
|
{
|
||||||
|
Window w = (Window)(((Reference) e.next()).get());
|
||||||
|
if (w != null)
|
||||||
|
w.dispose();
|
||||||
|
else
|
||||||
|
// Remove null weak reference from ownedWindows.
|
||||||
|
e.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ncomponents; ++i)
|
for (int i = 0; i < ncomponents; ++i)
|
||||||
component[i].removeNotify();
|
component[i].removeNotify();
|
||||||
|
@ -340,9 +364,33 @@ public class Window extends Container implements Accessible
|
||||||
/** @since 1.2 */
|
/** @since 1.2 */
|
||||||
public Window[] getOwnedWindows()
|
public Window[] getOwnedWindows()
|
||||||
{
|
{
|
||||||
// FIXME: return array containing all the windows this window currently
|
Window [] trimmedList;
|
||||||
// owns.
|
synchronized (ownedWindows)
|
||||||
return new Window[0];
|
{
|
||||||
|
// Windows with non-null weak references in ownedWindows.
|
||||||
|
Window [] validList = new Window [ownedWindows.size()];
|
||||||
|
|
||||||
|
Iterator e = ownedWindows.iterator();
|
||||||
|
int numValid = 0;
|
||||||
|
while (e.hasNext())
|
||||||
|
{
|
||||||
|
Window w = (Window)(((Reference) e.next()).get());
|
||||||
|
if (w != null)
|
||||||
|
validList[numValid++] = w;
|
||||||
|
else
|
||||||
|
// Remove null weak reference from ownedWindows.
|
||||||
|
e.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (numValid != validList.length)
|
||||||
|
{
|
||||||
|
trimmedList = new Window [numValid];
|
||||||
|
System.arraycopy (validList, 0, trimmedList, 0, numValid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
trimmedList = validList;
|
||||||
|
}
|
||||||
|
return trimmedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -494,15 +494,11 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_S
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *value;
|
const char *value;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
GtkArg arg;
|
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, obj);
|
ptr = NSA_GET_PTR (env, obj);
|
||||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||||
value = (*env)->GetStringUTFChars (env, jvalue, NULL);
|
value = (*env)->GetStringUTFChars (env, jvalue, NULL);
|
||||||
|
|
||||||
arg.type = GTK_TYPE_STRING;
|
|
||||||
arg.name = (char *) name;
|
|
||||||
GTK_VALUE_STRING (arg) = (char *) value;
|
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
g_object_set(ptr, name, value, NULL);
|
g_object_set(ptr, name, value, NULL);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
@ -512,20 +508,20 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_S
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z
|
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z
|
||||||
(JNIEnv *env, jobject obj, jstring jname, jboolean value)
|
(JNIEnv *env, jobject obj, jstring jname, jboolean jvalue)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
gboolean value;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
GtkArg arg;
|
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, obj);
|
ptr = NSA_GET_PTR (env, obj);
|
||||||
|
|
||||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||||
|
/* Apparently a jboolean can have a value greater than 1. gboolean
|
||||||
|
variables may only contain the value TRUE or FALSE. */
|
||||||
|
value = jvalue ? TRUE : FALSE;
|
||||||
|
|
||||||
arg.type = GTK_TYPE_BOOL;
|
gdk_threads_enter();
|
||||||
arg.name = (char *) name;
|
|
||||||
GTK_VALUE_BOOL (arg) = value;
|
|
||||||
|
|
||||||
gdk_threads_enter();
|
|
||||||
g_object_set(ptr, name, value, NULL);
|
g_object_set(ptr, name, value, NULL);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
|
||||||
|
@ -537,15 +533,10 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_la
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
GtkArg arg;
|
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, obj);
|
ptr = NSA_GET_PTR (env, obj);
|
||||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||||
|
|
||||||
arg.type = GTK_TYPE_INT;
|
|
||||||
arg.name = (char *) name;
|
|
||||||
GTK_VALUE_INT (arg) = value;
|
|
||||||
|
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
g_object_set(ptr, name, value, NULL);
|
g_object_set(ptr, name, value, NULL);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
@ -558,15 +549,10 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_la
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
GtkArg arg;
|
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, obj);
|
ptr = NSA_GET_PTR (env, obj);
|
||||||
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
name = (*env)->GetStringUTFChars (env, jname, NULL);
|
||||||
|
|
||||||
arg.type = GTK_TYPE_FLOAT;
|
|
||||||
arg.name = (char *) name;
|
|
||||||
GTK_VALUE_FLOAT (arg) = value;
|
|
||||||
|
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
g_object_set(ptr, name, value, NULL);
|
g_object_set(ptr, name, value, NULL);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
@ -580,7 +566,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_O
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
void *ptr1, *ptr2;
|
void *ptr1, *ptr2;
|
||||||
GtkArg arg;
|
|
||||||
|
|
||||||
ptr1 = NSA_GET_PTR (env, obj1);
|
ptr1 = NSA_GET_PTR (env, obj1);
|
||||||
ptr2 = NSA_GET_PTR (env, obj2);
|
ptr2 = NSA_GET_PTR (env, obj2);
|
||||||
|
@ -598,10 +583,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_O
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
arg.type = GTK_TYPE_OBJECT;
|
|
||||||
arg.name = (char *) name;
|
|
||||||
GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2);
|
|
||||||
|
|
||||||
gdk_threads_enter();
|
gdk_threads_enter();
|
||||||
g_object_set(ptr1, name, ptr2, NULL);
|
g_object_set(ptr1, name, ptr2, NULL);
|
||||||
gdk_threads_leave();
|
gdk_threads_leave();
|
||||||
|
|
|
@ -42,8 +42,6 @@ exception statement from your version. */
|
||||||
#include <gdk/gdkprivate.h>
|
#include <gdk/gdkprivate.h>
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
|
|
||||||
static void setBounds (GtkWidget *, jint, jint, jint, jint);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a new window (any type)
|
* Make a new window (any type)
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +58,13 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
|
||||||
|
|
||||||
gtk_window_set_default_size (GTK_WINDOW(window), width, height);
|
gtk_window_set_default_size (GTK_WINDOW(window), width, height);
|
||||||
|
|
||||||
|
/* We must set this window's size requisition. Otherwise when a
|
||||||
|
resize is queued (when gtk_widget_queue_resize is called) the
|
||||||
|
window will snap to its default requisition of 0x0. If we omit
|
||||||
|
this call, Frames and Dialogs shrink to degenerate 1x1 windows
|
||||||
|
when their resizable property changes. */
|
||||||
|
gtk_widget_set_size_request (window, width, height);
|
||||||
|
|
||||||
vbox = gtk_vbox_new (0, 0);
|
vbox = gtk_vbox_new (0, 0);
|
||||||
layout = gtk_layout_new (NULL, NULL);
|
layout = gtk_layout_new (NULL, NULL);
|
||||||
gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
|
gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
|
||||||
|
@ -88,6 +93,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisible
|
||||||
gtk_widget_hide (GTK_WIDGET (ptr));
|
gtk_widget_hide (GTK_WIDGET (ptr));
|
||||||
|
|
||||||
XFlush (GDK_DISPLAY ());
|
XFlush (GDK_DISPLAY ());
|
||||||
|
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,20 +108,20 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
|
||||||
|
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
|
|
||||||
children = gtk_container_get_children(GTK_CONTAINER(ptr));
|
children = gtk_container_get_children(GTK_CONTAINER(ptr));
|
||||||
vbox = children->data;
|
vbox = children->data;
|
||||||
|
|
||||||
if(!GTK_IS_VBOX(vbox))
|
if(!GTK_IS_VBOX(vbox))
|
||||||
{
|
{
|
||||||
printf("*** this is not a vbox\n");
|
printf("*** this is not a vbox\n");
|
||||||
}
|
}
|
||||||
children = gtk_container_get_children(GTK_CONTAINER(vbox));
|
children = gtk_container_get_children(GTK_CONTAINER(vbox));
|
||||||
layout = children->data;
|
layout = children->data;
|
||||||
|
|
||||||
if(!GTK_IS_LAYOUT(layout))
|
if(!GTK_IS_LAYOUT(layout))
|
||||||
{
|
{
|
||||||
printf("*** widget is not a layout ***");
|
printf("*** widget is not a layout ***");
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_realize (layout);
|
gtk_widget_realize (layout);
|
||||||
|
|
||||||
|
@ -176,24 +182,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setTitle
|
||||||
(*env)->ReleaseStringUTFChars (env, title, str);
|
(*env)->ReleaseStringUTFChars (env, title, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Set a window's resizing policy
|
|
||||||
*/
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setResizable
|
|
||||||
(JNIEnv *env, jobject obj, jboolean resize)
|
|
||||||
{
|
|
||||||
void *ptr;
|
|
||||||
|
|
||||||
ptr = NSA_GET_PTR (env, obj);
|
|
||||||
|
|
||||||
gdk_threads_enter ();
|
|
||||||
gtk_window_set_policy (GTK_WINDOW (ptr), resize, resize, 0);
|
|
||||||
gdk_threads_leave ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lower the z-level of a window.
|
* Lower the z-level of a window.
|
||||||
*/
|
*/
|
||||||
|
@ -230,12 +218,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
|
|
||||||
{
|
|
||||||
gtk_window_resize (GTK_WINDOW(widget), width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
|
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
|
||||||
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +229,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
|
||||||
gdk_threads_enter ();
|
gdk_threads_enter ();
|
||||||
|
|
||||||
widget = GTK_WIDGET (ptr);
|
widget = GTK_WIDGET (ptr);
|
||||||
setBounds (widget, x, y, width, height);
|
gtk_widget_set_size_request (widget, width, height);
|
||||||
|
gtk_window_resize (GTK_WINDOW(widget), width, height);
|
||||||
|
|
||||||
gdk_threads_leave ();
|
gdk_threads_leave ();
|
||||||
}
|
}
|
||||||
|
@ -306,7 +289,7 @@ gdk_window_get_root_geometry (GdkWindow *window,
|
||||||
gint *depth)
|
gint *depth)
|
||||||
{
|
{
|
||||||
GdkWindow *private;
|
GdkWindow *private;
|
||||||
|
|
||||||
g_return_if_fail (window != NULL);
|
g_return_if_fail (window != NULL);
|
||||||
|
|
||||||
private = (GdkWindow*) window;
|
private = (GdkWindow*) window;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue