+ gdk_threads_enter ();
+}
+
+static void
+window_active_state_change_cb (GtkWidget *widget __attribute__((unused)),
+ GParamSpec *pspec __attribute__((unused)),
+ jobject peer __attribute__((unused)))
+{
+ /* FIXME: not sure if this is needed or not. */
+ /* Remove the unused attributes if you fix the below. */
+#if 0
+ gdk_threads_leave ();
+ if (GTK_WINDOW (widget)->is_active)
+ (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+ postWindowEventID,
+ (jint) AWT_WINDOW_GAINED_FOCUS,
+ (jobject) NULL, (jint) 0);
+ else
+ (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+ postWindowEventID,
+ (jint) AWT_WINDOW_DEACTIVATED,
+ (jobject) NULL, (jint) 0);
+ gdk_threads_enter ();
+#endif
+}
+
+static void
+window_focus_state_change_cb (GtkWidget *widget,
+ GParamSpec *pspec __attribute__((unused)),
+ jobject peer)
+{
+ gdk_threads_leave ();
+ if (GTK_WINDOW (widget)->has_toplevel_focus)
+ (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+ postWindowEventID,
+ (jint) AWT_WINDOW_ACTIVATED,
+ (jobject) NULL, (jint) 0);
+ else
+ (*gdk_env())->CallVoidMethod (gdk_env(), peer,
+ postWindowEventID,
+ (jint) AWT_WINDOW_DEACTIVATED,
+ (jobject) NULL, (jint) 0);
+ gdk_threads_enter ();