https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1d690f041149ee3607dab…
commit 1d690f041149ee3607dabd2136fb0e96ee9d517a
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sun May 15 14:38:43 2022 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun May 15 14:38:43 2022 +0900
[NOTEPAD] Less flickering title bar (#4516)
When typing text on NotePad, then NotePad title bar flickers.
- Save previous modification flag.
- If no change in modification flag, do not set the title bar text.
---
base/applications/notepad/dialog.c | 14 ++++++++++++--
base/applications/notepad/main.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/base/applications/notepad/dialog.c b/base/applications/notepad/dialog.c
index 3befb566503..7a0e0fac6cc 100644
--- a/base/applications/notepad/dialog.c
+++ b/base/applications/notepad/dialog.c
@@ -68,6 +68,13 @@ void UpdateWindowCaption(BOOL clearModifyAlert)
TCHAR szCaption[MAX_STRING_LEN];
TCHAR szNotepad[MAX_STRING_LEN];
TCHAR szFilename[MAX_STRING_LEN];
+ BOOL isModified = !!SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0);
+
+ if (!clearModifyAlert && isModified == Globals.bWasModified)
+ {
+ /* We are in the same state as before, don't change the caption */
+ return;
+ }
/* Load the name of the application */
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
@@ -84,14 +91,17 @@ void UpdateWindowCaption(BOOL clearModifyAlert)
{
StringCbPrintf(szCaption, sizeof(szCaption), _T("%s - %s"),
szFilename, szNotepad);
+
+ Globals.bWasModified = FALSE;
}
else
{
- BOOL isModified = (SendMessage(Globals.hEdit, EM_GETMODIFY, 0, 0) ? TRUE : FALSE);
-
/* Update the caption based upon if the user has modified the contents of the file or not */
StringCbPrintf(szCaption, sizeof(szCaption), _T("%s%s - %s"),
(isModified ? _T("*") : _T("")), szFilename, szNotepad);
+
+ /* We will modify the caption below */
+ Globals.bWasModified = isModified;
}
/* Update the window caption */
diff --git a/base/applications/notepad/main.h b/base/applications/notepad/main.h
index 65a8782f909..349be218118 100644
--- a/base/applications/notepad/main.h
+++ b/base/applications/notepad/main.h
@@ -80,6 +80,7 @@ typedef struct
FINDREPLACE find;
WNDPROC EditProc;
RECT main_rect;
+ BOOL bWasModified;
} NOTEPAD_GLOBALS;
extern NOTEPAD_GLOBALS Globals;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=83d2c8ce3366a8d1fafae…
commit 83d2c8ce3366a8d1fafae52ee804a70c66e8a6b9
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sat May 14 15:41:44 2022 +0200
Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com>
CommitDate: Sat May 14 21:29:12 2022 +0200
[WIN32SS] mouse: call panning driver when moving pointer
Yes, if a driver supports both hardware pointers and panning, it will be called twice on each move.
---
win32ss/gdi/eng/mouse.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/win32ss/gdi/eng/mouse.c b/win32ss/gdi/eng/mouse.c
index 21f67f7fdcc..c8de250aa1f 100644
--- a/win32ss/gdi/eng/mouse.c
+++ b/win32ss/gdi/eng/mouse.c
@@ -820,6 +820,11 @@ GreMovePointer(
pdc->ppdev->pfnMovePointer(pso, x, y, prcl);
else if (pdc->ppdev->flFlags & PDEV_SOFTWARE_POINTER)
EngMovePointer(pso, x, y, prcl);
+
+ /* If panning device, and we're not hiding the cursor, notify cursor's current position.
+ * (driver may already have been called if it also supports hardware pointers) */
+ if (pdc->ppdev->devinfo.flGraphicsCaps & GCAPS_PANNING && y >= 0)
+ pdc->ppdev->pfnMovePointer(pso, x, y - pso->sizlBitmap.cy, NULL);
}
/* Release PDEV lock */
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=57c07ba117dca721676df…
commit 57c07ba117dca721676dfa3876b26e3fd63c4106
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sat May 14 15:37:29 2022 +0200
Commit: hpoussin <32227662+hpoussin(a)users.noreply.github.com>
CommitDate: Sat May 14 21:29:12 2022 +0200
[WIN32SS] mouse: use pointer flags in PDEVOBJ
When changing pointer cursor:
- use PDEV_HARDWARE_POINTER flag if using hardware pointer
- use PDEV_SOFTWARE_POINTER flag if using software pointer
- keep pfnMovePointer as an accelerator to driver function (if available) and never change it
- fix bug (2 pointers) when switching between hardware and software pointer
When moving pointer:
- check PDEV_HARDWARE_POINTER flag to know if we need to call the driver
- check PDEV_SOFTWARE_POINTER flag to know if we need to call EngMovePointer
---
win32ss/gdi/eng/mouse.c | 50 ++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 39 insertions(+), 11 deletions(-)
diff --git a/win32ss/gdi/eng/mouse.c b/win32ss/gdi/eng/mouse.c
index 677a0e68eee..21f67f7fdcc 100644
--- a/win32ss/gdi/eng/mouse.c
+++ b/win32ss/gdi/eng/mouse.c
@@ -618,6 +618,8 @@ IntEngSetPointerShape(
ULONG ulResult = SPS_DECLINE;
PFN_DrvSetPointerShape pfnSetPointerShape;
PPDEVOBJ ppdev = GDIDEV(pso);
+ BOOL bHardwarePointer = FALSE;
+ BOOL bSoftwarePointer = TRUE;
pfnSetPointerShape = GDIDEVFUNCS(pso).SetPointerShape;
@@ -638,15 +640,15 @@ IntEngSetPointerShape(
y,
prcl,
fl);
- }
- /* Check if the driver accepted it */
- if (ulResult == SPS_ACCEPT_NOEXCLUDE)
- {
- /* Set MovePointer to the driver function */
- ppdev->pfnMovePointer = GDIDEVFUNCS(pso).MovePointer;
+ /* Check if the driver accepted it */
+ if (ulResult == SPS_ACCEPT_NOEXCLUDE)
+ bHardwarePointer = TRUE;
+
+ bSoftwarePointer = !bHardwarePointer;
}
- else
+
+ if (bSoftwarePointer)
{
/* Set software pointer */
ulResult = EngSetPointerShape(pso,
@@ -659,10 +661,31 @@ IntEngSetPointerShape(
y,
prcl,
fl);
- /* Set MovePointer to the eng function */
- ppdev->pfnMovePointer = EngMovePointer;
}
+ if (!bSoftwarePointer && ppdev->flFlags & PDEV_SOFTWARE_POINTER)
+ {
+ /* Disable software pointer */
+ EngMovePointer(pso, -1, -1, NULL);
+ }
+
+ if (!bHardwarePointer && ppdev->flFlags & PDEV_HARDWARE_POINTER)
+ {
+ /* Disable hardware pointer */
+ ppdev->pfnMovePointer(pso, -1, -1, NULL);
+ }
+
+ /* Update flags */
+ if (bSoftwarePointer)
+ ppdev->flFlags |= PDEV_SOFTWARE_POINTER;
+ else
+ ppdev->flFlags &= ~PDEV_SOFTWARE_POINTER;
+
+ if (bHardwarePointer)
+ ppdev->flFlags |= PDEV_HARDWARE_POINTER;
+ else
+ ppdev->flFlags &= ~PDEV_HARDWARE_POINTER;
+
return ulResult;
}
@@ -787,11 +810,16 @@ GreMovePointer(
/* Check if we need to move it */
if(pdc->ppdev->SafetyRemoveLevel == 0)
{
+ SURFOBJ* pso = &pdc->ppdev->pSurface->SurfObj;
+
/* Store the cursor exclude position in the PDEV */
prcl = &pdc->ppdev->Pointer.Exclude;
- /* Call Eng/Drv function */
- pdc->ppdev->pfnMovePointer(&pdc->ppdev->pSurface->SurfObj, x, y, prcl);
+ /* Send new position of the hot spot of the pointer (will likely redraw cursor) */
+ if (pdc->ppdev->flFlags & PDEV_HARDWARE_POINTER)
+ pdc->ppdev->pfnMovePointer(pso, x, y, prcl);
+ else if (pdc->ppdev->flFlags & PDEV_SOFTWARE_POINTER)
+ EngMovePointer(pso, x, y, prcl);
}
/* Release PDEV lock */
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=884356a06e1589271595e…
commit 884356a06e1589271595e198e0a32c35d29d6059
Author: Tuur Martens <tuurmartens4(a)gmail.com>
AuthorDate: Thu May 12 08:11:52 2022 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sat May 14 15:09:50 2022 +0200
[NTOS:MM] Charge and free quotas for VAD allocations
Charge quotas for VAD allocations and free the quotas again when the VADs are freed.
CORE-18028
---
ntoskrnl/mm/ARM3/mdlsup.c | 5 +++++
ntoskrnl/mm/ARM3/procsup.c | 27 +++++++++++++++++++++++++--
ntoskrnl/mm/ARM3/section.c | 9 +++++++++
ntoskrnl/mm/ARM3/virtual.c | 26 ++++++++++++++++++++++----
4 files changed, 61 insertions(+), 6 deletions(-)
diff --git a/ntoskrnl/mm/ARM3/mdlsup.c b/ntoskrnl/mm/ARM3/mdlsup.c
index 9332ec3153e..0d74949cd16 100644
--- a/ntoskrnl/mm/ARM3/mdlsup.c
+++ b/ntoskrnl/mm/ARM3/mdlsup.c
@@ -158,6 +158,10 @@ MiMapLockedPagesInUserSpace(
MiInsertVad((PMMVAD)Vad, &Process->VadRoot);
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+ if (!NT_SUCCESS(Status))
+ goto Error;
+
/* Check if this is uncached */
if (CacheAttribute != MiCached)
{
@@ -319,6 +323,7 @@ MiUnmapLockedPagesInUserSpace(
/* Remove it from the process VAD tree */
ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
/* MiRemoveNode should have removed us if we were the hint */
ASSERT(Process->VadRoot.NodeHint != Vad);
diff --git a/ntoskrnl/mm/ARM3/procsup.c b/ntoskrnl/mm/ARM3/procsup.c
index dd04b68fb83..2ddd91c5ca2 100644
--- a/ntoskrnl/mm/ARM3/procsup.c
+++ b/ntoskrnl/mm/ARM3/procsup.c
@@ -97,6 +97,13 @@ MiCreatePebOrTeb(IN PEPROCESS Process,
return STATUS_NO_MEMORY;
}
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+ if (!NT_SUCCESS(Status))
+ {
+ ExFreePoolWithTag(Vad, 'ldaV');
+ return Status;
+ }
+
/* Success */
return STATUS_SUCCESS;
}
@@ -154,6 +161,9 @@ MmDeleteTeb(IN PEPROCESS Process,
/* Remove the VAD */
ExFreePool(Vad);
+
+ /* Return the quota the VAD used */
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
}
/* Release the address space lock */
@@ -842,7 +852,8 @@ MmCreateTeb(IN PEPROCESS Process,
#ifdef _M_AMD64
static
NTSTATUS
-MiInsertSharedUserPageVad(VOID)
+MiInsertSharedUserPageVad(
+ _In_ PEPROCESS Process)
{
PMMVAD_LONG Vad;
ULONG_PTR BaseAddress;
@@ -890,6 +901,15 @@ MiInsertSharedUserPageVad(VOID)
return Status;
}
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Ran out of quota.\n");
+ ExFreePoolWithTag(Vad, 'ldaV');
+ return Status;
+ }
+
+
/* Success */
return STATUS_SUCCESS;
}
@@ -1012,7 +1032,7 @@ MmInitializeProcessAddressSpace(IN PEPROCESS Process,
#ifdef _M_AMD64
/* On x64 we need a VAD for the shared user page */
- Status = MiInsertSharedUserPageVad();
+ Status = MiInsertSharedUserPageVad(Process);
if (!NT_SUCCESS(Status))
{
DPRINT1("MiCreateSharedUserPageVad() failed: 0x%lx\n", Status);
@@ -1300,6 +1320,9 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
/* Free the VAD memory */
ExFreePool(Vad);
+
+ /* Return the quota the VAD used */
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
}
/* Lock the working set */
diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c
index 4a65209d38b..40d942f7703 100644
--- a/ntoskrnl/mm/ARM3/section.c
+++ b/ntoskrnl/mm/ARM3/section.c
@@ -915,6 +915,7 @@ MiUnmapViewOfSection(IN PEPROCESS Process,
/* Remove the VAD */
ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
/* Remove the PTEs for this view, which also releases the working set lock */
MiRemoveMappedView(Process, Vad);
@@ -1489,6 +1490,13 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea,
StartAddress = 0;
}
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+ if (!NT_SUCCESS(Status))
+ {
+ ExFreePoolWithTag(Vad, 'ldaV');
+ return Status;
+ }
+
/* Insert the VAD */
Status = MiInsertVadEx((PMMVAD)Vad,
&StartAddress,
@@ -1498,6 +1506,7 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea,
AllocationType);
if (!NT_SUCCESS(Status))
{
+ PsReturnProcessNonPagedPoolQuota(PsGetCurrentProcess(), sizeof(MMVAD_LONG));
return Status;
}
diff --git a/ntoskrnl/mm/ARM3/virtual.c b/ntoskrnl/mm/ARM3/virtual.c
index f178edbb909..c5c5a5283b0 100644
--- a/ntoskrnl/mm/ARM3/virtual.c
+++ b/ntoskrnl/mm/ARM3/virtual.c
@@ -4790,6 +4790,15 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
goto FailPathNoLock;
}
+ // Charge quotas for the VAD
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Quota exceeded.\n");
+ ExFreePoolWithTag(Vad, 'SdaV');
+ goto FailPathNoLock;
+ }
+
//
// Detach and dereference the target process if
// it was different from the current process
@@ -5416,6 +5425,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
MiLockProcessWorkingSetUnsafe(Process, CurrentThread);
ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
}
else
{
@@ -5448,6 +5458,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
MiLockProcessWorkingSetUnsafe(Process, CurrentThread);
ASSERT(Process->VadRoot.NumberGenericTableElements >= 1);
MiRemoveNode((PMMADDRESS_NODE)Vad, &Process->VadRoot);
+ PsReturnProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
}
else
{
@@ -5522,6 +5533,17 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
goto FailPath;
}
+ // Charge quota for the new VAD
+ Status = PsChargeProcessNonPagedPoolQuota(Process, sizeof(MMVAD_LONG));
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Ran out of process quota whilst creating new VAD!\n");
+ ExFreePoolWithTag(NewVad, 'SdaV');
+ Status = STATUS_QUOTA_EXCEEDED;
+ goto FailPath;
+ }
+
//
// This new VAD describes the second chunk, so we keep the end
// address of the original and adjust the start to point past
@@ -5534,10 +5556,6 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
NewVad->u.VadFlags.CommitCharge = 0;
ASSERT(NewVad->EndingVpn >= NewVad->StartingVpn);
- //
- // TODO: charge quota for the new VAD
- //
-
//
// Get the commit charge for the released region
//