Bitcoin Core
31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
src
qt
macdockiconhandler.mm
Go to the documentation of this file.
1
// Copyright (c) 2011-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include "
macdockiconhandler.h
"
6
7
#include <AppKit/AppKit.h>
8
#include <objc/runtime.h>
9
10
static
MacDockIconHandler
*
s_instance
=
nullptr
;
11
12
bool
dockClickHandler
(
id
self
,
SEL
_cmd
, ...) {
13
Q_UNUSED
(
self
)
14
Q_UNUSED
(
_cmd
)
15
16
Q_EMIT
s_instance
->
dockIconClicked
();
17
18
// Return NO (false) to suppress the default macOS actions
19
return
false
;
20
}
21
22
void
setupDockClickHandler
() {
23
Class
delClass
= (Class)[[[
NSApplication
sharedApplication
]
delegate
]
class
];
24
SEL
shouldHandle
=
sel_registerName
(
"applicationShouldHandleReopen:hasVisibleWindows:"
);
25
class_replaceMethod
(
delClass
,
shouldHandle
, (
IMP
)
dockClickHandler
,
"B@:"
);
26
}
27
28
MacDockIconHandler::MacDockIconHandler
() : QObject()
29
{
30
setupDockClickHandler
();
31
}
32
33
MacDockIconHandler
*
MacDockIconHandler::instance
()
34
{
35
if
(!
s_instance
)
36
s_instance
=
new
MacDockIconHandler
();
37
return
s_instance
;
38
}
39
40
void
MacDockIconHandler::cleanup
()
41
{
42
delete
s_instance
;
43
}
44
50
void
ForceActivation
()
51
{
52
[[
NSApplication
sharedApplication
]
activateIgnoringOtherApps
:YES];
53
}
MacDockIconHandler
macOS-specific Dock icon handler.
Definition
macdockiconhandler.h:13
MacDockIconHandler::MacDockIconHandler
MacDockIconHandler()
Definition
macdockiconhandler.mm:28
MacDockIconHandler::dockIconClicked
void dockIconClicked()
MacDockIconHandler::cleanup
static void cleanup()
Definition
macdockiconhandler.mm:40
MacDockIconHandler::instance
static MacDockIconHandler * instance()
Definition
macdockiconhandler.mm:33
macdockiconhandler.h
s_instance
static MacDockIconHandler * s_instance
Definition
macdockiconhandler.mm:10
setupDockClickHandler
void setupDockClickHandler()
Definition
macdockiconhandler.mm:22
dockClickHandler
bool dockClickHandler(id self, SEL _cmd,...)
Definition
macdockiconhandler.mm:12
ForceActivation
void ForceActivation()
Force application activation on macOS.
Definition
macdockiconhandler.mm:50
Ticks
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
Definition
time.h:73
Generated on Thu Apr 16 2026 09:42:38 for Bitcoin Core by
1.10.0