add shade action.
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 \
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 \
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,
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,
}
}
-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;
action_iconify_startup();
action_fullscreen_startup();
action_maximize_startup();
+ action_maximizehorizontal_startup();
+ action_maximizevertical_startup();
action_moveto_startup();
action_moverelative_startup();
+ action_shade_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
#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);
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;
}
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);
}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}
--- /dev/null
+#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;
+}