Bug 1772404 - Corner snapping for Windows and Linux. r=mhowell,mconley

Differential Revision: https://phabricator.services.mozilla.com/D151162
This commit is contained in:
Niklas Baumgardner 2023-09-26 23:50:13 +00:00
Родитель 1dd295fe99
Коммит 823cc10a8e
3 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -989,7 +989,11 @@ let Player = {
let quadrant = this.determineCurrentQuadrant();
let dragAction = this.determineDirectionDragged();
if (event.metaKey && AppConstants.platform == "macosx" && dragAction) {
if (
((event.ctrlKey && AppConstants.platform !== "macosx") ||
(event.metaKey && AppConstants.platform === "macosx")) &&
dragAction
) {
// Moving logic based on current quadrant and direction of drag.
switch (quadrant) {
case TOP_RIGHT_QUADRANT:

Просмотреть файл

@ -5652,6 +5652,20 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
NotifySizeMoveDone();
}
// Windows spins a separate hidden event loop when moving a window so we
// don't hear mouse events during this time and WM_EXITSIZEMOVE is fired
// when the hidden event loop exits. We set mDraggingWindowWithMouse to
// true in WM_NCLBUTTONDOWN when we started moving the window with the
// mouse so we know that if mDraggingWindowWithMouse is true, we can send
// a mouse up event.
if (mDraggingWindowWithMouse) {
mDraggingWindowWithMouse = false;
result = DispatchMouseEvent(
eMouseUp, wParam, lParam, false, MouseButton::ePrimary,
MOUSE_INPUT_SOURCE(),
mPointerEvents.GetCachedPointerInfo(msg, wParam));
}
break;
}
@ -5679,6 +5693,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
if (ClientMarginHitTestPoint(GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam)) == HTCAPTION) {
DispatchCustomEvent(u"draggableregionleftmousedown"_ns);
mDraggingWindowWithMouse = true;
}
if (IsWindowButton(wParam) && mCustomNonClient) {

Просмотреть файл

@ -756,6 +756,7 @@ class nsWindow final : public nsBaseWidget {
bool mResizable = false;
bool mForMenupopupFrame = false;
bool mIsPerformingDwmFlushHack = false;
bool mDraggingWindowWithMouse = false;
DWORD_PTR mOldStyle = 0;
DWORD_PTR mOldExStyle = 0;
nsNativeDragTarget* mNativeDragTarget = nullptr;