Skip to content

Commit

Permalink
* Resolve issue with XWayland crashing because we don't handle non-c…
Browse files Browse the repository at this point in the history
…lose events in X.

 * Call HandleSuspend and HandleResume on Android on APP_CMD_PAUSE and APP_CMD_RESUME
  • Loading branch information
cnlohr committed May 25, 2023
1 parent d652d9f commit 63282ea
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions rawdraw_sf.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//This file was automatically generated by Makefile at https://github.com/cntools/rawdraw
//Generated from files git hash f90dd987fef2a5efde5ea05251f1d72e07e91a5d on Wed Feb 8 12:11:21 PST 2023 (This is not the git hash of this file)
//Generated from files git hash d652d9f474c3405a32e2b4e720f9295645432045 on Wed May 24 19:02:59 PDT 2023 (This is not the git hash of this file)
// Copyright 2010-2021 <>< CNLohr, et. al. (Several other authors, many but not all mentioned)
// Licensed under the MIT/x11 or NewBSD License you choose.
//
Expand Down Expand Up @@ -4615,8 +4615,16 @@ void handle_cmd(struct android_app* app, int32_t cmd)
//This also gets called when you are brought into standby.
//Not sure why - callbacks here seem to break stuff.
// break;

case APP_CMD_PAUSE:
HandleSuspend();
break;

case APP_CMD_RESUME:
HandleResume();
break;
default:
printf( "event not handled: %d", cmd);
printf( "event not handled: %d\n", cmd);
}
}

Expand Down Expand Up @@ -4983,6 +4991,7 @@ XClassHint *CNFGClassHint;
char * wm_res_name = 0;
char * wm_res_class = 0;
Display *CNFGDisplay;
Atom CFNGWMDeleteWindow;
Window CNFGWindow;
int CNFGWindowInvisible;
Pixmap CNFGPixmap;
Expand Down Expand Up @@ -5263,6 +5272,7 @@ void CNFGTearDown()
CNFGDisplay = NULL;
CNFGWindowGC = CNFGGC = NULL;
CNFGClassHint = NULL;
CFNGWMDeleteWindow = None;
}

int CNFGSetupWMClass( const char * WindowName, int w, int h , char * wm_res_name_ , char * wm_res_class_ )
Expand Down Expand Up @@ -5308,8 +5318,8 @@ int CNFGSetup( const char * WindowName, int w, int h )
InternalLinkScreenAndGo( WindowName );

//Not sure of the purpose of this code - if it's still commented out after 2019-12-31 and no one knows why, please delete it.
Atom WM_DELETE_WINDOW = XInternAtom( CNFGDisplay, "WM_DELETE_WINDOW", False );
XSetWMProtocols( CNFGDisplay, CNFGWindow, &WM_DELETE_WINDOW, 1 );
CFNGWMDeleteWindow = XInternAtom( CNFGDisplay, "WM_DELETE_WINDOW", False );
XSetWMProtocols( CNFGDisplay, CNFGWindow, &CFNGWMDeleteWindow, 1 );

#ifdef CNFGOGL
glXMakeCurrent( CNFGDisplay, CNFGWindow, CNFGCtx );
Expand Down Expand Up @@ -5376,8 +5386,8 @@ int CNFGHandleInput()
HandleMotion( report.xmotion.x, report.xmotion.y, ButtonsDown>>1 );
break;
case ClientMessage:
// Only subscribed to WM_DELETE_WINDOW, so return 0 to let user know of window exit
return 0;
if ( report.xclient.data.l[0] == CFNGWMDeleteWindow )
return 0;
break;
default:
break;
Expand Down

0 comments on commit 63282ea

Please sign in to comment.