mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 06:58:10 +00:00
[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.
This commit is contained in:
parent
99d9fc698f
commit
1d690f0411
2 changed files with 13 additions and 2 deletions
|
@ -68,6 +68,13 @@ void UpdateWindowCaption(BOOL clearModifyAlert)
|
||||||
TCHAR szCaption[MAX_STRING_LEN];
|
TCHAR szCaption[MAX_STRING_LEN];
|
||||||
TCHAR szNotepad[MAX_STRING_LEN];
|
TCHAR szNotepad[MAX_STRING_LEN];
|
||||||
TCHAR szFilename[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 */
|
/* Load the name of the application */
|
||||||
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
|
LoadString(Globals.hInstance, STRING_NOTEPAD, szNotepad, ARRAY_SIZE(szNotepad));
|
||||||
|
@ -84,14 +91,17 @@ void UpdateWindowCaption(BOOL clearModifyAlert)
|
||||||
{
|
{
|
||||||
StringCbPrintf(szCaption, sizeof(szCaption), _T("%s - %s"),
|
StringCbPrintf(szCaption, sizeof(szCaption), _T("%s - %s"),
|
||||||
szFilename, szNotepad);
|
szFilename, szNotepad);
|
||||||
|
|
||||||
|
Globals.bWasModified = FALSE;
|
||||||
}
|
}
|
||||||
else
|
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 */
|
/* 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"),
|
StringCbPrintf(szCaption, sizeof(szCaption), _T("%s%s - %s"),
|
||||||
(isModified ? _T("*") : _T("")), szFilename, szNotepad);
|
(isModified ? _T("*") : _T("")), szFilename, szNotepad);
|
||||||
|
|
||||||
|
/* We will modify the caption below */
|
||||||
|
Globals.bWasModified = isModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the window caption */
|
/* Update the window caption */
|
||||||
|
|
|
@ -80,6 +80,7 @@ typedef struct
|
||||||
FINDREPLACE find;
|
FINDREPLACE find;
|
||||||
WNDPROC EditProc;
|
WNDPROC EditProc;
|
||||||
RECT main_rect;
|
RECT main_rect;
|
||||||
|
BOOL bWasModified;
|
||||||
} NOTEPAD_GLOBALS;
|
} NOTEPAD_GLOBALS;
|
||||||
|
|
||||||
extern NOTEPAD_GLOBALS Globals;
|
extern NOTEPAD_GLOBALS Globals;
|
||||||
|
|
Loading…
Reference in a new issue