Add GLFW API to set WM_COMMAND
Also have create_os_window take keyword arguments
This commit is contained in:
parent
3c953d47ca
commit
303e4baa58
@ -222,6 +222,7 @@ def generate_wrappers(glfw_header: str) -> None:
|
|||||||
unsigned long long glfwDBusUserNotify(const char *app_name, const char* icon, const char *summary, const char *body, \
|
unsigned long long glfwDBusUserNotify(const char *app_name, const char* icon, const char *summary, const char *body, \
|
||||||
const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callback, void *data)
|
const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callback, void *data)
|
||||||
void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler)
|
void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler)
|
||||||
|
int glfwSetX11LaunchCommand(GLFWwindow *handle, char **argv, int argc)
|
||||||
'''.splitlines():
|
'''.splitlines():
|
||||||
if line:
|
if line:
|
||||||
functions.append(Function(line.strip(), check_fail=False))
|
functions.append(Function(line.strip(), check_fail=False))
|
||||||
|
|||||||
7
glfw/x11_window.c
vendored
7
glfw/x11_window.c
vendored
@ -3122,3 +3122,10 @@ GLFWAPI unsigned long long glfwDBusUserNotify(const char *app_name, const char*
|
|||||||
GLFWAPI void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler) {
|
GLFWAPI void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler) {
|
||||||
glfw_dbus_set_user_notification_activated_handler(handler);
|
glfw_dbus_set_user_notification_activated_handler(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI int glfwSetX11LaunchCommand(GLFWwindow *handle, char **argv, int argc)
|
||||||
|
{
|
||||||
|
_GLFW_REQUIRE_INIT_OR_RETURN(0);
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
return XSetCommand(_glfw.x11.display, window->x11.handle, argv, argc);
|
||||||
|
}
|
||||||
|
|||||||
3
kitty/glfw-wrapper.c
generated
3
kitty/glfw-wrapper.c
generated
@ -441,6 +441,9 @@ load_glfw(const char* path) {
|
|||||||
*(void **) (&glfwDBusSetUserNotificationHandler_impl) = dlsym(handle, "glfwDBusSetUserNotificationHandler");
|
*(void **) (&glfwDBusSetUserNotificationHandler_impl) = dlsym(handle, "glfwDBusSetUserNotificationHandler");
|
||||||
if (glfwDBusSetUserNotificationHandler_impl == NULL) dlerror(); // clear error indicator
|
if (glfwDBusSetUserNotificationHandler_impl == NULL) dlerror(); // clear error indicator
|
||||||
|
|
||||||
|
*(void **) (&glfwSetX11LaunchCommand_impl) = dlsym(handle, "glfwSetX11LaunchCommand");
|
||||||
|
if (glfwSetX11LaunchCommand_impl == NULL) dlerror(); // clear error indicator
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
kitty/glfw-wrapper.h
generated
4
kitty/glfw-wrapper.h
generated
@ -2168,4 +2168,8 @@ typedef void (*glfwDBusSetUserNotificationHandler_func)(GLFWDBusnotificationacti
|
|||||||
GFW_EXTERN glfwDBusSetUserNotificationHandler_func glfwDBusSetUserNotificationHandler_impl;
|
GFW_EXTERN glfwDBusSetUserNotificationHandler_func glfwDBusSetUserNotificationHandler_impl;
|
||||||
#define glfwDBusSetUserNotificationHandler glfwDBusSetUserNotificationHandler_impl
|
#define glfwDBusSetUserNotificationHandler glfwDBusSetUserNotificationHandler_impl
|
||||||
|
|
||||||
|
typedef int (*glfwSetX11LaunchCommand_func)(GLFWwindow*, char**, int);
|
||||||
|
GFW_EXTERN glfwSetX11LaunchCommand_func glfwSetX11LaunchCommand_impl;
|
||||||
|
#define glfwSetX11LaunchCommand glfwSetX11LaunchCommand_impl
|
||||||
|
|
||||||
const char* load_glfw(const char* path);
|
const char* load_glfw(const char* path);
|
||||||
|
|||||||
@ -622,11 +622,13 @@ native_window_handle(GLFWwindow *w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
create_os_window(PyObject UNUSED *self, PyObject *args) {
|
create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
|
||||||
int x = -1, y = -1;
|
int x = -1, y = -1;
|
||||||
char *title, *wm_class_class, *wm_class_name;
|
char *title, *wm_class_class, *wm_class_name;
|
||||||
PyObject *load_programs = NULL, *get_window_size, *pre_show_callback;
|
PyObject *load_programs = NULL, *get_window_size, *pre_show_callback;
|
||||||
if (!PyArg_ParseTuple(args, "OOsss|Oii", &get_window_size, &pre_show_callback, &title, &wm_class_name, &wm_class_class, &load_programs, &x, &y)) return NULL;
|
static const char* kwlist[] = {"get_window_size", "pre_show_callback", "title", "wm_class_name", "wm_class_class", "load_programs", "x", "y", NULL};
|
||||||
|
if (!PyArg_ParseTupleAndKeywords(args, kw, "OOsss|Oii", (char**)kwlist,
|
||||||
|
&get_window_size, &pre_show_callback, &title, &wm_class_name, &wm_class_class, &load_programs, &x, &y)) return NULL;
|
||||||
|
|
||||||
static bool is_first_window = true;
|
static bool is_first_window = true;
|
||||||
if (is_first_window) {
|
if (is_first_window) {
|
||||||
@ -1431,7 +1433,7 @@ stop_main_loop(void) {
|
|||||||
|
|
||||||
static PyMethodDef module_methods[] = {
|
static PyMethodDef module_methods[] = {
|
||||||
METHODB(set_custom_cursor, METH_VARARGS),
|
METHODB(set_custom_cursor, METH_VARARGS),
|
||||||
METHODB(create_os_window, METH_VARARGS),
|
{"create_os_window", (PyCFunction)(void (*) (void))(create_os_window), METH_VARARGS | METH_KEYWORDS, NULL},
|
||||||
METHODB(set_default_window_icon, METH_VARARGS),
|
METHODB(set_default_window_icon, METH_VARARGS),
|
||||||
METHODB(get_clipboard_string, METH_NOARGS),
|
METHODB(get_clipboard_string, METH_NOARGS),
|
||||||
METHODB(get_content_scale_for_window, METH_NOARGS),
|
METHODB(get_content_scale_for_window, METH_NOARGS),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user