Improve edge cases around macOS drag handles (#1219)

* Allow dragging macOS window by area around mx_UserMenu

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix context menus overlapping drag regions being unclickable

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix captcha overlapping drag region being unclickable

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Expand drag handle on top left user menu surround

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-09-14 08:55:11 +01:00 committed by GitHub
parent 1905e4759b
commit f45f83f0f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,17 @@ export function setupMacosTitleBar(window: BrowserWindow): void {
cssKey = await window.webContents.insertCSS(` cssKey = await window.webContents.insertCSS(`
/* Create margin of space for the traffic light buttons */ /* Create margin of space for the traffic light buttons */
.mx_UserMenu { .mx_UserMenu {
margin-top: 32px !important; /* We zero the margin and use padding as we want to use it as a drag handle */
margin-top: 0 !important;
margin-left: 0 !important;
padding-top: 32px !important;
padding-left: 20px !important;
-webkit-app-region: drag;
-webkit-user-select: none;
}
/* Exclude the button from being a drag handle and not working */
.mx_UserMenu > * {
-webkit-app-region: no-drag;
} }
/* Maintain alignment of the toggle space panel button */ /* Maintain alignment of the toggle space panel button */
.mx_SpacePanel_toggleCollapse { .mx_SpacePanel_toggleCollapse {
@ -112,6 +122,14 @@ export function setupMacosTitleBar(window: BrowserWindow): void {
.mx_RoomPreviewCard { .mx_RoomPreviewCard {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
/* Exclude context menus and their backgrounds */
.mx_ContextualMenu, .mx_ContextualMenu_background {
-webkit-app-region: no-drag;
}
/* Exclude iframes, such as recaptcha */
iframe {
-webkit-app-region: no-drag;
}
`); `);
} }