Skip to content

Commit c7410bb

Browse files
whrvtnowrep
authored andcommitted
GL: Also hook glXCreateWindow.
Fixes capture freezing when entering/exiting the map editor in osu! under Wine. Hooking this notifies us that we need to recreate the capture.
1 parent 553fbb1 commit c7410bb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/glinject.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ static bool gl_init_funcs(bool glx)
140140
GETGLXADDR(GetProcAddress);
141141
GETGLXADDR(GetProcAddressARB);
142142
GETGLXPROCADDR(DestroyContext);
143+
GETGLXPROCADDR(CreateWindow);
143144
GETGLXPROCADDR(SwapBuffers);
144145
GETGLXPROCADDR(SwapBuffersMscOML);
145146
GETGLXPROCADDR(CreatePixmap);
@@ -1072,6 +1073,7 @@ void *eglCreateWindowSurface(void *display, void *config, void *win, const intpt
10721073
void *glXGetProcAddress(const char *procName);
10731074
void *glXGetProcAddressARB(const char *procName);
10741075
void glXDestroyContext(void *display, void *context);
1076+
bool glXCreateWindow(void *display, void *config, unsigned long win, const int *attribList);
10751077
void glXSwapBuffers(void *display, void *surface);
10761078
int64_t glXSwapBuffersMscOML(void *display, void *drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
10771079

@@ -1084,7 +1086,8 @@ static struct {
10841086
ADD_HOOK(glXGetProcAddressARB),
10851087
ADD_HOOK(glXSwapBuffers),
10861088
ADD_HOOK(glXSwapBuffersMscOML),
1087-
ADD_HOOK(glXDestroyContext)
1089+
ADD_HOOK(glXDestroyContext),
1090+
ADD_HOOK(glXCreateWindow)
10881091
#undef ADD_HOOK
10891092
};
10901093

@@ -1127,6 +1130,17 @@ void glXDestroyContext(void *display, void *context)
11271130
glx_f.DestroyContext(display, context);
11281131
}
11291132

1133+
bool glXCreateWindow(void *display, void *config, unsigned long win, const int *attribList)
1134+
{
1135+
if (!gl_init_funcs(/*glx*/true)) {
1136+
return false;
1137+
}
1138+
1139+
gl_free();
1140+
1141+
return glx_f.CreateWindow(display, config, win, attribList);
1142+
}
1143+
11301144
void glXSwapBuffers(void *display, void *drawable)
11311145
{
11321146
if (!gl_init_funcs(/*glx*/true)) {

src/glinject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct glx_funcs {
9494
void *(*GetProcAddress)(const char*);
9595
void *(*GetProcAddressARB)(const char*);
9696
void (*DestroyContext)(void *display, void *context);
97+
bool (*CreateWindow)(void *display, void *config, unsigned long win, const int *attribList);
9798
void (*SwapBuffers)(void *display, void *drawable);
9899
int64_t (*SwapBuffersMscOML)(void *display, void *drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
99100
void *(*CreatePixmap)(void *display, void *config, unsigned long pixmap, const int *attribList);

0 commit comments

Comments
 (0)