OSDN Git Service

Fixed processing that uses GetAsyncKeyState(). (#505)
authorJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Sat, 12 Dec 2020 10:44:23 +0000 (19:44 +0900)
committerGitHub <noreply@github.com>
Sat, 12 Dec 2020 10:44:23 +0000 (19:44 +0900)
- Fixed the behaviour in the function CMainFrame::OnDropFiles() that when drag and drop is performed after pressing the control key,
  it behaves as if drag and drop is performed while pressing the control key.
- Fixed the behaviour in the function CImgMergeFrame::OnChildPaneEvent() that when an arrow key is pressed after pressing the shift key or control key,
  it behaves as if the arrow key is pressed while pressing the shift key or control key.

Src/ImgMergeFrm.cpp
Src/MainFrm.cpp

index a4c5e36..3d2d97e 100644 (file)
@@ -353,10 +353,10 @@ void CImgMergeFrame::OnChildPaneEvent(const IImgMergeWindow::Event& evt)
                case VK_RIGHT:
                case VK_UP:
                case VK_DOWN:
-                       if (GetAsyncKeyState(VK_SHIFT))
+                       if (::GetAsyncKeyState(VK_SHIFT) & 0x8000)
                        {
                                int nActivePane = pFrame->m_pImgMergeWindow->GetActivePane();
-                               int m = GetAsyncKeyState(VK_CONTROL) ? 8 : 1;
+                               int m = (::GetAsyncKeyState(VK_CONTROL) & 0x8000) ? 8 : 1;
                                int dx = (-(evt.keycode == VK_LEFT) + (evt.keycode == VK_RIGHT)) * m;
                                int dy = (-(evt.keycode == VK_UP) + (evt.keycode == VK_DOWN)) * m;
                                pFrame->m_pImgMergeWindow->AddImageOffset(nActivePane, dx, dy);
index b4bd6fe..45ddce5 100644 (file)
@@ -1370,7 +1370,7 @@ void CMainFrame::OnDropFiles(const std::vector<String>& dropped_files)
 
        bool recurse = GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS);
        // Do a reverse comparison with the current 'Include Subfolders' settings when pressing Control key
-       if (!!::GetAsyncKeyState(VK_CONTROL))
+       if (::GetAsyncKeyState(VK_CONTROL) & 0x8000)
                recurse = !recurse;
 
        // If user has <Shift> pressed with one file selected,