Browse Source

restore directx fullscreen exclusive after focus lost

ncannasse 8 năm trước cách đây
mục cha
commit
8fe3c7d4e9
1 tập tin đã thay đổi với 13 bổ sung0 xóa
  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: