chore: remove dev method PortalInputCapture::fakeEisFd
This commit is contained in:
parent
9413393057
commit
ae5ba4e51f
2 changed files with 4 additions and 39 deletions
|
|
@ -68,33 +68,6 @@ gboolean PortalInputCapture::timeoutHandler() const
|
||||||
return true; // keep re-triggering
|
return true; // keep re-triggering
|
||||||
}
|
}
|
||||||
|
|
||||||
int PortalInputCapture::fakeEisFd() const
|
|
||||||
{
|
|
||||||
auto path = std::getenv("LIBEI_SOCKET");
|
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
LOG_DEBUG("cannot fake eis socket, env var not set: LIBEI_SOCKET");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto sock = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0);
|
|
||||||
|
|
||||||
// Dealing with the socket directly because nothing in lib/... supports
|
|
||||||
// AF_UNIX and I'm too lazy to fix all this for a temporary hack
|
|
||||||
int fd = sock;
|
|
||||||
struct sockaddr_un addr = {
|
|
||||||
.sun_family = AF_UNIX,
|
|
||||||
.sun_path = {0},
|
|
||||||
};
|
|
||||||
std::snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path);
|
|
||||||
|
|
||||||
if (auto result = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); result != 0) {
|
|
||||||
LOG_DEBUG("faked eis fd failed: %s", strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
return sock;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PortalInputCapture::handleSessionClosed(XdpSession *session)
|
void PortalInputCapture::handleSessionClosed(XdpSession *session)
|
||||||
{
|
{
|
||||||
LOG_ERR("portal input capture session was closed, exiting");
|
LOG_ERR("portal input capture session was closed, exiting");
|
||||||
|
|
@ -123,17 +96,11 @@ void PortalInputCapture::handleInitSession(GObject *object, GAsyncResult *res)
|
||||||
auto fd = xdp_input_capture_session_connect_to_eis(session, &error);
|
auto fd = xdp_input_capture_session_connect_to_eis(session, &error);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
LOG_ERR("failed to connect to eis: %s", error->message);
|
LOG_ERR("failed to connect to eis: %s", error->message);
|
||||||
|
g_main_loop_quit(m_glibMainLoop);
|
||||||
// FIXME: Development hack to avoid having to assemble all parts just for
|
m_events->addEvent(EventTypes::Quit);
|
||||||
// testing this code.
|
return;
|
||||||
fd = fakeEisFd();
|
|
||||||
|
|
||||||
if (fd < 0) {
|
|
||||||
g_main_loop_quit(m_glibMainLoop);
|
|
||||||
m_events->addEvent(EventTypes::Quit);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Socket ownership is transferred to the EiScreen
|
// Socket ownership is transferred to the EiScreen
|
||||||
m_events->addEvent(Event(EventTypes::EIConnected, m_screen->getEventTarget(), EiScreen::EiConnectInfo::alloc(fd)));
|
m_events->addEvent(Event(EventTypes::EIConnected, m_screen->getEventTarget(), EiScreen::EiConnectInfo::alloc(fd)));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,6 @@ private:
|
||||||
static_cast<PortalInputCapture *>(data)->handleZonesChanged(session, options);
|
static_cast<PortalInputCapture *>(data)->handleZonesChanged(session, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fakeEisFd() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Signal : uint8_t
|
enum class Signal : uint8_t
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue