check for no client
This commit is contained in:
parent
9b4c587cd4
commit
647b4ff43f
1 changed files with 69 additions and 38 deletions
107
openbox/action.c
107
openbox/action.c
|
@ -40,141 +40,170 @@ void action_execute(union ActionData *data)
|
||||||
|
|
||||||
void action_focus(union ActionData *data)
|
void action_focus(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_focus(data->client.c);
|
if (data->client.c)
|
||||||
|
client_focus(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_unfocus (union ActionData *data)
|
void action_unfocus (union ActionData *data)
|
||||||
{
|
{
|
||||||
client_unfocus(data->client.c);
|
if (data->client.c)
|
||||||
|
client_unfocus(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_iconify(union ActionData *data)
|
void action_iconify(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_iconify(data->client.c, TRUE, TRUE);
|
if (data->client.c)
|
||||||
|
client_iconify(data->client.c, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_focusraise(union ActionData *data)
|
void action_focusraise(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_focus(data->client.c);
|
if (data->client.c) {
|
||||||
stacking_raise(data->client.c);
|
client_focus(data->client.c);
|
||||||
|
stacking_raise(data->client.c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_raise(union ActionData *data)
|
void action_raise(union ActionData *data)
|
||||||
{
|
{
|
||||||
stacking_raise(data->client.c);
|
if (data->client.c)
|
||||||
|
stacking_raise(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_lower(union ActionData *data)
|
void action_lower(union ActionData *data)
|
||||||
{
|
{
|
||||||
stacking_lower(data->client.c);
|
if (data->client.c)
|
||||||
|
stacking_lower(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_close(union ActionData *data)
|
void action_close(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_close(data->client.c);
|
if (data->client.c)
|
||||||
|
client_close(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_kill(union ActionData *data)
|
void action_kill(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_kill(data->client.c);
|
if (data->client.c)
|
||||||
|
client_kill(data->client.c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_shade(union ActionData *data)
|
void action_shade(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_shade(data->client.c, TRUE);
|
if (data->client.c)
|
||||||
|
client_shade(data->client.c, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_unshade(union ActionData *data)
|
void action_unshade(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_shade(data->client.c, FALSE);
|
if (data->client.c)
|
||||||
|
client_shade(data->client.c, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_toggle_shade(union ActionData *data)
|
void action_toggle_shade(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_shade(data->client.c, !data->client.c->shaded);
|
if (data->client.c)
|
||||||
|
client_shade(data->client.c, !data->client.c->shaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_toggle_omnipresent(union ActionData *data)
|
void action_toggle_omnipresent(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_set_desktop(data->client.c, data->client.c->desktop == DESKTOP_ALL ?
|
if (data->client.c)
|
||||||
screen_desktop : DESKTOP_ALL);
|
client_set_desktop(data->client.c,
|
||||||
|
data->client.c->desktop == DESKTOP_ALL ?
|
||||||
|
screen_desktop : DESKTOP_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_move_relative(union ActionData *data)
|
void action_move_relative(union ActionData *data)
|
||||||
{
|
{
|
||||||
Client *c = data->relative.c;
|
Client *c = data->relative.c;
|
||||||
client_configure(c, Corner_TopLeft,
|
if (c)
|
||||||
c->area.x + data->relative.dx,
|
client_configure(c, Corner_TopLeft,
|
||||||
c->area.y + data->relative.dy,
|
c->area.x + data->relative.dx,
|
||||||
c->area.width, c->area.height, TRUE, TRUE);
|
c->area.y + data->relative.dy,
|
||||||
|
c->area.width, c->area.height, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_resize_relative(union ActionData *data)
|
void action_resize_relative(union ActionData *data)
|
||||||
{
|
{
|
||||||
Client *c = data->relative.c;
|
Client *c = data->relative.c;
|
||||||
client_configure(c, Corner_TopLeft, c->area.x, c->area.y,
|
if (c)
|
||||||
c->area.width + data->relative.dx,
|
client_configure(c, Corner_TopLeft, c->area.x, c->area.y,
|
||||||
c->area.height + data->relative.dy, TRUE, TRUE);
|
c->area.width + data->relative.dx,
|
||||||
|
c->area.height + data->relative.dy, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_maximize_full(union ActionData *data)
|
void action_maximize_full(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, TRUE, 0, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, TRUE, 0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_unmaximize_full(union ActionData *data)
|
void action_unmaximize_full(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, FALSE, 0, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, FALSE, 0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_toggle_maximize_full(union ActionData *data)
|
void action_toggle_maximize_full(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c,
|
if (data->client.c)
|
||||||
!(data->client.c->max_horz || data->client.c->max_vert),
|
client_maximize(data->client.c,
|
||||||
0, TRUE);
|
!(data->client.c->max_horz ||
|
||||||
|
data->client.c->max_vert),
|
||||||
|
0, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_maximize_horz(union ActionData *data)
|
void action_maximize_horz(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, TRUE, 1, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, TRUE, 1, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_unmaximize_horz(union ActionData *data)
|
void action_unmaximize_horz(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, FALSE, 1, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, FALSE, 1, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_toggle_maximize_horz(union ActionData *data)
|
void action_toggle_maximize_horz(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, !data->client.c->max_horz, 1, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, !data->client.c->max_horz, 1, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_maximize_vert(union ActionData *data)
|
void action_maximize_vert(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, TRUE, 2, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, TRUE, 2, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_unmaximize_vert(union ActionData *data)
|
void action_unmaximize_vert(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, FALSE, 2, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, FALSE, 2, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_toggle_maximize_vert(union ActionData *data)
|
void action_toggle_maximize_vert(union ActionData *data)
|
||||||
{
|
{
|
||||||
client_maximize(data->client.c, !data->client.c->max_vert, 2, TRUE);
|
if (data->client.c)
|
||||||
|
client_maximize(data->client.c, !data->client.c->max_vert, 2, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_send_to_desktop(union ActionData *data)
|
void action_send_to_desktop(union ActionData *data)
|
||||||
{
|
{
|
||||||
if (data->sendto.desktop < screen_num_desktops ||
|
if (data->sendto.c)
|
||||||
data->sendto.desktop == DESKTOP_ALL)
|
if (data->sendto.desktop < screen_num_desktops ||
|
||||||
client_set_desktop(data->sendto.c, data->sendto.desktop);
|
data->sendto.desktop == DESKTOP_ALL)
|
||||||
|
client_set_desktop(data->sendto.c, data->sendto.desktop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void action_send_to_next_desktop(union ActionData *data)
|
void action_send_to_next_desktop(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint d;
|
guint d;
|
||||||
|
|
||||||
|
if (!data->sendto.c) return;
|
||||||
|
|
||||||
d = screen_desktop + 1;
|
d = screen_desktop + 1;
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->sendtonextprev.wrap) return;
|
if (!data->sendtonextprev.wrap) return;
|
||||||
|
@ -188,6 +217,8 @@ void action_send_to_previous_desktop(union ActionData *data)
|
||||||
{
|
{
|
||||||
guint d;
|
guint d;
|
||||||
|
|
||||||
|
if (!data->sendto.c) return;
|
||||||
|
|
||||||
d = screen_desktop - 1;
|
d = screen_desktop - 1;
|
||||||
if (d >= screen_num_desktops) {
|
if (d >= screen_num_desktops) {
|
||||||
if (!data->sendtonextprev.wrap) return;
|
if (!data->sendtonextprev.wrap) return;
|
||||||
|
@ -408,7 +439,7 @@ void action_move(union ActionData *data)
|
||||||
int x = data->move.x;
|
int x = data->move.x;
|
||||||
int y = data->move.y;
|
int y = data->move.y;
|
||||||
|
|
||||||
if (!client_normal(c)) return;
|
if (!c || !client_normal(c)) return;
|
||||||
|
|
||||||
dispatch_move(c, &x, &y);
|
dispatch_move(c, &x, &y);
|
||||||
|
|
||||||
|
@ -423,7 +454,7 @@ void action_resize(union ActionData *data)
|
||||||
int w = data->resize.x - c->frame->size.left - c->frame->size.right;
|
int w = data->resize.x - c->frame->size.left - c->frame->size.right;
|
||||||
int h = data->resize.y - c->frame->size.top - c->frame->size.bottom;
|
int h = data->resize.y - c->frame->size.top - c->frame->size.bottom;
|
||||||
|
|
||||||
if (!client_normal(c)) return;
|
if (!c || !client_normal(c)) return;
|
||||||
|
|
||||||
/* XXX window snapping/struts */
|
/* XXX window snapping/struts */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue