Repository: spyder-ide/spyder

Issue:
Menu items don't show in full-screen mode
## Description

**What steps will reproduce the problem?**

1. In full-screen mode
2. Click on menu buttons
3. Menu items won't show

**What is the expected output? What do you see instead?**


**Please provide any additional information below**


## Version and main components

* Spyder Version: 3.1.2 
* Python Version: 3.6.0
* Qt Versions: 5.7.1, PyQt5 5.7.1 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
numpy >=1.7      :  1.11.3 (OK)
sphinx >=0.6.6   :  1.5.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  2.0.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
pylint >=0.25    :  1.6.5 (OK)

```



Discussion:
Not a priority for us to make this work, sorry.
This is a duplicate of #4821. Its (temporary) solution is to close the Help pane.
@ccordoba12 it seems you can keep the help pane open if you switch the text to plain text instead of rich text. Only problem is spyder doesn't remember this setting upon closing. Is there any way to change that?
No, there isn't, sorry.
@ccordoba12 I believe this is not a duplicate of #4821. This is actually a known QT bug with documented workarounds. I will take a look at it when I have the time.

See:
https://bugreports.qt.io/browse/QTBUG-47156
https://bugreports.qt.io/browse/QTBUG-41309
https://doc.qt.io/qt-5/windows-issues.html#fullscreen-opengl-based-windows


Thanks for re-opening this issue, however I do not think the linked bugs are exactly the same issue. Everything is fine in full screen mode for me (on windows with anaconda build). 

For me it's been outside of full screen when there's any rich text in any pane. This can be the help pane or it can even be the IPython console when you restart the kernel and you get the screen below. For those few seconds until the console switches back to plain text, all my tools at top of spyder jump into the menu bar and all text looks blurry. If i perform this same action (killing the kernel and waiting for a new one) in fullscreen mode, everything stays just right...

![image](https://user-images.githubusercontent.com/30841951/44292429-63713800-a239-11e8-8f03-a71a4fa94446.png)

Now, When I start spyder, the issue comes from the help pane which starts in rich text mode. Simply switching to plain text doesn't immediately fix the spyder window. This time, I have to go into fullscreen then back out, and now everything is proper.

A short term solution then, is to have spyder start with the help pane in plain text mode and otherwise look into what rich text is doing. 
This could be fixed by a new option I added to select the OpenGL implementation used by Qt, which will appear in 3.3.2.

@jasonsross, could you help us to test that? For that, you'd need to download the Spyder source code with git, then `git checkout 3.x` and finally run `python bootstrap.py -- --opengl software` in the root of your repo.
@ccordoba12 I tried it and, if I did it right, no change. Problem persists. Was there some setting to choose in spyder? Here's some screenshots of my attempt:

![image](https://user-images.githubusercontent.com/30841951/44296017-fd50d900-a269-11e8-91f1-1f61f64d3a70.png)

![image](https://user-images.githubusercontent.com/30841951/44296025-2f623b00-a26a-11e8-94c4-b5b57d60a919.png)

>Thanks for re-opening this issue, however I do not think the linked bugs are exactly the same issue. Everything is fine in full screen mode for me (on windows with anaconda build).

>For me it's been outside of full screen when there's any rich text in any pane. This can be the help pane or it can even be the IPython console when you restart the kernel and you get the screen below. For those few seconds until the console switches back to plain text, all my tools at top of spyder jump into the menu bar and all text looks blurry. If i perform this same action (killing the kernel and waiting for a new one) in fullscreen mode, everything stays just right...

@jasonsross This issue relates to **unclickable menu items when in full screen mode** as per the description of the issue in the OP. I can replicate the issue on my development machine.

The issue you are describing seems to be related to #4821 instead. Please, post your info over there instead of here.
@jnsebgosselin Ah I see they are different issues now. I was assuming they were the same. Anyway, the 3.3.2 build also does not fix the full screen menu bars, still unclickable for me. Any plans to reopen the other issue?
>@jnsebgosselin Ah I see they are different issues now. I was assuming they were the same. Anyway, the 3.3.2 build also does not fix the full screen menu bars, still unclickable for me. Any plans to reopen the other issue?

I do not know, I wish I could help with that one too, but I have not been able to reproduce the problem yet :/ I'll see what I can do.
For the records, full screen mode is completely broken on Windows 10 on my laptop.

Its is not only the menu items of the main window that do not show up, but all the menus and popups of the entire application. Even context menus and comboboxes popup listview do not show up. Dialogs appear, but there is a delay and this cause the screen to flicker a lot.

@ccordoba12 I've tried launching Spyder with `Desktop` or `Software` for the `Rendering engine` option, but it doesn't change anything... I'll do more testing later.

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -478,10 +478,13 @@ def signal_handler(signum, frame=None):
         self.current_quick_layout = None
         self.previous_layout_settings = None  # TODO: related to quick layouts
         self.last_plugin = None
-        self.fullscreen_flag = None # isFullscreen does not work as expected
+        self.fullscreen_flag = None  # isFullscreen does not work as expected
         # The following flag remember the maximized state even when
         # the window is in fullscreen mode:
         self.maximized_flag = None
+        # The following flag is used to restore window's geometry when
+        # toggling out of fullscreen mode in Windows.
+        self.saved_normal_geometry = None
 
         # To keep track of the last focused widget
         self.last_focused_widget = None
@@ -2301,7 +2304,7 @@ def maximize_dockwidget(self, restore=False):
         self.__update_maximize_action()
 
     def __update_fullscreen_action(self):
-        if self.isFullScreen():
+        if self.fullscreen_flag:
             icon = ima.icon('window_nofullscreen')
         else:
             icon = ima.icon('window_fullscreen')
@@ -2311,15 +2314,34 @@ def __update_fullscreen_action(self):
 
     @Slot()
     def toggle_fullscreen(self):
-        if self.isFullScreen():
+        if self.fullscreen_flag:
             self.fullscreen_flag = False
+            if os.name == 'nt':
+                self.setWindowFlags(
+                    self.windowFlags()
+                    ^ (Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint))
+                self.setGeometry(self.saved_normal_geometry)
             self.showNormal()
             if self.maximized_flag:
                 self.showMaximized()
         else:
             self.maximized_flag = self.isMaximized()
             self.fullscreen_flag = True
-            self.showFullScreen()
+            self.saved_normal_geometry = self.normalGeometry()
+            if os.name == 'nt':
+                # Due to limitations of the Windows DWM, compositing is not
+                # handled correctly for OpenGL based windows when going into
+                # full screen mode, so we need to use this workaround.
+                # See Issue #4291.
+                self.setWindowFlags(self.windowFlags()
+                                    | Qt.FramelessWindowHint
+                                    | Qt.WindowStaysOnTopHint)
+                r = QApplication.desktop().screenGeometry()
+                self.setGeometry(
+                    r.left() - 1, r.top() - 1, r.width() + 2, r.height() + 2)
+                self.showNormal()
+            else:
+                self.showFullScreen()
         self.__update_fullscreen_action()
 
     def add_to_toolbar(self, toolbar, widget):


Test patch: