MCPcopy Create free account
hub / github.com/SFML/SFML / initRawMouse

Function initRawMouse

src/SFML/Window/Unix/WindowImplX11.cpp:431–458  ·  view source on GitHub ↗

Initialize raw mouse input

Source from the content-addressed store, hash-verified

429
430// Initialize raw mouse input
431bool initRawMouse(::Display* disp)
432{
433 int opcode = 0;
434 int event = 0;
435 int error = 0;
436
437 if (XQueryExtension(disp, "XInputExtension", &opcode, &event, &error))
438 {
439 int major = 2;
440 int minor = 0;
441
442 if (XIQueryVersion(disp, &major, &minor) != BadRequest)
443 {
444 std::array<unsigned char, XIMaskLen(XI_LASTEVENT)> mask{};
445 XISetMask(mask.data(), XI_RawMotion);
446
447 XIEventMask xiEventMask;
448 xiEventMask.deviceid = XIAllDevices;
449 xiEventMask.mask_len = mask.size();
450 xiEventMask.mask = mask.data();
451
452 if (XISelectEvents(disp, DefaultRootWindow(disp), &xiEventMask, 1) == Success)
453 return true;
454 }
455 }
456
457 return false;
458}
459} // namespace WindowImplX11Impl
460} // namespace
461

Callers 1

initializeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected