1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is Mozilla Communicator client code.
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | * David Hyatt <[email protected]>
|
---|
24 | * Suresh Duddi <[email protected]>
|
---|
25 | * Doug Turner <[email protected]>
|
---|
26 | * Judson Valeski <[email protected]>
|
---|
27 | * Dan Matejka <[email protected]>
|
---|
28 | * Ray Whitmer <[email protected]>
|
---|
29 | * Dan Mosedale <[email protected]>
|
---|
30 | *
|
---|
31 | * Alternatively, the contents of this file may be used under the terms of
|
---|
32 | * either of the GNU General Public License Version 2 or later (the "GPL"),
|
---|
33 | * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
34 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
35 | * of those above. If you wish to allow use of your version of this file only
|
---|
36 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
37 | * use your version of this file under the terms of the MPL, indicate your
|
---|
38 | * decision by deleting the provisions above and replace them with the notice
|
---|
39 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
40 | * the provisions above, a recipient may use your version of this file under
|
---|
41 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
42 | *
|
---|
43 | * ***** END LICENSE BLOCK ***** */
|
---|
44 |
|
---|
45 | #include "nsIEventTarget.idl"
|
---|
46 |
|
---|
47 | %{C++
|
---|
48 | #include "prthread.h"
|
---|
49 |
|
---|
50 | // {13D86C61-00A9-11d3-9F2A-00400553EEF0}
|
---|
51 | #define NS_EVENTQUEUE_CID \
|
---|
52 | { 0x13d86c61, 0xa9, 0x11d3, { 0x9f, 0x2a, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
|
---|
53 |
|
---|
54 | #define NS_EVENTQUEUE_CONTRACTID "@mozilla.org/event-queue;1"
|
---|
55 | #define NS_EVENTQUEUE_CLASSNAME "Event Queue"
|
---|
56 |
|
---|
57 | %}
|
---|
58 |
|
---|
59 | // some forward decls
|
---|
60 | //
|
---|
61 | [ptr] native PLEventQueuePtr(PLEventQueue);
|
---|
62 | [ptr] native PRThreadPtr(PRThread);
|
---|
63 | native PRStatus(PRStatus);
|
---|
64 | [ref] native PRBoolRef(PRBool);
|
---|
65 | native PLHandleEventProc(PLHandleEventProc);
|
---|
66 | native PLDestroyEventProc(PLDestroyEventProc);
|
---|
67 |
|
---|
68 | [scriptable, uuid(176AFB41-00A4-11d3-9F2A-00400553EEF0)]
|
---|
69 | interface nsIEventQueue : nsIEventTarget
|
---|
70 | {
|
---|
71 | [noscript] void initEvent(in PLEventPtr aEvent,
|
---|
72 | in voidPtr owner,
|
---|
73 | in PLHandleEventProc handler,
|
---|
74 | in PLDestroyEventProc destructor);
|
---|
75 |
|
---|
76 | [noscript] void postSynchronousEvent(in PLEventPtr aEvent,
|
---|
77 | out voidPtr aResult);
|
---|
78 |
|
---|
79 | boolean pendingEvents();
|
---|
80 | void processPendingEvents();
|
---|
81 | void eventLoop();
|
---|
82 |
|
---|
83 | [noscript] void eventAvailable(in PRBoolRef aResult);
|
---|
84 | [noscript] PLEventPtr getEvent();
|
---|
85 | [noscript] void handleEvent(in PLEventPtr aEvent);
|
---|
86 | [noscript] PLEventPtr waitForEvent();
|
---|
87 |
|
---|
88 | [notxpcom] PRInt32 getEventQueueSelectFD();
|
---|
89 |
|
---|
90 | void init(in boolean aNative);
|
---|
91 | [noscript] void initFromPRThread(in PRThreadPtr thread,
|
---|
92 | in boolean aNative);
|
---|
93 | [noscript] void initFromPLQueue(in PLEventQueuePtr aQueue);
|
---|
94 |
|
---|
95 | void enterMonitor();
|
---|
96 | void exitMonitor();
|
---|
97 |
|
---|
98 | [noscript] void revokeEvents(in voidPtr owner);
|
---|
99 | [noscript] PLEventQueuePtr getPLEventQueue();
|
---|
100 |
|
---|
101 | boolean isQueueNative();
|
---|
102 |
|
---|
103 | // effectively kill the queue. warning: the queue is allowed to delete
|
---|
104 | // itself any time after this.
|
---|
105 | void stopAcceptingEvents();
|
---|
106 | };
|
---|
107 |
|
---|