Message "Nothing from keyboard!" and exit GTK Application.



Hello everyone,
I am currently coding a program that GTK Application using thread on linux-fb(linux frame buffer).
It working good except title Message "Nothing from keyboard!".
After starting GTK Application, It's good working for a moment.
But, after a moment when no touch keyboard,
the GTK Application is exit with the message "Nothing from keyboard!".
How can I solve this problem?
For your understand, including code below.
Thanks,
Jinyo
========================================================
// mainapp.c
......
......
static void key_loop() {
    int count=0;
    long lbuff=0;
   
    echo_disable();
    while (lbuff != CPGUI_KEY_ESC) {
        lbuff = 0;
        read(0, &lbuff, 3);
       
        switch (lbuff) {
        case CPGUI_KEY_ARROW_UP : 
            break;
        case CPGUI_KEY_F3 :
            printf("key: f3~");
            cpmenu_show_setup();
            break;
        case CPGUI_KEY_ESC :
           
            break;
        }
        //printf("key: %d \n", lbuff);
    }
    echo_enable();
}
int main( int   argc,
          char *argv[] )
{
    GError *error = NULL;
    /* init threads */
    g_thread_init(NULL);
    gdk_threads_init();
    gtk_windows = g_malloc (sizeof (Windows));
   
    if (!g_thread_create(main_gtk, gtk_windows, FALSE, &error))
    {
      g_printerr ("Failed to create YES thread: %s\n", error->message);
      return 1;
    }
    key_loop();
   
    g_free(gtk_windows);
   
    return 0;
}

========================================================
// main_gtk.c

void *main_gtk(void *args)
{
    int iCancelType=0;
    /* init gtk */
    int argc = 0;
    char *argv[10];
    gtk_init(&argc, &argv);
   
    //gdk_device_set_mode (gdk_device_get_core_pointer(), GDK_MODE_DISABLED);
    //gdk_fb_keyboard_close();
   
    windows = (Windows *)args;
   
    // make widget
    cpmenu_show_main();
   
    gdk_threads_enter();
    gtk_main();
    gdk_threads_leave();    
   
    return 0;
}


-

 
새로운 형태의 이포스트카드 서비스
예쁜 우편 엽서로 마음을 전달
   
인터넷 속 나만의 자유 공간, 블로그
나를 진정 사랑하는 방법입니다!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]