Re: on screen keyboard error with gtk_main_do_event



Someone could help me?

Thanks


On 16-03-2017 16:54, Ruben ROdrigues wrote:
HI guys,

I have a on-screen keyboard that was made for gtk2. Now in gtk3 i get 
this errors:

Gdk-CRITICAL **: gdk_window_get_user_data: assertion 'GDK_IS_WINDOW 
(window)' failed

Gdk-CRITICAL **: gdk_window_get_display: assertion 'GDK_IS_WINDOW 
(window)' failed

 Gdk-WARNING **: Event with type 8 not holding a GdkDevice. It is most 
likely synthesized outside Gdk/GTK+


 Gdk-CRITICAL **: gdk_window_get_display: assertion 'GDK_IS_WINDOW 
(window)' failed

Gdk-CRITICAL **: gdk_display_get_device_manager: assertion 
'GDK_IS_DISPLAY (display)' failed

Gdk-CRITICAL **: gdk_device_manager_get_client_pointer: assertion 
'GDK_IS_DEVICE_MANAGER (device_manager)' failed

Gdk-CRITICAL **: gdk_device_get_associated_device: assertion 
'GDK_IS_DEVICE (device)' failed

 Gdk-CRITICAL **: gdk_device_grab_info_libgtk_only: assertion 
'GDK_IS_DISPLAY (display)' failed


This appears in this line of code : gtk_main_do_event(pxEvent);

Here is complete code:


void on_Keypad_button_clicked(GtkButton *button, gpointer data)
{
    GdkEvent            *pxEvent = NULL;

    GdkKeymapKey        *keys;
    gint                iNkeys;

    guint                cKey;

    GtkEntryBuffer        *pxBuffer;


    struct xParam_Widget_Keycode    *pxData;

    pxData = (struct xParam_Widget_Keycode *)data;

    switch(cKey = pxData->iKeyCode) {
    case GDK_KEY_BackSpace:
        pxBuffer = gtk_entry_get_buffer(GTK_ENTRY(pxData->pxWidget));
        gtk_entry_buffer_delete_text(pxBuffer, 
gtk_entry_buffer_get_length(pxBuffer) - 1, -1);
        break;
    default:
        pxEvent = gdk_event_new(GDK_KEY_PRESS);
if(gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(), cKey, 
&keys, &iNkeys)) {
            pxEvent->key.hardware_keycode = keys[0].keycode;
            pxEvent->key.group = keys[0].group;
            g_free(keys);
            pxEvent->key.keyval = gdk_unicode_to_keyval(cKey);
        } else {
            pxEvent->key.keyval = cKey;
        }

        pxEvent->key.window = g_object_ref(gtk_widget_get_screen 
(pxData->pxWidget));
        pxEvent->key.state = 0;

        pxEvent->key.send_event = FALSE;
        pxEvent->key.time = GDK_CURRENT_TIME;

        gtk_main_do_event(pxEvent);
        pxEvent->key.type = GDK_KEY_RELEASE;
        gtk_main_do_event(pxEvent);
        gdk_event_free(pxEvent);
    }
}

Thanks




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