python: Add wmfs_uicb python function
This commit is contained in:
parent
1189fe1690
commit
b2eb9ee33e
@ -36,6 +36,7 @@
|
||||
static PyMethodDef WmfsMethods[] =
|
||||
{
|
||||
{"init", wmfs_init, METH_VARARGS, "Init wmfs module"},
|
||||
{"uicb", wmfs_uicb, METH_VARARGS, "Exec an uicb function"},
|
||||
{"statustext", wmfs_statustext, METH_VARARGS, "Wrote in the statustext"},
|
||||
{"tag_set", wmfs_tag_set, METH_VARARGS, "Set a tag"},
|
||||
{"screen_set", wmfs_screen_set, METH_VARARGS, "Set the selected screen"},
|
||||
@ -104,6 +105,32 @@ wmfs_init(PyObject *self, PyObject *args)
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
PyObject*
|
||||
wmfs_uicb(PyObject *self, PyObject *args)
|
||||
{
|
||||
long data[5];
|
||||
char *func;
|
||||
char *cmd;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "ss", &func, &cmd))
|
||||
return NULL;
|
||||
|
||||
data[4] = True;
|
||||
|
||||
XChangeProperty(dpy, ROOT, ATOM("_WMFS_FUNCTION"), ATOM("UTF8_STRING"),
|
||||
8, PropModeReplace, (unsigned char*)func, strlen(func));
|
||||
|
||||
XChangeProperty(dpy, ROOT, ATOM("_WMFS_CMD"), ATOM("UTF8_STRING"),
|
||||
8, PropModeReplace, (unsigned char*)cmd, strlen(cmd));
|
||||
|
||||
send_client_message("_WMFS_FUNCTION", data);
|
||||
send_client_message("_WMFS_CMD", data);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
PyObject*
|
||||
wmfs_statustext(PyObject *self, PyObject *args)
|
||||
|
||||
@ -53,6 +53,7 @@ PyObject* wmfs_tag_set(PyObject *self, PyObject *args);
|
||||
|
||||
/* libwmfs.c */
|
||||
PyObject* wmfs_init(PyObject *self, PyObject *args);
|
||||
PyObject* wmfs_uicb(PyObject *self, PyObject *args);
|
||||
PyObject* wmfs_statustext(PyObject *self, PyObject *args);
|
||||
PyObject* wmfs_spawn(PyObject *self, PyObject *args);
|
||||
|
||||
|
||||
11
src/event.c
11
src/event.c
@ -174,7 +174,7 @@ clientmessageevent(XClientMessageEvent *ev)
|
||||
{
|
||||
uchar *ret_func = NULL;
|
||||
uchar *ret_cmd = NULL;
|
||||
char *cmd;
|
||||
char *cmd = NULL;
|
||||
|
||||
if(XGetWindowProperty(dpy, ROOT, net_atom[wmfs_function], 0, 4096,
|
||||
False, net_atom[utf8_string], &rt, &rf, &ir, &il, &ret_func) == Success)
|
||||
@ -183,15 +183,16 @@ clientmessageevent(XClientMessageEvent *ev)
|
||||
if(XGetWindowProperty(dpy, ROOT, net_atom[wmfs_cmd], 0, 4096,
|
||||
False, net_atom[utf8_string], &rt, &rf, &ir, &il, &ret_cmd) == Success)
|
||||
printf("%s\n", ret_cmd);
|
||||
|
||||
/*
|
||||
if(strcmp((char*)ret_cmd, "NULL") == 0)
|
||||
cmd = NULL;
|
||||
else
|
||||
strcpy(cmd, (char*)ret_cmd);
|
||||
else
|
||||
if(ret_cmd != NULL)
|
||||
strcpy(cmd, (char*)ret_cmd)*/
|
||||
|
||||
void (*func)(uicb_t) = name_to_func((char*)ret_func, func_list);
|
||||
|
||||
func(cmd);
|
||||
func((uicb_t)ret_cmd);
|
||||
|
||||
if(ret_cmd)
|
||||
XFree(ret_cmd);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user