All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.moaxcp.x11.protocol.xinput.DeviceCtl Maven / Gradle / Ivy

There is a newer version: 0.18.2
Show newest version
package com.github.moaxcp.x11.protocol.xinput;

import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.XStruct;

import java.io.IOException;

public interface DeviceCtl extends XStruct {
  static DeviceCtl readDeviceCtl(X11Input in) throws IOException {
    short controlId = in.readCard16();
    short len = in.readCard16();
    DeviceControl deviceControl = DeviceControl.getByCode(controlId);
    if(deviceControl == DeviceControl.RESOLUTION) {
      return DeviceCtlResolution.readDeviceCtlResolution(controlId, len, in);
    }
    if(deviceControl == DeviceControl.ABS_CALIB) {
      return DeviceCtlAbsCalib.readDeviceCtlAbsCalib(controlId, len, in);
    }
    if(deviceControl == DeviceControl.CORE) {
      return DeviceCtlCore.readDeviceCtlCore(controlId, len, in);
    }
    if(deviceControl == DeviceControl.ENABLE) {
      return DeviceCtlEnable.readDeviceCtlEnable(controlId, len, in);
    }
    if(deviceControl == DeviceControl.ABS_AREA) {
      return DeviceCtlAbsArea.readDeviceCtlAbsArea(controlId, len, in);
    }
    throw new IllegalStateException("Could not find class for " + deviceControl);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy