Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve window movement with Command Center enabled #157437

Closed
dlschmidt opened this issue Aug 7, 2022 · 13 comments
Closed

Improve window movement with Command Center enabled #157437

dlschmidt opened this issue Aug 7, 2022 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug command-center upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Milestone

Comments

@dlschmidt
Copy link

The problem:

I've recently found out if the VSCode window is quite small, it is very difficult to move the window.
vscode_drag_issue
As shown in this picture, only some small areas can be used to move the window. This is even worse if Layout Controls are enabled aswell.

One solution:

This could be improved by allowing the command center to be draggable as well. Also, this would fit better with the Command Center replacing the window bar.

I think this can be implemented, because no action is done when currently dragging the command center.

Version:

Version: 1.70.0 (user setup)
Commit: da76f93
Date: 2022-08-04T04:38:16.462Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19043

@gjsjohnmurray
Copy link
Contributor

Related to #152578

@jrieken
Copy link
Member

jrieken commented Aug 15, 2022

I think this can be implemented, because no action is done when currently dragging the command center

Unfortunately not. Once you mark a region as "window-drag-region" it won't receive any event anymore, e.g. clicking the CC won't work anymore. This is an electron/os limitation. Tho, note that you can drag the area above/below the CC to drag the window as well

@bpasero
Copy link
Member

bpasero commented Aug 15, 2022

This maybe the reason why Slack opens their "command center" on mouse down (we open on mouse up I think). As you can see below, I can still move the Window when clicking and dragging there:

Recording 2022-08-15 at 17 45 28

@dlschmidt
Copy link
Author

It would be really good if you could take the behaviour from Slack and adopt it a little bit. Maybe detect whether the window is been dragged and close the CC again? After a short period of 500ms for example.

But of course only if it works at all.

@trusktr
Copy link

trusktr commented Aug 15, 2022

I ran into this. Especially when the window is small, there is essentially no area left to drag the window with.

I think this can be implemented, because no action is done when currently dragging the command center

Unfortunately not.

Is it not possible to set the window position with BrowserWindow.setPosition on every pointermove while pointerdown?

@jrieken
Copy link
Member

jrieken commented Sep 20, 2022

This maybe the reason why Slack opens their "command center" on mouse down (we open on mouse up I think). As you can see below, I can still move the Window when clicking and dragging there:

This is how it works: we declare the title bar element as draggable region, via -webkit-app-region: drag. This "style" marks it a window drag region and electron/chromium do the right thing. Now the fun starts:

  • windows - elements inside a drag region do not emit events and we need to "clear" sub-regions via -webkit-app-region: no-drag;. Otherwise you cannot click any button inside the title bar part
  • linux - same as windows
  • mac - looks like elements inside drag regions still emit events

My guess is that slack doesn't always use the no-drag-tweak , e.g on mac you can drag while the click still happens (and while commands execute). Slack on windows doesn't support that, e.g you cannot drag its windows on the input thing.

I'll prepare a change that enables this for mac but I have nothing to offer for windows users...

@jrieken
Copy link
Member

jrieken commented Sep 21, 2022

@deepak1556 Do you think there is a chance to tweak electron to behave on windows/linux as it does on mac (see comment about drag/no-drag above)?

@jrieken jrieken added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Sep 23, 2022
@sbatten
Copy link
Member

sbatten commented Dec 29, 2022

A recent change to the title bar should provide more draggable space to the title bar on Windows and Linux. There should be a bit more space around the command center. Though, due to the holidays, this is not yet available in Insiders and won't be in stable until end of January.

@sbatten
Copy link
Member

sbatten commented Dec 29, 2022

@jrieken with the changes to use better flex layout in the titlebar, I would say we could tweak padding further if we want, but the situation is as improved as we can take it. Thus I propose we close this one out.

@sbatten sbatten added the bug Issue identified by VS Code Team member as probable bug label Dec 29, 2022
@sbatten sbatten added this to the January 2023 milestone Dec 29, 2022
@sbatten sbatten closed this as completed Dec 30, 2022
@joyceerhl joyceerhl added the verified Verification succeeded label Jan 26, 2023
@joyceerhl
Copy link
Contributor

You can still get unlucky with a couple of dead zones as shown in the gif below but the adaptive resizing of the menu bar is a significant improvement
Recording 2023-01-26 at 09 21 57

@sbatten
Copy link
Member

sbatten commented Jan 26, 2023

@jrieken joyce's report is due to padding on the CC, I think we can remove that padding as we have margin on the center content

@jrieken
Copy link
Member

jrieken commented Jan 27, 2023

Yeah, looks like there is margin around the title-container and padding for the CC container. Let's nuke the latter

@dlschmidt
Copy link
Author

Please re-open this issue because I don't have the permission for this.

sbatten added a commit that referenced this issue Jan 27, 2023
sbatten added a commit that referenced this issue Jan 30, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug command-center upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants