Esempio n. 1
0
void handle_event(Display *display)
{
    XEvent event;

    /* Get current event of X display */
    int result = XNextEvent(display, &event);
    if (result == Success && event.type == PropertyNotify) {
        if (event.xproperty.atom == active_window_prop) {
            Window win = get_active_window(event.xproperty.display,
                event.xproperty.window);
            if (win != None && win != active_window) {
                if (active_window_name)
                    XFree(active_window_name);
                if (active_window_class)
                    XFree(active_window_class);
                get_window_class_name(display, win, &active_window_class,
                    &active_window_name);
                active_window_pid = get_window_pid(display, win);
                fprintf(stdout, "%d - \"%s\", \"%s\" - %li ms\n",
                    active_window_pid, active_window_class,
                    active_window_name,
                    event.xproperty.time - activation_time);
                active_window = win;
                activation_time = event.xproperty.time;
            }
        }
    } else {
        fprintf(stderr, "Couldn't fetch event, error code %d\n", result);
    }
}
Esempio n. 2
0
void win32_windowed_app_setup_params::trace_dump() const {
    TRACE("hinstance : {:x}", (unsigned int)get_hinstance());
    TRACE("window_class_name : {}", utf16_to_utf8(get_window_class_name()));
    TRACE("window_caption : {}", utf16_to_utf8(get_window_caption()));
    TRACE("min_window_size : {}", get_min_window_size());
    TRACE("small_icon_id : {}", get_small_icon_id());
    TRACE("large_icon_id : {}", get_large_icon_id());
    TRACE("is_visible_by_default : {}", bool_to_string(get_is_visible_by_default()));
}