| 192 | } |
| 193 | |
| 194 | void CursorCapture::Capture() { |
| 195 | CaptureCursorBitmap cursor_bitmap; |
| 196 | CURSORINFO ci = {0}; |
| 197 | HICON icon; |
| 198 | ci.cbSize = sizeof(ci); |
| 199 | |
| 200 | if (!GetCursorInfo(&ci)) { |
| 201 | cursor_bitmap.visible_ = true; |
| 202 | return; |
| 203 | } |
| 204 | cursor_bitmap.visible_ = (ci.flags & CURSOR_SHOWING) == CURSOR_SHOWING; |
| 205 | cursor_bitmap.x_ = ci.ptScreenPos.x; |
| 206 | cursor_bitmap.y_ = ci.ptScreenPos.y; |
| 207 | |
| 208 | static HCURSOR cursor_arrow = LoadCursorW(nullptr, IDC_ARROW); |
| 209 | static HCURSOR cursor_ibeam = LoadCursorW(nullptr, IDC_IBEAM); |
| 210 | static HCURSOR cursor_wait = LoadCursorW(nullptr, IDC_WAIT); |
| 211 | static HCURSOR cursor_cross = LoadCursorW(nullptr, IDC_CROSS); |
| 212 | static HCURSOR cursor_uparrow = LoadCursorW(nullptr, IDC_UPARROW); |
| 213 | static HCURSOR cursor_size = LoadCursorW(nullptr, IDC_SIZE); |
| 214 | static HCURSOR cursor_icon = LoadCursorW(nullptr, IDC_ICON); |
| 215 | static HCURSOR cursor_sizenwse = LoadCursorW(nullptr, IDC_SIZENWSE); |
| 216 | static HCURSOR cursor_sizenesw = LoadCursorW(nullptr, IDC_SIZENESW); |
| 217 | static HCURSOR cursor_sizewe = LoadCursorW(nullptr, IDC_SIZEWE); |
| 218 | static HCURSOR cursor_sizens = LoadCursorW(nullptr, IDC_SIZENS); |
| 219 | static HCURSOR cursor_sizeall = LoadCursorW(nullptr, IDC_SIZEALL); |
| 220 | static HCURSOR cursor_hand = LoadCursorW(nullptr, IDC_HAND); |
| 221 | static HCURSOR cursor_help = LoadCursorW(nullptr, IDC_HELP); |
| 222 | static HCURSOR cursor_pin = LoadCursorW(nullptr, IDC_PIN); |
| 223 | static HCURSOR cursor_person = LoadCursorW(nullptr, IDC_PERSON); |
| 224 | |
| 225 | if (ci.hCursor == cursor_arrow) { |
| 226 | cursor_bitmap.type_ = CursorInfoSync::kIdcArrow; |
| 227 | } else if (ci.hCursor == cursor_ibeam) { |
| 228 | cursor_bitmap.type_ = CursorInfoSync::kIdcIBeam; |
| 229 | } else if (ci.hCursor == cursor_wait) { |
| 230 | cursor_bitmap.type_ = CursorInfoSync::kIdcWait; |
| 231 | } else if (ci.hCursor == cursor_cross) { |
| 232 | cursor_bitmap.type_ = CursorInfoSync::kIdcCross; |
| 233 | } else if (ci.hCursor == cursor_uparrow) { |
| 234 | cursor_bitmap.type_ = CursorInfoSync::kIdcUpArrow; |
| 235 | } else if (ci.hCursor == cursor_size) { |
| 236 | cursor_bitmap.type_ = CursorInfoSync::kIdcSize; |
| 237 | } else if (ci.hCursor == cursor_icon) { |
| 238 | cursor_bitmap.type_ = CursorInfoSync::kIdcIcon; |
| 239 | } else if (ci.hCursor == cursor_sizenwse) { |
| 240 | cursor_bitmap.type_ = CursorInfoSync::kIdcSizeNWSE; |
| 241 | } else if (ci.hCursor == cursor_sizenesw) { |
| 242 | cursor_bitmap.type_ = CursorInfoSync::kIdcSizeNESW; |
| 243 | } else if (ci.hCursor == cursor_sizewe) { |
| 244 | cursor_bitmap.type_ = CursorInfoSync::kIdcSizeWE; |
| 245 | } else if (ci.hCursor == cursor_sizens) { |
| 246 | cursor_bitmap.type_ = CursorInfoSync::kIdcSizeNS; |
| 247 | } else if (ci.hCursor == cursor_sizeall) { |
| 248 | cursor_bitmap.type_ = CursorInfoSync::kIdcSizeAll; |
| 249 | } else if (ci.hCursor == cursor_hand) { |
| 250 | cursor_bitmap.type_ = CursorInfoSync::kIdcHand; |
| 251 | } else if (ci.hCursor == cursor_help) { |
nothing calls this directly
no test coverage detected