FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added. · aebrahim/matplotlib@ce7f0a6 · GitHub

Repository navigation

Commit ce7f0a6

Browse files
committed
Added.
svn path=/trunk/matplotlib/; revision=214
1 parent 4413c50 commit ce7f0a6

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

‎src/_windowing.cpp‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "Python.h"
2+
#include <windows.h>
3+
4+
static PyObject *
5+
_GetForegroundWindow(PyObject *module, PyObject *args)
6+
{
7+
HWND handle = GetForegroundWindow();
8+
if (!PyArg_ParseTuple(args, ":GetForegroundWindow"))
9+
return NULL;
10+
return PyInt_FromLong((long) handle);
11+
}
12+
13+
static PyObject *
14+
_SetForegroundWindow(PyObject *module, PyObject *args)
15+
{
16+
HWND handle;
17+
if (!PyArg_ParseTuple(args, "l:SetForegroundWindow", &handle))
18+
return NULL;
19+
if (!SetForegroundWindow(handle))
20+
return PyErr_Format(PyExc_RuntimeError,
21+
"Error setting window");
22+
Py_INCREF(Py_None);
23+
return Py_None;
24+
}
25+
26+
static PyMethodDef _windowing_methods[] = {
27+
{"GetForegroundWindow", _GetForegroundWindow, METH_VARARGS},
28+
{"SetForegroundWindow", _SetForegroundWindow, METH_VARARGS},
29+
{NULL, NULL}
30+
};
31+
32+
extern "C" DL_EXPORT(void) init_windowing()
33+
{
34+
Py_InitModule("_windowing", _windowing_methods);
35+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL