[vlc-devel] [PATCH 0/1] qt: prevent setMinimalView() from sizing incorrectly on fullscreen exit

Darrell Walisser darrell.walisser at gmail.com
Sat Mar 19 18:58:31 CET 2016

On Sat, Mar 19, 2016 at 11:12 AM, Rémi Denis-Courmont <remi at remlab.net>

> Le 2016-03-19 04:50, Darrell Walisser a écrit :
>> On Fri, Mar 18, 2016 at 9:14 PM, Rémi Denis-Courmont <remi at remlab.net
>> [1]> wrote:
> At what point all those things come together to make
>> the window "fullscreen" is indeterminate because there is no single
>> event supplied for that.
> I utterly fail to see why you should even care for reasons already
> outlined. But there IS an X11 event, and most probably there are events in
> other systems.
The bug that I am attempting to fix is the one where if you make the window
fullscreen, when it returns to normal its size is now the size of the
screen and not the original size. There was a bug report on this some time
after I first submitted the patch, and it is not limited to X11.

I have traced the source of the bug to setMinimalView(). setMinimalView()
is used to hide the UI elements (menu bar, toolbars, etc) prior to
fullscreen switch, and recently, it now wants to resize the window as well.
setMinimalView() tests QWidget::isFullscreen() (rightly so) and will not
call QWidget::resize() if it returns true.

The problem is that QWidget::isFullScreen() will return false while the
window is switching away from fullscreen but before Qt has restored it to
the original position and size. setMinimalView(), which now needs to show
the UI elements that it hid, then proceeds to set the wrong size on the
window since it sees QWidget::size() as the fullscreen size and not the
original size.

In summary, in Qt (any version, any platform), you cannot trust
QWidget::isFullScreen() to mean that the window size() isn't going to
change soon, as setMinimalView() does.

This is a real bug, it is not limited to X11, is not a bug in Qt, and there
is no single Qt event that can be used if you really want to know when the
fullscreen switch is done (you have to look for
WindowStateChanged+ResizeEvent it seems).

I do not believe there is any better solution than the two I have already
proposed. If you are looking for something that isn't a compromise, you
won't find one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160319/96c01924/attachment.html>

More information about the vlc-devel mailing list