From c00ff2924ea3d2c558e3528d0fceab651befbfcf Mon Sep 17 00:00:00 2001 From: Ankith Date: Fri, 22 Nov 2024 22:22:22 +0530 Subject: [PATCH 1/2] Deprecate Window foreign kwarg --- docs/reST/ref/window.rst | 1 - src_c/window.c | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/reST/ref/window.rst b/docs/reST/ref/window.rst index 7c78de9dc0..9b18406a80 100644 --- a/docs/reST/ref/window.rst +++ b/docs/reST/ref/window.rst @@ -37,7 +37,6 @@ :param bool keyboard_grabbed: Create a window with grabbed keyboard input. :param bool input_focus: Create a window with input focus. :param bool mouse_focus: Create a window with mouse focus. - :param bool foreign: Marks a window not created by SDL. :param bool allow_high_dpi: Create a window in high-DPI mode if supported. :param bool mouse_capture: Create a window that has the mouse captured (unrelated to INPUT_GRABBED). diff --git a/src_c/window.c b/src_c/window.c index 63b7270d06..727aa06d3b 100644 --- a/src_c/window.c +++ b/src_c/window.c @@ -923,6 +923,12 @@ window_init(pgWindowObject *self, PyObject *args, PyObject *kwargs) } } else if (!strcmp(_key_str, "foreign")) { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "The foreign kwarg has been deprecated " + "and may be removed in a future version", + 1) == -1) { + return -1; + } if (_value_bool) { flags |= SDL_WINDOW_FOREIGN; } From fae899bd0cfaba14785550a1f855e9961cbfaad8 Mon Sep 17 00:00:00 2001 From: Ankith Date: Fri, 22 Nov 2024 22:56:17 +0530 Subject: [PATCH 2/2] Deprecate input_only argument --- docs/reST/ref/window.rst | 5 ++++- src_c/window.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reST/ref/window.rst b/docs/reST/ref/window.rst index 9b18406a80..81352fee3c 100644 --- a/docs/reST/ref/window.rst +++ b/docs/reST/ref/window.rst @@ -403,7 +403,10 @@ :param bool input_only: if ``True``, the window will be given input focus but may be completely obscured by other windows. - Only supported on X11. + Only supported on X11. This has been deprecated and + may be removed in a future version. + + .. deprecated:: 2.5.3 ``input_only`` argument .. method:: restore diff --git a/src_c/window.c b/src_c/window.c index 727aa06d3b..5fe7ca90d2 100644 --- a/src_c/window.c +++ b/src_c/window.c @@ -289,6 +289,12 @@ window_focus(pgWindowObject *self, PyObject *args, PyObject *kwargs) return NULL; } if (input_only) { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "The input_only kwarg has been deprecated and may be " + "removed in a future version", + 1) == -1) { + return NULL; + } if (SDL_SetWindowInputFocus(self->_win)) { return RAISE(pgExc_SDLError, SDL_GetError()); }