g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/**
* ChimaraGlk::char-input:
- * @glk: The widget that received the signal
+ * @self: The widget that received the signal
* @window_rock: The rock value of the window that received character input
* (see <link linkend="chimara-Rocks">Rocks</link>)
- * @keysym: The key that was typed, in the form of a key symbol from
+ * @window_id_string: A string value uniquely identifying the window that
+ * received character input
+ * @keysym: The key that was typed, in the form of a key symbol from
* <filename class="headerfile">gdk/gdkkeysyms.h</filename>
- *
+ *
* Emitted when a Glk window receives character input.
+ * The @window_rock can be used to identify the window.
+ * However, rock values in Glk are allowed to be identical for different
+ * windows, so Chimara also provides a string value with which the window
+ * can be uniquely identified.
*/
chimara_glk_signals[CHAR_INPUT] = g_signal_new("char-input",
G_OBJECT_CLASS_TYPE(klass), 0,
G_STRUCT_OFFSET(ChimaraGlkClass, char_input), NULL, NULL,
- _chimara_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+ _chimara_marshal_VOID__UINT_STRING_UINT,
+ G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT);
/**
* ChimaraGlk::line-input:
- * @glk: The widget that received the signal
+ * @self: The widget that received the signal
* @window_rock: The rock value of the window that received line input (see
* <link linkend="chimara-Rocks">Rocks</link>)
+ * @window_id_string: A string value uniquely identifying the window that
+ * received the input
* @text: The text that was typed
- *
+ *
* Emitted when a Glk window receives line input.
+ * The @window_rock can be used to identify the window.
+ * However, rock values in Glk are allowed to be identical for different
+ * windows, so Chimara also provides a string value with which the window
+ * can be uniquely identified.
*/
chimara_glk_signals[LINE_INPUT] = g_signal_new("line-input",
G_OBJECT_CLASS_TYPE(klass), 0,
G_STRUCT_OFFSET(ChimaraGlkClass, line_input), NULL, NULL,
- _chimara_marshal_VOID__UINT_STRING,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ _chimara_marshal_VOID__UINT_STRING_STRING,
+ G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
/**
* ChimaraGlk::text-buffer-output:
- * @glk: The widget that received the signal
+ * @self: The widget that received the signal
* @window_rock: The rock value of the window that was printed to (see <link
* linkend="chimara-Rocks">Rocks</link>)
- *
+ * @window_id_string: A string value uniquely identifying the window that
+ * was printed to
+ *
* Emitted when text is printed to a text buffer window.
+ * The @window_rock can be used to identify the window.
+ * However, rock values in Glk are allowed to be identical for different
+ * windows, so Chimara also provides a string value with which the window
+ * can be uniquely identified.
*/
chimara_glk_signals[TEXT_BUFFER_OUTPUT] = g_signal_new("text-buffer-output",
G_OBJECT_CLASS_TYPE(klass), 0,
G_STRUCT_OFFSET(ChimaraGlkClass, text_buffer_output), NULL, NULL,
- _chimara_marshal_VOID__UINT_STRING,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING);
+ _chimara_marshal_VOID__UINT_STRING_STRING,
+ G_TYPE_NONE, 3, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING);
/**
* ChimaraGlk::iliad-screen-update:
* @self: The widget that received the signal
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);
+ void(* char_input) (ChimaraGlk *self, guint32 window_rock, char *string_id, unsigned keysym);
+ void(* line_input) (ChimaraGlk *self, guint32 window_rock, char *string_id, char *text);
+ void(* text_buffer_output) (ChimaraGlk *self, guint32 window_rock, char *string_id, char *text);
void(* iliad_screen_update) (ChimaraGlk *self, gboolean typing);
} ChimaraGlkClass;
}
static void
-chimara_if_char_input(ChimaraGlk *glk, guint32 win_rock, guint keysym)
+chimara_if_char_input(ChimaraGlk *glk, guint32 win_rock, char *string_id, unsigned keysym)
{
CHIMARA_IF_USE_PRIVATE(glk, priv);
g_assert(priv->input == NULL);
}
static void
-chimara_if_line_input(ChimaraGlk *glk, guint32 win_rock, gchar *input)
+chimara_if_line_input(ChimaraGlk *glk, guint32 win_rock, char *string_id, char *input)
{
CHIMARA_IF_USE_PRIVATE(glk, priv);
g_assert(priv->input == NULL);
}
static void
-chimara_if_text_buffer_output(ChimaraGlk *glk, guint32 win_rock, gchar *output)
+chimara_if_text_buffer_output(ChimaraGlk *glk, guint32 win_rock, char *string_id, char *output)
{
CHIMARA_IF_USE_PRIVATE(glk, priv);
g_string_append(priv->response, output);
# Extra callback marshallers for chimara
# Run this file through glib-genmarshal to create chimara-marshallers.c
-VOID:UINT,UINT
-VOID:UINT,STRING
+VOID:UINT,STRING,UINT
+VOID:UINT,STRING,STRING
VOID:STRING,STRING
VOID:BOOLEAN
ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(widget, CHIMARA_TYPE_GLK));
g_assert(glk);
event_throw(glk, evtype_CharInput, win, keycode, 0);
- g_signal_emit_by_name(glk, "char-input", win->rock, event->keyval);
+ g_signal_emit_by_name(glk, "char-input", win->rock, win->librock, event->keyval);
/* Only one keypress will be handled */
win->input_request_type = INPUT_REQUEST_NONE;
{
ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK));
g_assert(glk);
- g_signal_emit_by_name(glk, "line-input", win->rock, inserted_text);
+ g_signal_emit_by_name(glk, "line-input", win->rock, win->librock, inserted_text);
}
/* Add the text to the window input history */
{
ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK));
g_assert(glk);
- g_signal_emit_by_name(glk, "line-input", win->rock, text);
+ g_signal_emit_by_name(glk, "line-input", win->rock, win->librock, text);
}
/* Add the text to the window input history */
gdk_threads_enter();
ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK));
g_assert(glk);
- g_signal_emit_by_name(glk, "char-input", win->rock, keyval);
+ g_signal_emit_by_name(glk, "char-input", win->rock, win->librock, keyval);
gdk_threads_leave();
event->type = evtype_CharInput;
ChimaraGlk *glk = CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK));
g_assert(glk);
- g_signal_emit_by_name(glk, "text-buffer-output", win->rock, win->buffer->str);
+ g_signal_emit_by_name(glk, "text-buffer-output", win->rock, win->librock, win->buffer->str);
}
break;
win->magic = MAGIC_WINDOW;
win->rock = rock;
+ win->librock = g_strdup_printf("%p", win);
if(glk_data->register_obj)
win->disprock = (*glk_data->register_obj)(win, gidisp_Class_Window);
g_node_destroy(win->window_node);
win->magic = MAGIC_FREE;
-
+
+ g_free(win->librock);
g_list_foreach(win->history, (GFunc)g_free, NULL);
g_list_free(win->history);
g_slist_free(win->extra_line_terminators);
{
/*< private >*/
glui32 magic, rock;
+ char *librock; /* "library rock" - unique string identifier */
gidispatch_rock_t disprock;
/* Pointer to the node in the global tree that contains this window */
GNode *window_node;