enum {
STOPPED,
STARTED,
+ WAITING,
CHAR_INPUT,
LINE_INPUT,
TEXT_BUFFER_OUTPUT,
/* TODO: Add default signal handler implementation here */
}
+static void
+chimara_glk_waiting(ChimaraGlk *self)
+{
+ /* TODO: Add default signal handler */
+}
+
static void
chimara_glk_char_input(ChimaraGlk *self, guint window_rock, guint keysym)
{
/* Signals */
klass->stopped = chimara_glk_stopped;
klass->started = chimara_glk_started;
+ klass->waiting = chimara_glk_waiting;
klass->char_input = chimara_glk_char_input;
klass->line_input = chimara_glk_line_input;
klass->text_buffer_output = chimara_glk_text_buffer_output;
*/
chimara_glk_signals[STOPPED] = g_signal_new("stopped",
G_OBJECT_CLASS_TYPE(klass), 0,
+ /* FIXME: Should be G_SIGNAL_RUN_CLEANUP but that segfaults??! */
G_STRUCT_OFFSET(ChimaraGlkClass, stopped), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* the widget.
*/
chimara_glk_signals[STARTED] = g_signal_new ("started",
- G_OBJECT_CLASS_TYPE (klass), 0,
+ G_OBJECT_CLASS_TYPE(klass), 0,
G_STRUCT_OFFSET(ChimaraGlkClass, started), NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ chimara_glk_signals[WAITING] = g_signal_new("waiting",
+ G_OBJECT_CLASS_TYPE(klass), 0,
+ G_STRUCT_OFFSET(ChimaraGlkClass, waiting), NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
chimara_glk_signals[CHAR_INPUT] = g_signal_new("char-input",
G_OBJECT_CLASS_TYPE(klass), 0,
#ifndef __CHIMARA_GLK_H__
#define __CHIMARA_GLK_H__
-#include <glib-object.h>
+#include <glib.h>
#include <gtk/gtk.h>
#include <pango/pango.h>
/* Signals */
void(* stopped) (ChimaraGlk *self);
void(* started) (ChimaraGlk *self);
+ void(* waiting) (ChimaraGlk *self);
void(* char_input) (ChimaraGlk *self, guint32 window_rock, guint keysym);
void(* line_input) (ChimaraGlk *self, guint32 window_rock, gchar *text);
void(* text_buffer_output) (ChimaraGlk *self, guint32 window_rock, gchar *text);
ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
+ /* Emit the "waiting" signal to let listeners know we are ready for input */
+ g_signal_emit_by_name(glk_data->self, "waiting");
+
g_mutex_lock(glk_data->event_lock);
/* Wait for an event */
/* If an abort event was generated, the thread should have exited by now */
g_assert(event->type != evtype_Abort);
-}
\ No newline at end of file
+}
g_printerr("Stopped!\n");
}
+static void
+on_waiting(ChimaraGlk *glk)
+{
+ g_printerr("Waiting!\n");
+}
+
static void
on_char_input(ChimaraGlk *glk, guint32 window_rock, guint keysym)
{
return;
}
- gtk_builder_connect_signals(builder, NULL);
-
glk = chimara_glk_new();
g_object_set(glk, "border-width", 6, "spacing", 6, NULL);
chimara_glk_set_default_font_string(CHIMARA_GLK(glk), "Serif 12");
chimara_glk_set_monospace_font_string(CHIMARA_GLK(glk), "Monospace 12");
g_signal_connect(glk, "started", G_CALLBACK(on_started), NULL);
g_signal_connect(glk, "stopped", G_CALLBACK(on_stopped), NULL);
+ g_signal_connect(glk, "waiting", G_CALLBACK(on_waiting), NULL);
g_signal_connect(glk, "char-input", G_CALLBACK(on_char_input), NULL);
g_signal_connect(glk, "line-input", G_CALLBACK(on_line_input), NULL);
g_signal_connect(glk, "text-buffer-output", G_CALLBACK(on_text_buffer_output), NULL);
gtk_box_pack_end(vbox, glk, TRUE, TRUE, 0);
gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0);
gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0);
+
+ gtk_builder_connect_signals(builder, NULL);
}
int