File indexing completed on 2024-05-12 17:07:17
0001 /* 0002 SPDX-FileCopyrightText: 2010 Andriy Rysin <rysin@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "x11_helper.h" 0010 0011 #include <X11/Xlib.h> 0012 #include <fixx11h.h> 0013 0014 class QTimer; 0015 class UdevDeviceNotifier; 0016 0017 class XInputEventNotifier : public XEventNotifier 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 explicit XInputEventNotifier(QWidget *parent = nullptr); 0023 0024 void start() override; 0025 void stop() override; 0026 0027 int registerForNewDeviceEvent(Display *dpy); 0028 0029 Q_SIGNALS: 0030 void newKeyboardDevice(); 0031 void newPointerDevice(); 0032 0033 protected: 0034 bool processOtherEvents(xcb_generic_event_t *event) override; 0035 0036 private: 0037 int getNewDeviceEventType(xcb_generic_event_t *event); 0038 0039 int xinputEventType; 0040 Display *display; 0041 UdevDeviceNotifier *udevNotifier; 0042 QTimer *keyboardNotificationTimer; 0043 QTimer *mouseNotificationTimer; 0044 };