summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-05-21 03:58:32 +0000
committerDana Jansens <danakj@orodu.net>2003-05-21 03:58:32 +0000
commit7da6e2271e6318611e648b0149411aa581343c09 (patch)
treea641b32790affb6237b07e224f0996b3a2e7fca9
parent9f501638b55f023a6dff7c557f208083df74e4c9 (diff)
add 'movetoedge' actions
-rw-r--r--openbox/action.c95
-rw-r--r--openbox/action.h5
2 files changed, 87 insertions, 13 deletions
diff --git a/openbox/action.c b/openbox/action.c
index 7f1622fa..ad12c331 100644
--- a/openbox/action.c
+++ b/openbox/action.c
@@ -41,42 +41,42 @@ void action_free(Action *a)
void setup_action_directional_focus_north(Action *a)
{
- a->data.dfocus.direction = Direction_North;
+ a->data.diraction.direction = Direction_North;
}
void setup_action_directional_focus_east(Action *a)
{
- a->data.dfocus.direction = Direction_East;
+ a->data.diraction.direction = Direction_East;
}
void setup_action_directional_focus_south(Action *a)
{
- a->data.dfocus.direction = Direction_South;
+ a->data.diraction.direction = Direction_South;
}
void setup_action_directional_focus_west(Action *a)
{
- a->data.dfocus.direction = Direction_West;
+ a->data.diraction.direction = Direction_West;
}
void setup_action_directional_focus_northeast(Action *a)
{
- a->data.dfocus.direction = Direction_NorthEast;
+ a->data.diraction.direction = Direction_NorthEast;
}
void setup_action_directional_focus_southeast(Action *a)
{
- a->data.dfocus.direction = Direction_SouthEast;
+ a->data.diraction.direction = Direction_SouthEast;
}
void setup_action_directional_focus_southwest(Action *a)
{
- a->data.dfocus.direction = Direction_SouthWest;
+ a->data.diraction.direction = Direction_SouthWest;
}
void setup_action_directional_focus_northwest(Action *a)
{
- a->data.dfocus.direction = Direction_NorthWest;
+ a->data.diraction.direction = Direction_NorthWest;
}
void setup_action_send_to_desktop(Action *a)
@@ -149,7 +149,27 @@ void setup_action_cycle_windows_previous(Action *a)
a->data.cycle.linear = FALSE;
a->data.cycle.forward = FALSE;
}
-
+
+void setup_action_movetoedge_north(Action *a)
+{
+ a->data.diraction.direction = Direction_North;
+}
+
+void setup_action_movetoedge_south(Action *a)
+{
+ a->data.diraction.direction = Direction_South;
+}
+
+void setup_action_movetoedge_east(Action *a)
+{
+ a->data.diraction.direction = Direction_East;
+}
+
+void setup_action_movetoedge_west(Action *a)
+{
+ a->data.diraction.direction = Direction_West;
+}
+
ActionString actionstrings[] =
{
{
@@ -483,6 +503,26 @@ ActionString actionstrings[] =
setup_action_cycle_windows_previous
},
{
+ "movetoedgenorth",
+ action_movetoedge,
+ setup_action_movetoedge_north
+ },
+ {
+ "movetoedgesouth",
+ action_movetoedge,
+ setup_action_movetoedge_south
+ },
+ {
+ "movetoedgewest",
+ action_movetoedge,
+ setup_action_movetoedge_west
+ },
+ {
+ "movetoedgeeast",
+ action_movetoedge,
+ setup_action_movetoedge_east
+ },
+ {
NULL,
NULL,
NULL
@@ -1009,8 +1049,41 @@ void action_directional_focus(union ActionData *data)
{
Client *nf;
- if (!data->dfocus.c)
+ if (!data->diraction.c)
return;
- if ((nf = client_find_directional(data->dfocus.c, data->dfocus.direction)))
+ if ((nf = client_find_directional(data->diraction.c,
+ data->diraction.direction)))
client_activate(nf);
}
+
+void action_movetoedge(union ActionData *data)
+{
+ int x, y, h, w;
+ Client *c = data->diraction.c;
+
+ if (!c)
+ return;
+ x = c->frame->area.x;
+ y = c->frame->area.y;
+
+ h = screen_area(c->desktop)->height;
+ w = screen_area(c->desktop)->width;
+ switch(data->diraction.direction) {
+ case Direction_North:
+ y = 0;
+ break;
+ case Direction_West:
+ x = 0;
+ break;
+ case Direction_South:
+ y = h - c->frame->area.height;
+ break;
+ case Direction_East:
+ x = w - c->frame->area.width;
+ break;
+ }
+ frame_frame_gravity(c->frame, &x, &y);
+ client_configure(c, Corner_TopLeft,
+ x, y, c->area.width, c->area.height, TRUE, TRUE);
+
+}
diff --git a/openbox/action.h b/openbox/action.h
index e0ea0d56..ba5ff223 100644
--- a/openbox/action.h
+++ b/openbox/action.h
@@ -12,7 +12,7 @@ struct AnyAction {
Client *c;
};
-struct DirectionalFocus {
+struct DirectionalAction{
Client *c;
int direction;
};
@@ -78,7 +78,7 @@ struct CycleWindows {
union ActionData {
struct AnyAction any;
- struct DirectionalFocus dfocus;
+ struct DirectionalAction diraction;
struct Execute execute;
struct ClientAction client;
struct MoveResizeRelative relative;
@@ -206,4 +206,5 @@ void action_showmenu(union ActionData *data);
void action_cycle_windows(union ActionData *data);
void action_directional_focus(union ActionData *data);
+void action_movetoedge(union ActionData *data);
#endif