[webkit-gtk] X11 event mask not setup for webkitgtk window

Barry Scott barry.scott at onelan.co.uk
Mon Mar 24 10:39:43 PDT 2014

I'm porting a webkitgtk app from Fedora 16 to Fedora 20 and I have hit a
problem with the X11 event mask not allowing mouse or keyboard input.

The app has been ported to gtk3 but I'm still using the webkit1 API.
The RPM is: webkitgtk3-2.2.5-1.fc20.x86_64.

In this application there are no scroll bars and a controlling process
can set the size position and offset of the window that is drawn.

The Fedora 16 version of the code works as expected.

This is the key code I use to create the browser window:

    m_widget_toplevel = gtk_window_new( GTK_WINDOW_TOPLEVEL );
    m_window_toplevel = GTK_WINDOW( m_widget_toplevel );

    m_widget_fixed = gtk_fixed_new();
    m_fixed = GTK_FIXED( m_widget_fixed );

    m_widget_webview = webkit_web_view_new();
    m_webview = WEBKIT_WEB_VIEW( m_widget_webview );

    WebKitWebSettings *settings = webkit_web_view_get_settings( m_webview );
    g_object_set( G_OBJECT( settings ), "enable-file-access-from-file-uris", TRUE, NULL 
    g_object_set( G_OBJECT( settings ), "enable-universal-access-from-file-uris", TRUE, 


    webkit_web_view_set_full_content_zoom( m_webview, TRUE );

    gtk_fixed_put( m_fixed, m_widget_webview,  0, 0 );
    gtk_window_set_title( m_window_toplevel, m_browser_name.c_str() );

    // If we don't set the window to a size request of 1x1, it will
    // default to the size of the largest child. GTK autolayout will
    // then expand the window to the larger of the window size request
    // or the size we set.
    // We avoid problems elsewhere by using a GtkFixed to stop
    // WebKit's size request bubbling up to the window.

    gtk_widget_set_size_request( m_widget_toplevel, 1, 1 );

    _setCanvasSize( *m_properties_active );
    _setCanvasPosition( *m_properties_active );
    _setWindowSize( *m_properties_active );
    _setWindowPosition( *m_properties_active );

    gtk_container_add( GTK_CONTAINER( m_widget_toplevel ), m_widget_fixed );
    gtk_widget_grab_focus( m_widget_webview );
    gtk_widget_show_all( m_widget_toplevel );

I added some debug to find the addresses of the key objects
and using gdb found the XID used by the GdkWindow.

Info: m_widget_toplevel is  0x6d8330 window is 0x6d8330 GdkWindow is 0x6b8280
XID = 0xc00003
Info: m_widget_fixed is   0x6c8210 window is 0x6c8210 GdkWindow is 0x6b8280
Info: m_widget_webview is 0x69e370 window is 0x69e370 GdkWindow is 0x6b84e0

Using xwininfo I can check the state of the X window that is created.

# xwininfo -tree -root

xwininfo: Window id: 0xa4 (the root window) (has no name)

  Root window id: 0xa4 (the root window) (has no name)
  Parent window id: 0x0 (none)
     8 children:
     0xa00002 "player_text_T6": ()  2000x2000+2000+2000  +2000+2000
     0xc00003 "player_html-o.H4": ("player_html" "Player_html")  1267x713+41+32  
        1 child:
        0xc00004 (has no name): ()  1x1+-1+-1  +40+31
     0x600002 "player_image_I3": ()  1360x768+0+0  +0+0
     0xc0000c (has no name): ()  1x1+-1+-1  +-1+-1
     0xc00001 "player_html": ("player_html" "Player_html")  10x10+10+10  +10+10
        1 child:
        0xc00002 (has no name): ()  1x1+-1+-1  +9+9
     0x800002 "player_text_hiddenT6": ()  1x1+2000+2000  +2000+2000
     0x400001 "ntbglcomp": ()  1x1+0+0  +0+0
     0x200001 "screen_manager_hidden": ()  1x1+2000+2000  +2000+2000

# xwininfo -events -id 0xc00003

xwininfo: Window id: 0xc00003 "player_html-o.H4"

  Someone wants these events:
  Do not propagate these events:
  Override redirection?: No

The problem is that the m_widget_webview has a GdkWindows but does not
have a X window. The only X windows is realised for the m_widget_toplevel
and shared with m_widget_fixed.

What have I missed that makes GTK create the X window for m_widget_webview?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20140324/ae738046/attachment.html>

More information about the webkit-gtk mailing list