mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-09 15:28:21 -04:00
Fix X11 error when closing the game on Linux
This commit is contained in:
parent
9607fa2cf1
commit
79a996d6cd
@ -852,4 +852,5 @@ void Game_Run(int width, int height, const cc_string* title) {
|
||||
|
||||
frameStart = Stopwatch_Measure();
|
||||
Game_RunLoop();
|
||||
Window_Destroy();
|
||||
}
|
||||
|
@ -297,6 +297,7 @@ void Launcher_Run(void) {
|
||||
cc_result res = Updater_Start(&action);
|
||||
if (res) Logger_SysWarn(res, action);
|
||||
}
|
||||
Window_Destroy();
|
||||
}
|
||||
|
||||
|
||||
|
@ -117,6 +117,9 @@ void Window_Create2D(int width, int height);
|
||||
/* Creates a window of the given size at centre of the screen. */
|
||||
/* NOTE: The created window is compatible with 3D rendering */
|
||||
void Window_Create3D(int width, int height);
|
||||
/* Destroys the window. */
|
||||
void Window_Destroy(void);
|
||||
|
||||
/* Sets the text of the titlebar above the window. */
|
||||
CC_API void Window_SetTitle(const cc_string* title);
|
||||
|
||||
|
@ -75,6 +75,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -340,6 +340,8 @@ static void DoCreateWindow(void) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
/* TODO: Implement this somehow */
|
||||
/* Maybe https://stackoverflow.com/questions/2198410/how-to-change-title-of-activity-in-android */
|
||||
|
@ -375,6 +375,9 @@ void Window_Create3D(int width, int height) {
|
||||
win_handle->AddChild(view_handle);
|
||||
}
|
||||
|
||||
void Window_Destroy(void) {
|
||||
}
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char raw[NATIVE_STR_LEN];
|
||||
String_EncodeUtf8(raw, title);
|
||||
|
@ -62,6 +62,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -102,6 +102,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_RequestClose(void) {
|
||||
Event_RaiseVoid(&WindowEvents.Closing);
|
||||
}
|
||||
|
@ -216,6 +216,8 @@ static void DoCreateWindow(int width, int height) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -65,6 +65,8 @@ void Window_Free(void) { }
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -175,6 +175,8 @@ void Window_Create3D(int width, int height) {
|
||||
videoSetMode(MODE_0_3D);
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -58,10 +58,15 @@ void Window_Init(void) {
|
||||
|
||||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
launcherMode = true;
|
||||
}
|
||||
void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
@ -145,10 +150,6 @@ void Window_ProcessGamepads(float delta) {
|
||||
/*########################################################################################################################*
|
||||
*------------------------------------------------------Framebuffer--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Window_Create2D(int width, int height) {
|
||||
launcherMode = true;
|
||||
}
|
||||
|
||||
static DISPENV disp;
|
||||
static cc_uint16* fb;
|
||||
|
||||
|
@ -125,6 +125,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -82,6 +82,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { } // TODO sceClipboardGetText
|
||||
void Clipboard_SetText(const cc_string* value) { } // TODO sceClipboardSetText
|
||||
|
@ -53,6 +53,8 @@ void Window_Free(void) { }
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -70,6 +70,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { } // TODO sceClipboardGetText
|
||||
void Clipboard_SetText(const cc_string* value) { } // TODO sceClipboardSetText
|
||||
|
@ -106,6 +106,8 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); }
|
||||
#endif
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
String_EncodeUtf8(str, title);
|
||||
|
@ -90,6 +90,8 @@ void Window_Create3D(int width, int height) { DoCreateWindow(width, height, SDL_
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height, 0); }
|
||||
#endif
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
String_EncodeUtf8(str, title);
|
||||
|
@ -61,6 +61,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -92,6 +92,8 @@ void Window_Create3D(int width, int height) {
|
||||
launcherMode = false;
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -433,6 +433,8 @@ static void DoCreateWindow(int width, int height) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
// TODO
|
||||
}
|
||||
|
@ -439,6 +439,8 @@ static void DoCreateWindow(void) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
extern void interop_SetPageTitle(const char* title);
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
|
@ -136,6 +136,8 @@ void Window_Create3D(int width, int height) {
|
||||
Event_Unregister_(&WindowEvents.InactiveChanged, NULL, LauncherInactiveChanged);
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_RequestClose(void) {
|
||||
Event_RaiseVoid(&WindowEvents.Closing);
|
||||
}
|
||||
|
@ -404,6 +404,8 @@ static void DoCreateWindow(int width, int height) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
cc_winstring str;
|
||||
Platform_EncodeString(&str, title);
|
||||
|
@ -404,6 +404,13 @@ static void DoCreateWindow(int width, int height) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height); }
|
||||
|
||||
void Window_Destroy(void) {
|
||||
/* sync and discard all events queued */
|
||||
XSync(win_display, true);
|
||||
XDestroyWindow(win_display, win_handle);
|
||||
Window_Main.Exists = false;
|
||||
}
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
String_EncodeUtf8(str, title);
|
||||
@ -567,10 +574,6 @@ static Bool FilterEvent(Display* d, XEvent* e, XPointer w) {
|
||||
static void HandleWMDestroy(void) {
|
||||
Platform_LogConst("Exit message received.");
|
||||
Event_RaiseVoid(&WindowEvents.Closing);
|
||||
|
||||
/* sync and discard all events queued */
|
||||
XSync(win_display, true);
|
||||
XDestroyWindow(win_display, win_handle);
|
||||
Window_Main.Exists = false;
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,8 @@ void Window_Free(void) { usbh_core_deinit(); }
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -56,6 +56,8 @@ void Window_Free(void) { }
|
||||
void Window_Create2D(int width, int height) { launcherMode = true; }
|
||||
void Window_Create3D(int width, int height) { launcherMode = false; }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) { }
|
||||
void Clipboard_GetText(cc_string* value) { }
|
||||
void Clipboard_SetText(const cc_string* value) { }
|
||||
|
@ -395,6 +395,8 @@ static void DoCreateWindow(int width, int height) {
|
||||
void Window_Create2D(int width, int height) { DoCreateWindow(width, height); }
|
||||
void Window_Create3D(int width, int height) { DoCreateWindow(width, height); }
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
void Window_SetTitle(const cc_string* title) {
|
||||
char raw[NATIVE_STR_LEN];
|
||||
NSString* str;
|
||||
|
@ -722,6 +722,8 @@ void Window_Create3D(int width, int height) {
|
||||
Init3DLayer();
|
||||
}
|
||||
|
||||
void Window_Destroy(void) { }
|
||||
|
||||
|
||||
/*########################################################################################################################*
|
||||
*--------------------------------------------------------GLContext--------------------------------------------------------*
|
||||
|
Loading…
x
Reference in New Issue
Block a user