<commit_before>#include "PWDialog.h"
#include "DboxMain.h"

#if defined(POCKET_PC)
#error "TBD - define proper Dialog base class for PPC"
#endif

IMPLEMENT_DYNAMIC(CPWDialog, CDialog)

LRESULT CPWDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  // list of all the events that signify actual user activity, as opposed
  // to Windows internal events...
  if (message == WM_KEYDOWN ||
      message == WM_COMMAND ||
      message == WM_SYSCOMMAND ||
      message == WM_MOUSEMOVE ||
      message == WM_MOVE ||
      message == WM_LBUTTONDOWN ||
      message == WM_LBUTTONDBLCLK ||
      message == WM_CONTEXTMENU ||
      message == WM_MENUSELECT ||
      message == WM_VSCROLL
      ) {
    DboxMain *dbx = dynamic_cast<DboxMain *>(GetParent());
    if (dbx != NULL)
      dbx->ResetIdleLockCounter();
    else
      TRACE(_T("CPWDialog::WindowProc - parent NULL or not a DboxMain\n"));
  }
  return CDialog::WindowProc(message, wParam, lParam);
}<commit_msg>CPWDialog now works correctly if DboxMain is an ancestor, not only a direct parent.<commit_after>#include "PWDialog.h"
#include "DboxMain.h"

#if defined(POCKET_PC)
#error "TBD - define proper Dialog base class for PPC"
#endif

IMPLEMENT_DYNAMIC(CPWDialog, CDialog)

LRESULT CPWDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  // list of all the events that signify actual user activity, as opposed
  // to Windows internal events...
  if (message == WM_KEYDOWN ||
      message == WM_COMMAND ||
      message == WM_SYSCOMMAND ||
      message == WM_MOUSEMOVE ||
      message == WM_MOVE ||
      message == WM_LBUTTONDOWN ||
      message == WM_LBUTTONDBLCLK ||
      message == WM_CONTEXTMENU ||
      message == WM_MENUSELECT ||
      message == WM_VSCROLL
      ) {
    CWnd *p = GetParent();
    while (p != NULL) {
      DboxMain *dbx = dynamic_cast<DboxMain *>(p);
      if (dbx != NULL) {
        dbx->ResetIdleLockCounter();
        break;
      } else
        p = p->GetParent();
    }
    if (p == NULL)
      TRACE(_T("CPWDialog::WindowProc - couldn't find DboxMain ancestor\n"));
  }
  return CDialog::WindowProc(message, wParam, lParam);
}
{'fraction_non_alphanumeric': 0.12052117263843648, 'fraction_numerical': 0.0, 'mean_word_length': 3.1666666666666665, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6784519', 'n_tokens_mistral': 706, 'n_tokens_neox': 710, 'n_words': 187}