https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d90e1061e1f8d09ba70a8…
commit d90e1061e1f8d09ba70a87170cd6d29813703579
Author: Charles Ambrye <giawa(a)hotmail.com>
AuthorDate: Wed Apr 15 14:31:16 2020 -0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Apr 15 23:31:16 2020 +0200
[CHARMAP] Updates to behaviour and UI (#2543)
Purpose
~=~=~=~
This pull request updates charmap to look a bit better (removes gap at bottom of the window), removes the blank space character (0x0020) from the charmap, and also modifies the behaviour of when a larger glyph is rendered (allowing the user to select a new glyph by holding down the mouse button). This better mimics the charmap.exe that is bundled by Microsoft.
Proposed changes
~=~=~=~=~=~=~=~=
- Remove gap where the advanced button is normally rendered when compiled with REMOVE_ADVANCED (which is the default behaviour).
- Skip over the blank space character.
- Change behaviour of rendering large glyphs to allow mouse move, and to hide on double click.
- Optimize search for glyph under the mouse by using the cellSize instead of PtInRect.
* [CHARMAP] Resize the window slightly when compiled with REMOVE_ADVANCED to avoid deadspace at the bottom of the window
* [CHARMAP] Skip over the non-printable characters by starting with character ' ' + 1
* [CHARMAP] Instead of iterating over every cell, simply compute the cell x and y using the CellSize
Modify behaviour of charmap to allow large character render on mouse move, only hiding the larger character on double click.
---
base/applications/charmap/charmap.c | 12 +++++
base/applications/charmap/map.c | 92 +++++++++++++++++--------------------
2 files changed, 54 insertions(+), 50 deletions(-)
diff --git a/base/applications/charmap/charmap.c b/base/applications/charmap/charmap.c
index 218f8512c5e..1ed517b390f 100644
--- a/base/applications/charmap/charmap.c
+++ b/base/applications/charmap/charmap.c
@@ -276,6 +276,8 @@ ChangeView(HWND hWnd)
RECT rcCharmap;
#ifndef REMOVE_ADVANCED
RECT rcAdvanced;
+#else
+ RECT rcCopy;
#endif
RECT rcPanelExt;
RECT rcPanelInt;
@@ -284,10 +286,16 @@ ChangeView(HWND hWnd)
UINT xPos, yPos;
UINT Width, Height;
UINT DeskTopWidth, DeskTopHeight;
+#ifdef REMOVE_ADVANCED
+ HWND hCopy;
+#endif
GetClientRect(hCharmapDlg, &rcCharmap);
#ifndef REMOVE_ADVANCED
GetClientRect(hAdvancedDlg, &rcAdvanced);
+#else
+ hCopy = GetDlgItem(hCharmapDlg, IDC_COPY);
+ GetClientRect(hCopy, &rcCopy);
#endif
GetWindowRect(hWnd, &rcPanelExt);
GetClientRect(hWnd, &rcPanelInt);
@@ -312,6 +320,10 @@ ChangeView(HWND hWnd)
#ifndef REMOVE_ADVANCED
if (Settings.IsAdvancedView)
Height += rcAdvanced.bottom;
+#else
+ /* The lack of advanced button leaves an empty gap at the bottom of the window.
+ Shrink the window height a bit here to accomodate for that lost control. */
+ Height = rcCharmap.bottom + rcCopy.bottom + 10;
#endif
if ((xPos + Width) > DeskTopWidth)
xPos += DeskTopWidth - (xPos + Width);
diff --git a/base/applications/charmap/map.c b/base/applications/charmap/map.c
index a8a9c8a2823..7b2d7838ef8 100644
--- a/base/applications/charmap/map.c
+++ b/base/applications/charmap/map.c
@@ -256,7 +256,7 @@ SetFont(PMAP infoPtr,
GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
{
j = 0;
- for (i = 0; i < MAX_GLYPHS; i++)
+ for (i = ' ' + 1; i < MAX_GLYPHS; i++)
{
if (out[i] != 0xffff)
{
@@ -312,64 +312,38 @@ OnClick(PMAP infoPtr,
WORD ptx,
WORD pty)
{
- POINT pt;
INT x, y;
- pt.x = ptx;
- pt.y = pty;
+ x = ptx / max(1, infoPtr->CellSize.cx);
+ y = pty / max(1, infoPtr->CellSize.cy);
- for (x = 0; x < XCELLS; x++)
- for (y = 0; y < YCELLS; y++)
+ /* if the cell is not already active */
+ if (!infoPtr->Cells[y][x].bActive)
{
- if (PtInRect(&infoPtr->Cells[y][x].CellInt,
- pt))
+ /* set previous active cell to inactive */
+ if (infoPtr->pActiveCell)
{
- /* if the cell is not already active */
- if (!infoPtr->Cells[y][x].bActive)
- {
- /* set previous active cell to inactive */
- if (infoPtr->pActiveCell)
- {
- /* invalidate normal cells, required when
- * moving a small active cell via keyboard */
- if (!infoPtr->pActiveCell->bLarge)
- {
- InvalidateRect(infoPtr->hMapWnd,
- &infoPtr->pActiveCell->CellInt,
- TRUE);
- }
-
- infoPtr->pActiveCell->bActive = FALSE;
- infoPtr->pActiveCell->bLarge = FALSE;
- }
-
- /* set new cell to active */
- infoPtr->pActiveCell = &infoPtr->Cells[y][x];
- infoPtr->pActiveCell->bActive = TRUE;
- infoPtr->pActiveCell->bLarge = TRUE;
- if (infoPtr->hLrgWnd)
- MoveLargeCell(infoPtr);
- else
- CreateLargeCell(infoPtr);
- }
- else
+ /* invalidate normal cells, required when
+ * moving a small active cell via keyboard */
+ if (!infoPtr->pActiveCell->bLarge)
{
- /* flick between large and small */
- if (infoPtr->pActiveCell->bLarge)
- {
- DestroyWindow(infoPtr->hLrgWnd);
- infoPtr->hLrgWnd = NULL;
- }
- else
- {
- CreateLargeCell(infoPtr);
- }
-
- infoPtr->pActiveCell->bLarge = (infoPtr->pActiveCell->bLarge) ? FALSE : TRUE;
+ InvalidateRect(infoPtr->hMapWnd,
+ &infoPtr->pActiveCell->CellInt,
+ TRUE);
}
- break;
+ infoPtr->pActiveCell->bActive = FALSE;
+ infoPtr->pActiveCell->bLarge = FALSE;
}
+
+ /* set new cell to active */
+ infoPtr->pActiveCell = &infoPtr->Cells[y][x];
+ infoPtr->pActiveCell->bActive = TRUE;
+ infoPtr->pActiveCell->bLarge = TRUE;
+ if (infoPtr->hLrgWnd)
+ MoveLargeCell(infoPtr);
+ else
+ CreateLargeCell(infoPtr);
}
}
@@ -577,12 +551,30 @@ MapWndProc(HWND hwnd,
break;
}
+ case WM_MOUSEMOVE:
+ {
+ if (wParam & MK_LBUTTON)
+ {
+ OnClick(infoPtr,
+ LOWORD(lParam),
+ HIWORD(lParam));
+ }
+ break;
+ }
+
case WM_LBUTTONDBLCLK:
{
NotifyParentOfSelection(infoPtr,
FM_SETCHAR,
infoPtr->pActiveCell->ch);
+ if (infoPtr->pActiveCell->bLarge)
+ {
+ DestroyWindow(infoPtr->hLrgWnd);
+ infoPtr->hLrgWnd = NULL;
+ }
+
+ infoPtr->pActiveCell->bLarge = FALSE;
break;
}
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e3a706627984622c381ba…
commit e3a706627984622c381ba8239d4fafe8e41b9ba5
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Apr 15 14:07:25 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Apr 15 14:14:06 2020 +0200
[CSRSRV] CsrCaptureArguments(): Tell the compiler the contents ClientCaptureBuffer points to has a volatile character.
See https://docs.microsoft.com/fr-fr/archive/blogs/itgoestoeleven/why-your-user…
for more details.
Since the contents of ClientCaptureBuffer is in the shared memory, the
client could modify it while it is being probed and captured, and so we
have to avoid any potential compiler optimizations regarding the
captured "Length = ClientCaptureBuffer->Size" and
"PointerCount = ClientCaptureBuffer->PointerCount" values.
---
subsystems/win32/csrsrv/api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/subsystems/win32/csrsrv/api.c b/subsystems/win32/csrsrv/api.c
index 8561ee13943..9120794b16e 100644
--- a/subsystems/win32/csrsrv/api.c
+++ b/subsystems/win32/csrsrv/api.c
@@ -848,7 +848,6 @@ CsrApiRequestThread(IN PVOID Parameter)
/* Reply back to the API port now */
ReplyMsg = NULL;
ReplyPort = CsrApiPort;
-
CsrDereferenceThread(CsrThread);
}
else if (ReplyCode == CsrReplyPending)
@@ -1121,7 +1120,8 @@ CsrCaptureArguments(IN PCSR_THREAD CsrThread,
IN PCSR_API_MESSAGE ApiMessage)
{
PCSR_PROCESS CsrProcess = CsrThread->Process;
- PCSR_CAPTURE_BUFFER ClientCaptureBuffer, ServerCaptureBuffer = NULL;
+ volatile CSR_CAPTURE_BUFFER* ClientCaptureBuffer;
+ PCSR_CAPTURE_BUFFER ServerCaptureBuffer = NULL;
ULONG_PTR EndOfClientBuffer;
SIZE_T SizeOfBufferThroughOffsetsArray;
SIZE_T BufferDistance;