aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc180
1 files changed, 11 insertions, 169 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 6af65a9..9002ad2 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -341,14 +341,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
341 m_pressed_winbutton_theme(new WinButtonTheme(scrn, ".pressed", ".Pressed", *m_focused_windowtheme)), 341 m_pressed_winbutton_theme(new WinButtonTheme(scrn, ".pressed", ".Pressed", *m_focused_windowtheme)),
342 m_menutheme(new FbTk::MenuTheme(scrn)), 342 m_menutheme(new FbTk::MenuTheme(scrn)),
343 m_root_window(scrn), 343 m_root_window(scrn),
344 m_geom_window(m_root_window, 344 m_geom_window(m_root_window, *this, *m_focused_windowtheme),
345 0, 0, 10, 10, 345 m_pos_window(m_root_window, *this, *m_focused_windowtheme),
346 false, // override redirect
347 true), // save under
348 m_pos_window(m_root_window,
349 0, 0, 10, 10,
350 false, // override redirect
351 true), // save under
352 m_dummy_window(scrn, -1, -1, 1, 1, 0, true, false, CopyFromParent, 346 m_dummy_window(scrn, -1, -1, 1, 1, 0, true, false, CopyFromParent,
353 InputOnly), 347 InputOnly),
354 resource(rm, screenname, altscreenname), 348 resource(rm, screenname, altscreenname),
@@ -483,11 +477,6 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
483 focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window 477 focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window
484 478
485 479
486 geom_visible = false;
487 geom_pixmap = 0;
488 pos_visible = false;
489 pos_pixmap = 0;
490
491 renderGeomWindow(); 480 renderGeomWindow();
492 renderPosWindow(); 481 renderPosWindow();
493 482
@@ -585,12 +574,6 @@ BScreen::~BScreen() {
585 } 574 }
586 } 575 }
587 576
588 if (geom_pixmap != None)
589 imageControl().removeImage(geom_pixmap);
590
591 if (pos_pixmap != None)
592 imageControl().removeImage(pos_pixmap);
593
594 removeWorkspaceNames(); 577 removeWorkspaceNames();
595 using namespace FbTk::STLUtil; 578 using namespace FbTk::STLUtil;
596 destroyAndClear(m_workspaces_list); 579 destroyAndClear(m_workspaces_list);
@@ -938,9 +921,6 @@ void BScreen::reconfigure() {
938 m_menutheme->setDelayOpen(*resource.menu_delay); 921 m_menutheme->setDelayOpen(*resource.menu_delay);
939 m_menutheme->setDelayClose(*resource.menu_delay_close); 922 m_menutheme->setDelayClose(*resource.menu_delay_close);
940 923
941 renderGeomWindow();
942 renderPosWindow();
943
944 // realize the number of workspaces from the init-file 924 // realize the number of workspaces from the init-file
945 const unsigned int nr_ws = *resource.workspaces; 925 const unsigned int nr_ws = *resource.workspaces;
946 if (nr_ws > m_workspaces_list.size()) { 926 if (nr_ws > m_workspaces_list.size()) {
@@ -1812,47 +1792,17 @@ void BScreen::shutdown() {
1812 1792
1813 1793
1814void BScreen::showPosition(int x, int y) { 1794void BScreen::showPosition(int x, int y) {
1815 if (!doShowWindowPos()) 1795 if (!doShowWindowPos())
1816 return; 1796 return;
1817 1797
1818 if (! pos_visible) {
1819 if (hasXinerama()) {
1820 unsigned int head = getCurrHead();
1821
1822 m_pos_window.move(getHeadX(head) + (getHeadWidth(head) - m_pos_window.width()) / 2,
1823 getHeadY(head) + (getHeadHeight(head) - m_pos_window.height()) / 2);
1824
1825 } else {
1826 m_pos_window.move((width() - m_pos_window.width()) / 2,
1827 (height() - m_pos_window.height()) / 2);
1828 }
1829
1830 m_pos_window.show();
1831 m_pos_window.raise();
1832
1833 pos_visible = true;
1834 }
1835
1836 char label[256]; 1798 char label[256];
1837 sprintf(label, "X:%5d x Y:%5d", x, y); 1799 sprintf(label, "X:%5d x Y:%5d", x, y);
1838 1800 m_pos_window.showText(label);
1839 m_pos_window.clear();
1840
1841 focusedWinFrameTheme()->font().drawText(m_pos_window, screenNumber(),
1842 focusedWinFrameTheme()->iconbarTheme().text().textGC(),
1843 label, strlen(label),
1844 focusedWinFrameTheme()->bevelWidth(),
1845 focusedWinFrameTheme()->bevelWidth() +
1846 focusedWinFrameTheme()->font().ascent());
1847
1848} 1801}
1849 1802
1850 1803
1851void BScreen::hidePosition() { 1804void BScreen::hidePosition() {
1852 if (pos_visible) { 1805 m_pos_window.hide();
1853 m_pos_window.hide();
1854 pos_visible = false;
1855 }
1856} 1806}
1857 1807
1858// can be negative when base_width/height > min_width/height 1808// can be negative when base_width/height > min_width/height
@@ -1860,23 +1810,6 @@ void BScreen::showGeometry(int gx, int gy) {
1860 if (!doShowWindowPos()) 1810 if (!doShowWindowPos())
1861 return; 1811 return;
1862 1812
1863 if (! geom_visible) {
1864 if (hasXinerama()) {
1865 unsigned int head = getCurrHead();
1866
1867 m_geom_window.move(getHeadX(head) + (getHeadWidth(head) - m_geom_window.width()) / 2,
1868 getHeadY(head) + (getHeadHeight(head) - m_geom_window.height()) / 2);
1869 } else {
1870 m_geom_window.move((width() - m_geom_window.width()) / 2,
1871 (height() - m_geom_window.height()) / 2);
1872
1873 }
1874 m_geom_window.show();
1875 m_geom_window.raise();
1876
1877 geom_visible = true;
1878 }
1879
1880 char label[256]; 1813 char label[256];
1881 _FB_USES_NLS; 1814 _FB_USES_NLS;
1882 1815
@@ -1885,24 +1818,12 @@ void BScreen::showGeometry(int gx, int gy) {
1885 "W: %4d x H: %4d", 1818 "W: %4d x H: %4d",
1886 "Format for width and height window, %4d for width, and %4d for height").c_str(), 1819 "Format for width and height window, %4d for width, and %4d for height").c_str(),
1887 gx, gy); 1820 gx, gy);
1888 1821 m_geom_window.showText(label);
1889 m_geom_window.clear();
1890
1891 //!! TODO: geom window again?! repeated
1892 focusedWinFrameTheme()->font().drawText(m_geom_window, screenNumber(),
1893 focusedWinFrameTheme()->iconbarTheme().text().textGC(),
1894 label, strlen(label),
1895 focusedWinFrameTheme()->bevelWidth(),
1896 focusedWinFrameTheme()->bevelWidth() +
1897 focusedWinFrameTheme()->font().ascent());
1898} 1822}
1899 1823
1900 1824
1901void BScreen::hideGeometry() { 1825void BScreen::hideGeometry() {
1902 if (geom_visible) { 1826 m_geom_window.hide();
1903 m_geom_window.hide();
1904 geom_visible = false;
1905 }
1906} 1827}
1907 1828
1908void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) { 1829void BScreen::setLayer(FbTk::XLayerItem &item, int layernum) {
@@ -1950,93 +1871,14 @@ void BScreen::renderGeomWindow() {
1950 _FB_XTEXT(Screen, GeometrySpacing, 1871 _FB_XTEXT(Screen, GeometrySpacing,
1951 "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(), 1872 "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(),
1952 0, 0); 1873 0, 0);
1953 1874 m_geom_window.resize(label);
1954 int geom_h = focusedWinFrameTheme()->font().height() + 1875 m_geom_window.reconfigTheme();
1955 focusedWinFrameTheme()->bevelWidth()*2;
1956 int geom_w = focusedWinFrameTheme()->font().textWidth(label, strlen(label))
1957 + focusedWinFrameTheme()->bevelWidth()*2;
1958 m_geom_window.resize(geom_w, geom_h);
1959
1960 m_geom_window.setBorderWidth(focusedWinFrameTheme()->border().width());
1961 m_geom_window.setBorderColor(focusedWinFrameTheme()->border().color());
1962
1963
1964 Pixmap tmp = geom_pixmap;
1965
1966 if (focusedWinFrameTheme()->iconbarTheme().texture().type() &
1967 FbTk::Texture::PARENTRELATIVE) {
1968 if (!focusedWinFrameTheme()->titleTexture().usePixmap()) {
1969 geom_pixmap = None;
1970 m_geom_window.setBackgroundColor(
1971 focusedWinFrameTheme()->titleTexture().color());
1972 } else {
1973 geom_pixmap = imageControl().renderImage(m_geom_window.width(),
1974 m_geom_window.height(),
1975 focusedWinFrameTheme()->titleTexture());
1976 m_geom_window.setBackgroundPixmap(geom_pixmap);
1977 }
1978 } else {
1979 if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
1980 geom_pixmap = None;
1981 m_geom_window.setBackgroundColor(
1982 focusedWinFrameTheme()->iconbarTheme().texture().color());
1983 } else {
1984 geom_pixmap = imageControl().renderImage(m_geom_window.width(),
1985 m_geom_window.height(),
1986 focusedWinFrameTheme()->iconbarTheme().texture());
1987 m_geom_window.setBackgroundPixmap(geom_pixmap);
1988 }
1989 }
1990
1991 if (tmp)
1992 imageControl().removeImage(tmp);
1993
1994} 1876}
1995 1877
1996 1878
1997void BScreen::renderPosWindow() { 1879void BScreen::renderPosWindow() {
1998 1880 m_pos_window.resize("0:00000 x 0:00000");
1999 int pos_h = focusedWinFrameTheme()->font().height() + 1881 m_pos_window.reconfigTheme();
2000 focusedWinFrameTheme()->bevelWidth()*2;
2001 int pos_w = focusedWinFrameTheme()->font().textWidth("0:00000 x 0:00000",
2002 17) +
2003 focusedWinFrameTheme()->bevelWidth()*2;
2004 m_pos_window.resize(pos_w, pos_h);
2005
2006 m_pos_window.setBorderWidth(focusedWinFrameTheme()->border().width());
2007 m_pos_window.setBorderColor(focusedWinFrameTheme()->border().color());
2008
2009
2010 Pixmap tmp = pos_pixmap;
2011
2012 if (focusedWinFrameTheme()->iconbarTheme().texture().type() &
2013 FbTk::Texture::PARENTRELATIVE) {
2014 if (!focusedWinFrameTheme()->titleTexture().usePixmap()) {
2015 pos_pixmap = None;
2016 m_pos_window.setBackgroundColor(
2017 focusedWinFrameTheme()->titleTexture().color());
2018 } else {
2019 pos_pixmap = imageControl().renderImage(m_pos_window.width(),
2020 m_pos_window.height(),
2021 focusedWinFrameTheme()->titleTexture());
2022 m_pos_window.setBackgroundPixmap(pos_pixmap);
2023 }
2024 } else {
2025 if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
2026 pos_pixmap = None;
2027 m_pos_window.setBackgroundColor(
2028 focusedWinFrameTheme()->iconbarTheme().texture().color());
2029 } else {
2030 pos_pixmap = imageControl().renderImage(m_pos_window.width(),
2031 m_pos_window.height(),
2032 focusedWinFrameTheme()->iconbarTheme().texture());
2033 m_pos_window.setBackgroundPixmap(pos_pixmap);
2034 }
2035 }
2036
2037 if (tmp)
2038 imageControl().removeImage(tmp);
2039
2040} 1882}
2041 1883
2042void BScreen::updateSize() { 1884void BScreen::updateSize() {