Skip to content

Commit

Permalink
Merge pull request #3234 from pygame-community/ankith26-foreign-depre…
Browse files Browse the repository at this point in the history
…cate

Deprecate `Window` `foreign` kwarg and `Window.focus` `input_only` kwarg
  • Loading branch information
ankith26 authored Dec 2, 2024
2 parents 983e223 + fae899b commit 64b5320
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/reST/ref/window.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -415,7 +414,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

Expand Down
12 changes: 12 additions & 0 deletions src_c/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -930,6 +936,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;
}
Expand Down

0 comments on commit 64b5320

Please sign in to comment.