add missing PMacDockIcon files.

This commit is contained in:
suter_a committed 2026-10-29 11:01:32 +01:00
1 parent 1719375bbc
commit 268e4c5579
2 files changed
+84

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
/***************************************************************************
PMacDockIcon.mm
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2026 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#import <Cocoa/Cocoa.h>
#include "PMacDockIcon.h"
void SetMacDockIcon(const unsigned char *pngData, unsigned int pngDataLen)
{
@autoreleasepool {
NSData *data = [NSData dataWithBytes:pngData length:pngDataLen];
NSImage *image = [[[NSImage alloc] initWithData:data] autorelease];
if (image != nil) {
[NSApplication sharedApplication].applicationIconImage = image;
}
}
}
+41
View File
@@ -0,0 +1,41 @@
/***************************************************************************
PMacDockIcon.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2026 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PMACDOCKICON_H_
#define _PMACDOCKICON_H_
// On macOS, ROOT's Cocoa backend (TGCocoa) implements TVirtualX::SetIconPixmap()
// and TVirtualX::SetClassHints() as no-ops: Cocoa windows do not carry an
// X11-style per-window icon/class hint, and the Dock icon is process-wide,
// set once via [NSApp setApplicationIconImage:]. This helper provides that
// macOS-specific replacement so musrview/musrFT/musrt0 show their own Dock
// icon instead of the generic ROOT one. It is a no-op on all other platforms.
void SetMacDockIcon(const unsigned char *pngData, unsigned int pngDataLen);
#endif // _PMACDOCKICON_H_