Skip to content

Commit 64b5320

Browse files
authored
Merge pull request #3234 from pygame-community/ankith26-foreign-deprecate
Deprecate `Window` `foreign` kwarg and `Window.focus` `input_only` kwarg
2 parents 983e223 + fae899b commit 64b5320

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

docs/reST/ref/window.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
:param bool keyboard_grabbed: Create a window with grabbed keyboard input.
3838
:param bool input_focus: Create a window with input focus.
3939
:param bool mouse_focus: Create a window with mouse focus.
40-
:param bool foreign: Marks a window not created by SDL.
4140
:param bool allow_high_dpi: Create a window in high-DPI mode if supported.
4241
:param bool mouse_capture: Create a window that has the mouse captured
4342
(unrelated to INPUT_GRABBED).
@@ -415,7 +414,10 @@
415414

416415
:param bool input_only: if ``True``, the window will be given input focus
417416
but may be completely obscured by other windows.
418-
Only supported on X11.
417+
Only supported on X11. This has been deprecated and
418+
may be removed in a future version.
419+
420+
.. deprecated:: 2.5.3 ``input_only`` argument
419421

420422
.. method:: restore
421423

src_c/window.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ window_focus(pgWindowObject *self, PyObject *args, PyObject *kwargs)
289289
return NULL;
290290
}
291291
if (input_only) {
292+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
293+
"The input_only kwarg has been deprecated and may be "
294+
"removed in a future version",
295+
1) == -1) {
296+
return NULL;
297+
}
292298
if (SDL_SetWindowInputFocus(self->_win)) {
293299
return RAISE(pgExc_SDLError, SDL_GetError());
294300
}
@@ -930,6 +936,12 @@ window_init(pgWindowObject *self, PyObject *args, PyObject *kwargs)
930936
}
931937
}
932938
else if (!strcmp(_key_str, "foreign")) {
939+
if (PyErr_WarnEx(PyExc_DeprecationWarning,
940+
"The foreign kwarg has been deprecated "
941+
"and may be removed in a future version",
942+
1) == -1) {
943+
return -1;
944+
}
933945
if (_value_bool) {
934946
flags |= SDL_WINDOW_FOREIGN;
935947
}

0 commit comments

Comments
 (0)