Skip to content

Commit 0dd5a96

Browse files
Hybrid Machineclaude
andcommitted
feat: emit NPPN_BUFFERACTIVATED, BEFORESHUTDOWN, TBMODIFICATION
- NPPN_BUFFERACTIVATED: fired from switchToTabInView() with buffer ID in idFrom, so plugins can track which buffer is now active - NPPN_BEFORESHUTDOWN: fired before NPPN_SHUTDOWN for last-chance cleanup - NPPN_TBMODIFICATION: fired after NPPN_READY to signal toolbar readiness These notifications are required by ComparePlus for compare-pair bookkeeping, resource cleanup, and toolbar icon registration. Phase 1c of issue #100 — ComparePlus macOS port. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent de4277e commit 0dd5a96

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

macos/platform/app_delegate.mm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,14 @@ - (void)applicationDidFinishLaunching:(NSNotification*)notification
568568
pluginManager().notify(&readyNotif);
569569
}
570570

571+
// Signal plugins that toolbar is ready for icon registration
572+
{
573+
SCNotification tbNotif{};
574+
tbNotif.nmhdr.hwndFrom = ctx().mainHwnd;
575+
tbNotif.nmhdr.code = NPPN_TBMODIFICATION;
576+
pluginManager().notify(&tbNotif);
577+
}
578+
571579
NSLog(@"=== Notepad++ macOS Port — Phase 7 ===");
572580
NSLog(@"Settings, split view, edit commands, encoding, session, drag-and-drop!");
573581
}
@@ -643,6 +651,14 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender
643651

644652
- (void)applicationWillTerminate:(NSNotification*)notification
645653
{
654+
// Notify plugins that we are about to shut down (last chance for cleanup)
655+
{
656+
SCNotification beforeNotif{};
657+
beforeNotif.nmhdr.hwndFrom = ctx().mainHwnd;
658+
beforeNotif.nmhdr.code = NPPN_BEFORESHUTDOWN;
659+
pluginManager().notify(&beforeNotif);
660+
}
661+
646662
// Notify plugins that we are shutting down
647663
{
648664
SCNotification shutdownNotif{};

macos/platform/document_manager.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ void switchToTabInView(int viewIndex, int tabIndex)
148148
NSString* title = WideToNSString(doc.title.c_str());
149149
[ctx().mainWindow setTitle:[NSString stringWithFormat:@"Notepad++ — %@", title]];
150150
updateWindowDocumentEdited();
151+
152+
// Notify plugins that a buffer was activated
153+
{
154+
SCNotification notif{};
155+
notif.nmhdr.hwndFrom = ctx().mainHwnd;
156+
notif.nmhdr.code = NPPN_BUFFERACTIVATED;
157+
notif.nmhdr.idFrom = static_cast<uintptr_t>(doc.bufferId);
158+
pluginManager().notify(&notif);
159+
}
151160
}
152161

153162
void switchToTab(int tabIndex)

0 commit comments

Comments
 (0)