小编Dyl*_*all的帖子

使用X11,如何在忽略某些事件的同时将用户的时间"远离键盘"?

我正在制作一个需要了解用户闲置时间的应用程序 - 例如,不使用键盘或鼠标.XCB和Xlib都承诺通过各自的屏幕保护程序扩展为我提供空闲时间.这是我在XCB闲暇时间的地方:

#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/screensaver.h>

static xcb_connection_t * connection;
static xcb_screen_t * screen;

/**
 * Connects to the X server (via xcb) and gets the screen
 */
void magic_begin () {
    connection = xcb_connect (NULL, NULL);
    screen = xcb_setup_roots_iterator (xcb_get_setup (connection)).data;
}

/**
 * Asks X for the time the user has been idle
 * @returns idle time in milliseconds
 */
unsigned long magic_get_idle_time () {
    xcb_screensaver_query_info_cookie_t cookie;
    xcb_screensaver_query_info_reply_t *info;

    cookie = xcb_screensaver_query_info (connection, screen->root);
    info …
Run Code Online (Sandbox Code Playgroud)

linux x11 xcb

5
推荐指数
1
解决办法
933
查看次数

标签 统计

linux ×1

x11 ×1

xcb ×1