foobar2000 SDK  2015-08-03
Functions
window_placement_helper.cpp File Reference

Go to the source code of this file.

Functions

static BOOL CALLBACK __MonitorEnumProc (HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
 
static bool g_is_enabled ()
 
static BOOL SetWindowSize (HWND p_wnd, unsigned p_x, unsigned p_y)
 
static bool test_rect (const RECT *rc)
 

Function Documentation

static BOOL CALLBACK __MonitorEnumProc ( HMONITOR  hMonitor,
HDC  hdcMonitor,
LPRECT  lprcMonitor,
LPARAM  dwData 
)
static

Definition at line 10 of file window_placement_helper.cpp.

15  {
16  RECT * clip = (RECT*)dwData;
17  RECT newclip;
18  if (UnionRect(&newclip,clip,lprcMonitor)) {
19  *clip = newclip;
20  }
21  return TRUE;
22 }
static bool g_is_enabled ( )
static

Definition at line 5 of file window_placement_helper.cpp.

static BOOL SetWindowSize ( HWND  p_wnd,
unsigned  p_x,
unsigned  p_y 
)
static

Definition at line 133 of file window_placement_helper.cpp.

134 {
135  if (p_x != ~0 && p_y != ~0)
136  return SetWindowPos(p_wnd,0,0,0,p_x,p_y,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
137  else
138  return FALSE;
139 }
static bool test_rect ( const RECT *  rc)
static

Definition at line 24 of file window_placement_helper.cpp.

24  {
25  RECT clip = {};
26  if (EnumDisplayMonitors(NULL,NULL,__MonitorEnumProc,(LPARAM)&clip)) {
27  const LONG sanitycheck = 4;
28  const LONG cwidth = clip.right - clip.left;
29  const LONG cheight = clip.bottom - clip.top;
30 
31  const LONG width = rc->right - rc->left;
32  const LONG height = rc->bottom - rc->top;
33 
34  if (width > cwidth * sanitycheck || height > cheight * sanitycheck) return false;
35  }
36 
37  return MonitorFromRect(rc,MONITOR_DEFAULTTONULL) != NULL;
38 }
static BOOL CALLBACK __MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)