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); |
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 |
} |
} |
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); |
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 |
} |
} |