示例#1
0
文件: layer.c 项目: godvmxi/obwm
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    if (data->client) {
        ObClient *c = data->client;

        actions_client_move(data, TRUE);

        if (o->layer < 0) {
            if (o->toggle || !c->below)
                client_set_layer(c, c->below ? 0 : -1);
        }
        else if (o->layer > 0) {
            if (o->toggle || !c->above)
                client_set_layer(c, c->above ? 0 : 1);
        }
        else if (c->above || c->below)
            client_set_layer(c, 0);

        actions_client_move(data, FALSE);
    }

    return FALSE;
}
示例#2
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    if (data->client) {
/*
        ob_debug("button %d focusable %d context %d %d %d\n",
                 data->button, client_mouse_focusable(data->client),
                 data->context,
                 OB_FRAME_CONTEXT_CLIENT, OB_FRAME_CONTEXT_FRAME);
*/
        if (data->button == 0 || client_mouse_focusable(data->client) ||
            (data->context != OB_FRAME_CONTEXT_CLIENT &&
             data->context != OB_FRAME_CONTEXT_FRAME))
        {
            if (o->stop_int)
                actions_interactive_cancel_act();

            actions_client_move(data, TRUE);
            client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE);
            actions_client_move(data, FALSE);
        }
    } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) {
        if (o->stop_int)
            actions_interactive_cancel_act();

        /* focus action on the root window. make keybindings work for this
           openbox instance, but don't focus any specific client */
        focus_nothing();
    }

    return FALSE;
}
示例#3
0
文件: maximize.c 项目: godvmxi/obwm
/* Always return FALSE because its not interactive */
static gboolean run_func_off(ObActionsData *data, gpointer options)
{
    Options *o = options;
    if (data->client) {
        actions_client_move(data, TRUE);
        client_maximize(data->client, FALSE, o->dir);
        actions_client_move(data, FALSE);
    }
    return FALSE;
}
示例#4
0
static gboolean run_func_toggle(struct wm_actions_data *data, gpointer options)
{
	(void)options;
	if(data->client) {
		actions_client_move(data, TRUE);
		client_set_desktop(data->client, data->client->desktop == DESKTOP_ALL ? screen_desktop : DESKTOP_ALL, FALSE, TRUE);
		actions_client_move(data, FALSE);
	}
	return FALSE;
}
示例#5
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    if (data->client) {
        actions_client_move(data, TRUE);
        stacking_lower(CLIENT_AS_WINDOW(data->client));
        actions_client_move(data, FALSE);
    }

    return FALSE;
}
示例#6
0
static gboolean do_grow_all_edges(ObActionsData* data,
                                  ObClientDirectionalResizeType resize_type)
{
    gint x, y, w, h;
    gint temp_x, temp_y, temp_w, temp_h;

    client_find_resize_directional(data->client,
                                   OB_DIRECTION_NORTH,
                                   resize_type,
                                   &temp_x, &temp_y, &temp_w, &temp_h);
    y = temp_y;
    h = temp_h;

    client_find_resize_directional(data->client,
                                   OB_DIRECTION_SOUTH,
                                   resize_type,
                                   &temp_x, &temp_y, &temp_w, &temp_h);
    h += temp_h - data->client->area.height;


    client_find_resize_directional(data->client,
                                   OB_DIRECTION_WEST,
                                   resize_type,
                                   &temp_x, &temp_y, &temp_w, &temp_h);
    x = temp_x;
    w = temp_w;

    client_find_resize_directional(data->client,
                                   OB_DIRECTION_EAST,
                                   resize_type,
                                   &temp_x, &temp_y, &temp_w, &temp_h);
    w += temp_w - data->client->area.width;

    /* When filling, we allow the window to move to an arbitrary x/y
       position, since we'll be growing the other edge as well. */
    int lw, lh;
    client_try_configure(data->client, &x, &y, &w, &h, &lw, &lh, TRUE);

    if (x == data->client->area.x &&
        y == data->client->area.y &&
        w == data->client->area.width &&
        h == data->client->area.height)
    {
        return FALSE;
    }

    actions_client_move(data, TRUE);
    client_move_resize(data->client, x, y, w, h);
    actions_client_move(data, FALSE);
    return TRUE;
}
示例#7
0
文件: raise.c 项目: godvmxi/openbox
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    if (data->client) {
//	syslog(LOG_INFO,"raise before move");
        actions_client_move(data, TRUE);
	
//	syslog(LOG_INFO,"raise before raise");
        stacking_raise(CLIENT_AS_WINDOW(data->client));
//	syslog(LOG_INFO,"raise after raise");
        actions_client_move(data, FALSE);
    }

    return FALSE;
}
示例#8
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    actions_client_move(data, TRUE);

    if (o->add)
        screen_add_desktop(o->current);
    else
        screen_remove_desktop(o->current);

    actions_client_move(data, FALSE);

    return FALSE;
}
示例#9
0
文件: maximize.c 项目: godvmxi/obwm
/* Always return FALSE because its not interactive */
static gboolean run_func_toggle(ObActionsData *data, gpointer options)
{
    Options *o = options;
    if (data->client) {
        gboolean toggle;
        actions_client_move(data, TRUE);
        toggle = ((o->dir == HORZ && !data->client->max_horz) ||
                  (o->dir == VERT && !data->client->max_vert) ||
                  (o->dir == BOTH &&
                   !(data->client->max_horz && data->client->max_vert)));
        client_maximize(data->client, toggle, o->dir);
        actions_client_move(data, FALSE);
    }
    return FALSE;
}
示例#10
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    if (data->client) {
        ObClient *c = data->client;
        gint x, y, ow, xoff, nw, oh, yoff, nh, lw, lh, wshrink, hshrink;
        gint left = o->left, right = o->right, top = o->top, bottom = o->bottom;

        if (o->left_denom)
            left = left * c->area.width / o->left_denom;
        if (o->right_denom)
            right = right * c->area.width / o->right_denom;
        if (o->top_denom)
            top = top * c->area.height / o->top_denom;
        if (o->bottom_denom)
            bottom = bottom * c->area.height / o->bottom_denom;

        // When resizing, if the resize has a non-zero value then make sure it
        // is at least as big as the size increment so the window does actually
        // resize.
        x = c->area.x;
        y = c->area.y;
        ow = c->area.width;
        xoff = -MAX(left, (left ? c->size_inc.width : 0));
        wshrink = right + left < 0 ? -1 : 1;
        nw = ow + wshrink * MAX(abs(right + left), (abs(right + left) ? c->size_inc.width : 0));
        oh = c->area.height;
        yoff = -MAX(top, (top ? c->size_inc.height : 0));
        hshrink = bottom + top < 0 ? -1 : 1;
        nh = oh + hshrink * MAX(abs(bottom + top), (bottom + top ? c->size_inc.height : 0));

        client_try_configure(c, &x, &y, &nw, &nh, &lw, &lh, TRUE);
        xoff = xoff == 0 ? 0 :
            (xoff < 0 ? MAX(xoff, ow-nw) : MIN(xoff, ow-nw));
        yoff = yoff == 0 ? 0 :
            (yoff < 0 ? MAX(yoff, oh-nh) : MAX(yoff, oh-nh));

        actions_client_move(data, TRUE);
        client_move_resize(c, x + xoff, y + yoff, nw, nh);
        actions_client_move(data, FALSE);
    }

    return FALSE;
}
示例#11
0
static gboolean do_grow(ObActionsData *data, gint x, gint y, gint w, gint h)
{
    gint realw, realh, lw, lh;

    realw = w;
    realh = h;
    client_try_configure(data->client, &x, &y, &realw, &realh,
                         &lw, &lh, TRUE);
    /* if it's going to be resized smaller than it intended, don't
       move the window over */
    if (x != data->client->area.x) x += w - realw;
    if (y != data->client->area.y) y += h - realh;

    if (x != data->client->area.x || y != data->client->area.y ||
        realw != data->client->area.width ||
        realh != data->client->area.height)
    {
        actions_client_move(data, TRUE);
        client_move_resize(data->client, x, y, realw, realh);
        actions_client_move(data, FALSE);
        return TRUE;
    }
    return FALSE;
}
示例#12
0
/* Always return FALSE because its not interactive */
static gboolean run_func(ObActionsData *data, gpointer options)
{
    Options *o = options;

    if (data->client) {
        Rect *area, *carea;
        ObClient *c;
        guint mon, cmon;
        gint x, y, lw, lh, w, h;

        c = data->client;
        mon = o->monitor;
        cmon = client_monitor(c);
        switch (mon) {
        case CURRENT_MONITOR:
            mon = cmon; break;
        case ALL_MONITORS:
            mon = SCREEN_AREA_ALL_MONITORS; break;
        case NEXT_MONITOR:
            mon = (cmon + 1 > screen_num_monitors - 1) ? 0 : (cmon + 1); break;
        case PREV_MONITOR:
            mon = (cmon == 0) ? (screen_num_monitors - 1) : (cmon - 1); break;
        default:
            g_assert_not_reached();
        }

        area = screen_area(c->desktop, mon, NULL);
        carea = screen_area(c->desktop, cmon, NULL);

        w = o->w;
        if (w == G_MININT) w = c->area.width;
        else if (o->w_denom) w = (w * area->width) / o->w_denom;

        h = o->h;
        if (h == G_MININT) h = c->area.height;
        else if (o->h_denom) h = (h * area->height) / o->h_denom;

        /* it might not be able to resize how they requested, so find out what
           it will actually be resized to */
        x = c->area.x;
        y = c->area.y;
        client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);

        /* get the frame's size */
        w += c->frame->size.left + c->frame->size.right;
        h += c->frame->size.top + c->frame->size.bottom;

        x = o->x.pos;
        if (o->x.denom)
            x = (x * area->width) / o->x.denom;
        if (o->x.center) x = (area->width - w) / 2;
        else if (x == G_MININT) x = c->frame->area.x - carea->x;
        else if (o->x.opposite) x = area->width - w - x;
        x += area->x;

        y = o->y.pos;
        if (o->y.denom)
            y = (y * area->height) / o->y.denom;
        if (o->y.center) y = (area->height - h) / 2;
        else if (y == G_MININT) y = c->frame->area.y - carea->y;
        else if (o->y.opposite) y = area->height - h - y;
        y += area->y;

        /* get the client's size back */
        w -= c->frame->size.left + c->frame->size.right;
        h -= c->frame->size.top + c->frame->size.bottom;

        frame_frame_gravity(c->frame, &x, &y); /* get the client coords */
        client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE);
        /* force it on screen if its moving to another monitor */
        client_find_onscreen(c, &x, &y, w, h, mon != cmon);

        actions_client_move(data, TRUE);
        client_configure(c, x, y, w, h, TRUE, TRUE, FALSE);
        actions_client_move(data, FALSE);

        g_slice_free(Rect, area);
        g_slice_free(Rect, carea);
    }

    return FALSE;
}