add max horz/vert actions. add toggle/on/off ability to all the maximize actions.
add shade action.
This commit is contained in:
parent
597c9c9321
commit
d468f85300
8 changed files with 220 additions and 63 deletions
|
@ -167,6 +167,8 @@ openbox_openbox_SOURCES = \
|
|||
openbox/actions/iconify.c \
|
||||
openbox/actions/lower.c \
|
||||
openbox/actions/maximize.c \
|
||||
openbox/actions/maximizehorizontal.c \
|
||||
openbox/actions/maximizevertical.c \
|
||||
openbox/actions/move.c \
|
||||
openbox/actions/moverelative.c \
|
||||
openbox/actions/moveto.c \
|
||||
|
@ -174,6 +176,7 @@ openbox_openbox_SOURCES = \
|
|||
openbox/actions/raiselower.c \
|
||||
openbox/actions/reconfigure.c \
|
||||
openbox/actions/restart.c \
|
||||
openbox/actions/shade.c \
|
||||
openbox/actions/showdesktop.c \
|
||||
openbox/actions/showmenu.c \
|
||||
openbox/actions/unfocus.c \
|
||||
|
|
|
@ -469,31 +469,11 @@ ActionString actionstrings[] =
|
|||
action_unshaderaise,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"shade",
|
||||
action_shade,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"unshade",
|
||||
action_unshade,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"toggleshade",
|
||||
action_toggle_shade,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"toggleomnipresent",
|
||||
action_toggle_omnipresent,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"moverelativehorz",
|
||||
action_move_relative_horz,
|
||||
setup_client_action
|
||||
},
|
||||
{
|
||||
"resizerelativevert",
|
||||
action_resize_relative_vert,
|
||||
|
@ -950,27 +930,6 @@ void action_kill(union ActionData *data)
|
|||
client_kill(data->client.any.c);
|
||||
}
|
||||
|
||||
void action_shade(union ActionData *data)
|
||||
{
|
||||
client_action_start(data);
|
||||
client_shade(data->client.any.c, TRUE);
|
||||
client_action_end(data, config_focus_under_mouse);
|
||||
}
|
||||
|
||||
void action_unshade(union ActionData *data)
|
||||
{
|
||||
client_action_start(data);
|
||||
client_shade(data->client.any.c, FALSE);
|
||||
client_action_end(data, config_focus_under_mouse);
|
||||
}
|
||||
|
||||
void action_toggle_shade(union ActionData *data)
|
||||
{
|
||||
client_action_start(data);
|
||||
client_shade(data->client.any.c, !data->client.any.c->shaded);
|
||||
client_action_end(data, config_focus_under_mouse);
|
||||
}
|
||||
|
||||
void action_toggle_omnipresent(union ActionData *data)
|
||||
{
|
||||
client_set_desktop(data->client.any.c,
|
||||
|
@ -999,15 +958,6 @@ void action_resize_relative_vert(union ActionData *data)
|
|||
}
|
||||
}
|
||||
|
||||
void action_move_relative(union ActionData *data)
|
||||
{
|
||||
ObClient *c = data->relative.any.c;
|
||||
client_action_start(data);
|
||||
client_move(c, c->area.x + data->relative.deltax, c->area.y +
|
||||
data->relative.deltay);
|
||||
client_action_end(data, FALSE);
|
||||
}
|
||||
|
||||
void action_resize_relative(union ActionData *data)
|
||||
{
|
||||
ObClient *c = data->relative.any.c;
|
||||
|
|
|
@ -21,6 +21,9 @@ void action_all_startup()
|
|||
action_iconify_startup();
|
||||
action_fullscreen_startup();
|
||||
action_maximize_startup();
|
||||
action_maximizehorizontal_startup();
|
||||
action_maximizevertical_startup();
|
||||
action_moveto_startup();
|
||||
action_moverelative_startup();
|
||||
action_shade_startup();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@ void action_unfocus_startup();
|
|||
void action_iconify_startup();
|
||||
void action_fullscreen_startup();
|
||||
void action_maximize_startup();
|
||||
void action_maximizehorizontal_startup();
|
||||
void action_maximizevertical_startup();
|
||||
void action_moveto_startup();
|
||||
void action_moverelative_startup();
|
||||
void action_shade_startup();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "openbox/client.h"
|
||||
|
||||
typedef struct {
|
||||
gboolean vertical;
|
||||
gboolean horizontal;
|
||||
gboolean toggle;
|
||||
gboolean on;
|
||||
} Options;
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
|
||||
|
@ -25,13 +25,17 @@ static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
|||
Options *o;
|
||||
|
||||
o = g_new0(Options, 1);
|
||||
o->vertical = TRUE;
|
||||
o->horizontal = TRUE;
|
||||
o->toggle = TRUE;
|
||||
|
||||
if ((n = parse_find_node("maximize", node))) {
|
||||
gchar *s = parse_string(doc, n);
|
||||
if (g_ascii_strcasecmp(s, "toggle")) {
|
||||
o->toggle = FALSE;
|
||||
o->on = parse_bool(doc, n);
|
||||
}
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
if ((n = parse_find_node("vertical", node)))
|
||||
o->vertical = parse_bool(doc, n);
|
||||
if ((n = parse_find_node("horizontal", node)))
|
||||
o->horizontal = parse_bool(doc, n);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -50,14 +54,12 @@ static gboolean run_func(ObActionsData *data, gpointer options)
|
|||
if (data->client) {
|
||||
actions_client_move(data, TRUE);
|
||||
|
||||
if (o->horizontal && !o->vertical)
|
||||
client_maximize(data->client, !data->client->max_horz, 1);
|
||||
else if (!o->horizontal && o->vertical)
|
||||
client_maximize(data->client, !data->client->max_vert, 2);
|
||||
else if (o->horizontal && o->vertical)
|
||||
if (o->toggle)
|
||||
client_maximize(data->client,
|
||||
!data->client->max_horz || !data->client->max_vert,
|
||||
0);
|
||||
else
|
||||
client_maximize(data->client, o->on, 0);
|
||||
|
||||
actions_client_move(data, FALSE);
|
||||
}
|
||||
|
|
66
openbox/actions/maximizehorizontal.c
Normal file
66
openbox/actions/maximizehorizontal.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include "openbox/actions.h"
|
||||
#include "openbox/client.h"
|
||||
|
||||
typedef struct {
|
||||
gboolean toggle;
|
||||
gboolean on;
|
||||
} Options;
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
|
||||
static void free_func(gpointer options);
|
||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||
|
||||
void action_maximizehorizontal_startup()
|
||||
{
|
||||
actions_register("MaximizeHorizontal",
|
||||
setup_func,
|
||||
free_func,
|
||||
run_func,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||
{
|
||||
xmlNodePtr n;
|
||||
Options *o;
|
||||
|
||||
o = g_new0(Options, 1);
|
||||
o->toggle = TRUE;
|
||||
|
||||
if ((n = parse_find_node("maximize", node))) {
|
||||
gchar *s = parse_string(doc, n);
|
||||
if (g_ascii_strcasecmp(s, "toggle")) {
|
||||
o->toggle = FALSE;
|
||||
o->on = parse_bool(doc, n);
|
||||
}
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void free_func(gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
g_free(o);
|
||||
}
|
||||
|
||||
/* Always return FALSE because its not interactive */
|
||||
static gboolean run_func(ObActionsData *data, gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
if (data->client) {
|
||||
actions_client_move(data, TRUE);
|
||||
|
||||
if (o->toggle)
|
||||
client_maximize(data->client, !data->client->max_horz, 1);
|
||||
else
|
||||
client_maximize(data->client, o->on, 1);
|
||||
|
||||
actions_client_move(data, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
66
openbox/actions/maximizevertical.c
Normal file
66
openbox/actions/maximizevertical.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include "openbox/actions.h"
|
||||
#include "openbox/client.h"
|
||||
|
||||
typedef struct {
|
||||
gboolean toggle;
|
||||
gboolean on;
|
||||
} Options;
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
|
||||
static void free_func(gpointer options);
|
||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||
|
||||
void action_maximizevertical_startup()
|
||||
{
|
||||
actions_register("MaximizeVertical",
|
||||
setup_func,
|
||||
free_func,
|
||||
run_func,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||
{
|
||||
xmlNodePtr n;
|
||||
Options *o;
|
||||
|
||||
o = g_new0(Options, 1);
|
||||
o->toggle = TRUE;
|
||||
|
||||
if ((n = parse_find_node("maximize", node))) {
|
||||
gchar *s = parse_string(doc, n);
|
||||
if (g_ascii_strcasecmp(s, "toggle")) {
|
||||
o->toggle = FALSE;
|
||||
o->on = parse_bool(doc, n);
|
||||
}
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void free_func(gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
g_free(o);
|
||||
}
|
||||
|
||||
/* Always return FALSE because its not interactive */
|
||||
static gboolean run_func(ObActionsData *data, gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
if (data->client) {
|
||||
actions_client_move(data, TRUE);
|
||||
|
||||
if (o->toggle)
|
||||
client_maximize(data->client, !data->client->max_vert, 2);
|
||||
else
|
||||
client_maximize(data->client, o->on, 2);
|
||||
|
||||
actions_client_move(data, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
64
openbox/actions/shade.c
Normal file
64
openbox/actions/shade.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include "openbox/actions.h"
|
||||
#include "openbox/client.h"
|
||||
|
||||
typedef struct {
|
||||
gboolean toggle;
|
||||
gboolean on;
|
||||
} Options;
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
|
||||
static void free_func(gpointer options);
|
||||
static gboolean run_func(ObActionsData *data, gpointer options);
|
||||
|
||||
void action_shade_startup()
|
||||
{
|
||||
actions_register("Shade",
|
||||
setup_func,
|
||||
free_func,
|
||||
run_func,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
|
||||
{
|
||||
xmlNodePtr n;
|
||||
Options *o;
|
||||
|
||||
o = g_new0(Options, 1);
|
||||
o->toggle = TRUE;
|
||||
|
||||
if ((n = parse_find_node("shade", node))) {
|
||||
gchar *s = parse_string(doc, n);
|
||||
if (g_ascii_strcasecmp(s, "toggle")) {
|
||||
o->toggle = FALSE;
|
||||
o->on = parse_bool(doc, n);
|
||||
}
|
||||
g_free(s);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void free_func(gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
g_free(o);
|
||||
}
|
||||
|
||||
/* Always return FALSE because its not interactive */
|
||||
static gboolean run_func(ObActionsData *data, gpointer options)
|
||||
{
|
||||
Options *o = options;
|
||||
|
||||
if (data->client) {
|
||||
actions_client_move(data, TRUE);
|
||||
if (o->toggle)
|
||||
client_shade(data->client, !data->client->shaded);
|
||||
else
|
||||
client_shade(data->client, o->on);
|
||||
actions_client_move(data, FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
Loading…
Reference in a new issue