Imported GNU Classpath 0.90
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r111942
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
|
||||
Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2002, 2003, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -42,6 +42,8 @@ import java.awt.Checkbox;
|
||||
import java.awt.CheckboxGroup;
|
||||
import java.awt.peer.CheckboxPeer;
|
||||
|
||||
import java.awt.event.ItemEvent;
|
||||
|
||||
public class GtkCheckboxPeer extends GtkComponentPeer
|
||||
implements CheckboxPeer
|
||||
{
|
||||
@@ -49,12 +51,15 @@ public class GtkCheckboxPeer extends GtkComponentPeer
|
||||
public GtkCheckboxGroupPeer old_group;
|
||||
// The current state of the GTK checkbox.
|
||||
private boolean currentState;
|
||||
private boolean changing = false;
|
||||
|
||||
public native void create (GtkCheckboxGroupPeer group);
|
||||
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
|
||||
public native void connectSignals ();
|
||||
native void gtkWidgetModifyFont (String name, int style, int size);
|
||||
|
||||
/**
|
||||
* Overridden to set Font of label inside button.
|
||||
*/
|
||||
protected native void gtkWidgetModifyFont(String name, int style, int size);
|
||||
native void gtkButtonSetLabel (String label);
|
||||
native void gtkToggleButtonSetActive (boolean is_active);
|
||||
|
||||
@@ -71,23 +76,24 @@ public class GtkCheckboxPeer extends GtkComponentPeer
|
||||
CheckboxGroup g = checkbox.getCheckboxGroup ();
|
||||
old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
|
||||
create (old_group);
|
||||
gtkToggleButtonSetActive (checkbox.getState ());
|
||||
currentState = checkbox.getState();
|
||||
gtkToggleButtonSetActive(currentState);
|
||||
gtkButtonSetLabel (checkbox.getLabel ());
|
||||
}
|
||||
|
||||
public void setState (boolean state)
|
||||
/**
|
||||
* Sets native GtkCheckButton is state is different from current
|
||||
* state. Will set currentState to state to prevent posting an
|
||||
* event since events should only be posted for user initiated
|
||||
* clicks on the GtkCheckButton.
|
||||
*/
|
||||
synchronized public void setState (boolean state)
|
||||
{
|
||||
// prevent item_toggled_cb -> postItemEvent ->
|
||||
// awtComponent.setState -> this.setState ->
|
||||
// gtkToggleButtonSetActive self-deadlock on the GDK lock.
|
||||
if (changing && Thread.currentThread() == GtkToolkit.mainThread)
|
||||
{
|
||||
changing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentState != state)
|
||||
gtkToggleButtonSetActive (state);
|
||||
{
|
||||
currentState = state;
|
||||
gtkToggleButtonSetActive(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLabel (String label)
|
||||
@@ -111,22 +117,15 @@ public class GtkCheckboxPeer extends GtkComponentPeer
|
||||
// Override the superclass postItemEvent so that the peer doesn't
|
||||
// need information that we have.
|
||||
// called back by native side: item_toggled_cb
|
||||
public void postItemEvent (Object item, int stateChange)
|
||||
synchronized public void postItemEvent(Object item, boolean state)
|
||||
{
|
||||
Checkbox currentCheckBox = ((Checkbox)awtComponent);
|
||||
// A firing of the event is only desired if the state has changed due to a
|
||||
// button press. The currentCheckBox's state must be different from the
|
||||
// one that the stateChange is changing to.
|
||||
// stateChange = 1 if it goes from false -> true
|
||||
// stateChange = 2 if it goes from true -> false
|
||||
if (( !currentCheckBox.getState() && stateChange == 1)
|
||||
|| (currentCheckBox.getState() && stateChange == 2))
|
||||
{
|
||||
super.postItemEvent (awtComponent, stateChange);
|
||||
currentState = !currentCheckBox.getState();
|
||||
changing = true;
|
||||
currentCheckBox.setState(currentState);
|
||||
}
|
||||
// Only fire event is state actually changed.
|
||||
if (currentState != state)
|
||||
{
|
||||
currentState = state;
|
||||
super.postItemEvent(awtComponent,
|
||||
state ? ItemEvent.SELECTED : ItemEvent.DESELECTED);
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose ()
|
||||
|
||||
Reference in New Issue
Block a user