* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include <time.h>
#include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/module.h"
#include "chardev/char-serial.h"
#include "ui/console.h"
#include "ui/input.h"
#include "trace.h"
+#include "qom/object.h"
#define WC_OUTPUT_BUF_MAX_LEN 512
};
/* This structure is used to save private info for Wacom Tablet. */
-typedef struct {
+struct TabletChardev {
Chardev parent;
QemuInputHandlerState *hs;
int axis[INPUT_AXIS__MAX];
bool btns[INPUT_BUTTON__MAX];
-} TabletChardev;
+};
+typedef struct TabletChardev TabletChardev;
#define TYPE_CHARDEV_WCTABLET "chardev-wctablet"
-#define WCTABLET_CHARDEV(obj) \
- OBJECT_CHECK(TabletChardev, (obj), TYPE_CHARDEV_WCTABLET)
+DECLARE_INSTANCE_CHECKER(TabletChardev, WCTABLET_CHARDEV,
+ TYPE_CHARDEV_WCTABLET)
static void wctablet_chr_accept_input(Chardev *chr);
}
}
-static QemuInputHandler wctablet_handler = {
- .name = "QEMU Wacome Pen Tablet",
+static const QemuInputHandler wctablet_handler = {
+ .name = "QEMU Wacom Pen Tablet",
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS,
.event = wctablet_input_event,
.sync = wctablet_input_sync,
{
TabletChardev *tablet = WCTABLET_CHARDEV(obj);
- qemu_input_handler_unregister(tablet->hs);
- g_free(tablet);
+ if (tablet->hs) {
+ qemu_input_handler_unregister(tablet->hs);
+ }
}
static void wctablet_chr_open(Chardev *chr,