X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=monitor.c;h=da31a725e6cc24466939c41adce48ce4552a807a;hb=5c1f76fdd6477dde835fcc70afee1fff23052d14;hp=5b2dedb0de4f211fefd0e5c3a36ff20d13509a53;hpb=aca232b23ca181caf992b1da144cfd187ef72535;p=bspwm.git diff --git a/monitor.c b/monitor.c index 5b2dedb..da31a72 100644 --- a/monitor.c +++ b/monitor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, Bastien Dejean +/* Copyright (c) 2012, Bastien Dejean * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -20,10 +20,6 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those - * of the authors and should not be interpreted as representing official policies, - * either expressed or implied, of the FreeBSD Project. */ #include @@ -139,7 +135,7 @@ void focus_monitor(monitor_t *m) mon = m; if (pointer_follows_monitor) - center_pointer(m); + center_pointer(m->rectangle); ewmh_update_current_desktop(); put_status(); @@ -369,7 +365,7 @@ bool update_monitors(void) } } free(cir); - } else if (!remove_disabled_monitor && info->connection != XCB_RANDR_CONNECTION_DISCONNECTED) { + } else if (!remove_disabled_monitors && info->connection != XCB_RANDR_CONNECTION_DISCONNECTED) { m = get_monitor_by_id(outputs[i]); if (m != NULL) m->wired = true; @@ -392,22 +388,29 @@ bool update_monitors(void) free(gpo); /* handle overlapping monitors */ - m = mon_head; - while (m != NULL) { - monitor_t *next = m->next; - if (m->wired) { - for (monitor_t *mb = mon_head; mb != NULL; mb = mb->next) - if (mb != m && mb->wired && - (m->desk == NULL || mb->desk == NULL) && - contains(mb->rectangle, m->rectangle)) { - if (mm == m) - mm = mb; - merge_monitors(m, mb); - remove_monitor(m); - break; - } + if (merge_overlapping_monitors) { + m = mon_head; + while (m != NULL) { + monitor_t *next = m->next; + if (m->wired) { + for (monitor_t *mb = mon_head; mb != NULL; mb = mb->next) + if (mb != m && mb->wired && + (m->desk == NULL || mb->desk == NULL) && + contains(mb->rectangle, m->rectangle)) { + if (mm == m) + mm = mb; + if (m->desk != NULL && mb->desk == NULL && contains(m->rectangle, mb->rectangle)) { + mm = m; + remove_monitor(mb); + } else { + merge_monitors(m, mb); + remove_monitor(m); + } + break; + } + } + m = next; } - m = next; } /* merge and remove disconnected monitors */