Skip to content

Commit

Permalink
Fix crash issue due to the bad fix of touchscreen hanging issue
Browse files Browse the repository at this point in the history
This crash issue is a regression due to
6f4140a 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
  • Loading branch information
donho committed Jan 16, 2016
1 parent 7ba01cb commit f2cd779
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
9 changes: 0 additions & 9 deletions PowerEditor/src/Notepad_plus.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,7 @@ friend class FileManager;
//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;
Expand Down
26 changes: 13 additions & 13 deletions PowerEditor/src/NppBigSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion PowerEditor/src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f2cd779

Please sign in to comment.