Iliad port
authorrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Sun, 18 Apr 2010 14:04:40 +0000 (14:04 +0000)
committerrodin <rodin@ddfedd41-794f-dd11-ae45-00112f111e67>
Sun, 18 Apr 2010 14:04:40 +0000 (14:04 +0000)
12 files changed:
Makefile.am
configure.ac
interpreters/frotz/Makefile.am
libchimara/Makefile.am
libchimara/abort.c
libchimara/chimara-glk.c
libchimara/chimara-if.c
libchimara/fileref.c
libchimara/input.c
libchimara/pager.c
player/iliad.c
tests/styletest.c

index 445af84942ded4cbf521a03f9f753ca2c71133ec..9cac9d78b8ebefaafd01706e9f3d7588197ee701 100644 (file)
@@ -1,7 +1,11 @@
 ## Process this file with automake to produce Makefile.in
 ## Created by Anjuta
 
+if TARGET_ILIAD
+SUBDIRS = libchimara interpreters player po
+else
 SUBDIRS = libchimara interpreters player tests docs po
+endif
 
 chimaradocdir = $(datadir)/doc/chimara
 dist_chimaradoc_DATA = \
index 9b0ebb0f7c7c176a14819b74538f278493c93446..18e630a32b9f5662bbed6a78493f6a01405047dc 100644 (file)
@@ -25,8 +25,8 @@ LT_VERSION_INFO="$CHIMARA_CURRENT:$CHIMARA_REVISION:$CHIMARA_AGE"
 AC_SUBST(LT_VERSION_INFO)
 
 ### REQUIREMENTS ##############################################################
-GTK_REQUIRED_VERSION=2.12
-GLIB_REQUIRED_VERSION=2.16
+GTK_REQUIRED_VERSION=2.6
+GLIB_REQUIRED_VERSION=2.6
 GTK_DOC_REQUIRED_VERSION=1.9
 AC_SUBST(GTK_REQUIRED_VERSION)
 AC_SUBST(GLIB_REQUIRED_VERSION)
index f1a010026927ac8979744e044b5c024bee8b11a7..f72505c53c4e01ccc9d436f942dd8a659f1f9cc9 100644 (file)
@@ -3,7 +3,15 @@ frotz_la_SOURCES = buffer.c err.c fastmem.c files.c input.c main.c math.c \
        object.c process.c quetzal.c random.c redirect.c sound.c stream.c table.c \
        text.c variable.c glkscreen.c glkmisc.c frotz.h glkfrotz.h glkio.h setup.h
 frotz_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libchimara
-frotz_la_CFLAGS = -Wno-pointer-sign $(AM_CFLAGS)
+
+if TARGET_ILIAD
+no_pointer_sign = 
+else
+no_pointer_sign = -Wno-pointer-sign
+endif
+
+frotz_la_CFLAGS = $(no_pointer_sign) $(AM_CFLAGS)
+
 frotz_la_LDFLAGS = -module $(PLUGIN_LIBTOOL_FLAGS)
 
 frotzdocdir = $(datadir)/doc/$(PACKAGE)/frotz
index 5fb89bfedbd1390931e5e52f27c032350c88ae8a..ff634e4639c4b006e3429372cac0b3011c1858d3 100644 (file)
@@ -4,6 +4,12 @@ AM_CFLAGS = -Wall
 
 lib_LTLIBRARIES = libchimara.la
 
+if TARGET_ILIAD
+       plugindir = "../interpreters"
+else
+       plugindir = $(pkglibdir)
+endif
+
 libchimara_la_SOURCES = \
        abort.c abort.h \
        case.c \
@@ -38,7 +44,7 @@ libchimara_la_SOURCES = \
 libchimara_la_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"Chimara\" \
        -DLOCALEDIR=\""$(datadir)/locale"\" \
-       -DPLUGINDIR=\""$(pkglibdir)"\" \
+       -DPLUGINDIR=\""$(plugindir)"\" \
        -DPLUGINSOURCEDIR=\""$(abs_builddir)/../interpreters"\" \
        -I$(top_srcdir)
 libchimara_la_CFLAGS = @CHIMARA_CFLAGS@ $(AM_CFLAGS)
index 28e33fae444c5d85e64b29232d3b08d58b99572e..8eb21dae91d53aaa13966624f1914def01037d00 100644 (file)
@@ -143,7 +143,13 @@ shutdown_glk_post(void)
        /* Empty the event queue */
        g_mutex_lock(glk_data->event_lock);
        g_queue_foreach(glk_data->event_queue, (GFunc)g_free, NULL);
-       g_queue_clear(glk_data->event_queue);
+
+       /* COMPAT: g_queue_clear could be used here, but only appeared in 2.14 */
+       // g_queue_clear(glk_data->event_queue);
+       g_list_free(glk_data->event_queue->head);
+       glk_data->event_queue->head = glk_data->event_queue->tail = NULL;
+       glk_data->event_queue->length = 0;
+
        g_mutex_unlock(glk_data->event_lock);
        
        /* Reset the abort signaling mechanism */
index 982b39fa6f1edbd89ef6d7147a27125a818b91c3..e585165399415b7f6c6a1a49878b058b0186cc77 100644 (file)
@@ -617,9 +617,16 @@ chimara_glk_text_buffer_output(ChimaraGlk *self, guint window_rock, gchar *text)
        /* Default signal handler */
 }
 
-/* G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
+/* COMPAT: G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
 #ifndef G_PARAM_STATIC_STRINGS
+
+/* COMPAT: G_PARAM_STATIC_NAME and friends only appeared in GTK 2.8 */
+#if GTK_CHECK_VERSION(2,8,0)
 #define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+#else
+#define G_PARAM_STATIC_STRINGS (0)
+#endif
+
 #endif
 
 static void
@@ -1107,7 +1114,9 @@ glk_enter(struct StartupData *startup)
        
        /* Run main function */
        glk_main_t glk_main = startup->glk_main;
-       g_slice_free(struct StartupData, startup);
+       
+       /* COMPAT: avoid usage of slices */
+       g_free(startup);
     g_signal_emit_by_name(startup->glk_data->self, "started");
        glk_main();
        glk_exit(); /* Run shutdown code in glk_exit() even if glk_main() returns normally */
@@ -1146,7 +1155,9 @@ chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GE
        }
     
     ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
-       struct StartupData *startup = g_slice_new0(struct StartupData);
+
+       /* COMPAT: avoid usage of slices */
+       struct StartupData *startup = g_new0(struct StartupData,1);
        
     /* Open the module to run */
     g_assert( g_module_supported() );
index c7e4575f41fdc25363c8958806a5b5654ef917dc..be9fc206f0c519ec8cd06bbce56e894a02ff63cc 100644 (file)
@@ -248,9 +248,16 @@ chimara_if_command(ChimaraIF *self, gchar *input, gchar *response)
        /* Default signal handler */
 }
 
-/* G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
+/* COMPAT: G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
 #ifndef G_PARAM_STATIC_STRINGS
+
+/* COMPAT: G_PARAM_STATIC_NAME and friends only appeared in GTK 2.8 */
+#if GTK_CHECK_VERSION(2,8,0)
 #define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+#else
+#define G_PARAM_STATIC_STRINGS (0)
+#endif
+
 #endif
 
 static void
index 937933cedd914badf737bfba208d9d4d94151331..d0cee0829479ecded8a6ec5b743a5298c4cf3c60 100644 (file)
@@ -233,7 +233,11 @@ glk_fileref_create_by_prompt(glui32 usage, glui32 fmode, glui32 rock)
                                GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
                                NULL);
                        gtk_file_chooser_set_action(GTK_FILE_CHOOSER(chooser), GTK_FILE_CHOOSER_ACTION_SAVE);
+
+                       /* COMPAT: */
+#if GTK_CHECK_VERSION(2,8,0)
                        gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(chooser), TRUE);
+#endif
                        break;
                case filemode_ReadWrite:
                case filemode_WriteAppend:
index ddc41d8b216fe7ba14ccdc8359f1f41b2616fe66..8b6d4c27662d5296e4b7df1a0ec0caedf40c6b7e 100644 (file)
@@ -127,7 +127,11 @@ text_grid_request_line_event_common(winid_t win, glui32 maxlen, gboolean insert,
        /* Make the entry as small as possible to fit with the text */
        gtk_entry_set_has_frame(GTK_ENTRY(win->input_entry), FALSE);
        GtkBorder border = { 0, 0, 0, 0 };
+
+       /* COMPAT: */
+#if GTK_CHECK_VERSION(2,10,0)
        gtk_entry_set_inner_border(GTK_ENTRY(win->input_entry), &border);
+#endif
     gtk_entry_set_max_length(GTK_ENTRY(win->input_entry), win->input_length);
     gtk_entry_set_width_chars(GTK_ENTRY(win->input_entry), win->input_length);
 
index e00daf97710c8f25e5ea4409e58618d3bd864291..1fdbf4627b333ffb6d3c1ede74756345554ce514 100644 (file)
@@ -75,7 +75,12 @@ pager_after_size_allocate(GtkTextView *view, GtkAllocation *allocation, winid_t
                if(scroll_distance > view_height) {
                        start_paging(win);
                        /* Seriously... */
+                       /* COMPAT: */
+#if GTK_CHECK_VERSION(2,14,0)
                        gdk_window_invalidate_rect(gtk_widget_get_window(win->widget), NULL, TRUE);
+#else
+                       gdk_window_invalidate_rect(win->widget->window, NULL, TRUE);
+#endif
                }
                else if(scroll_distance > 0) {
                        GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(win->widget));
index ee9d7f5336b949c10eb1fd2baca8f57cccede1ec..6433e827e5a8c3ef9d77a723b1903ac659edffd3 100644 (file)
 #include <libchimara/chimara-glk.h>
 #include <libchimara/chimara-if.h>
 
+/* Iliad includes */
+#include <liberdm/erdm.h>
+#include <liberipc/eripcviewer.h>
+#include <liberipc/eripctoolbar.h>
+#include <liberipc/eripcbusyd.h>
+
 /* Global pointers to widgets */
 GtkWidget *window = NULL;
 GtkWidget *glk = NULL;
 
+static erClientChannel_t erbusyChannel;
+static erClientChannel_t ertoolbarChannel;
+
 static void
 on_started(ChimaraGlk *glk)
 {
@@ -115,6 +124,22 @@ create_window(void)
        gtk_container_add( GTK_CONTAINER(window), vbox );
 }
 
+static void
+iliad_popup_keyboard()
+{
+       erIpcStartClient(ER_TOOLBAR_CHANNEL, &ertoolbarChannel);
+       tbSelectIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);
+       tbClearIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);
+
+       // Turn off trashcan
+       tbAppendPlatformIcon(  ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_trashcan, -1);
+       tbSetStatePlatformIcon(ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_trashcan, iconState_grey );
+
+       // Enable then pop up keyboard
+       tbAppendPlatformIcon(  ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_keyboard, -1);
+       tbSetStatePlatformIcon(ertoolbarChannel, ER_PDF_VIEWER_UA_ID, iconID_keyboard, iconState_selected);
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -144,7 +169,8 @@ main(int argc, char *argv[])
                return 1;
        }
        //chimara_glk_run( CHIMARA_GLK(glk), ".libs/multiwin.so", argc, argv, NULL);
-
+       
+       iliad_popup_keyboard();
 
        gdk_threads_enter();
        gtk_main();
index 0ed73cc248999f2282f669d28240ce743da79d90..7b976d0627b563eb043bbfe99d9942261ce2b862 100644 (file)
@@ -28,7 +28,7 @@ void glk_main(void)
     assert(buffer);
     
     glk_put_string("Welcome to the style test\n");
-
+       glk_put_string("int finish_text_grid_line_input(winid_t win, gboolean\n          11 static void cancel_old_input_request(winid_t win);\n         12 \n            13 /* Internal function: code common to both flavors of char ev\n                              14 void\n                                15 request_char_event_common(winid_t win, gboolean unicode)\n                            16 {\n                                   17     VALID_WINDOW(win, return);\n                                  18     g_return_if_fail(win->type != wintype_TextBuffer || win-\n                                        19 \n                                    20     cancel_old_input_request(win);\n                                          21 \n                                                22     flush_window_buffer(win);\n                                               23 \n                                            24     ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key\n                                                25 \n                                                        26     win->input_request_type = unicode? INPUT_REQUEST_CHARACT\n                                                        27     g_signal_handler_unblock( win->widget, win->char_input_k\n                                                        28 \n                                                            29     gdk_threads_enter();\n                                                                30 \n                                                            31     /*\n                                                              32     if(win->type == wintype_TextBuffer)\n                                                             33     {\n                                                                   34         GtkTextBuffer *buffer = gtk_text_view_get_buffer( GT\n                                                                        35         GtkTextIter iter;\n                                                                           36         gtk_text_buffer_get_end_iter(buffer, &iter);\n                                                                        37         gtk_text_buffer_place_cursor(buffer, &iter);\n                                                                            38         gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(win\n                                                                                39         // Why doesn't this always work?? \n                                                                                  40     } */\n                   41 \n                    42     gtk_widget_grab_focus( GTK_WIDGET(win->widget) );\n    43     gdk_threads_leave();\n    44 \n                                            47 }\n                                               48 \n                                            49 /**\n                                                 50  * glk_request_char_event:\n                                                  51  * @win: A window to request char events from.\n                                                  52  *\n                                                          53  * Request input of a Latin-1 character or special key. A wi\n                                                        54  * requests for both character and line input at the same ti\n                                                        55  * requests for character input of both types (Latin-1 and U\n                                                            56  * illegal to call glk_request_char_event() if the window al\n                                                                57  * request for either character or\n");
     glk_request_line_event(mainwin, buffer, 255, 0);
     while(strncmp(buffer, "quit", 4)) 
     {