option to make dragging and findedge ignore windows on lower layers

This commit is contained in:
Mikael Magnusson 2004-09-04 19:45:38 +00:00
parent 1ed2670b89
commit c02f68499f
6 changed files with 26 additions and 0 deletions

View file

@ -11,6 +11,7 @@
<resistance> <resistance>
<strength>10</strength> <strength>10</strength>
<screen_edge_strength>20</screen_edge_strength> <screen_edge_strength>20</screen_edge_strength>
<edges_hit_layers_below>no</edges_hit_layers_below>
</resistance> </resistance>
<focus> <focus>

View file

@ -65,6 +65,7 @@
<xs:sequence> <xs:sequence>
<xs:element name="strength" type="xs:integer"/> <xs:element name="strength" type="xs:integer"/>
<xs:element name="screen_edge_strength" type="xs:integer"/> <xs:element name="screen_edge_strength" type="xs:integer"/>
<xs:element name="edges_hit_layers_below" type="xs:yesorno"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="focus"> <xs:complexType name="focus">

View file

@ -3151,6 +3151,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
continue; continue;
if(cur->iconic) if(cur->iconic)
continue; continue;
if(cur->layer < c->layer && !config_resist_layers_below)
continue;
his_edge_start = cur->frame->area.x; his_edge_start = cur->frame->area.x;
his_edge_end = cur->frame->area.x + cur->frame->area.width; his_edge_end = cur->frame->area.x + cur->frame->area.width;
@ -3192,6 +3194,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
continue; continue;
if(cur->iconic) if(cur->iconic)
continue; continue;
if(cur->layer < c->layer && !config_resist_layers_below)
continue;
his_edge_start = cur->frame->area.x; his_edge_start = cur->frame->area.x;
his_edge_end = cur->frame->area.x + cur->frame->area.width; his_edge_end = cur->frame->area.x + cur->frame->area.width;
@ -3234,6 +3238,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
continue; continue;
if(cur->iconic) if(cur->iconic)
continue; continue;
if(cur->layer < c->layer && !config_resist_layers_below)
continue;
his_edge_start = cur->frame->area.y; his_edge_start = cur->frame->area.y;
his_edge_end = cur->frame->area.y + cur->frame->area.height; his_edge_end = cur->frame->area.y + cur->frame->area.height;
@ -3276,6 +3282,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir)
continue; continue;
if(cur->iconic) if(cur->iconic)
continue; continue;
if(cur->layer < c->layer && !config_resist_layers_below)
continue;
his_edge_start = cur->frame->area.y; his_edge_start = cur->frame->area.y;
his_edge_end = cur->frame->area.y + cur->frame->area.height; his_edge_end = cur->frame->area.y + cur->frame->area.height;

View file

@ -73,6 +73,8 @@ GSList *config_menu_files;
gint config_resist_win; gint config_resist_win;
gint config_resist_edge; gint config_resist_edge;
gboolean config_resist_layers_below;
/* /*
<keybind key="C-x"> <keybind key="C-x">
@ -422,6 +424,8 @@ static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
config_resist_win = parse_int(doc, n); config_resist_win = parse_int(doc, n);
if ((n = parse_find_node("screen_edge_strength", node))) if ((n = parse_find_node("screen_edge_strength", node)))
config_resist_edge = parse_int(doc, n); config_resist_edge = parse_int(doc, n);
if ((n = parse_find_node("edges_hit_layers_below", node)))
config_resist_layers_below = parse_bool(doc, n);
} }
typedef struct typedef struct
@ -589,6 +593,7 @@ void config_startup(ObParseInst *i)
config_resist_win = 10; config_resist_win = 10;
config_resist_edge = 20; config_resist_edge = 20;
config_resist_layers_below = FALSE;
parse_register(i, "resistance", parse_resistance, NULL); parse_register(i, "resistance", parse_resistance, NULL);

View file

@ -104,6 +104,8 @@ extern gint config_mouse_dclicktime;
extern gint config_resist_win; extern gint config_resist_win;
/*! Number of pixels to resist while crossing a screen's edge */ /*! Number of pixels to resist while crossing a screen's edge */
extern gint config_resist_edge; extern gint config_resist_edge;
/*! Should windows resist edges at layers below */
extern gboolean config_resist_layers_below;
/*! Warp near edge on menu? */ /*! Warp near edge on menu? */
extern gboolean config_menu_warppointer; extern gboolean config_menu_warppointer;

View file

@ -54,9 +54,14 @@ void resist_move_windows(ObClient *c, gint *x, gint *y)
if (!WINDOW_IS_CLIENT(it->data)) if (!WINDOW_IS_CLIENT(it->data))
continue; continue;
target = it->data; target = it->data;
/* don't snap to self or non-visibles */ /* don't snap to self or non-visibles */
if (!target->frame->visible || target == c) continue; if (!target->frame->visible || target == c) continue;
/* don't snap to windows in layers beneath */
if(target->layer < c->layer && !config_resist_layers_below)
continue;
tl = RECT_LEFT(target->frame->area) - 1; tl = RECT_LEFT(target->frame->area) - 1;
tt = RECT_TOP(target->frame->area) - 1; tt = RECT_TOP(target->frame->area) - 1;
tr = RECT_RIGHT(target->frame->area) + 1; tr = RECT_RIGHT(target->frame->area) + 1;
@ -195,6 +200,10 @@ void resist_size_windows(ObClient *c, gint *w, gint *h, ObCorner corn)
/* don't snap to invisibles or ourself */ /* don't snap to invisibles or ourself */
if (!target->frame->visible || target == c) continue; if (!target->frame->visible || target == c) continue;
/* don't snap to windows in layers beneath */
if(target->layer < c->layer && !config_resist_layers_below)
continue;
tl = RECT_LEFT(target->frame->area); tl = RECT_LEFT(target->frame->area);
tr = RECT_RIGHT(target->frame->area); tr = RECT_RIGHT(target->frame->area);
tt = RECT_TOP(target->frame->area); tt = RECT_TOP(target->frame->area);