From 49fb7f52e5488f7b13702d40e94b1b05c6cb2fb5 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson <mikachu@gmail.com> Date: Fri, 5 May 2017 19:57:15 +0200 Subject: [PATCH 1/1] Don't clobber loop variable with return value Fixes bug 6383. --- openbox/screen.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openbox/screen.c b/openbox/screen.c index e758ada..31cb8de 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1903,18 +1903,21 @@ guint screen_monitor_pointer() gboolean screen_pointer_pos(gint *x, gint *y) { - Window w; gint i; - guint u; gboolean ret; + /* we don't care about any of these return values, but we can't pass NULL */ + Window w; + guint u; + gint j; + ret = !!XQueryPointer(obt_display, obt_root(ob_screen), - &w, &w, x, y, &i, &i, &u); + &w, &w, x, y, &j, &j, &u); if (!ret) { for (i = 0; i < ScreenCount(obt_display); ++i) if (i != ob_screen) - if (XQueryPointer(obt_display, obt_root(i), - &w, &w, x, y, &i, &i, &u)) + if ((ret=XQueryPointer(obt_display, obt_root(i), + &w, &w, x, y, &j, &j, &u))) break; } return ret; -- 1.9.1 From b0c40f37282035c253250fa82eaba8eeafb8e597 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson <mikachu@gmail.com> Date: Sun, 2 Apr 2017 19:20:23 +0200 Subject: [PATCH 1/1] Apply combined shape mask correctly This only broke windows that use ShapeInput and don't hide their window decorations, which is a fairly small set. --- openbox/frame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbox/frame.c b/openbox/frame.c index 8966972..fecac58 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -318,7 +318,7 @@ void frame_adjust_shape_kind(ObFrame *self, int kind) } XShapeCombineRectangles(obt_display, self->window, - ShapeBounding, 0, 0, xrect, num, + kind, 0, 0, xrect, num, ShapeUnion, Unsorted); } } -- 1.9.1 From d9a405e9b3b0e9bfe5686c6df456138b443d1e35 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson <mikachu@gmail.com> Date: Mon, 7 Sep 2015 00:24:03 +0200 Subject: [PATCH 1/1] Add 'last' as a desktop target for if/foreach --- openbox/actions/if.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openbox/actions/if.c b/openbox/actions/if.c index a9c4094..c76fb71 100644 --- a/openbox/actions/if.c +++ b/openbox/actions/if.c @@ -68,6 +68,7 @@ typedef struct { gboolean omnipresent_off; gboolean desktop_current; gboolean desktop_other; + gboolean desktop_last; guint desktop_number; guint screendesktop_number; guint client_monitor; @@ -192,8 +193,10 @@ static void setup_query(Options* o, xmlNodePtr node, QueryTarget target) { if ((s = obt_xml_node_string(n))) { if (!g_ascii_strcasecmp(s, "current")) q->desktop_current = TRUE; - if (!g_ascii_strcasecmp(s, "other")) + else if (!g_ascii_strcasecmp(s, "other")) q->desktop_other = TRUE; + else if (!g_ascii_strcasecmp(s, "last")) + q->desktop_last = TRUE; else q->desktop_number = atoi(s); g_free(s); @@ -392,6 +395,8 @@ static gboolean run_func_if(ObActionsData *data, gpointer options) is_true &= is_on_current_desktop; if (q->desktop_other) is_true &= !is_on_current_desktop; + if (q->desktop_last) + is_true &= query_target->desktop == screen_last_desktop; if (q->desktop_number) { gboolean is_on_desktop = -- 1.9.1 From 025822e7b5609943d3635434b91d43b4de8a2a81 Mon Sep 17 00:00:00 2001 From: Ian Zimmerman <itz@buug.org> Date: Wed, 8 Jul 2015 16:02:00 -0700 Subject: [PATCH 1/1] Directional switching On 2015-07-07 13:17 -0700, Ian Zimmerman wrote: > The 2 and 5 could/should be rc.xml parameters. With defaults 1 and 1 > you'd have the current behavior. Is there interest in me pursuing that > path and providing a more complete patch? Not much interest, but here it is anyway. I want to be on record as using this feature to its full extent, and if necessary maintaining it. -- Please *no* private copies of mailing list or newsgroup messages. Rule 420: All persons more than eight miles high to leave the court. --- data/rc.xsd | 2 ++ openbox/config.c | 10 ++++++++++ openbox/config.h | 4 ++++ openbox/focus_cycle.c | 4 +++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/data/rc.xsd b/data/rc.xsd index c8f5638..dcca6bc 100644 --- a/data/rc.xsd +++ b/data/rc.xsd @@ -62,6 +62,8 @@ <xsd:element minOccurs="0" name="focusDelay" type="xsd:integer"/> <xsd:element minOccurs="0" name="raiseOnFocus" type="ob:bool"/> <xsd:element minOccurs="0" name="unfocusOnLeave" type="ob:bool"/> + <xsd:element minOccurs="0" name="directionalDistanceWeight" type="xsd:integer"/> + <xsd:element minOccurs="0" name="directionalAngleWeight" type="xsd:integer"/> </xsd:all> </xsd:complexType> <xsd:complexType name="placement"> diff --git a/openbox/config.c b/openbox/config.c index dad5d1b..83c2bf8 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -35,6 +35,8 @@ gboolean config_focus_raise; gboolean config_focus_last; gboolean config_focus_under_mouse; gboolean config_unfocus_leave; +guint config_directional_distance_weight; +guint config_directional_angle_weight; ObPlacePolicy config_place_policy; gboolean config_place_center; @@ -635,6 +637,14 @@ static void parse_focus(xmlNodePtr node, gpointer d) config_focus_under_mouse = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "unfocusOnLeave"))) config_unfocus_leave = obt_xml_node_bool(n); + if ((n = obt_xml_find_node(node, "directionalDistanceWeight"))) + config_directional_distance_weight = obt_xml_node_int(n); + else + config_directional_distance_weight = 1U; + if ((n = obt_xml_find_node(node, "directionalAngleWeight"))) + config_directional_angle_weight = obt_xml_node_int(n); + else + config_directional_angle_weight = 1U; } static void parse_placement(xmlNodePtr node, gpointer d) diff --git a/openbox/config.h b/openbox/config.h index 96a66cf..51944b3 100644 --- a/openbox/config.h +++ b/openbox/config.h @@ -85,6 +85,10 @@ extern gboolean config_focus_under_mouse; /*! Remove focus from windows when the mouse leaves them */ extern gboolean config_unfocus_leave; +/*! Weight of distance part of score for directional switching */ +extern guint config_directional_distance_weight; +/*! Weight of angle part of score for directional switching */ +extern guint config_directional_angle_weight; /*! The algorithm to use for placing new windows */ extern ObPlacePolicy config_place_policy; diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index de17650..24c0d2a 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -25,6 +25,7 @@ #include "screen.h" #include "openbox.h" #include "debug.h" +#include "config.h" #include <X11/Xlib.h> #include <glib.h> @@ -250,7 +251,8 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir, continue; /* Calculate score for this window. The smaller the better. */ - score = distance + offset; + score = (distance * config_directional_distance_weight + + offset * config_directional_angle_weight); /* windows more than 45 degrees off the direction are * heavily penalized and will only be chosen if nothing -- 1.9.1