(*a)->data.cycle.dialog = TRUE;
}
+void setup_action_movefromedge_north(ObAction **a, ObUserAction uact)
+{
+ (*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
+ (*a)->data.diraction.direction = OB_DIRECTION_NORTH;
+ (*a)->data.diraction.hang = TRUE;
+}
+
+void setup_action_movefromedge_south(ObAction **a, ObUserAction uact)
+{
+ (*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
+ (*a)->data.diraction.direction = OB_DIRECTION_SOUTH;
+ (*a)->data.diraction.hang = TRUE;
+}
+
+void setup_action_movefromedge_east(ObAction **a, ObUserAction uact)
+{
+ (*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
+ (*a)->data.diraction.direction = OB_DIRECTION_EAST;
+ (*a)->data.diraction.hang = TRUE;
+}
+
+void setup_action_movefromedge_west(ObAction **a, ObUserAction uact)
+{
+ (*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
+ (*a)->data.diraction.direction = OB_DIRECTION_WEST;
+ (*a)->data.diraction.hang = TRUE;
+}
+
void setup_action_movetoedge_north(ObAction **a, ObUserAction uact)
{
(*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
(*a)->data.diraction.direction = OB_DIRECTION_NORTH;
+ (*a)->data.diraction.hang = FALSE;
}
void setup_action_movetoedge_south(ObAction **a, ObUserAction uact)
{
(*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
(*a)->data.diraction.direction = OB_DIRECTION_SOUTH;
+ (*a)->data.diraction.hang = FALSE;
}
void setup_action_movetoedge_east(ObAction **a, ObUserAction uact)
{
(*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
(*a)->data.diraction.direction = OB_DIRECTION_EAST;
+ (*a)->data.diraction.hang = FALSE;
}
void setup_action_movetoedge_west(ObAction **a, ObUserAction uact)
{
(*a)->data.diraction.any.client_action = OB_CLIENT_ACTION_ALWAYS;
(*a)->data.diraction.direction = OB_DIRECTION_WEST;
+ (*a)->data.diraction.hang = FALSE;
}
void setup_action_growtoedge_north(ObAction **a, ObUserAction uact)
action_cycle_windows,
setup_action_cycle_windows_previous
},
+ {
+ "movefromedgenorth",
+ action_movetoedge,
+ setup_action_movefromedge_north
+ },
+ {
+ "movefromedgesouth",
+ action_movetoedge,
+ setup_action_movefromedge_south
+ },
+ {
+ "movefromedgewest",
+ action_movetoedge,
+ setup_action_movefromedge_west
+ },
+ {
+ "movefromedgeeast",
+ action_movetoedge,
+ setup_action_movefromedge_east
+ },
{
"movetoedgenorth",
action_movetoedge,
switch(data->diraction.direction) {
case OB_DIRECTION_NORTH:
- y = client_directional_edge_search(c, OB_DIRECTION_NORTH);
+ y = client_directional_edge_search(c, OB_DIRECTION_NORTH, data->diraction.hang)
+ - (data->diraction.hang ? c->frame->area.height : 0);
break;
case OB_DIRECTION_WEST:
- x = client_directional_edge_search(c, OB_DIRECTION_WEST);
+ x = client_directional_edge_search(c, OB_DIRECTION_WEST, data->diraction.hang)
+ - (data->diraction.hang ? c->frame->area.width : 0);
break;
case OB_DIRECTION_SOUTH:
- y = client_directional_edge_search(c, OB_DIRECTION_SOUTH) -
- c->frame->area.height;
+ y = client_directional_edge_search(c, OB_DIRECTION_SOUTH, data->diraction.hang)
+ - (data->diraction.hang ? 0 : c->frame->area.height);
break;
case OB_DIRECTION_EAST:
- x = client_directional_edge_search(c, OB_DIRECTION_EAST) -
- c->frame->area.width;
+ x = client_directional_edge_search(c, OB_DIRECTION_EAST, data->diraction.hang)
+ - (data->diraction.hang ? 0 : c->frame->area.width);
break;
default:
g_assert_not_reached();
switch(data->diraction.direction) {
case OB_DIRECTION_NORTH:
- dest = client_directional_edge_search(c, OB_DIRECTION_NORTH);
+ dest = client_directional_edge_search(c, OB_DIRECTION_NORTH, FALSE);
if (a->y == y)
height = c->frame->area.height / 2;
else {
}
break;
case OB_DIRECTION_WEST:
- dest = client_directional_edge_search(c, OB_DIRECTION_WEST);
+ dest = client_directional_edge_search(c, OB_DIRECTION_WEST, FALSE);
if (a->x == x)
width = c->frame->area.width / 2;
else {
}
break;
case OB_DIRECTION_SOUTH:
- dest = client_directional_edge_search(c, OB_DIRECTION_SOUTH);
+ dest = client_directional_edge_search(c, OB_DIRECTION_SOUTH, FALSE);
if (a->y + a->height == y + c->frame->area.height) {
height = c->frame->area.height / 2;
y = a->y + a->height - height;
height -= (height - c->frame->area.height) % c->size_inc.height;
break;
case OB_DIRECTION_EAST:
- dest = client_directional_edge_search(c, OB_DIRECTION_EAST);
+ dest = client_directional_edge_search(c, OB_DIRECTION_EAST, FALSE);
if (a->x + a->width == x + c->frame->area.width) {
width = c->frame->area.width / 2;
x = a->x + a->width - width;
&self->sm_client_id);
}
+#define WANT_EDGE(cur, c) \
+ if(cur == c) \
+ continue; \
+ if(!client_normal_or_dock(cur)) \
+ continue; \
+ if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL) \
+ continue; \
+ if(cur->iconic) \
+ continue; \
+ if(cur->layer < c->layer && !config_resist_layers_below) \
+ continue;
+
+#define HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end) \
+ if ((his_edge_start >= my_edge_start && \
+ his_edge_start <= my_edge_end) || \
+ (my_edge_start >= his_edge_start && \
+ my_edge_start <= his_edge_end)) \
+ dest = his_offset;
+
/* finds the nearest edge in the given direction from the current client
* note to self: the edge is the -frame- edge (the actual one), not the
* client edge.
*/
-gint client_directional_edge_search(ObClient *c, ObDirection dir)
+gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang)
{
gint dest, monitor_dest;
gint my_edge_start, my_edge_end, my_offset;
case OB_DIRECTION_NORTH:
my_edge_start = c->frame->area.x;
my_edge_end = c->frame->area.x + c->frame->area.width;
- my_offset = c->frame->area.y;
+ my_offset = c->frame->area.y + (hang ? c->frame->area.height : 0);
/* default: top of screen */
- dest = a->y;
- monitor_dest = monitor->y;
+ dest = a->y + (hang ? c->frame->area.height : 0);
+ monitor_dest = monitor->y + (hang ? c->frame->area.height : 0);
/* if the monitor edge comes before the screen edge, */
/* use that as the destination instead. (For xinerama) */
if (monitor_dest != dest && my_offset > monitor_dest)
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
- if(cur == c)
- continue;
- if(!client_normal(cur))
- continue;
- if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
- continue;
- if(cur->iconic)
- continue;
- if(cur->layer < c->layer && !config_resist_layers_below)
- continue;
+ WANT_EDGE(cur, c)
his_edge_start = cur->frame->area.x;
his_edge_end = cur->frame->area.x + cur->frame->area.width;
- his_offset = cur->frame->area.y + cur->frame->area.height;
+ his_offset = cur->frame->area.y + (hang ? 0 : cur->frame->area.height);
if(his_offset + 1 > my_offset)
continue;
if(his_offset < dest)
continue;
-
- if(his_edge_start >= my_edge_start &&
- his_edge_start <= my_edge_end)
- dest = his_offset;
-
- if(my_edge_start >= his_edge_start &&
- my_edge_start <= his_edge_end)
- dest = his_offset;
+ HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end)
}
break;
case OB_DIRECTION_SOUTH:
my_edge_start = c->frame->area.x;
my_edge_end = c->frame->area.x + c->frame->area.width;
- my_offset = c->frame->area.y + c->frame->area.height;
+ my_offset = c->frame->area.y + (hang ? 0 : c->frame->area.height);
/* default: bottom of screen */
- dest = a->y + a->height;
- monitor_dest = monitor->y + monitor->height;
+ dest = a->y + a->height - (hang ? c->frame->area.height : 0);
+ monitor_dest = monitor->y + monitor->height - (hang ? c->frame->area.height : 0);
/* if the monitor edge comes before the screen edge, */
/* use that as the destination instead. (For xinerama) */
if (monitor_dest != dest && my_offset < monitor_dest)
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
- if(cur == c)
- continue;
- if(!client_normal(cur))
- continue;
- if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
- continue;
- if(cur->iconic)
- continue;
- if(cur->layer < c->layer && !config_resist_layers_below)
- continue;
+ WANT_EDGE(cur, c)
his_edge_start = cur->frame->area.x;
his_edge_end = cur->frame->area.x + cur->frame->area.width;
- his_offset = cur->frame->area.y;
+ his_offset = cur->frame->area.y + (hang ? cur->frame->area.height : 0);
if(his_offset - 1 < my_offset)
if(his_offset > dest)
continue;
-
- if(his_edge_start >= my_edge_start &&
- his_edge_start <= my_edge_end)
- dest = his_offset;
-
- if(my_edge_start >= his_edge_start &&
- my_edge_start <= his_edge_end)
- dest = his_offset;
+ HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end)
}
break;
case OB_DIRECTION_WEST:
my_edge_start = c->frame->area.y;
my_edge_end = c->frame->area.y + c->frame->area.height;
- my_offset = c->frame->area.x;
+ my_offset = c->frame->area.x + (hang ? c->frame->area.width : 0);
/* default: leftmost egde of screen */
- dest = a->x;
- monitor_dest = monitor->x;
+ dest = a->x + (hang ? c->frame->area.width : 0);
+ monitor_dest = monitor->x + (hang ? c->frame->area.width : 0);
/* if the monitor edge comes before the screen edge, */
/* use that as the destination instead. (For xinerama) */
if (monitor_dest != dest && my_offset > monitor_dest)
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
- if(cur == c)
- continue;
- if(!client_normal(cur))
- continue;
- if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
- continue;
- if(cur->iconic)
- continue;
- if(cur->layer < c->layer && !config_resist_layers_below)
- continue;
+ WANT_EDGE(cur, c)
his_edge_start = cur->frame->area.y;
his_edge_end = cur->frame->area.y + cur->frame->area.height;
- his_offset = cur->frame->area.x + cur->frame->area.width;
+ his_offset = cur->frame->area.x + (hang ? 0 : cur->frame->area.width);
if(his_offset + 1 > my_offset)
continue;
-
+
if(his_offset < dest)
continue;
-
- if(his_edge_start >= my_edge_start &&
- his_edge_start <= my_edge_end)
- dest = his_offset;
-
- if(my_edge_start >= his_edge_start &&
- my_edge_start <= his_edge_end)
- dest = his_offset;
-
+ HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end)
}
- break;
+ break;
case OB_DIRECTION_EAST:
my_edge_start = c->frame->area.y;
my_edge_end = c->frame->area.y + c->frame->area.height;
- my_offset = c->frame->area.x + c->frame->area.width;
+ my_offset = c->frame->area.x + (hang ? 0 : c->frame->area.width);
/* default: rightmost edge of screen */
- dest = a->x + a->width;
- monitor_dest = monitor->x + monitor->width;
+ dest = a->x + a->width - (hang ? c->frame->area.width : 0);
+ monitor_dest = monitor->x + monitor->width - (hang ? c->frame->area.width : 0);
/* if the monitor edge comes before the screen edge, */
/* use that as the destination instead. (For xinerama) */
if (monitor_dest != dest && my_offset < monitor_dest)
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
- if(cur == c)
- continue;
- if(!client_normal(cur))
- continue;
- if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
- continue;
- if(cur->iconic)
- continue;
- if(cur->layer < c->layer && !config_resist_layers_below)
- continue;
+ WANT_EDGE(cur, c)
his_edge_start = cur->frame->area.y;
his_edge_end = cur->frame->area.y + cur->frame->area.height;
- his_offset = cur->frame->area.x;
+ his_offset = cur->frame->area.x + (hang ? cur->frame->area.width : 0);
if(his_offset - 1 < my_offset)
continue;
if(his_offset > dest)
continue;
-
- if(his_edge_start >= my_edge_start &&
- his_edge_start <= my_edge_end)
- dest = his_offset;
-
- if(my_edge_start >= his_edge_start &&
- my_edge_start <= his_edge_end)
- dest = his_offset;
+ HIT_EDGE(my_edge_start, my_edge_end, his_edge_start, his_edge_end)
}
break;
case OB_DIRECTION_NORTHEAST: