The native function is implemented in swing_GTKStyle.c.
JNIEXPORT jint JNICALL
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness(
JNIEnv *env, jclass klass, jint widget_type)
{
return gtk2_get_ythickness(env, widget_type);
}
Next call is to gtk2_interface.c.
gint gtk2_get_ythickness(JNIEnv *env, WidgetType widget_type)
{
init_containers();
gtk2_widget = gtk2_get_widget(widget_type);
GtkStyle* style = gtk2_widget->style;
return style->ythickness;
}
And here is an excerpt of gtk2_get_widget.
/**
* Returns a pointer to the cached native widget for the specified
widget
* type.
*/
static GtkWidget *gtk2_get_widget(WidgetType widget_type)
{
gboolean init_result = FALSE;
GtkWidget *result = NULL;
switch (widget_type)
{
case BUTTON:
case TABLE_HEADER:
if (init_result = (NULL == gtk2_widgets[_GTK_BUTTON_TYPE]))
{
gtk2_widgets[_GTK_BUTTON_TYPE] = (*fp_gtk_button_new)();
}
result = gtk2_widgets[_GTK_BUTTON_TYPE];
break;
case CHECK_BOX:
-----------------------------------------------------------
case POPUP_MENU_SEPARATOR:
if (init_result =
(NULL ==
gtk2_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE]))
{
gtk2_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE] =
(*fp_gtk_separator_menu_item_new)();
}
result = gtk2_widgets[_GTK_SEPARATOR_MENU_ITEM_TYPE];
break;
-----------------------------------------------------------
default:
result = NULL;
break;
}
if (result != NULL && init_result)
{
if (widget_type == RADIO_BUTTON_MENU_ITEM ||
widget_type == CHECK_BOX_MENU_ITEM ||
widget_type == MENU_ITEM ||
widget_type == MENU ||
widget_type == POPUP_MENU_SEPARATOR)
{
GtkWidget *menu = gtk2_get_widget(POPUP_MENU);
(*fp_gtk_menu_shell_append)((GtkMenuShell *)menu, result);
}
-----------------------------------------------------------
(*fp_gtk_widget_realize)(result);
}
return result;
}
From gtk2_interface.c the native libgtk is called via dynamic function
pointers. The working principle of gtk2_interface is to basically create
a complete set of gtk widgets in an offscreen window. The widgets are
created on demand, either when the corresponding swing widget is needed
or when they serve as a parent. They are then realized but remain
invisible. In case of the POPUP_MENU_SEPARATOR, the widget is actually
realized automatically by gtk on gtk_menu_shell_append not on
gtk_widget_realize, but that does not seem to be a problem.
In the end widget->style->ythickness is returned to the java side. And
that, in fact, is the problem.
signature.asc
Description: This is a digitally signed message part

