From c02f68499f8cb001f48cbc6d4af43a6fe9cf681d Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 4 Sep 2004 19:45:38 +0000 Subject: [PATCH] option to make dragging and findedge ignore windows on lower layers --- data/rc.xml.in | 1 + data/rc.xsd | 1 + openbox/client.c | 8 ++++++++ openbox/config.c | 5 +++++ openbox/config.h | 2 ++ openbox/resist.c | 9 +++++++++ 6 files changed, 26 insertions(+) diff --git a/data/rc.xml.in b/data/rc.xml.in index a1f27627..58c6b42d 100644 --- a/data/rc.xml.in +++ b/data/rc.xml.in @@ -11,6 +11,7 @@ 10 20 + no diff --git a/data/rc.xsd b/data/rc.xsd index 9cb585a7..9f992ed7 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -65,6 +65,7 @@ + diff --git a/openbox/client.c b/openbox/client.c index b7ed57b5..bc1ccc0e 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3151,6 +3151,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir) continue; if(cur->iconic) continue; + if(cur->layer < c->layer && !config_resist_layers_below) + continue; his_edge_start = cur->frame->area.x; 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; if(cur->iconic) continue; + if(cur->layer < c->layer && !config_resist_layers_below) + continue; his_edge_start = cur->frame->area.x; 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; if(cur->iconic) continue; + if(cur->layer < c->layer && !config_resist_layers_below) + continue; his_edge_start = cur->frame->area.y; 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; if(cur->iconic) continue; + if(cur->layer < c->layer && !config_resist_layers_below) + continue; his_edge_start = cur->frame->area.y; his_edge_end = cur->frame->area.y + cur->frame->area.height; diff --git a/openbox/config.c b/openbox/config.c index da1128f4..9156c888 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -73,6 +73,8 @@ GSList *config_menu_files; gint config_resist_win; gint config_resist_edge; +gboolean config_resist_layers_below; + /* @@ -422,6 +424,8 @@ static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_resist_win = parse_int(doc, n); if ((n = parse_find_node("screen_edge_strength", node))) 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 @@ -589,6 +593,7 @@ void config_startup(ObParseInst *i) config_resist_win = 10; config_resist_edge = 20; + config_resist_layers_below = FALSE; parse_register(i, "resistance", parse_resistance, NULL); diff --git a/openbox/config.h b/openbox/config.h index e13dd091..3117a710 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -104,6 +104,8 @@ extern gint config_mouse_dclicktime; extern gint config_resist_win; /*! Number of pixels to resist while crossing a screen's edge */ extern gint config_resist_edge; +/*! Should windows resist edges at layers below */ +extern gboolean config_resist_layers_below; /*! Warp near edge on menu? */ extern gboolean config_menu_warppointer; diff --git a/openbox/resist.c b/openbox/resist.c index c88f5948..42c03675 100644 --- a/openbox/resist.c +++ b/openbox/resist.c @@ -54,9 +54,14 @@ void resist_move_windows(ObClient *c, gint *x, gint *y) if (!WINDOW_IS_CLIENT(it->data)) continue; target = it->data; + /* don't snap to self or non-visibles */ 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; tt = RECT_TOP(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 */ 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); tr = RECT_RIGHT(target->frame->area); tt = RECT_TOP(target->frame->area); -- 2.39.2