mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
Patch 2/5 xfree86: libseat support, wireup libseat
Refactor libseat code for Xlibre and add to meson.build:
* update meson for seat-libseat
* refactor code:
* seatd-libseat.c - add aditional private include headers
* add cast to libseat_set_log_handler argument 1 for (libseat_log_func),
for warning silencing
* make seatd_libseat_init to accept keeptty state as parameter
* include xf86Events, xf86_priv - make visible xf86VTLeave for seatd code (it
is neccesary because seatd can force console leave)
Signed-off-By: Tautvis <gtautvis@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
|
||||
#ifdef SEATD_LIBSEAT
|
||||
#include <xf86Xinput.h>
|
||||
extern int seatd_libseat_init(void);
|
||||
extern int seatd_libseat_init(Bool KeepTty_state);
|
||||
extern void seatd_libseat_fini(void);
|
||||
extern int seatd_libseat_open_graphics(const char *path);
|
||||
extern void seatd_libseat_open_device(InputInfoPtr p,int *fd,Bool *paus);
|
||||
@@ -37,13 +37,15 @@ extern void seatd_libseat_close_device(InputInfoPtr p);
|
||||
extern int seatd_libseat_switch_session(int session);
|
||||
extern Bool seatd_libseat_controls_session(void);
|
||||
#else
|
||||
#define seatd_libseat_init()
|
||||
#define seatd_libseat_fini()
|
||||
#define seatd_libseat_open_graphics(path) -1
|
||||
#define seatd_libseat_open_device(p,x,y)
|
||||
#define seatd_libseat_close_device(p)
|
||||
#define seatd_libseat_switch_session(int) -1
|
||||
#define seatd_libseat_controls_session() FALSE
|
||||
|
||||
static inline int seatd_libseat_init(bool KeepTty_state) {(void)KeepTty_state; return -1; };
|
||||
static inline void seatd_libseat_fini(void) {};
|
||||
static inline int seatd_libseat_open_graphics(const char *path) {(void)path; return -1; }
|
||||
static inline void seatd_libseat_open_device(void *p,int *fd, Bool *paus) { (void)p;(void)fd;(void)paus; };
|
||||
static inline void seatd_libseat_close_device(void *p) { (void)p;};
|
||||
static inline int seatd_libseat_switch_session(int session) { return -1; };
|
||||
static inline Bool seatd_libseat_controls_session(void) { return FALSE; };
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -363,7 +363,7 @@ void xf86DisableGeneralHandler(void *handler) {
|
||||
_xf86DisableGeneralHandler(handler);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
xf86VTLeave(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -65,6 +65,7 @@ InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, void *data);
|
||||
void xf86ProcessActionEvent(ActionEvent action, void *arg);
|
||||
Bool xf86VTOwner(void);
|
||||
void xf86VTEnter(void);
|
||||
void xf86VTLeave(void);
|
||||
void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo);
|
||||
void xf86Wakeup(void *blockData, int err);
|
||||
void xf86HandlePMEvents(int fd, void *data);
|
||||
|
||||
@@ -51,6 +51,7 @@ if host_machine.system() == 'linux'
|
||||
srcs_xorg_os_support += 'linux/systemd-logind.c'
|
||||
endif
|
||||
|
||||
|
||||
# this is ugly because the code is also
|
||||
if build_apm or build_acpi
|
||||
srcs_xorg_os_support += 'linux/lnx_apm.c'
|
||||
@@ -157,6 +158,15 @@ else
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'linux' or host_machine.system() == 'dragonfly' or host_machine.system().endswith('bsd')
|
||||
|
||||
if build_seatd_libseat
|
||||
srcs_xorg_os_support += 'shared/seatd-libseat.c'
|
||||
os_dep += seat_libseat_dep
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
xorg_os_support = static_library('xorg_os_support',
|
||||
srcs_xorg_os_support,
|
||||
include_directories: [inc, xorg_inc],
|
||||
|
||||
@@ -36,12 +36,17 @@
|
||||
#include <libseat.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "linux.h"
|
||||
#include "xf86.h"
|
||||
#include "xf86_priv.h"
|
||||
#include "xf86platformBus.h"
|
||||
#include "xf86Xinput.h"
|
||||
#include "xf86Xinput_priv.h"
|
||||
#include "xf86Priv.h"
|
||||
#include "globals.h"
|
||||
|
||||
#include "config/hotplug_priv.h"
|
||||
#include "xf86platformBus_priv.h"
|
||||
|
||||
#include "seatd-libseat.h"
|
||||
|
||||
/* ============ libseat client adapter ====================== */
|
||||
@@ -160,7 +165,7 @@ event_handler(int fd, int ready, void *data)
|
||||
/*
|
||||
* Handle libseat logging.
|
||||
*/
|
||||
static void
|
||||
static _X_ATTRIBUTE_PRINTF(2, 0) void
|
||||
log_libseat(enum libseat_log_level level, const char *fmt, va_list args)
|
||||
{
|
||||
MessageType xmt;
|
||||
@@ -192,6 +197,8 @@ log_libseat(enum libseat_log_level level, const char *fmt, va_list args)
|
||||
/*
|
||||
* Initialise the libseat client.
|
||||
*
|
||||
* @param KeepTty_state - the KeepTty parameter value
|
||||
*
|
||||
* Returns:
|
||||
* 0 if all ok
|
||||
* 1 if not possible
|
||||
@@ -199,17 +206,17 @@ log_libseat(enum libseat_log_level level, const char *fmt, va_list args)
|
||||
* -EPIPE (-32) if the seat opening failed.
|
||||
*/
|
||||
int
|
||||
seatd_libseat_init(void)
|
||||
seatd_libseat_init(Bool KeepTty_state)
|
||||
{
|
||||
if (!ServerIsNotSeat0() && xf86HasTTYs() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) {
|
||||
LogMessage(X_INFO,
|
||||
if (!ServerIsNotSeat0() && xf86HasTTYs() && !KeepTty_state) {
|
||||
LogMessage(X_WARNING,
|
||||
"seat-libseat: libseat integration requires -keeptty which "
|
||||
"was not provided, disabling\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
libseat_set_log_level(LIBSEAT_LOG_LEVEL_DEBUG);
|
||||
libseat_set_log_handler(log_libseat);
|
||||
libseat_set_log_handler((libseat_log_func)log_libseat);
|
||||
LogMessage(X_INFO, "seatd_libseat init\n");
|
||||
if (libseat_active()) {
|
||||
LogMessage(X_ERROR, "seatd_libseat already initialised\n");
|
||||
@@ -304,7 +311,7 @@ check_duplicate_device(int maj, int min) {
|
||||
void
|
||||
seatd_libseat_open_device(InputInfoPtr p, int *pfd, Bool *paused)
|
||||
{
|
||||
int id, fd;
|
||||
int id = -1, fd = -1;
|
||||
char *path = xf86CheckStrOption(p->options, "Device", NULL);
|
||||
|
||||
if (!libseat_active()) {
|
||||
|
||||
@@ -92,6 +92,7 @@ conf_data.set('CONFIG_UDEV', build_udev ? '1' : false)
|
||||
conf_data.set('CONFIG_UDEV_KMS', build_udev_kms ? '1' : false)
|
||||
conf_data.set('HAVE_DBUS', build_dbus ? '1' : false)
|
||||
conf_data.set('CONFIG_HAL', build_hal ? '1' : false)
|
||||
conf_data.set('SEATD_LIBSEAT', build_seatd_libseat ? '1' : false)
|
||||
conf_data.set('SYSTEMD_LOGIND', build_systemd_logind ? '1' : false)
|
||||
conf_data.set('NEED_DBUS', build_systemd_logind or build_hal ? '1' : false)
|
||||
conf_data.set('CONFIG_WSCONS', host_machine.system() in ['openbsd', 'netbsd'] ? '1' : false)
|
||||
|
||||
16
meson.build
16
meson.build
@@ -115,6 +115,9 @@ xfont2_dep = dependency('xfont2', version: '>= 2.0')
|
||||
dbus_required = get_option('systemd_logind') == 'true'
|
||||
dbus_dep = dependency('dbus-1', version: '>= 1.0', required: dbus_required)
|
||||
|
||||
seat_libseat_required = get_option('seatd_libseat') == 'true'
|
||||
seat_libseat_dep = dependency('libseat', version: '>= 0.9.1', required: seat_libseat_required)
|
||||
|
||||
build_systemd = get_option('systemd_notify') == 'true'
|
||||
# libsystemd-daemon was moved into libsystemd in version 209
|
||||
libsystemd_daemon_dep = dependency('libsystemd', version: '>= 209', required: false)
|
||||
@@ -197,12 +200,23 @@ endif
|
||||
build_udev = (udev_option != 'false')
|
||||
build_udev_kms = (udev_kms_option != 'false')
|
||||
|
||||
if get_option('seatd_libseat') == 'auto'
|
||||
build_seatd_libseat = build_udev_kms and seat_libseat_dep.found()
|
||||
else
|
||||
build_seatd_libseat = get_option('seatd_libseat') == 'true'
|
||||
endif
|
||||
|
||||
|
||||
if get_option('systemd_logind') == 'auto'
|
||||
build_systemd_logind = build_udev_kms and dbus_dep.found()
|
||||
build_systemd_logind = build_udev_kms and dbus_dep.found() and not build_seatd_libseat
|
||||
else
|
||||
build_systemd_logind = get_option('systemd_logind') == 'true'
|
||||
endif
|
||||
|
||||
if build_systemd_logind and build_seatd_libseat
|
||||
error('Support for systemd-logind and seatd-libseat are mutually exclusive: choose either.')
|
||||
endif
|
||||
|
||||
with_dtrace = get_option('dtrace')
|
||||
if with_dtrace
|
||||
dtrace = find_program('dtrace', required: true)
|
||||
|
||||
@@ -85,6 +85,10 @@ option('systemd_notify', type: 'combo', choices: ['true', 'false', 'auto'], valu
|
||||
description: 'Enable systemd-notify support')
|
||||
option('systemd_logind', type: 'combo', choices: ['true', 'false', 'auto'], value: 'false',
|
||||
description: 'Enable systemd-logind integration')
|
||||
|
||||
option('seatd_libseat', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
|
||||
description: 'Enable seatd-libseat integration')
|
||||
|
||||
option('vgahw', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
|
||||
description: 'Xorg VGA access module')
|
||||
option('dpms', type: 'boolean', value: true,
|
||||
|
||||
Reference in New Issue
Block a user