Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-125457

Embedded gtk doesn't seem to recognize keyboard focus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.15, 6.2, 6.5, 6.7
    • QPA: X11/XCB
    • None
    • Linux/X11

    Description

      Build the following code:

      #include <QApplication>
      #include <QWidget>
      #include <QWindow>
      
      extern "C" {
      #include <gdk/gdkx.h>
      #include <gtk/gtk.h>
      }
      
      int main(int argc, char *argv[]) {
      	QApplication app(argc, argv);
      	gtk_init(nullptr, nullptr);
      	const auto window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
      	const auto entry = gtk_entry_new();
      	gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(entry));
      	gtk_widget_show_all(window);
      	QWidget::createWindowContainer(QWindow::fromWinId(gdk_x11_window_get_xid(gtk_widget_get_window(window))))->show();
      	return app.exec();
      }
      

      With g++ -o main main.cpp -DQT_NO_KEYWORDS $(pkg-config --cflags --libs Qt6Core Qt6Gui Qt6Widgets gtk+-3.0).

      Whatever distro or DE I try it with, it never shows cursor in input fields. Which apparently means it thinks the windows doesn't have focus. Keyboard input works nevertheless.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              liaqi Liang Qi
              ilya-fedin Ilya Fedin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes