Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / widget / cocoa / nsToolkit.h
blob46b08d0ebeb18a3dac66a3135802c7e9205c4361
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsToolkit_h_
7 #define nsToolkit_h_
9 #include "nscore.h"
11 #import <Carbon/Carbon.h>
12 #import <Cocoa/Cocoa.h>
13 #import <objc/Object.h>
14 #import <IOKit/IOKitLib.h>
16 class nsToolkit {
17 public:
18 nsToolkit();
19 virtual ~nsToolkit();
21 static nsToolkit* GetToolkit();
23 static void Shutdown() {
24 delete gToolkit;
25 gToolkit = nullptr;
28 static void PostSleepWakeNotification(const char* aNotification);
30 static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
31 bool classMethods = false);
33 void MonitorAllProcessMouseEvents();
34 void StopMonitoringAllProcessMouseEvents();
36 protected:
37 nsresult RegisterForSleepWakeNotifications();
38 void RemoveSleepWakeNotifications();
40 protected:
41 static nsToolkit* gToolkit;
43 CFRunLoopSourceRef mSleepWakeNotificationRLS;
44 io_object_t mPowerNotifier;
46 id mAllProcessMouseMonitor;
49 #endif // nsToolkit_h_