Explorar o código

restore directx fullscreen exclusive after focus lost

ncannasse %!s(int64=8) %!d(string=hai) anos
pai
achega
8fe3c7d4e9
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      hxd/Stage.hl.hx

+ 13 - 0
hxd/Stage.hl.hx

@@ -132,6 +132,8 @@ class Stage {
 		return b;
 	}
 
+	var wasBlurred : Bool;
+
 	function onEvent( e : #if hldx dx.Event #else sdl.Event #end ) : Bool {
 		var eh = null;
 		switch( e.type ) {
@@ -141,6 +143,17 @@ class Stage {
 				windowWidth = window.width;
 				windowHeight = window.height;
 				onResize(null);
+			case Focus:
+				#if hldx
+				// return to exclusive mode
+				if( fullScreenMode == Fullscreen && wasBlurred ) {
+					window.displayMode = Borderless;
+					window.displayMode = fullScreenMode;
+				}
+				#end
+				wasBlurred = false;
+			case Blur:
+				wasBlurred = true;
 			default:
 			}
 		case MouseDown: