problem when draw a gtk window in IME

1 message Options
Embed this post
Permalink
Tom Si

problem when draw a gtk window in IME

Reply Threaded More More options
Print post
Permalink
hi all,
I am try to draw a gtk window in IME (for special UI), the code is following.
But I found with my IME, the window could not work correctly, sometime the mouse did not work, some time the application will pending for a long time to run.
so my questions are:
could we call gtk's functions in IME directly, if not, what I should do? if yes, is there any problem in my code?

thanks a lot.
Tom


        if (window == NULL)
        {
// gtk_init (0, 0);
               
                window = gtk_window_new (GTK_WINDOW_POPUP);
// gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
                gtk_widget_set_usize (window, w, h);
// gtk_widget_realize (window);
                gtk_widget_show(window);
               
                drawarea = gtk_drawing_area_new ();
                gtk_widget_set_size_request (drawarea, w, h);

                g_signal_connect (G_OBJECT (drawarea), "expose_event",
                        G_CALLBACK (on_expose), NULL);
               
                gtk_signal_connect (GTK_OBJECT (drawarea), "button_press_event",
                        GTK_SIGNAL_FUNC (on_button_press), NULL);
               
                gtk_widget_set_events (drawarea, GDK_EXPOSURE_MASK|GDK_BUTTON_PRESS_MASK);
               
                gtk_container_add (GTK_CONTAINER (window), drawarea);
               
               
                gtk_widget_show(drawarea);

               
                gtk_window_move (GTK_WINDOW (window),  0, gdk_screen_height() - h);
               
               
                pixmap = gdk_pixmap_new (drawarea->window, 800, 60, -1);
                gc = gdk_gc_new (pixmap);
               
                GdkColormap * cmap;
                cmap = gdk_colormap_get_system ();  
                gdk_color_alloc (cmap, &color1);  
               
                gtk_widget_hide(window);
        }