Back to index

im-sdk  12.3.91
sendkey1.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <iiimcf.h>
00004 #include <time.h>
00005 #include "common.h"
00006 
00007 IIIMCF_context context;
00008 
00009 static void
00010 create_context()
00011 {
00012     check(iiimcf_create_context(handle, IIIMCF_ATTR_NULL, &context));
00013 }
00014 
00015 static void
00016 destroy_context(
00017     IIIMCF_context c
00018 )
00019 {
00020     check(iiimcf_destroy_context(c));
00021 }
00022 
00023 static void
00024 check_status(
00025     IIIMCF_context c
00026 )
00027 {
00028     int flag;
00029 
00030     check(iiimcf_is_UIstate_changed(c, &flag));
00031 
00032     if (flag & IIIMCF_STATE_PREEDIT_CHANGED) {
00033        test_show_preedit_info(c);
00034     }
00035     if (flag & IIIMCF_STATE_STATUS_CHANGED) {
00036        test_show_status_info(c);
00037     }
00038     if (flag & IIIMCF_STATE_LOOKUP_CHOICE_CHANGED) {
00039        test_show_lookup_choice_info(c);
00040     }
00041     if (flag & IIIMCF_STATE_COMMIT_REQUIRED) {
00042        test_show_commit_info(c);
00043     }
00044     test_show_incoming_events(c, 0);
00045 }
00046 
00047 int
00048 main(
00049     int argc,
00050     char **argv
00051 )
00052 {
00053     test_init();
00054     create_context();
00055     test_forwardkey(context, IIIMF_KEYCODE_A, 'a', 0);
00056     check_status(context);
00057     test_trigger(context, 1);
00058     check_status(context);
00059     test_forwardkey(context, IIIMF_KEYCODE_K, 'k', 0);
00060     check_status(context);
00061     test_forwardkey(context, IIIMF_KEYCODE_U, 'u', 0);
00062     check_status(context);
00063     test_forwardkey(context, IIIMF_KEYCODE_1, '1', 0);
00064     check_status(context);
00065     test_forwardkey(context, IIIMF_KEYCODE_ENTER, 0, 0);
00066     check_status(context);
00067     test_trigger(context, 0);
00068     check_status(context);
00069     destroy_context(context);
00070     test_uninit();
00071 
00072     return 0;
00073 }
00074 
00075 /* Local Variables: */
00076 /* c-file-style: "iiim-project" */
00077 /* End: */
00078