Skip to content

hwndFrom in message NPPN_DARKMODECHANGED is not hwndNpp #12144

@blu3mania

Description

@blu3mania

From the document https://npp-user-manual.org/docs/plugin-communication/#nppn-darkmodechanged it is stated that hwndFrom in message NPPN_DARKMODECHANGED is hwndNpp. However, it is 0 instead. The problem is that in NppBigSwitch.cpp, when this notification is sent it uses lParam as hwndFrom, like this:

		case NPPM_INTERNAL_REFRESHDARKMODE:
		{
			refreshDarkMode(static_cast<bool>(wParam));
			// Notify plugins that Dark Mode changed
			SCNotification scnN;
			scnN.nmhdr.code = NPPN_DARKMODECHANGED;
			scnN.nmhdr.hwndFrom = reinterpret_cast<void*>(lParam);
			scnN.nmhdr.idFrom = 0;
			_pluginsManager.notify(&scnN);
			return TRUE;
		}

And in the code, most places send NPPM_INTERNAL_REFRESHDARKMODE with 0 as lParam, e.g. Notepad_plus::refreshDarkMode().

The code in NppBigSwitch should be changed to use hwnd as hwndFrom.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions