public void run() { while (m_bMonitorOn) { for (InputDevice idev:events.m_Devs) { InputEvent ie= new InputEvent(); ... eventList.add(ie); } } }
InputEvent ie= new InputEvent(); while (m_bMonitorOn) { ie= new InputEvent(); ...
public static final int STRUCT_SIZE_BYTES = 24; to this: public static final int STRUCT_SIZE_BYTES = 16; Change the parse function in the same source file as follows: public static InputEvent parse(ShortBuffer shortBuffer, String source) throws IOException { InputEvent e = new InputEvent(); short a,b,c,d; a=shortBuffer.get(); b=shortBuffer.get(); //c=shortBuffer.get(); //d=shortBuffer.get(); e.time_sec = (b<<16) | a; //(d<<48) | (c<<32) | (b<<16) | a; a=shortBuffer.get(); b=shortBuffer.get(); //c=shortBuffer.get(); //d=shortBuffer.get(); e.time_usec = (b<<16) | a; //(d<<48) | (c<<32) | (b<<16) | a; e.type = shortBuffer.get(); e.code = shortBuffer.get(); c=shortBuffer.get(); d=shortBuffer.get(); e.value = (d<<16) | c; e.source = source; return e; }
InputEvent ie = new InputEvent(); ie.setKeyCode(Keys.SWITCH_CHARSET); ie.setType(Type.keyUp); actor.fire(ie);
/** Converts an AU request to an input event. * Notice that this method will convert the value to a string object. * If it is not what you want, you have to parse it by yourself. * @param oldValue the previous value * @since 5.0.4 */ public static final InputEvent getInputEvent(AuRequest request, Object oldValue) { final Map<String, Object> data = request.getData(); final Object val = data.get("value"); return new InputEvent(request.getCommand(), request.getComponent(), val == null ? "" : val.toString(), oldValue, AuRequests.getBoolean(data, "bySelectBack"), AuRequests.getInt(data, "start", 0)); }
screenPos = new Vector2(); localPos = new Vector2(); fakeTouchDownEvent = new InputEvent(); fakeTouchDownEvent.setType(Type.touchDown);
if (listeners.length > 0) { InputEvent evt = new InputEvent(this, text); for (InputObsever obsever : listeners) { obsever.inputChanged(evt);
/** Processes an AU request. * * <p>Default: in addition to what are handled by {@link XulElement#service}, * it also handles onChange, onChanging and onError. * @since 5.0.0 */ public void service(org.zkoss.zk.au.AuRequest request, boolean everError) { final String cmd = request.getCommand(); if (cmd.equals(Events.ON_CHANGE)) { final Map<String, Object> data = request.getData(); final Object value = data.get("value"); if (Objects.equals(_value, value)) return; //nothing happen _value = (Date) value; final InputEvent evt = new InputEvent(cmd, this, getDateFormat().format(value), value, AuRequests.getBoolean(data, "bySelectBack"), AuRequests.getInt(data, "start", 0)); Events.postEvent(evt); } else { super.service(request, everError); } }
Events.postEvent(new InputEvent(Events.ON_CHANGE, this, val, val)); Events.postEvent(evt); } else if (cmd.equals(Events.ON_CHANGE)) {
return; //Bug 1881557: don't post event if not modified final InputEvent evt = new InputEvent(cmd, this, valstr, oldval, //20101022, henrichen: for backward compatible, must coerceToString AuRequests.getBoolean(data, "bySelectBack"), AuRequests.getInt(data, "start", 0)); Events.postEvent(evt); final Object clientv = data.get("value"); final Object oldval = _value; final InputEvent evt = new InputEvent(cmd, this, clientv == null ? "" : clientv.toString(), oldval, //clientv is what user input (not marshal) AuRequests.getBoolean(data, "bySelectBack"), AuRequests.getInt(data, "start", 0)); Events.postEvent(evt);
public void typing(String value) { String desktopId = target.getDesktop().getId(); String cmd = Events.ON_CHANGING; InputEvent event = new InputEvent(cmd, (Component) target.getDelegatee(), value, null); Map<String, Object> data = EventDataManager.getInstance().build(event); ((ClientCtrl) target.getClient()).postUpdate(desktopId, target.getUuid(), cmd, data, false); ((ClientCtrl) getClient()).flush(desktopId); }
public void type(String value) { try { ClientCtrl cctrl = (ClientCtrl) target.getClient(); String cmd = Events.ON_CHANGE; InputEvent event = new InputEvent(cmd, (Component) target.getDelegatee(), value, null); Map<String, Object> data = EventDataManager.getInstance().build(event); putValue(target, value, data); // parse value and put into data collection String desktopId = target.getDesktop().getId(); cctrl.postUpdate(desktopId, target.getUuid(), cmd, data, false); cctrl.flush(desktopId); } catch (Exception e) { throw new AgentException("value \"" + value + "\" is invalid for the component: " + target, e); } }