我需要一些帮助来隐藏和禁用鼠标指针。但我需要将所有鼠标事件发送到其他设备。 所以主要的场景是:打开SWT应用程序 - >按下按钮(或标签,或你想要什么...) - >消失鼠标SWT端,无指针,无事件 - >鼠标指针出现在其他设备 - - >我可以从主要的物理鼠标控制其他设备的鼠标指针。SWT和完全禁用和隐藏鼠标指针
我现在发现的是如何使指针透明,我想到了可以每20ms修复一次位置的计时器。但我怎样才能防止事件发生?我还能抓住他们吗?
问候
更新:
最终的解决方案:新的全屏窗口半透明
public class AntiMouseGui {
Display display;
Shell shell;
final int time = 20;
private Runnable timer = null;
public AntiMouseGui(final Display display, final DebugForm df, final PrintWriter socketOut) {
Image bg = new Image(display, "icons/hide_mouse_wallpapaer.png");
shell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
final int dis_x = display.getClientArea().width, dis_y = display.getClientArea().height;
shell.setSize(dis_x, dis_y);
shell.setBackgroundImage(bg);
shell.setAlpha(50);
shell.setMinimumSize(shell.getSize());
shell.open();
timer = new Runnable() {
public void run() {
Point cur_loc = display.getCursorLocation();
int span_x = dis_x/2 - cur_loc.x, span_y = dis_y/2 - cur_loc.y;
df.appendTxt("span x = " + span_x + " span y = " + span_y);
if (span_x != 0) Controller.moveMouseRight(socketOut, -span_x);
if (span_y != 0) Controller.moveMouseDown(socketOut, -span_y);
display.setCursorLocation(new Point(dis_x/2, dis_y/2));
if (!shell.isDisposed()) display.timerExec(time, this);
}
};
display.timerExec(time, timer);
}
}
请详细说明。很难说这里到底在问什么。 – Baz
我的意思是我需要捕获鼠标事件并将它们发送到其他设备 – user1417608
从哪里抓住它们并将它们发送到哪里? – Baz