Skip to content

Commit

Permalink
Make handledestroy about to cancel.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlohr committed Sep 8, 2023
1 parent 294d99d commit 17163cd
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CNFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int CNFGHandleInput();
void HandleKey( int keycode, int bDown );
void HandleButton( int x, int y, int button, int bDown );
void HandleMotion( int x, int y, int mask );
void HandleDestroy();
int HandleDestroy(); // Return nonzero if you want to cancel destroy.
#ifdef ANDROID_WANT_WINDOW_TERMINATION
void HandleWindowTermination();
#endif
Expand Down
4 changes: 2 additions & 2 deletions CNFGEGLDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ void handle_cmd(struct android_app* app, int32_t cmd)
{
case APP_CMD_DESTROY:
//This gets called initially after back.
HandleDestroy();
ANativeActivity_finish( gapp->activity );
if( !HandleDestroy() )
ANativeActivity_finish( gapp->activity );
break;
case APP_CMD_INIT_WINDOW:
//When returning from a back button suspension, this isn't called.
Expand Down
4 changes: 2 additions & 2 deletions CNFGWinDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ LRESULT CALLBACK MyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
break;
#endif
case WM_DESTROY:
HandleDestroy();
CNFGTearDown();
if( !HandleDestroy() )
CNFGTearDown();
return 0;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ is as follows:
void HandleKey( int keycode, int bDown ) { }
void HandleButton( int x, int y, int button, int bDown ) { }
void HandleMotion( int x, int y, int mask ) { }
void HandleDestroy() { }
int HandleDestroy() { reutrn 0; }
int main()
{
CNFGSetup( "Example App", 1024, 768 );
Expand Down
3 changes: 2 additions & 1 deletion examples/fontsize.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ void HandleMotion( int x, int y, int mask )
// printf( "Motion: %d,%d (%d)\n", x, y, mask );
}

void HandleDestroy()
int HandleDestroy()
{
printf( "Destroying\n" );
exit(10);
return 0;
}

int main()
Expand Down
3 changes: 2 additions & 1 deletion ogltest.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ void HandleMotion( int x, int y, int mask )
{
}

void HandleDestroy()
int HandleDestroy()
{
exit(10);
return 0;
}

int main()
Expand Down
3 changes: 2 additions & 1 deletion osdtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ void HandleMotion( int x, int y, int mask )
}


void HandleDestroy()
int HandleDestroy()
{
printf( "Destroying\n" );
exit(10);
return 0;
}


Expand Down
3 changes: 2 additions & 1 deletion rawdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ void DrawHeightmap()
}


void HandleDestroy()
int HandleDestroy()
{
printf( "Destroying\n" );
exit(10);
return 0;
}

uint32_t randomtexturedata[65536];
Expand Down
2 changes: 1 addition & 1 deletion simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
void HandleKey( int keycode, int bDown ) { }
void HandleButton( int x, int y, int button, int bDown ) { }
void HandleMotion( int x, int y, int mask ) { }
void HandleDestroy() { }
int HandleDestroy() { return 0; }
int main()
{
CNFGSetup( "Example App", 1024, 768 );
Expand Down

0 comments on commit 17163cd

Please sign in to comment.