-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewritten post process to deal with screens individually
- Loading branch information
Showing
25 changed files
with
876 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using AppKit; | ||
using Newtonsoft.Json; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
|
||
namespace AstroWall.ApplicationLayer.Helpers | ||
{ | ||
[JsonObject] | ||
public struct Screen | ||
{ | ||
public static Dictionary<string, Screen> FromCurrentConnected() | ||
{ | ||
return NSScreen.Screens.Select(nsscreen => new Screen(nsscreen)).ToDictionary(screen => screen.Id); | ||
} | ||
public static Screen Main() | ||
{ | ||
return new Screen(NSScreen.MainScreen); | ||
} | ||
|
||
private Screen(NSScreen nSscreen) | ||
{ | ||
Id = nSscreen.LocalizedName; | ||
xRes = (int)nSscreen.Frame.Size.Width; | ||
yRes = (int)nSscreen.Frame.Size.Height; | ||
isMainScreen = NSScreen.MainScreen == nSscreen; | ||
} | ||
|
||
/// <summary> | ||
/// Can possibly return null, if the screen width this.Id is | ||
/// no longer connected | ||
/// </summary> | ||
/// <returns></returns> | ||
public NSScreen toNSScreen() | ||
{ | ||
var that = this; | ||
var filteredArray = NSScreen.Screens.Where(nsscreen => nsscreen.LocalizedName == that.Id).ToArray(); | ||
if (filteredArray.Length != 1) return null; | ||
else return filteredArray[0]; | ||
} | ||
|
||
[JsonProperty] | ||
public string Id; | ||
[JsonProperty] | ||
public int xRes; | ||
[JsonProperty] | ||
public int yRes; | ||
[JsonProperty] | ||
public bool isMainScreen; | ||
|
||
public bool isHorizontal() | ||
{ | ||
return xRes > yRes; | ||
} | ||
public bool isVertical() | ||
{ | ||
return yRes > xRes; | ||
} | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
AstroWall/ApplicationLayer/View/PostProcessContentViewController.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.