- closer to wayland support; still not tested in solid way - but wayland usage is disabled by default to allow merge back to master
This commit is contained in:
parent
8c04eb45d2
commit
6cf8d86ffa
@ -133,7 +133,9 @@ public:
|
|||||||
kde_idle_detector()
|
kde_idle_detector()
|
||||||
{}
|
{}
|
||||||
~kde_idle_detector()
|
~kde_idle_detector()
|
||||||
{}
|
{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
// Idle timeout is in msec
|
// Idle timeout is in msec
|
||||||
void start(int idle_timeout)
|
void start(int idle_timeout)
|
||||||
@ -145,12 +147,14 @@ public:
|
|||||||
registry.on_global() = [&] (uint32_t name, const std::string& interface, uint32_t version)
|
registry.on_global() = [&] (uint32_t name, const std::string& interface, uint32_t version)
|
||||||
{
|
{
|
||||||
if (interface == wayland::seat_t::interface_name)
|
if (interface == wayland::seat_t::interface_name)
|
||||||
registry.bind(name, seat, version);
|
registry.bind(name, this->seat, version);
|
||||||
|
else
|
||||||
if (interface == wayland::org_kde_kwin_idle_t::interface_name)
|
if (interface == wayland::org_kde_kwin_idle_t::interface_name)
|
||||||
registry.bind(name, idle, version);
|
registry.bind(name, this->idle, version);
|
||||||
};
|
};
|
||||||
d.roundtrip();
|
d.roundtrip();
|
||||||
|
|
||||||
|
|
||||||
bool has_keyboard = false, has_pointer = false;
|
bool has_keyboard = false, has_pointer = false;
|
||||||
seat.on_capabilities() = [&] (const wayland::seat_capability& capability)
|
seat.on_capabilities() = [&] (const wayland::seat_capability& capability)
|
||||||
{
|
{
|
||||||
@ -199,7 +203,7 @@ kde_idle_detector kde_idle;
|
|||||||
int get_idle_time_kde_wayland()
|
int get_idle_time_kde_wayland()
|
||||||
{
|
{
|
||||||
// Ensure idle detector runs
|
// Ensure idle detector runs
|
||||||
kde_idle.start(1000);
|
kde_idle.start(1);
|
||||||
|
|
||||||
return kde_idle.get_idle_time();
|
return kde_idle.get_idle_time();
|
||||||
}
|
}
|
||||||
@ -210,9 +214,10 @@ int get_idle_time_dynamically()
|
|||||||
{
|
{
|
||||||
#if defined(USE_WAYLAND)
|
#if defined(USE_WAYLAND)
|
||||||
const char* wl_display = std::getenv("WAYLAND_DISPLAY");
|
const char* wl_display = std::getenv("WAYLAND_DISPLAY");
|
||||||
if (wl_display)
|
const char* x11_display = std::getenv("DISPLAY");
|
||||||
|
if (wl_display && !x11_display)
|
||||||
{
|
{
|
||||||
const char* desktop_name = std::getenv("XDG_DESKTOP_NAME");
|
const char* desktop_name = std::getenv("XDG_SESSION_DESKTOP");
|
||||||
if (!desktop_name)
|
if (!desktop_name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@ -50,8 +50,10 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||||||
|
|
||||||
# X11 and wayland libraries
|
# X11 and wayland libraries
|
||||||
unix:LIBS += -L/usr/X11R6/lib/ \
|
unix:LIBS += -L/usr/X11R6/lib/ \
|
||||||
-L/usr/local/lib \
|
-lX11 -lXext -lXss -ldl
|
||||||
-lX11 -lXext -lXss -ldl \
|
|
||||||
-lwayland-client-unstable++ -lwayland-client-extra++ -lwayland-client++
|
# When using wayland:
|
||||||
|
# unix:LIBS += -L/usr/local/lib \
|
||||||
|
# -lwayland-client-unstable++ -lwayland-client-extra++ -lwayland-client++
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user