public void AttachHandler(IOHandler h) { handler = h; if(!XLibHelper.IsAvailable) { MessageDialog.ShowError("libX11 library not found"); return; } int pid; try { pid = source.ParentWindow.Id; } catch(DllNotFoundException) { MessageDialog.ShowError("gdk x11 library not found"); return; } XLibHelper.GrabCursorByWindow(pid); XLibHelper.MoveCursorAbsolute(pid, (int)(source.ParentWindow.Size.Width / 2), (int)(source.ParentWindow.Size.Height / 2)); XLibHelper.StartEventListenerLoop(this); }
public void AttachHandler(IOHandler h) { handler = h; source.MouseMoved += HandleMouseMoved; source.ButtonPressed += HandleButtonPressed; source.ButtonReleased += HandleButtonReleased; source.KeyPressed += HandleKeyPressed; source.KeyReleased += HandleKeyReleased; }