]> Dogcows Code - chaz/openbox/commitdiff
add 'movetoedge' actions
authorDana Jansens <danakj@orodu.net>
Wed, 21 May 2003 03:58:32 +0000 (03:58 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 21 May 2003 03:58:32 +0000 (03:58 +0000)
openbox/action.c
openbox/action.h

index 7f1622fadf29db1e2d121899af7ee0d58f3fd367..ad12c331f8729256da168568042529e5ec83456b 100644 (file)
@@ -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[] =
 {
     {
@@ -482,6 +502,26 @@ ActionString actionstrings[] =
         action_cycle_windows,
         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,
@@ -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);
+
+}
index e0ea0d566d8c7b8e650122d2c07fc5679b7ce958..ba5ff22359ca997981c5a7857596faae972698e6 100644 (file)
@@ -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
This page took 0.0337 seconds and 4 git commands to generate.