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

X11: QWidget::activateWindow() does not work reliably

    XMLWordPrintable

Details

    Description

      I'd like to force my app (Qt Creator) into the foreground, e.g. when the app currently debugged hits a breakpoint. However,

      raise();
      activateWindow():
      

      doesn't work reliably for me. Sometimes it activates Qt Creator, sometimes it just 'flashes' the icon of Qt Creator, sometimes it does nothing.

      That's because the X11 _NET_ACTIVE_WINDOW event is initialized with

      e.xclient.data.l[1] = X11->userTime;
      

      depending on the last interaction with Qt Creator this might have been loong ago. Changing it to

      e.xclient.data.l[1] = X11->time;
      

      Makes raise() behave as expected!

      If activateWindow() is called in ubuntu (unity) it does not brings the focus to the window as it can be demonstrated in showHide example atttached.
      -Run the example and press C (to create a new window)
      -Press T to toggle Hide and show,if focus is not in new window it will hide

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            kkohne Kai Köhne
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes