16 RECT * clip = (RECT*)dwData;
18 if (UnionRect(&newclip,clip,lprcMonitor)) {
27 const LONG sanitycheck = 4;
28 const LONG cwidth = clip.right - clip.left;
29 const LONG cheight = clip.bottom - clip.top;
31 const LONG width = rc->right - rc->left;
32 const LONG height = rc->bottom - rc->top;
34 if (width > cwidth * sanitycheck || height > cheight * sanitycheck)
return false;
37 return MonitorFromRect(rc,MONITOR_DEFAULTTONULL) != NULL;
43 WINDOWPLACEMENT wp = {};
45 wp.length =
sizeof(wp);
46 if (!GetWindowPlacement(window,&wp)) {
47 PFC_ASSERT(!
"GetWindowPlacement fail!");
48 memset(&wp,0,
sizeof(wp));
78 if (SetWindowPlacement(window,&
m_data))
104 PFC_ASSERT(IsWindow(window));
116 if (p_sizehint == 0)
return;
117 WINDOWPLACEMENT temp;
119 p_stream->read_object(&temp,
sizeof(temp),p_abort);
120 }
catch(exception_io_data) {
return;}
121 if (temp.length ==
sizeof(temp))
m_data = temp;
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);
169 if (GetWindowRect(p_wnd,&r))
194 PFC_ASSERT(IsWindow(window));
200 p_stream->write_lendian_t(
m_width,p_abort);
201 p_stream->write_lendian_t(
m_height,p_abort);
207 if (p_sizehint == 0)
return;
210 p_stream->read_lendian_t(width,p_abort);
211 p_stream->read_lendian_t(height,p_abort);
212 }
catch(exception_io_data) {
return;}
void on_window_destruction(HWND window)
static BOOL CALLBACK __MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
typedef BOOL(WINAPI *pPowerSetRequest_t)(__in HANDLE PowerRequest
static bool test_rect(const RECT *rc)
bool read_from_window(HWND window)
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
cfg_window_placement(const GUID &p_guid)
t_size add_item(const T &item)
void on_window_creation_silent(HWND window)
static bool g_is_enabled()
bool on_window_creation(HWND window)
pfc::list_hybrid_t< HWND, 2 > m_windows
pfc::list_hybrid_t< HWND, 2 > m_windows
cfg_window_size(const GUID &p_guid)
void get_data_raw(stream_writer *p_stream, abort_callback &p_abort)
Retrieves state of the variable. Called only from main thread, when writing configuration file...
static bool query_remember_window_positions()
void remove_item(const T &item)
static BOOL SetWindowSize(HWND p_wnd, unsigned p_x, unsigned p_y)
void on_window_destruction(HWND window)
void set_data_raw(stream_reader *p_stream, t_size p_sizehint, abort_callback &p_abort)
Sets state of the variable. Called only from main thread, when reading configuration file...
bool read_from_window(HWND window)
Base class for configuration variable classes; provides self-registration mechaisms and methods to se...
bool on_window_creation(HWND window)
bool have_item(const t_search &p_item) const