Fix crash issue due to the bad fix of touchscreen hanging issue

This crash issue is a regression due to
6f4140a281 which was intended to fix a
touchscreen hanging bug.
The crash issue is fixed in this commit, as well the touchscreen hanging
issue thanks to the answer from StackOverflow:

http://stackoverflow.com/questions/34816597/messagebox-not-responsing-in-wm-activateapp-on-touchscreen/34825851#34825851
This commit is contained in:
Don Ho 2016-01-16 13:00:39 +01:00
parent 7ba01cb7f4
commit f2cd779066
3 changed files with 14 additions and 23 deletions

View File

@ -383,16 +383,7 @@ private:
//For Dynamic selection highlight
CharacterRange _prevSelectedRange;
struct ActivateAppInfo final
{
bool _isActivated = false;
int _x = 0;
int _y = 0;
}
_activeAppInf;
//Synchronized Scolling
struct SyncInfo final
{
int _line = 0;

View File

@ -1347,24 +1347,24 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return notify(notification);
}
case NPPM_INTERNAL_CHECKDOCSTATUS:
case WM_ACTIVATEAPP:
{
if (wParam == TRUE) // if npp is about to be activated
{
const NppGUI & nppgui = pNppParam->getNppGUI();
if (LOWORD(wParam) && (nppgui._fileAutoDetection != cdDisabled))
{
_activeAppInf._isActivated = true;
//checkModifiedDocument();
// Make checkModifiedDocument as thread to avoid Notepad++ hanging while user uses touch screen to activate Notepad++ windows
HANDLE hThread = CreateThread(NULL, 0, &CheckModifiedDocumentThread, NULL, 0, NULL);
::CloseHandle(hThread);
return FALSE;
}
::PostMessage(hwnd, NPPM_INTERNAL_CHECKDOCSTATUS, 0, 0);
}
break;
return FALSE;
}
case NPPM_INTERNAL_CHECKDOCSTATUS:
{
const NppGUI & nppgui = pNppParam->getNppGUI();
if (nppgui._fileAutoDetection != cdDisabled)
{
checkModifiedDocument();
return TRUE;
}
return FALSE;
}
case NPPM_INTERNAL_GETCHECKDOCOPT:

View File

@ -407,7 +407,7 @@
// Used by Doc Monitor plugin
//
#define NPPM_INTERNAL_CHECKDOCSTATUS (NPPMSG + 53)
// VOID NPPM_CHECKDOCSTATUS(BOOL, 0)
// VOID NPPM_CHECKDOCSTATUS(0, 0)
// check all opened documents status.
// If files are modified, then reloaod (with or without prompt, it depends on settings).
// if files are deleted, then prompt user to close the documents