/[classpath]/classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18.2.3 by gnu_andrew, Tue Aug 2 20:12:09 2005 UTC revision 1.18.2.4 by gnu_andrew, Sat Sep 10 15:31:37 2005 UTC
# Line 49  public class GtkCheckboxPeer extends Gtk Line 49  public class GtkCheckboxPeer extends Gtk
49    public GtkCheckboxGroupPeer old_group;    public GtkCheckboxGroupPeer old_group;
50    // The current state of the GTK checkbox.    // The current state of the GTK checkbox.
51    private boolean currentState;      private boolean currentState;  
52      private boolean changing = false;
53    
54    public native void create (GtkCheckboxGroupPeer group);    public native void create (GtkCheckboxGroupPeer group);
55    public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);    public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
# Line 76  public class GtkCheckboxPeer extends Gtk Line 77  public class GtkCheckboxPeer extends Gtk
77    
78    public void setState (boolean state)    public void setState (boolean state)
79    {    {
80        // prevent item_toggled_cb -> postItemEvent ->
81        // awtComponent.setState -> this.setState ->
82        // gtkToggleButtonSetActive self-deadlock on the GDK lock.
83        if (changing && Thread.currentThread() == GtkToolkit.mainThread)
84          {
85            changing = false;
86            return;
87          }
88    
89      if (currentState != state)      if (currentState != state)
90        gtkToggleButtonSetActive (state);        gtkToggleButtonSetActive (state);
91    }    }
# Line 100  public class GtkCheckboxPeer extends Gtk Line 110  public class GtkCheckboxPeer extends Gtk
110    
111    // Override the superclass postItemEvent so that the peer doesn't    // Override the superclass postItemEvent so that the peer doesn't
112    // need information that we have.    // need information that we have.
113      // called back by native side: item_toggled_cb
114    public void postItemEvent (Object item, int stateChange)    public void postItemEvent (Object item, int stateChange)
115    {    {
116      Checkbox currentCheckBox = ((Checkbox)awtComponent);      Checkbox currentCheckBox = ((Checkbox)awtComponent);
# Line 113  public class GtkCheckboxPeer extends Gtk Line 124  public class GtkCheckboxPeer extends Gtk
124      {      {
125        super.postItemEvent (awtComponent, stateChange);        super.postItemEvent (awtComponent, stateChange);
126        currentState = !currentCheckBox.getState();        currentState = !currentCheckBox.getState();
127          changing = true;
128        currentCheckBox.setState(currentState);        currentCheckBox.setState(currentState);
129      }      }
130    }    }

Legend:
Removed from v.1.18.2.3  
changed lines
  Added in v.1.18.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26