Пример #1
0
static void
drawin_update_drawing(drawin_t *w, int widx)
{
    luaA_object_push_item(globalconf.L, widx, w->drawable);
    drawable_set_geometry(w->drawable, -1, w->geometry);
    lua_pop(globalconf.L, 1);
}
Пример #2
0
static void
drawin_update_drawing(lua_State *L, int widx)
{
    drawin_t *w = luaA_checkudata(L, widx, &drawin_class);
    luaA_object_push_item(L, widx, w->drawable);
    drawable_set_geometry(L, -1, w->geometry);
    lua_pop(L, 1);
}
Пример #3
0
/** Move and/or resize a drawin
 * \param L The Lua VM state.
 * \param udx The index of the drawin.
 * \param geometry The new geometry.
 */
static void
drawin_moveresize(lua_State *L, int udx, area_t geometry)
{
    drawin_t *w = luaA_checkudata(L, udx, &drawin_class);
    int number_of_vals = 0;
    uint32_t moveresize_win_vals[4], mask_vals = 0;

    if(w->geometry.x != geometry.x)
    {
        w->geometry.x = moveresize_win_vals[number_of_vals++] = geometry.x;
        mask_vals |= XCB_CONFIG_WINDOW_X;
    }

    if(w->geometry.y != geometry.y)
    {
        w->geometry.y = moveresize_win_vals[number_of_vals++] = geometry.y;
        mask_vals |= XCB_CONFIG_WINDOW_Y;
    }

    if(geometry.width > 0 && w->geometry.width != geometry.width)
    {
        w->geometry.width = moveresize_win_vals[number_of_vals++] = geometry.width;
        mask_vals |= XCB_CONFIG_WINDOW_WIDTH;
    }

    if(geometry.height > 0 && w->geometry.height != geometry.height)
    {
        w->geometry.height = moveresize_win_vals[number_of_vals++] = geometry.height;
        mask_vals |= XCB_CONFIG_WINDOW_HEIGHT;
    }

    if(mask_vals & (XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT))
        drawin_update_drawing(w, udx);
    else {
        /* We still have to set x/y */
        luaA_object_push_item(L, udx, w->drawable);
        drawable_set_geometry(w->drawable, -1, w->geometry);
        lua_pop(L, 1);
    }

    /* Activate BMA */
    client_ignore_enterleave_events();

    if(mask_vals)
        xcb_configure_window(globalconf.connection, w->window, mask_vals, moveresize_win_vals);

    /* Deactivate BMA */
    client_restore_enterleave_events();

    if(mask_vals & XCB_CONFIG_WINDOW_X)
        luaA_object_emit_signal(L, udx, "property::x", 0);
    if(mask_vals & XCB_CONFIG_WINDOW_Y)
        luaA_object_emit_signal(L, udx, "property::y", 0);
    if(mask_vals & XCB_CONFIG_WINDOW_WIDTH)
        luaA_object_emit_signal(L, udx, "property::width", 0);
    if(mask_vals & XCB_CONFIG_WINDOW_HEIGHT)
        luaA_object_emit_signal(L, udx, "property::height", 0);
}
Пример #4
0
static void
drawin_update_drawing(drawin_t *w, int widx)
{
    /* If this drawin isn't visible, we don't need an up-to-date cairo surface
     * for it. (drawin_map() will later make sure we are called again) */
    if(!w->visible)
        return;

    luaA_object_push_item(globalconf.L, widx, w->drawable);
    drawable_set_geometry(w->drawable, -1, w->geometry);
    lua_pop(globalconf.L, 1);
}