2001-11-06 18:35:24 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#ifndef nsToolkit_h_
|
|
|
|
#define nsToolkit_h_
|
|
|
|
|
2011-10-25 19:05:32 +04:00
|
|
|
#include "nscore.h"
|
2006-12-18 22:50:14 +03:00
|
|
|
|
2007-07-18 00:29:39 +04:00
|
|
|
#import <Carbon/Carbon.h>
|
2008-02-13 18:57:12 +03:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <objc/Object.h>
|
2007-01-18 09:34:07 +03:00
|
|
|
#import <IOKit/IOKitLib.h>
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2011-10-25 19:05:32 +04:00
|
|
|
class nsToolkit
|
2001-11-06 18:35:24 +03:00
|
|
|
{
|
|
|
|
public:
|
2006-12-08 11:29:46 +03:00
|
|
|
nsToolkit();
|
|
|
|
virtual ~nsToolkit();
|
|
|
|
|
2012-05-17 11:53:20 +04:00
|
|
|
static nsToolkit* GetToolkit();
|
2011-10-25 19:05:32 +04:00
|
|
|
|
|
|
|
static void Shutdown() {
|
|
|
|
delete gToolkit;
|
2012-07-30 18:20:58 +04:00
|
|
|
gToolkit = nullptr;
|
2011-10-25 19:05:32 +04:00
|
|
|
}
|
2006-12-08 11:29:46 +03:00
|
|
|
|
|
|
|
static void PostSleepWakeNotification(const char* aNotification);
|
|
|
|
|
2008-03-27 19:30:13 +03:00
|
|
|
static nsresult SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool classMethods = false);
|
2008-02-13 18:57:12 +03:00
|
|
|
|
2011-11-07 20:43:10 +04:00
|
|
|
void RegisterForAllProcessMouseEvents();
|
|
|
|
void UnregisterAllProcessMouseEventHandlers();
|
|
|
|
|
2006-12-08 11:29:46 +03:00
|
|
|
protected:
|
|
|
|
|
2014-09-08 18:59:34 +04:00
|
|
|
nsresult RegisterForSleepWakeNotifications();
|
|
|
|
void RemoveSleepWakeNotifications();
|
2006-12-08 11:29:46 +03:00
|
|
|
|
|
|
|
protected:
|
2003-10-31 05:30:22 +03:00
|
|
|
|
2012-05-17 11:53:20 +04:00
|
|
|
static nsToolkit* gToolkit;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2006-12-08 11:29:46 +03:00
|
|
|
CFRunLoopSourceRef mSleepWakeNotificationRLS;
|
|
|
|
io_object_t mPowerNotifier;
|
2007-07-18 00:29:39 +04:00
|
|
|
|
|
|
|
CFMachPortRef mEventTapPort;
|
|
|
|
CFRunLoopSourceRef mEventTapRLS;
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsToolkit_h_
|