aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Screen.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 0b477d7..c2929d0 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1961,6 +1961,7 @@ void BScreen::initXinerama() {
1961 1961
1962 if (m_xinerama_headinfo) 1962 if (m_xinerama_headinfo)
1963 delete [] m_xinerama_headinfo; 1963 delete [] m_xinerama_headinfo;
1964
1964 m_xinerama_headinfo = new XineramaHeadInfo[number]; 1965 m_xinerama_headinfo = new XineramaHeadInfo[number];
1965 m_xinerama_num_heads = number; 1966 m_xinerama_num_heads = number;
1966 for (int i=0; i < number; i++) { 1967 for (int i=0; i < number; i++) {
@@ -1974,7 +1975,8 @@ void BScreen::initXinerama() {
1974 fbdbg<<"BScreen::initXinerama(): number of heads ="<<number<<endl; 1975 fbdbg<<"BScreen::initXinerama(): number of heads ="<<number<<endl;
1975 1976
1976 /* Reallocate to the new number of heads. */ 1977 /* Reallocate to the new number of heads. */
1977 int ha_num = numHeads() ? numHeads() : 1, ha_oldnum = m_head_areas.size(); 1978 int ha_num = numHeads() ? numHeads() : 1;
1979 int ha_oldnum = m_head_areas.size();
1978 if (ha_num > ha_oldnum) { 1980 if (ha_num > ha_oldnum) {
1979 m_head_areas.resize(ha_num); 1981 m_head_areas.resize(ha_num);
1980 for (int i = ha_oldnum; i < ha_num; i++) 1982 for (int i = ha_oldnum; i < ha_num; i++)
@@ -2012,18 +2014,18 @@ void BScreen::clearHeads() {
2012} 2014}
2013 2015
2014int BScreen::getHead(int x, int y) const { 2016int BScreen::getHead(int x, int y) const {
2015 if (!hasXinerama()) return 0;
2016#ifdef XINERAMA
2017 2017
2018 for (int i=0; i < m_xinerama_num_heads; i++) { 2018#ifdef XINERAMA
2019 if (x >= m_xinerama_headinfo[i].x && 2019 if (hasXinerama()) {
2020 x < (m_xinerama_headinfo[i].x + m_xinerama_headinfo[i].width) && 2020 for (int i=0; i < m_xinerama_num_heads; i++) {
2021 y >= m_xinerama_headinfo[i].y && 2021 if (x >= m_xinerama_headinfo[i].x &&
2022 y < (m_xinerama_headinfo[i].y + m_xinerama_headinfo[i].height)) { 2022 x < (m_xinerama_headinfo[i].x + m_xinerama_headinfo[i].width) &&
2023 return i+1; 2023 y >= m_xinerama_headinfo[i].y &&
2024 y < (m_xinerama_headinfo[i].y + m_xinerama_headinfo[i].height)) {
2025 return i+1;
2026 }
2024 } 2027 }
2025 } 2028 }
2026
2027#endif // XINERAMA 2029#endif // XINERAMA
2028 return 0; 2030 return 0;
2029} 2031}
@@ -2119,7 +2121,7 @@ pair<int,int> BScreen::clampToHead(int head, int x, int y, int w, int h) const {
2119 // if there are multiple heads, head=0 is not valid 2121 // if there are multiple heads, head=0 is not valid
2120 // a better way would be to search the closest head 2122 // a better way would be to search the closest head
2121 if (head == 0 && numHeads() != 0) 2123 if (head == 0 && numHeads() != 0)
2122 head = 1; 2124 head = 1;
2123 2125
2124 int hx = getHeadX(head); 2126 int hx = getHeadX(head);
2125 int hy = getHeadY(head); 2127 int hy = getHeadY(head);