Nominate our 2022 Qt Champions!

[solved] Qt + DirectFB == Windows Losing Focus

  • My apps running under DirectFB platform plugin are either permanently losing focus, or never get focus. The main window will appear, but either it has no focus so that I cannot use the mouse or keyboard, or it loses the focus the instant the cursor exits any edit widget (QLineEdit, QTextEdit, etc). This applies to all widgets, buttons are not clickable, sliders will not slide, etc.

    Some apps seem to be fine, but most apps show the problem. I am unsure what the difference is. For example, the "wiggly" example works fine, but the "lineedits" does not.

    I thought this was a problem on my target platform, but it occurs on the desktop as well. With a .directfbrc file to run directfb under X11, the behavior is the same.

    To reproduce (on desktop):

    • Create a minimal .directfbfc file under Linux/Unix (just put in the line "system=x11"), and make sure Qt was build with directfb support.
    • run wiggly: wiggly -platform directfb
    • run lineedits: lineedits -platform directfb

    With some judicious qDebug statements in qdirectfbinput.cpp, I've narrowed the problem down to DirectFB simply not reporting ANY input events at all to the affected windows, including DWET_GOTFOCUS.

    Is this a problem with DirectFB? Or with Qt? Any special configurations or environment variables I need? Any workarounds? I've been searching for a while but have found no answers online. Please help. Surely someone out there is using the DirectFB platform.

  • Source of problem found, fix applied. Basically the DirectFB places every new window at the top of the z-order by default. Which is normally the right thing to do... except for QDesktopWidget windows. The app was not getting any events because there was an invisible desktop window in the way.

    The fix was to have the directfb plugin lower all desktop windows (those with a Qt:Desktop window flag) to the bottom when created.

  • Lifetime Qt Champion


    Nice you found and thanks for sharing !

    Can you also please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply