| 45 * Return TRUE if successful, otherwise FALSE |
45 * Return TRUE if successful, otherwise FALSE |
| 46 */ |
46 */ |
| 47 static gboolean |
47 static gboolean |
| 48 get_rect_from_monitor(HMODULE hmod, HMONITOR monitor, RECT *rect) { |
48 get_rect_from_monitor(HMODULE hmod, HMONITOR monitor, RECT *rect) { |
| 49 gaim_GetMonitorInfo *the_GetMonitorInfo; |
49 gaim_GetMonitorInfo *the_GetMonitorInfo; |
| |
50 MONITORINFO info; |
| 50 |
51 |
| 51 if (!(the_GetMonitorInfo = (gaim_GetMonitorInfo*) |
52 if (!(the_GetMonitorInfo = (gaim_GetMonitorInfo*) |
| 52 GetProcAddress(hmod, "GetMonitorInfoA"))) { |
53 GetProcAddress(hmod, "GetMonitorInfoA"))) { |
| 53 return FALSE; |
54 return FALSE; |
| 54 } |
55 } |
| 55 |
56 |
| 56 MONITORINFO info; |
|
| 57 info.cbSize = sizeof(info); |
57 info.cbSize = sizeof(info); |
| 58 if (!the_GetMonitorInfo(monitor, &info)) { |
58 if (!the_GetMonitorInfo(monitor, &info)) { |
| 59 return FALSE; |
59 return FALSE; |
| 60 } |
60 } |
| 61 |
61 |
| 69 * Return TRUE if successful, otherwise FALSE |
69 * Return TRUE if successful, otherwise FALSE |
| 70 */ |
70 */ |
| 71 static gboolean |
71 static gboolean |
| 72 get_rect_at_point_multimonitor(POINT pt, RECT *rect) { |
72 get_rect_at_point_multimonitor(POINT pt, RECT *rect) { |
| 73 HMODULE hmod; |
73 HMODULE hmod; |
| |
74 gaim_MonitorFromPoint *the_MonitorFromPoint; |
| |
75 HMONITOR monitor; |
| 74 |
76 |
| 75 if (!(hmod = GetModuleHandle("user32"))) { |
77 if (!(hmod = GetModuleHandle("user32"))) { |
| 76 return FALSE; |
78 return FALSE; |
| 77 } |
79 } |
| 78 |
80 |
| 79 gaim_MonitorFromPoint *the_MonitorFromPoint; |
|
| 80 if (!(the_MonitorFromPoint = (gaim_MonitorFromPoint*) |
81 if (!(the_MonitorFromPoint = (gaim_MonitorFromPoint*) |
| 81 GetProcAddress(hmod, "MonitorFromPoint"))) { |
82 GetProcAddress(hmod, "MonitorFromPoint"))) { |
| 82 return FALSE; |
83 return FALSE; |
| 83 } |
84 } |
| 84 |
85 |
| 85 HMONITOR monitor = |
86 monitor = |
| 86 the_MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); |
87 the_MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); |
| 87 |
88 |
| 88 return get_rect_from_monitor(hmod, monitor, rect); |
89 return get_rect_from_monitor(hmod, monitor, rect); |
| 89 } |
90 } |
| 90 |
91 |
| 93 * Return TRUE if successful, otherwise FALSE |
94 * Return TRUE if successful, otherwise FALSE |
| 94 */ |
95 */ |
| 95 static gboolean |
96 static gboolean |
| 96 get_rect_of_window_multimonitor(HWND window, RECT *rect) { |
97 get_rect_of_window_multimonitor(HWND window, RECT *rect) { |
| 97 HMODULE hmod; |
98 HMODULE hmod; |
| |
99 gaim_MonitorFromWindow *the_MonitorFromWindow; |
| |
100 HMONITOR monitor; |
| 98 |
101 |
| 99 if (!(hmod = GetModuleHandle("user32"))) { |
102 if (!(hmod = GetModuleHandle("user32"))) { |
| 100 return FALSE; |
103 return FALSE; |
| 101 } |
104 } |
| 102 |
105 |
| 103 gaim_MonitorFromWindow *the_MonitorFromWindow; |
|
| 104 if (!(the_MonitorFromWindow = (gaim_MonitorFromWindow*) |
106 if (!(the_MonitorFromWindow = (gaim_MonitorFromWindow*) |
| 105 GetProcAddress(hmod, "MonitorFromWindow"))) { |
107 GetProcAddress(hmod, "MonitorFromWindow"))) { |
| 106 return FALSE; |
108 return FALSE; |
| 107 } |
109 } |
| 108 |
110 |
| 109 HMONITOR monitor = |
111 monitor = |
| 110 the_MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); |
112 the_MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY); |
| 111 |
113 |
| 112 return get_rect_from_monitor(hmod, monitor, rect); |
114 return get_rect_from_monitor(hmod, monitor, rect); |
| 113 } |
115 } |
| 114 |
116 |