mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 23:21:29 +00:00
evdev_stop was never called, and calling it revealed unsafe teardown: the device list was freed before the thread was joined, a zero epoll descriptor was mistaken for a valid one, and the device loops walked past the end of the array through a sentinel that does not exist. Join the thread in evdev_stop and defer the rest to the new evdev_free. The display server grab hooks route into evdev until its event thread is joined, so the device state must stay valid until the display server has been freed; evdev_free then restores the hooks and releases the state.
58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/**
|
|
* Looking Glass
|
|
* Copyright © 2017-2026 The Looking Glass Authors
|
|
* https://looking-glass.io
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the Free
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc., 59
|
|
* Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* initialize configuration options
|
|
*/
|
|
void evdev_earlyInit(void);
|
|
|
|
/**
|
|
* start the evdev layer
|
|
*/
|
|
bool evdev_start(void);
|
|
|
|
/**
|
|
* join the evdev thread; device state stays valid for callbacks
|
|
*/
|
|
void evdev_stop(void);
|
|
|
|
/**
|
|
* restore the display server hooks and free the device state; only
|
|
* call once display server callbacks have stopped
|
|
*/
|
|
void evdev_free(void);
|
|
|
|
/**
|
|
* grab the keyboard for exclusive access
|
|
*/
|
|
void evdev_grabKeyboard(void);
|
|
|
|
/**
|
|
* ungrab the keyboard
|
|
*/
|
|
void evdev_ungrabKeyboard(void);
|
|
|
|
/**
|
|
* returns true if input should only be processed by evdev
|
|
*/
|
|
bool evdev_isExclusive(void);
|