-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move display enumeration functionality to DisplayManager
- Loading branch information
Showing
15 changed files
with
174 additions
and
99 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include <Windows.h> | ||
#include <list> | ||
#include <string> | ||
#include <unordered_map> | ||
#include <vector> | ||
|
||
#include "Monitor.h" | ||
|
||
class DisplayManager { | ||
public: | ||
static std::unordered_map<std::wstring, Monitor> &MonitorMap(); | ||
static void UpdateMonitorMap(); | ||
static Monitor Primary(); | ||
static std::list<DISPLAY_DEVICE> ListAllDevices(); | ||
|
||
private: | ||
static MONITORINFO Info(HMONITOR monitor); | ||
static const int Width(HMONITOR monitor); | ||
static const int Height(HMONITOR monitor); | ||
static RECT Rect(HMONITOR monitor); | ||
|
||
static BOOL CALLBACK MonitorEnumProc( | ||
HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); | ||
}; |
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 |
---|---|---|
@@ -1,21 +1,54 @@ | ||
#pragma once | ||
|
||
#include <Windows.h> | ||
#include <list> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
class Monitor { | ||
public: | ||
static HMONITOR Primary(); | ||
static MONITORINFO Info(HMONITOR monitor); | ||
static const int Width(HMONITOR monitor); | ||
static const int Height(HMONITOR monitor); | ||
static RECT Rect(HMONITOR monitor); | ||
static std::list<DISPLAY_DEVICE> ListAllDevices(); | ||
Monitor() { | ||
|
||
} | ||
|
||
Monitor(std::wstring name, int x, int y, int width, int height) : | ||
_name(name), | ||
_x(x), | ||
_y(y), | ||
_width(width), | ||
_height(height) { | ||
|
||
} | ||
|
||
Monitor(std::wstring name, RECT rect) : | ||
_name(name), | ||
_x(rect.left), | ||
_y(rect.top), | ||
_width(rect.right - rect.left), | ||
_height(rect.bottom - rect.top) { | ||
|
||
} | ||
|
||
int X() { | ||
return _x; | ||
} | ||
|
||
int Y() { | ||
return _y; | ||
} | ||
|
||
int Width() { | ||
return _width; | ||
} | ||
|
||
static void UpdateMonitorMap(); | ||
static std::unordered_map<std::wstring, HMONITOR> MonitorMap(); | ||
int Height() { | ||
return _height; | ||
} | ||
|
||
private: | ||
static BOOL CALLBACK MonitorEnumProc( | ||
HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); | ||
std::wstring _name; | ||
int _x; | ||
int _y; | ||
int _width; | ||
int _height; | ||
}; |
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
Oops, something went wrong.