After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 654688 - Gtk does not seem to handle XReparentWindow correctly
Gtk does not seem to handle XReparentWindow correctly
Status: RESOLVED NOTGNOME
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-07-15 16:25 UTC by Duncan Ferguson
Modified: 2013-02-03 21:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Duncan Ferguson 2011-07-15 16:25:34 UTC
Raised a bug against xterm not reparenting its window correctly at https://bugs.launchpad.net/bugs/806969 which resulted in the maintainer saying the bug is with Gtk2

Full text of bug report is:
===
When re-parenting xterm into another window using '-into <id>' the term ignores all input.

When using a different terminal such as "urxvt -embed <id>" it works as expected

Attached scripts shows the problem when typing into the new window when using xterm and urxvt

$ dpkg -l |grep xterm
ii xterm 268-1ubuntu1
$ more /etc/debian_version
squeeze/sid

system is up to date
===
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2;

init Gtk2;

my $window = new Gtk2::Window 'toplevel';
$window->signal_connect(
    'destroy' => sub {
        Gtk2->main_quit;
        return 0;
    }
);

my $frame = new Gtk2::Frame "embedded terminal";

$window->add($frame);

my $rxvt = new Gtk2::Socket;

$frame->add($rxvt);
$frame->set_size_request( 700, 400 );
$window->show_all;
my $xid = $rxvt->window->get_xid;

# works with rxvt but xterm loses keyboard focus
system "xterm -into $xid &";
#system "urxvt -embed $xid &";

$window->show_all;

$rxvt->add_events( [qw( all_events_mask key_press_mask )] );

main Gtk2;
===
Response from xterm admin
===
Investigated, found that the essential difference between xterm and
urxvt in this aspect is that xterm initializes using one of the
functions such as XtOpenApplication, which does resource initialization,
etc., on a shell widget that it creates.  Later, it uses XReparentWindow
to handle the "-into" option.  urxvt on the other hand, processes its
"-embed" option before creating its first window, using the parameter
directly as its parent window.  While Tcl/Tk handles the
XReparentWindow, Gtk does not, it seems.

Given the nature of the problem (a bug in Gtk), revising xterm's
initialization to work around Gtk's problems would seem to be a wish-
list item for xterm rather than a bug in xterm.
Comment 1 Torsten Schoenfeld 2011-08-02 21:54:01 UTC
If this is a bug, then it's not with the Perl bindings, but with the underlying gtk+ library.  Reassigning accordingly.
Comment 2 Matthias Clasen 2013-02-03 21:36:10 UTC
You can't expect this to work - randomly reparenting a window into another app.
The xembed protocol was invented to handle this.