question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maximize window state will show a gap on top

See original GitHub issue

Description

When I maximize the window, there is a gap above the fake title bar. Apply to:

  • dragging title bar,
  • clicking on maximize button,
  • using hotkey Win + Up
  • double clicking on title bar

Version

  • GitHub Desktop: 1.2.6
  • Operating system: 10.0.17134.112 x64

Steps to Reproduce

  1. Open GitHub in normal window state
  2. Maximize the window. The issue occurs.
  3. Restore window state to normal
  4. Maximize the window again, there is no issue.
  5. Keep repeating this, the issue will happen again.

Expected Behavior

There is no gap on top of the window

Actual Behavior

There is a gap which is title bar location on top of window

Additional Information

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
shiftkeycommented, Jun 26, 2018

@j-f1 it does not (I expect all the window to be tinted blue here)

Adding electron to indicate this might be a framework issue to dig into.

1reaction
shiftkeycommented, Jun 27, 2018

After digging into this a bit further I think this is a problem with how Electron handles the events. Maybe this has been fixed, but here’s my setup so far:

  • make these changes to master
diff --git a/app/src/lib/stores/app-store.ts b/app/src/lib/stores/app-store.ts
index 8adcaa199..fa1963aed 100644
--- a/app/src/lib/stores/app-store.ts
+++ b/app/src/lib/stores/app-store.ts
@@ -315,7 +315,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
   private wireupIpcEventHandlers(window: Electron.BrowserWindow) {
     ipcRenderer.on(
       'window-state-changed',
-      (event: Electron.IpcMessageEvent, args: any[]) => {
+      (event: Electron.IpcMessageEvent, state: WindowState) => {
+        log.warn(`window-state-changed: ${state}`)
         this.windowState = getWindowState(window)
         this.emitUpdate()
       }
diff --git a/app/src/ui/index.tsx b/app/src/ui/index.tsx
index ad88a9b79..3c6e59865 100644
--- a/app/src/ui/index.tsx
+++ b/app/src/ui/index.tsx
@@ -151,7 +151,34 @@ dispatcher.registerErrorHandler(missingRepositoryHandler)
 
 document.body.classList.add(`platform-${process.platform}`)
 
-dispatcher.setAppFocusState(remote.getCurrentWindow().isFocused())
+const currentWindow = remote.getCurrentWindow()
+
+dispatcher.setAppFocusState(currentWindow.isFocused())
+
+window.addEventListener('resize', resizeThrottler, false)
+
+let resizeTimeout: number | null = null
+function resizeThrottler() {
+  // ignore resize events as long as an actualResizeHandler execution is in the queue
+  if (!resizeTimeout) {
+    resizeTimeout = window.setTimeout(function() {
+      resizeTimeout = null
+      actualResizeHandler()
+
+      // The actualResizeHandler will execute at a rate of 15fps
+    }, 66)
+  }
+}
+
+function actualResizeHandler() {
+  if (currentWindow.isMaximized()) {
+    const [x, y] = currentWindow.getPosition()
+    const bounds = currentWindow.getContentBounds()
+    log.warn(
+      `maximized position: [${x}, ${y}] - bounds: ${JSON.stringify(bounds)}`
+    )
+  }
+}
 
 ipcRenderer.on('focus', () => {
   const { selectedState } = appStore.getState()

When you run the app up and switch between maximized and normal state using WinKey + Up Arrow you’ll notice this pattern in the logs:

Note that we’re only listening to these window change events, and I don’t think we’re setting these bounds anywhere.

The next step is to upgrade to Electron 2.0.x and see if it’s been fixed there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gap at top of screen with window maximized
Hi, I am using Windows 7. My problem is when I maximize the explorer (windows or internet any), I am not able to...
Read more >
Some applications in full screen leave an invisible gap ...
When their window is maximized to full screen, there's actually an invisible gap between the top of the window to the top edge...
Read more >
Fixing ~8 pixel overhang on maximized window state ... - Reddit
I fixed it by making a DataTrigger Binding to WindowState and modifying the border thickness when the window is maximized.
Read more >
WPF Maximized Window bigger than screen - Stack Overflow
It seems a pretty common issue. It appears you'll have to bind your height and width to the actual ...
Read more >
macos - Gap at the bottom of maximized windows - Ask Different
Those 5 pixels are tied to the Dock. You can position the dock on either the left of right side instead, but the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found