Wrap request attention API and expose to python

This commit is contained in:
Kovid Goyal 2026-03-01 11:33:03 +05:30
parent 4d0459df95
commit 3352b8e572
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 2 deletions

View file

@ -1032,8 +1032,8 @@ def set_active_window(os_window_id: int, tab_id: int, window_id: int) -> None:
pass
def ring_bell(os_window_id: int = 0) -> None:
pass
def ring_bell(os_window_id: int = 0) -> None: ...
def request_attention(os_window_id: int) -> None: ...
def concat_cells(cell_width: int, cell_height: int, is_32_bit: bool, cells: Tuple[bytes, ...], bgcolor: int = 0) -> bytes:

View file

@ -2167,6 +2167,16 @@ ring_bell(PyObject *self UNUSED, PyObject *args) {
Py_RETURN_NONE;
}
static PyObject*
request_attention(PyObject *self UNUSED, PyObject *args) {
unsigned long long os_window_id;
if (!PyArg_ParseTuple(args, "K", &os_window_id)) return NULL;
OSWindow *w = os_window_for_id(os_window_id);
if (w && w->handle) glfwRequestWindowAttention(w->handle);
Py_RETURN_NONE;
}
static PyObject*
get_content_scale_for_window(PYNOARG) {
OSWindow *w = global_state.callback_os_window ? global_state.callback_os_window : global_state.os_windows;
@ -2913,6 +2923,7 @@ static PyMethodDef module_methods[] = {
METHODB(macos_cycle_through_os_windows, METH_O),
METHODB(get_content_scale_for_window, METH_NOARGS),
METHODB(ring_bell, METH_VARARGS),
METHODB(request_attention, METH_VARARGS),
METHODB(toggle_fullscreen, METH_VARARGS),
METHODB(toggle_maximized, METH_VARARGS),
METHODB(change_os_window_state, METH_VARARGS),