Exemplo n.º 1
0
/** Update the WM hints of a client.
 * \param c The client.
 * \param cookie Cookie returned by property_get_wm_hints.
 */
void
property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie)
{
    xcb_icccm_wm_hints_t wmh;

    if(!xcb_icccm_get_wm_hints_reply(globalconf.connection,
				     cookie,
				     &wmh, NULL))
        return;

    luaA_object_push(globalconf.L, c);
    client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));

    if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
        c->nofocus = !wmh.input;

    if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP)
        client_set_group_window(globalconf.L, -1, wmh.window_group);

    if(!c->have_ewmh_icon)
    {
        if(wmh.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP)
        {
            if(wmh.flags & XCB_ICCCM_WM_HINT_ICON_MASK)
                client_set_icon_from_pixmaps(c, wmh.icon_pixmap, wmh.icon_mask);
            else
                client_set_icon_from_pixmaps(c, wmh.icon_pixmap, XCB_NONE);
        }
        else
            client_set_icon(c, NULL);
    }

    lua_pop(globalconf.L, 1);
}
Exemplo n.º 2
0
/** Update the WM hints of a client.
 * \param c The client.
 * \param reply (Optional) An existing reply.
 */
void
property_update_wm_hints(client_t *c, xcb_get_property_reply_t *reply)
{
    xcb_icccm_wm_hints_t wmh;

    if(reply)
    {
        if(!xcb_icccm_get_wm_hints_from_reply(&wmh, reply))
            return;
    }
    else
    {
        if(!xcb_icccm_get_wm_hints_reply(globalconf.connection,
                                         xcb_icccm_get_wm_hints_unchecked(globalconf.connection, c->window),
                                         &wmh, NULL))
            return;
    }

    luaA_object_push(globalconf.L, c);
    client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));
    if(wmh.flags & XCB_ICCCM_WM_HINT_STATE &&
       wmh.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN)
        client_set_border_width(globalconf.L, -1, 0);

    if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
        c->nofocus = !wmh.input;

    if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP)
        client_set_group_window(globalconf.L, -1, wmh.window_group);

#ifdef LAB126
    /* pop client */
    lua_pop(globalconf.L, 1);
#endif
}
Exemplo n.º 3
0
void window_focus(Window window) {
    HSClient* client = get_client_from_window(window);
    assert(client != NULL);
    // set keyboard focus
    if (!client->neverfocus) {
        XSetInputFocus(g_display, window, RevertToPointerRoot, CurrentTime);
    }
    else client_sendevent(client, g_wmatom[WMTakeFocus]);

    if (window != lastfocus) {
        /* FIXME: this is a workaround because window_focus always is called
         * twice.  see BUGS for more information
         *
         * only emit the hook if the focus *really* changes */
        // unfocus last one
        window_unfocus(lastfocus);
        hsobject_link(g_client_object, &client->object, "focus");
        ewmh_update_active_window(window);
        tag_update_each_focus_layer();
        char* title = client ? client->title->str : "?";
        char winid_str[STRING_BUF_SIZE];
        snprintf(winid_str, STRING_BUF_SIZE, "0x%x", (unsigned int)window);
        hook_emit_list("focus_changed", winid_str, title, NULL);
    }

    // change window-colors
    HSDebug("window_focus ACTIVE\n");
    window_update_border(window, g_window_border_active_color);

    lastfocus = window;
    /* do some specials for the max layout */
    bool is_max_layout = frame_focused_window(g_cur_frame) == window
                         && g_cur_frame->content.clients.layout == LAYOUT_MAX
                         && get_current_monitor()->tag->floating == false;
    if (*g_raise_on_focus || is_max_layout) {
        client_raise(client);
    }
    tag_update_focus_layer(get_current_monitor()->tag);
    grab_client_buttons(get_client_from_window(window), true);
    client_set_urgent(client, false);
}
Exemplo n.º 4
0
/** Update the WM hints of a client.
 * \param c The client.
 * \param cookie Cookie returned by property_get_wm_hints.
 */
void
property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie)
{
    xcb_icccm_wm_hints_t wmh;

    if(!xcb_icccm_get_wm_hints_reply(globalconf.connection,
				     cookie,
				     &wmh, NULL))
        return;

    luaA_object_push(globalconf.L, c);
    client_set_urgent(globalconf.L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));

    if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
        c->nofocus = !wmh.input;

    if(wmh.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP)
        client_set_group_window(globalconf.L, -1, wmh.window_group);

    lua_pop(globalconf.L, 1);
}