MCPcopy Create free account
hub / github.com/WallBreaker2/op / BindWindowEx

Method BindWindowEx

libop/binding/BindingSession.cpp:154–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154long BindingSession::BindWindowEx(LONG_PTR display_hwnd, LONG_PTR input_hwnd, const wstring &sdisplay,
155 const wstring &smouse, const wstring &skeypad, long mode) {
156 // step 1.避免重复绑定
157 reset_bind_state(false);
158
159 HWND displayWnd = display_hwnd == 0 ? GetDesktopWindow() : HWND(display_hwnd);
160 HWND inputWnd = input_hwnd == 0 ? displayWnd : HWND(input_hwnd);
161 // step 2.check hwnd
162 if (!::IsWindow(displayWnd) || !::IsWindow(inputWnd)) {
163 setlog("Invalid window handles display=%p input=%p", displayWnd, inputWnd);
164 return 0;
165 }
166
167 int display, mouse, keypad;
168 std::vector<int> display_candidates;
169 const bool auto_display = sdisplay == L"normal.auto";
170 // step 3.check display... mode
171 if (auto_display) {
172 display_candidates = choose_auto_displays(displayWnd);
173 display = display_candidates.front();
174 } else if (sdisplay == L"normal")
175 display = RDT_NORMAL;
176 else if (sdisplay == L"normal.dxgi")
177 display = RDT_NORMAL_DXGI;
178 else if (sdisplay == L"normal.wgc")
179 display = RDT_NORMAL_WGC;
180 else if (sdisplay == L"gdi")
181 display = RDT_GDI;
182 else if (sdisplay == L"gdi2")
183 display = RDT_GDI2;
184 else if (sdisplay == L"dx2")
185 display = RDT_GDI_DX2;
186 else if (sdisplay == L"dx")
187 display = RDT_DX_DEFAULT;
188 else if (sdisplay == L"dx.d3d9")
189 display = RDT_DX_D3D9;
190 else if (sdisplay == L"dx.d3d10")
191 display = RDT_DX_D3D10;
192 else if (sdisplay == L"dx.d3d11")
193 display = RDT_DX_D3D11;
194 else if (sdisplay == L"dx.d3d12")
195 display = RDT_DX_D3D12;
196 else if (sdisplay == L"opengl")
197 display = RDT_GL_DEFAULT;
198 else if (sdisplay == L"opengl.std")
199 display = RDT_GL_STD;
200 else if (sdisplay == L"opengl.nox")
201 display = RDT_GL_NOX;
202 else if (sdisplay == L"opengl.es")
203 display = RDT_GL_ES;
204 else if (sdisplay == L"opengl.fi") // glFinish
205 display = RDT_GL_FI;
206 else {
207 setlog(L"error display mode: %s", sdisplay.c_str());
208 return 0;
209 }
210 if (!auto_display)
211 display_candidates.push_back(display);

Callers

nothing calls this directly

Calls 8

setlogFunction · 0.85
choose_auto_displaysFunction · 0.85
IsWindowsVersionAtLeastFunction · 0.85
display_mode_nameFunction · 0.85
BindMethod · 0.45
sizeMethod · 0.45
waitForBindReadyMethod · 0.45

Tested by

no test coverage detected