summaryrefslogtreecommitdiff
path: root/iup/src/gtk/iupgtk_focus.c
diff options
context:
space:
mode:
Diffstat (limited to 'iup/src/gtk/iupgtk_focus.c')
-rwxr-xr-xiup/src/gtk/iupgtk_focus.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/iup/src/gtk/iupgtk_focus.c b/iup/src/gtk/iupgtk_focus.c
new file mode 100755
index 0000000..fa596ba
--- /dev/null
+++ b/iup/src/gtk/iupgtk_focus.c
@@ -0,0 +1,44 @@
+/** \file
+ * \brief GTK Focus
+ *
+ * See Copyright Notice in "iup.h"
+ */
+
+#include <gtk/gtk.h>
+
+#include <stdio.h>
+
+#include "iup.h"
+
+#include "iup_object.h"
+#include "iup_focus.h"
+#include "iup_attrib.h"
+#include "iup_drv.h"
+#include "iup_assert.h"
+#include "iup_drv.h"
+
+#include "iupgtk_drv.h"
+
+
+void iupdrvSetFocus(Ihandle *ih)
+{
+ gtk_widget_grab_focus(ih->handle);
+}
+
+gboolean iupgtkFocusInOutEvent(GtkWidget *widget, GdkEventFocus *evt, Ihandle *ih)
+{
+ (void)widget;
+
+ if (evt->in)
+ {
+ /* even when ACTIVE=NO the dialog gets this evt */
+ if (!iupdrvIsActive(ih))
+ return TRUE;
+
+ iupCallGetFocusCb(ih);
+ }
+ else
+ iupCallKillFocusCb(ih);
+
+ return FALSE;
+}