Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
883765eb
Commit
883765eb
authored
Jun 20, 1997
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added SetEventHandler
parent
3757523f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
12 deletions
+25
-12
Mac/Modules/macosmodule.c
Mac/Modules/macosmodule.c
+25
-12
No files found.
Mac/Modules/macosmodule.c
View file @
883765eb
...
@@ -499,27 +499,39 @@ MacOS_EnableAppswitch(PyObject *self, PyObject *args)
...
@@ -499,27 +499,39 @@ MacOS_EnableAppswitch(PyObject *self, PyObject *args)
return
Py_BuildValue
(
"i"
,
old
);
return
Py_BuildValue
(
"i"
,
old
);
}
}
static
char
setevh_doc
[]
=
"Set python event handler to be called in mainloop"
;
static
PyObject
*
MacOS_SetEventHandler
(
self
,
args
)
PyObject
*
self
;
PyObject
*
args
;
{
PyObject
*
evh
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"|O"
,
&
evh
))
return
NULL
;
if
(
evh
==
Py_None
)
evh
=
NULL
;
if
(
evh
&&
!
PyCallable_Check
(
evh
)
)
{
PyErr_SetString
(
PyExc_ValueError
,
"SetEventHandler argument must be callable"
);
return
NULL
;
}
if
(
!
PyMac_SetEventHandler
(
evh
)
)
return
NULL
;
Py_INCREF
(
Py_None
);
return
Py_None
;
}
static
char
handleev_doc
[]
=
"Pass event to other interested parties like sioux"
;
static
char
handleev_doc
[]
=
"Pass event to other interested parties like sioux"
;
static
PyObject
*
static
PyObject
*
MacOS_HandleEvent
(
PyObject
*
self
,
PyObject
*
args
)
MacOS_HandleEvent
(
PyObject
*
self
,
PyObject
*
args
)
{
{
EventRecord
ev
;
EventRecord
ev
;
static
int
inhere
;
/*
** With HandleEvent and SetEventHandler we have a chance of recursive
** calls. We check that here (for lack of a better place)
*/
if
(
inhere
)
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Recursive call to MacOS.HandleEvent"
);
return
NULL
;
}
if
(
!
PyArg_ParseTuple
(
args
,
"O&"
,
PyMac_GetEventRecord
,
&
ev
))
if
(
!
PyArg_ParseTuple
(
args
,
"O&"
,
PyMac_GetEventRecord
,
&
ev
))
return
NULL
;
return
NULL
;
inhere
=
1
;
PyMac_HandleEventIntern
(
&
ev
);
PyMac_HandleEvent
(
&
ev
,
1
);
inhere
=
0
;
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
return
Py_None
;
return
Py_None
;
}
}
...
@@ -658,6 +670,7 @@ static PyMethodDef MacOS_Methods[] = {
...
@@ -658,6 +670,7 @@ static PyMethodDef MacOS_Methods[] = {
#endif
#endif
{
"SchedParams"
,
MacOS_SchedParams
,
1
,
schedparams_doc
},
{
"SchedParams"
,
MacOS_SchedParams
,
1
,
schedparams_doc
},
{
"EnableAppswitch"
,
MacOS_EnableAppswitch
,
1
,
appswitch_doc
},
{
"EnableAppswitch"
,
MacOS_EnableAppswitch
,
1
,
appswitch_doc
},
{
"SetEventHandler"
,
MacOS_SetEventHandler
,
1
,
setevh_doc
},
{
"HandleEvent"
,
MacOS_HandleEvent
,
1
,
handleev_doc
},
{
"HandleEvent"
,
MacOS_HandleEvent
,
1
,
handleev_doc
},
{
"GetErrorString"
,
MacOS_GetErrorString
,
1
,
geterr_doc
},
{
"GetErrorString"
,
MacOS_GetErrorString
,
1
,
geterr_doc
},
{
"openrf"
,
MacOS_openrf
,
1
,
openrf_doc
},
{
"openrf"
,
MacOS_openrf
,
1
,
openrf_doc
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment