public override void EnterMessageLoop(bool runInBackground) { LibEvdev.KeyDown += OnKeyDown; LibEvdev.KeyUp += OnKeyUp; LibEvdev.Char += OnChar; LibEvdev.TouchDown += OnTouchDown; LibEvdev.TouchUp += OnTouchUp; LibEvdev.TouchMove += OnTouchMove; bool running = true; while (running) { LibEvdev.HandleEvents(); Render?.Invoke(this); PageFlip(); if (_close) { bool cancel = false; Closing?.Invoke(this, ref cancel); if (!cancel) { Closed?.Invoke(this); running = false; } _close = false; } } }
public override void EnterMessageLoop(bool runInBackground) { bool running = true; SizeChanged?.Invoke(this, _width, _height); Activated?.Invoke(this); while (running) { LibEvdev.HandleEvents(); Render?.Invoke(this); } }
public override void EnterMessageLoop(bool runInBackground) { bool running = true; SizeChanged?.Invoke(this, _width, _height); Activated?.Invoke(this); IntPtr bo = Gbm.SurfaceLockFrontBuffer(_gbmSurface); uint fb = GetFbForBo(bo); IntPtr connectors = System.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(uint)); System.Runtime.InteropServices.Marshal.WriteInt32(connectors, (int)_drmConnectorId); int rc = Drm.ModeSetCrtc(_drmFd, _drmEncoderCrtcId, fb, 0, 0, connectors, 1, ref _drmMode); System.Runtime.InteropServices.Marshal.FreeHGlobal(connectors); if (rc != 0) { throw new Exception("Failed to create DRM Mode"); } while (running) { LibEvdev.HandleEvents(); Render?.Invoke(this); IntPtr prevBo = bo; bo = Gbm.SurfaceLockFrontBuffer(_gbmSurface); fb = GetFbForBo(bo); Drm.ModePageFlip(_drmFd, _drmEncoderCrtcId, fb, Drm.MODE_PAGE_FLIP_EVENT, IntPtr.Zero); LibC.PollFd fd = new LibC.PollFd(); fd.fd = _drmFd; fd.events = LibC.POLLIN | LibC.POLLPRI; LibC.PollFd[] fds = new LibC.PollFd[] { fd }; LibC.Poll(fds, -1); Drm.EventContext evctx = new Drm.EventContext(); evctx.version = 2; Drm.HandleEvent(_drmFd, ref evctx); if (prevBo != IntPtr.Zero) { Gbm.SurfaceReleaseBuffer(_gbmSurface, prevBo); } } }
public override void EnterMessageLoop(bool runInBackground) { bool running = true; SizeChanged?.Invoke(this, _width, _height); Activated?.Invoke(this); while (running) { LibEvdev.HandleEvents(); Render?.Invoke(this); if (_close) { bool cancel = false; Closing?.Invoke(this, ref cancel); if (!cancel) { Closed?.Invoke(this); running = false; } _close = false; } } }