Additional fix for r528.

This commit is contained in:
spx 2010-09-04 08:04:13 +00:00
parent 07d5671707
commit 979117f623
3 changed files with 21 additions and 18 deletions

View File

@ -185,7 +185,7 @@ CMeterWindow::~CMeterWindow()
int counter = 0;
do {
// Wait for the window to die
Result = UnregisterClass(L"RainmeterMeterWindow", m_Rainmeter->GetInstance());
Result = UnregisterClass(METERWINDOW_CLASS_NAME, m_Rainmeter->GetInstance());
Sleep(100);
++counter;
} while(!Result && counter < 10);
@ -211,7 +211,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpfnWndProc = WndProc;
wc.hInstance = m_Rainmeter->GetInstance();
wc.lpszClassName = L"RainmeterMeterWindow";
wc.lpszClassName = METERWINDOW_CLASS_NAME;
if(!RegisterClassEx(&wc))
{
@ -224,7 +224,7 @@ int CMeterWindow::Initialize(CRainmeter& Rainmeter)
}
m_Window = CreateWindowEx(WS_EX_TOOLWINDOW,
L"RainmeterMeterWindow",
METERWINDOW_CLASS_NAME,
NULL,
WS_POPUP,
CW_USEDEFAULT,
@ -2667,12 +2667,6 @@ LRESULT CMeterWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (WindowFromPoint(pos) == m_Window)
{
SetMouseLeaveEvent(false);
MapWindowPoints(NULL, m_Window, &pos, 1);
while (DoMoveAction(pos.x, pos.y, MOUSE_OVER)) ;
// Handle buttons
HandleButtons(pos, BUTTONPROC_MOVE, NULL, false);
}
else
{
@ -2797,11 +2791,14 @@ void CMeterWindow::ShowWindowIfAppropriate()
POINT pos;
GetCursorPos(&pos);
if (GetWindowFromPoint(pos) == m_Window)
{
MapWindowPoints(NULL, m_Window, &pos, 1);
POINT posScr = pos;
inside = HitTest(pos.x, pos.y);
MapWindowPoints(NULL, m_Window, &pos, 1);
inside = HitTest(pos.x, pos.y);
if (inside)
{
inside = (GetWindowFromPoint(posScr) == m_Window);
}
if (m_ClickThrough)
@ -2879,12 +2876,15 @@ HWND CMeterWindow::GetWindowFromPoint(POINT pos)
if (HitTest(pos.x, pos.y))
{
HWND hWnd = GetAncestor(hwndPos, GA_ROOT);
while (hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT))
if (hwndPos)
{
if (hWnd == m_Window)
HWND hWnd = GetAncestor(hwndPos, GA_ROOT);
while (hWnd = FindWindowEx(NULL, hWnd, METERWINDOW_CLASS_NAME, NULL))
{
return hwndPos;
if (hWnd == m_Window)
{
return hwndPos;
}
}
}
return m_Window;

View File

@ -39,6 +39,8 @@
#define WM_DELAYED_REFRESH WM_APP + 1
#define WM_DELAYED_MOVE WM_APP + 3
#define METERWINDOW_CLASS_NAME L"RainmeterMeterWindow"
enum MOUSE
{
MOUSE_LMB_DOWN,

View File

@ -20,6 +20,7 @@
#include "System.h"
#include "Litestep.h"
#include "Rainmeter.h"
#include "MeterWindow.h"
#include "MeasureNet.h"
#include "Error.h"
@ -675,7 +676,7 @@ BOOL CALLBACK MyEnumWindowsProc(HWND hwnd, LPARAM lParam)
CMeterWindow* Window;
if (GetClassName(hwnd, className, 128) > 0 &&
wcscmp(className, L"RainmeterMeterWindow") == 0 &&
wcscmp(className, METERWINDOW_CLASS_NAME) == 0 &&
Rainmeter && (Window = Rainmeter->GetMeterWindow(hwnd)))
{
ZPOSITION zPos = Window->GetWindowZPosition();