Skip to content

Commit 17e3ccc

Browse files
committed
(#20) Split screen.c
1 parent 3ab73d0 commit 17e3ccc

File tree

3 files changed

+46
-18
lines changed

3 files changed

+46
-18
lines changed

src/screen.c src/linux/screen.c

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
#include "screen.h"
2-
#include "os.h"
3-
#include "highlightwindow.h"
1+
#include "../screen.h"
2+
#include "../os.h"
3+
#include "../highlightwindow.h"
44

5-
#if defined(IS_MACOSX)
6-
#include <ApplicationServices/ApplicationServices.h>
7-
#elif defined(USE_X11)
8-
#include <X11/Xlib.h>
9-
#include "xdisplay.h"
10-
#endif
5+
#include <X11/Xlib.h>
6+
#include "../xdisplay.h"
117

128
MMSize getMainDisplaySize(void)
139
{
14-
#if defined(IS_MACOSX)
15-
CGDirectDisplayID displayID = CGMainDisplayID();
16-
return MMSizeMake(CGDisplayPixelsWide(displayID),
17-
CGDisplayPixelsHigh(displayID));
18-
#elif defined(USE_X11)
1910
Display *display = XGetMainDisplay();
2011
const int screen = DefaultScreen(display);
2112

2213
return MMSizeMake((size_t)DisplayWidth(display, screen),
2314
(size_t)DisplayHeight(display, screen));
24-
#elif defined(IS_WINDOWS)
25-
return MMSizeMake((size_t)GetSystemMetrics(SM_CXSCREEN),
26-
(size_t)GetSystemMetrics(SM_CYSCREEN));
27-
#endif
2815
}
2916

3017
bool pointVisibleOnMainDisplay(MMPoint point)

src/macos/screen.c

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "../screen.h"
2+
#include "../os.h"
3+
#include "../highlightwindow.h"
4+
5+
#include <ApplicationServices/ApplicationServices.h>
6+
7+
MMSize getMainDisplaySize(void)
8+
{
9+
CGDirectDisplayID displayID = CGMainDisplayID();
10+
return MMSizeMake(CGDisplayPixelsWide(displayID),
11+
CGDisplayPixelsHigh(displayID));
12+
}
13+
14+
bool pointVisibleOnMainDisplay(MMPoint point)
15+
{
16+
MMSize displaySize = getMainDisplaySize();
17+
return point.x < displaySize.width && point.y < displaySize.height;
18+
}
19+
20+
void highlight(int32_t x, int32_t y, int32_t width, int32_t height, long duration, float opacity) {
21+
showHighlightWindow(x, y, width, height, duration, opacity);
22+
}

src/win32/screen.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "../screen.h"
2+
#include "../os.h"
3+
#include "../highlightwindow.h"
4+
5+
MMSize getMainDisplaySize(void)
6+
{
7+
return MMSizeMake((size_t)GetSystemMetrics(SM_CXSCREEN),
8+
(size_t)GetSystemMetrics(SM_CYSCREEN));
9+
}
10+
11+
bool pointVisibleOnMainDisplay(MMPoint point)
12+
{
13+
MMSize displaySize = getMainDisplaySize();
14+
return point.x < displaySize.width && point.y < displaySize.height;
15+
}
16+
17+
void highlight(int32_t x, int32_t y, int32_t width, int32_t height, long duration, float opacity) {
18+
showHighlightWindow(x, y, width, height, duration, opacity);
19+
}

0 commit comments

Comments
 (0)