Browse Source

Merge pull request #28 from GWRon/fix_linuxAppSuspend

Fix: Enable AppSuspended()-function on Linux-(X11)-Systems
Brucey 9 years ago
parent
commit
b75cadb12e
2 changed files with 12 additions and 1 deletions
  1. 1 1
      glgraphics.mod/glgraphics.linux.c
  2. 11 0
      systemdefault.mod/system.linux.c

+ 1 - 1
glgraphics.mod/glgraphics.linux.c

@@ -345,7 +345,7 @@ BBGLContext *bbGLGraphicsCreateGraphics( int width,int height,int depth,int hz,i
 		}
 		glXMakeCurrent(xdisplay,window,context);	
 		XIfEvent(xdisplay,&event,WaitForNotify,(XPointer)window);	     
-		XSelectInput(xdisplay,window,ResizeRedirectMask|PointerMotionMask|ButtonPressMask|ButtonReleaseMask|KeyPressMask|KeyReleaseMask);	
+		XSelectInput(xdisplay,window,ResizeRedirectMask|FocusChangeMask|PointerMotionMask|ButtonPressMask|ButtonReleaseMask|KeyPressMask|KeyReleaseMask);	
 		xwindow=window;
 		bbSetSystemWindow(xwindow);
 	}

+ 11 - 0
systemdefault.mod/system.linux.c

@@ -232,6 +232,17 @@ void bbSystemEmitOSEvent( XEvent *xevent,BBObject *source ){
 	case MotionNotify:
 		id=BBEVENT_MOUSEMOVE;
 		break;
+	case FocusIn:
+		id=BBEVENT_APPRESUME;
+		break;
+	case FocusOut:
+		//ignore if lost focus because the window got grabbed
+		//(moving around the windowed application)
+		if( xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) {
+			break;
+		}
+		id=BBEVENT_APPSUSPEND;
+		break;
 	case ClientMessage:
 		if( xevent->xclient.data.l[0]==XInternAtom( x_display,"WM_DELETE_WINDOW",True ) ){
 			id=BBEVENT_APPTERMINATE;