Skip to content

Commit cf9e213

Browse files
committed
limited
1 parent 8cad0ab commit cf9e213

File tree

4 files changed

+7
-43
lines changed

4 files changed

+7
-43
lines changed

buildconfig/stubs/pygame/display.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def set_mode(
3131
depth: int = 0,
3232
display: int = 0,
3333
vsync: int = 0,
34-
hwnd: int = 0,
3534
) -> Surface: ...
3635
def get_surface() -> Surface: ...
3736
def flip() -> None: ...

docs/reST/ref/display.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ required).
113113
.. function:: set_mode
114114

115115
| :sl:`Initialize a window or screen for display`
116-
| :sg:`set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0, hwnd=0) -> Surface`
116+
| :sg:`set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface`
117117
118118
This function will create a display Surface. The arguments passed in are
119119
requests for a display type. The actual created display will be the best
@@ -189,13 +189,6 @@ required).
189189

190190
.. versionadded:: 2.0.0 ``vsync``
191191

192-
The ``hwnd`` argument is an integer contains the window id (or handle) of
193-
a foreign window. By setting this parameter, pygame display can be embedded
194-
into the foreign window. Be aware that there can be many strange side effects
195-
when running in an embedded display.
196-
197-
.. versionadded:: 2.1.4 ``hwnd``
198-
199192
Basic example:
200193

201194
::

src_c/display.c

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,6 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
815815

816816
_DisplayState *state = DISPLAY_MOD_STATE(self);
817817
SDL_Window *win = pg_GetDefaultWindow();
818-
#if !SDL_VERSION_ATLEAST(2, 0, 22)
819-
SDL_Window *dummy = NULL;
820-
char dummy_id_str[64];
821-
#endif
822818
pgSurfaceObject *surface = pg_GetDefaultWindowSurface();
823819
SDL_Surface *surf = NULL;
824820
SDL_Surface *newownedsurf = NULL;
@@ -835,14 +831,13 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
835831
char *title = state->title;
836832
char *scale_env, *winid_env;
837833

838-
char *keywords[] = {"size", "flags", "depth", "display",
839-
"vsync", "hwnd", NULL};
834+
char *keywords[] = {"size", "flags", "depth", "display", "vsync", NULL};
840835

841836
scale_env = SDL_getenv("PYGAME_FORCE_SCALE");
842837
winid_env = SDL_getenv("SDL_WINDOWID");
843838

844-
if (!PyArg_ParseTupleAndKeywords(arg, kwds, "|OiiiiK", keywords, &size,
845-
&flags, &depth, &display, &vsync, &hwnd))
839+
if (!PyArg_ParseTupleAndKeywords(arg, kwds, "|Oiiii", keywords, &size,
840+
&flags, &depth, &display, &vsync))
846841
return NULL;
847842

848843
if (hwnd == 0 && winid_env != NULL) {
@@ -1087,30 +1082,7 @@ pg_set_mode(PyObject *self, PyObject *arg, PyObject *kwds)
10871082
if (!win) {
10881083
/*open window*/
10891084
if (hwnd != 0) {
1090-
if (flags & PGS_OPENGL) {
1091-
#if SDL_VERSION_ATLEAST(2, 0, 22)
1092-
SDL_SetHint(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, "1");
1093-
win = SDL_CreateWindowFrom((void *)hwnd);
1094-
SDL_SetHint(SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL, "0");
1095-
#else
1096-
// Create window with SDL_CreateWindowFrom() and OpenGL
1097-
// See https://gamedev.stackexchange.com/a/119903
1098-
dummy = SDL_CreateWindow(
1099-
"OpenGL Dummy", 0, 0, 1, 1,
1100-
SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN);
1101-
sprintf(dummy_id_str, "%p", dummy);
1102-
SDL_SetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
1103-
dummy_id_str);
1104-
1105-
win = SDL_CreateWindowFrom((void *)hwnd);
1106-
1107-
SDL_SetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT,
1108-
"");
1109-
#endif
1110-
}
1111-
else {
1112-
win = SDL_CreateWindowFrom((void *)hwnd);
1113-
}
1085+
win = SDL_CreateWindowFrom((void *)hwnd);
11141086
}
11151087
else {
11161088
win = SDL_CreateWindow(title, x, y, w_1, h_1, sdl_flags);

src_c/doc/display_doc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define DOC_PYGAMEDISPLAYINIT "init() -> None\nInitialize the display module"
44
#define DOC_PYGAMEDISPLAYQUIT "quit() -> None\nUninitialize the display module"
55
#define DOC_PYGAMEDISPLAYGETINIT "get_init() -> bool\nReturns True if the display module has been initialized"
6-
#define DOC_PYGAMEDISPLAYSETMODE "set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0, hwnd=0) -> Surface\nInitialize a window or screen for display"
6+
#define DOC_PYGAMEDISPLAYSETMODE "set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface\nInitialize a window or screen for display"
77
#define DOC_PYGAMEDISPLAYGETSURFACE "get_surface() -> Surface\nGet a reference to the currently set display surface"
88
#define DOC_PYGAMEDISPLAYFLIP "flip() -> None\nUpdate the full display Surface to the screen"
99
#define DOC_PYGAMEDISPLAYUPDATE "update(rectangle=None) -> None\nupdate(rectangle_list) -> None\nUpdate portions of the screen for software displays"
@@ -50,7 +50,7 @@ pygame.display.get_init
5050
Returns True if the display module has been initialized
5151
5252
pygame.display.set_mode
53-
set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0, hwnd=0) -> Surface
53+
set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface
5454
Initialize a window or screen for display
5555
5656
pygame.display.get_surface

0 commit comments

Comments
 (0)