Skip to content

Commit

Permalink
Merge pull request #27 from idietmoran/dev-win32
Browse files Browse the repository at this point in the history
Optimizations
  • Loading branch information
Stateford authored Apr 16, 2018
2 parents 4f23a1a + be24ff4 commit 8fa21e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Display Lock.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<ClCompile>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -136,7 +137,7 @@
<ClCompile>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<IntrinsicFunctions>true</IntrinsicFunctions>
<CompileAs>CompileAsC</CompileAs>
Expand Down
12 changes: 6 additions & 6 deletions src/bin/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
return TRUE;
}

void getCurrentMousePos(POINT *cursor)
inline void getCurrentMousePos(POINT *cursor)
{
GetCursorPos(cursor);
}

// checks if the cursor is within the client area of specified windows RECT object
BOOL checkClientArea(POINT* cursorPos, RECT* rect)
inline BOOL checkClientArea(POINT* cursorPos, RECT* rect)
{
return (cursorPos->y <= rect->bottom && cursorPos->y >= rect->top) && (cursorPos->x >= rect->left && cursorPos->x <= rect->right);
}

BOOL checkResizeStyle(HWND activeWindow)
inline BOOL checkResizeStyle(HWND activeWindow)
{
return (GetWindowLongPtr(activeWindow, GWL_STYLE)&WS_SIZEBOX);
}

void borderlessWindow(HWND activeWindow)
inline void borderlessWindow(HWND activeWindow)
{
SetWindowLongPtr(activeWindow, GWL_STYLE, GetWindowLongPtr(activeWindow, GWL_STYLE)^WS_OVERLAPPED^WS_THICKFRAME^WS_SYSMENU^WS_CAPTION);
SetWindowLongPtr(activeWindow, GWL_EXSTYLE, GetWindowLongPtr(activeWindow, GWL_EXSTYLE)^WS_EX_WINDOWEDGE);
Expand All @@ -80,13 +80,13 @@ void fullScreen(WINDOW activeWindow, PREVIOUSRECT *prev)
SetWindowPos(activeWindow.hWnd, NULL, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 0);
}

void disableFullScreen(WINDOW activeWindow, PREVIOUSRECT *prev)
inline void disableFullScreen(WINDOW activeWindow, PREVIOUSRECT *prev)
{
SetWindowPos(activeWindow.hWnd, NULL, prev->x, prev->y, prev->width, prev->height, 0);
}

// NOTE: this causes compiler warning, but works.
BOOL checkProcess(WINDOW activeWindow)
inline BOOL checkProcess(WINDOW activeWindow)
{
return (BOOL)GetWindow(activeWindow.hWnd, 0);
}
Expand Down
Binary file modified src/displayLock-win32.c
Binary file not shown.

0 comments on commit 8fa21e9

Please sign in to comment.