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

Bug#809367: libqt5gui5: XEMBED interop with gtksocket broken



Package: libqt5gui5
Version: 5.5.1+dfsg-10
Severity: normal

This bug appears when one embeds a QWindow inside a GTK socket container
using the functions QWindow::setParent and QWindow::fromWinId().
According to the doc, the size of the QWindow should track the size of the container.
This used to work with Qt-5.2 and no longer works with this version of Qt.

Here are the replication instructions:

* The following python program creates a window with a gtk socket
  and prints the window id of the socket

-------------------
#!/usr/bin/env python

import gtk, sys, string

class Socket:
    def __init__(self):
        window = gtk.Window()     
        window.set_default_size(200, 200) 
        socket = gtk.Socket()
        window.add(socket)
        print(socket.get_id())
        window.connect("destroy", lambda w: gtk.main_quit())
        socket.connect("destroy", lambda w: gtk.main_quit())
        socket.connect("plug-added", self.plugged_event)
        socket.connect("plug-removed", self.unplugged_event)
        window.show_all()
        
    def plugged_event(self, widget):
        print "A plug has been inserted."
            
    def unplugged_event(self, widget):
        print "A plug has been removed."
        return True

Socket()
gtk.main()
-------------------

* The following Qt program tries to embed itself
  into the container whose id is passed on the command line.

-------------------
#include <QWidget>
#include <QWindow>
#include <QApplication>
#include <QLabel>
#include <QString>
#include <cstdio>

int main(int argc, char **argv)
{
  QApplication app(argc,argv);
  long wid = app.arguments().at(1).toLong(0,0);
  QLabel *lbl = new QLabel();
  lbl->setText("here");
  lbl->setAlignment(Qt::AlignCenter);
  lbl->winId();
  QWindow *wlbl = lbl->windowHandle();
  wlbl->setParent(QWindow::fromWinId(wid));
  lbl->show();
  app.exec();
}
-------------------

* To reproduce, open a terminal window, run "gtksocket.py"
  and record the printed socket window id. This creates
  a toplevel window containing the socket. In a second terminal window,
  run "plug <socketwindowid>".
  The label text "here" appears in socket window.

* Under Qt-5.2, the label text appears in the middle of
  the window because the QLabel widget has the same size
  as the gtksocket window.  Resizing the gtksocket window
  keeps the text "here" in the middle of the window because
  the QLabel widget size tracks that of the socker.

* Under Qt-5.5.1+dfsg-10, the label text appears in the top left
  corner of the window and stays there. Using program "xwininfo"
  shows that the size of the underlying X11 window effectively
  tracks the size of the gtksocket. But it appears that
  the size of the QWindow and of the associated QLabel
  remains stuck to its initial value.


As a consequence, XEMBED interop is broken in this version of Qt.




-- System Information:
Debian Release: stretch/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libqt5gui5 depends on:
ii  fontconfig                       2.11.0-6.3
ii  libc6                            2.21-4
ii  libegl1-mesa [libegl1-x11]       11.0.8-1
ii  libfontconfig1                   2.11.0-6.3
ii  libfreetype6                     2.6.1-0.1
ii  libgl1-mesa-glx [libgl1]         11.0.8-1
ii  libglib2.0-0                     2.46.2-1
ii  libharfbuzz0b                    1.0.1-1+b1
ii  libinput10                       1.1.3-1
ii  libjpeg62-turbo                  1:1.4.1-2
ii  libmtdev1                        1.1.5-1
ii  libpng12-0                       1.2.54-1
ii  libqt5core5a [qtbase-abi-5-5-1]  5.5.1+dfsg-10
ii  libqt5dbus5                      5.5.1+dfsg-10
ii  libqt5network5                   5.5.1+dfsg-10
ii  libstdc++6                       5.3.1-4
ii  libudev1                         228-2+b1
ii  libx11-6                         2:1.6.3-1
ii  libxkbcommon0                    0.5.0-1
ii  libxrender1                      1:0.9.9-2
ii  zlib1g                           1:1.2.8.dfsg-2+b1

Versions of packages libqt5gui5 recommends:
ii  libqt5svg5     5.5.1-2
ii  libqt5xcbqpa5  5.5.1+dfsg-10

Versions of packages libqt5gui5 suggests:
pn  libqt5libqgtk2             <none>
pn  qt5-image-formats-plugins  <none>
pn  qtwayland5                 <none>

-- no debconf information


Reply to: