Example #1
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;
}
Example #2
0
static void menu_execute(ObMenuEntry *self, ObMenuFrame *f,
                         ObClient *c, guint state, gpointer data)
{
    if (self->id == ADD_DESKTOP) {
        screen_add_desktop(FALSE);
        menu_frame_hide_all();
    }
    else if (self->id == REMOVE_DESKTOP) {
        screen_remove_desktop(FALSE);
        menu_frame_hide_all();
    }
    else {
        ObClient *t = self->data.normal.data;
        if (t) { /* it's set to NULL if its destroyed */
            gboolean here = state & ShiftMask;

            if (state & ShiftMask) {
                client_close(t);
                self->data.normal.enabled = FALSE;
            }
            else {
                client_activate(t, TRUE, here, TRUE, TRUE, TRUE);

                /* if the window is omnipresent then we need to go to its
                   desktop */
                if (!here && t->desktop == DESKTOP_ALL)
                    screen_set_desktop(self->id, FALSE);
            }
        }
        else
            screen_set_desktop(self->id, TRUE);
    }
}
Example #3
0
// raise all windows in a tag
void tag_raise(unsigned int tag)
{
	int i, found = 0, shaded = 0; Window w; client *c;
	winlist *stack;

	// if this tag was previously hidden, reveal it
	clients_ascend(windows_shaded, i, w, c)
		if (c->manage && c->cache->tags & tag)
			{ client_reveal(c); shaded++; }
	if (shaded)
	{
		XSync(display, False);
		reset_cache_xattr();
		reset_cache_client();
		reset_cache_inplay();
	}

	stack = winlist_new();

	// locate windows with _NET_WM_STATE_ABOVE and _NET_WM_STATE_STICKY
	managed_descend(i, w, c)
		if (winlist_find(stack, w) < 0 && c->visible && c->trans == None
			&& client_has_state(c, netatoms[_NET_WM_STATE_ABOVE])
			&& client_has_state(c, netatoms[_NET_WM_STATE_STICKY]))
				client_stack_family(c, stack);
	// locate windows with _NET_WM_STATE_ABOVE in this tag
	tag_descend(i, w, c, tag)
		if (winlist_find(stack, w) < 0 && c->visible && c->trans == None
			&& client_has_state(c, netatoms[_NET_WM_STATE_ABOVE]))
				{ client_stack_family(c, stack); found++; }
	// locate _NET_WM_WINDOW_TYPE_DOCK windows
	clients_descend(windows_in_play(), i, w, c)
		if (winlist_find(stack, w) < 0 && c->visible && c->trans == None
			&& c->type == netatoms[_NET_WM_WINDOW_TYPE_DOCK])
				client_stack_family(c, stack);
	// locate all other windows in the tag
	tag_descend(i, w, c, tag)
		if (winlist_find(stack, w) < 0 && c->trans == None)
			{ client_stack_family(c, stack); found++; }

	// raise the top window in the stack
	if (stack->len) XRaiseWindow(display, stack->array[0]);
	// stack everything else, in order, underneath top window
	if (stack->len > 1) XRestackWindows(display, stack->array, stack->len);

	winlist_free(stack);
	tag_set_current(tag);
	if (config_only_auto) tag_only(tag);

	// focus the last-focused client in the tag
	clients_descend(windows_activated, i, w, c) if (c->cache->tags & tag)
		{ client_activate(c, RAISE, WARPDEF); break; }

	// in case no windows are in the tag, show some activity
	if (found) notice("Tag %d", tag_to_desktop(tag)+1);
	else notice("Tag %d (empty!)", tag_to_desktop(tag)+1);
}
Example #4
0
static void desk_menu_execute(ObMenuEntry *self, ObMenuFrame *f,
                              ObClient *c, guint state, gpointer data)
{
    ObClient *t = self->data.normal.data;
    if (t) { /* it's set to NULL if its destroyed */
        gboolean here = state & ShiftMask;

        client_activate(t, TRUE, here, TRUE, TRUE, TRUE);
        /* if the window is omnipresent then we need to go to its
           desktop */
        if (!here && t->desktop == DESKTOP_ALL)
            screen_set_desktop(self->id, FALSE);
        if (config_mouse_to_focus)
            WARP_POINTER_TO(t);
    }
    else
        screen_set_desktop(self->id, TRUE);
}