mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
common: refactor common library pt2 (#8588)
- remove common lib - split settings, remove common-md - move ipc interop/kb_layout to interop - rename core -> settings, settings -> old_settings - os-detect header-only; interop -> PowerToysInterop - split notifications, move single-use headers where they're used - winstore lib - rename com utils - rename Updating and Telemetry projects - rename core -> settings-ui and remove examples folder - rename settings-ui folder + consisent common/version include
This commit is contained in:
38
src/common/Display/monitors.h
Normal file
38
src/common/Display/monitors.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <Windows.h>
|
||||
#include <vector>
|
||||
|
||||
struct ScreenSize
|
||||
{
|
||||
explicit ScreenSize(RECT rect) :
|
||||
rect(rect) {}
|
||||
RECT rect;
|
||||
int left() const { return rect.left; }
|
||||
int right() const { return rect.right; }
|
||||
int top() const { return rect.top; }
|
||||
int bottom() const { return rect.bottom; }
|
||||
int height() const { return rect.bottom - rect.top; };
|
||||
int width() const { return rect.right - rect.left; };
|
||||
POINT top_left() const { return { rect.left, rect.top }; };
|
||||
POINT top_middle() const { return { rect.left + width() / 2, rect.top }; };
|
||||
POINT top_right() const { return { rect.right, rect.top }; };
|
||||
POINT middle_left() const { return { rect.left, rect.top + height() / 2 }; };
|
||||
POINT middle() const { return { rect.left + width() / 2, rect.top + height() / 2 }; };
|
||||
POINT middle_right() const { return { rect.right, rect.top + height() / 2 }; };
|
||||
POINT bottom_left() const { return { rect.left, rect.bottom }; };
|
||||
POINT bottom_middle() const { return { rect.left + width() / 2, rect.bottom }; };
|
||||
POINT bottom_right() const { return { rect.right, rect.bottom }; };
|
||||
};
|
||||
|
||||
struct MonitorInfo : ScreenSize
|
||||
{
|
||||
explicit MonitorInfo(HMONITOR monitor, RECT rect) :
|
||||
handle(monitor), ScreenSize(rect) {}
|
||||
HMONITOR handle;
|
||||
|
||||
// Returns monitor rects ordered from left to right
|
||||
static std::vector<MonitorInfo> GetMonitors(bool includeNonWorkingArea);
|
||||
static MonitorInfo GetPrimaryMonitor();
|
||||
};
|
||||
|
||||
bool operator==(const ScreenSize& lhs, const ScreenSize& rhs);
|
||||
Reference in New Issue
Block a user