Przeglądaj źródła

When set to always on top refresh active window on first mouse move over window

scott brogden 5 lat temu
rodzic
commit
6553cd3d7f
2 zmienionych plików z 24 dodań i 0 usunięć
  1. 23 0
      QPasteWnd.cpp
  2. 1 0
      QPasteWnd.h

+ 23 - 0
QPasteWnd.cpp

@@ -85,6 +85,7 @@ CQPasteWnd::CQPasteWnd()
 	m_noSearchResults = false;
 	m_lastDbWrite = 0;
 	m_pendingRefresh = false;
+	m_lastNonActiveMouseMove = 0;
 }
 
 CQPasteWnd::~CQPasteWnd()
@@ -2852,6 +2853,28 @@ BOOL CQPasteWnd::PreTranslateMessage(MSG *pMsg)
 		}
 	}
 	break;
+	case WM_NCMOUSEMOVE:
+	case WM_MOUSEMOVE:
+	{
+		if (g_Opt.m_bShowPersistent)
+		{
+			bool hasFocus = ::GetForegroundWindow() == m_hWnd;
+			if (hasFocus == false)
+			{
+				DWORD tick = GetTickCount();
+				if ((tick - m_lastNonActiveMouseMove) > 1000)
+				{
+					theApp.m_activeWnd.TrackActiveWnd(true);
+					m_lastNonActiveMouseMove = GetTickCount();
+				}
+			}
+			else
+			{
+				m_lastNonActiveMouseMove = 0;
+			}
+		}		
+	}
+	break;
 	default:
 		if (CheckActions(pMsg))
 		{

+ 1 - 0
QPasteWnd.h

@@ -175,6 +175,7 @@ public:
 	CAccel m_timerAction;
 	__int64 m_lastDbWrite;
 	bool m_pendingRefresh;
+	DWORD m_lastNonActiveMouseMove;
 
     void RefreshNc();
     void UpdateStatus(bool bRepaintImmediately = false); // regenerates the status (caption) text