summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-02-16 01:14:54 (GMT)
committerfluxgen <fluxgen>2003-02-16 01:14:54 (GMT)
commita6e3b3a6f634edea759cf67cbf4acd5ee6dcf255 (patch)
tree2b9c0857d7106674f714f48b8dbc80014e48e2fe
parent7d39d015dbaae5182676087b3a42b7d0a5a65694 (diff)
downloadfluxbox_lack-a6e3b3a6f634edea759cf67cbf4acd5ee6dcf255.zip
fluxbox_lack-a6e3b3a6f634edea759cf67cbf4acd5ee6dcf255.tar.bz2
fixed geom_window to FbTk FbWindow and changes some old windowstyle to m_windowtheme
-rw-r--r--src/Screen.cc147
1 files changed, 63 insertions, 84 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 14b344f..d77117d 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.104 2003/02/15 02:03:09 fluxgen Exp $ 25// $Id: Screen.cc,v 1.105 2003/02/16 01:14:54 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -423,8 +423,8 @@ BScreen::BScreen(ResourceManager &rm,
423 423
424 int l = strlen(s); 424 int l = strlen(s);
425 425
426 geom_h = theme->getWindowStyle().font.height(); 426 geom_h = m_windowtheme.font().height();
427 geom_w = theme->getWindowStyle().font.textWidth(s, l); 427 geom_w = m_windowtheme.font().textWidth(s, l);
428 428
429 geom_w += getBevelWidth()*2; 429 geom_w += getBevelWidth()*2;
430 geom_h += getBevelWidth()*2; 430 geom_h += getBevelWidth()*2;
@@ -441,27 +441,25 @@ BScreen::BScreen(ResourceManager &rm,
441 InputOutput, getVisual(), mask, &attrib); 441 InputOutput, getVisual(), mask, &attrib);
442 geom_visible = false; 442 geom_visible = false;
443 443
444 if (theme->getWindowStyle().l_focus.type() & FbTk::Texture::PARENTRELATIVE) { 444 if (m_windowtheme.labelFocusTexture().type() & FbTk::Texture::PARENTRELATIVE) {
445 if (theme->getWindowStyle().t_focus.type() == 445 if (m_windowtheme.titleFocusTexture().type() ==
446 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 446 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
447 geom_pixmap = None; 447 geom_pixmap = None;
448 XSetWindowBackground(disp, geom_window, 448 geom_window.setBackgroundColor(m_windowtheme.titleFocusTexture().color());
449 theme->getWindowStyle().t_focus.color().pixel());
450 } else { 449 } else {
451 geom_pixmap = image_control->renderImage(geom_w, geom_h, 450 geom_pixmap = image_control->renderImage(geom_w, geom_h,
452 theme->getWindowStyle().t_focus); 451 m_windowtheme.titleFocusTexture());
453 XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); 452 geom_window.setBackgroundPixmap(geom_pixmap);
454 } 453 }
455 } else { 454 } else {
456 if (theme->getWindowStyle().l_focus.type() == 455 if (m_windowtheme.labelFocusTexture().type() ==
457 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 456 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
458 geom_pixmap = None; 457 geom_pixmap = None;
459 XSetWindowBackground(disp, geom_window, 458 geom_window.setBackgroundColor(m_windowtheme.labelFocusTexture().color());
460 theme->getWindowStyle().l_focus.color().pixel());
461 } else { 459 } else {
462 geom_pixmap = image_control->renderImage(geom_w, geom_h, 460 geom_pixmap = image_control->renderImage(geom_w, geom_h,
463 theme->getWindowStyle().l_focus); 461 m_windowtheme.labelFocusTexture());
464 XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); 462 geom_window.setBackgroundPixmap(geom_pixmap);
465 } 463 }
466 } 464 }
467 465
@@ -486,7 +484,7 @@ BScreen::BScreen(ResourceManager &rm,
486 m_slit.reset(new Slit(*this)); 484 m_slit.reset(new Slit(*this));
487#endif // SLIT 485#endif // SLIT
488 486
489 m_toolbar.reset(new Toolbar(this)); 487 m_toolbar.reset(new Toolbar(*this));
490 488
491 setupWorkspacemenu(*this, *workspacemenu); 489 setupWorkspacemenu(*this, *workspacemenu);
492 490
@@ -579,8 +577,6 @@ BScreen::~BScreen() {
579 if (geom_pixmap != None) 577 if (geom_pixmap != None)
580 image_control->removeImage(geom_pixmap); 578 image_control->removeImage(geom_pixmap);
581 579
582 if (geom_window != None)
583 XDestroyWindow(getBaseDisplay()->getXDisplay(), geom_window);
584 580
585 removeWorkspaceNames(); 581 removeWorkspaceNames();
586 582
@@ -645,15 +641,6 @@ void BScreen::reconfigure() {
645 FbTk::ThemeManager::instance().load(filename.c_str()); // new theme engine 641 FbTk::ThemeManager::instance().load(filename.c_str()); // new theme engine
646 theme->reconfigure(*resource.antialias); 642 theme->reconfigure(*resource.antialias);
647 643
648 // special case for tab rotated
649 if (*resource.tab_rotate_vertical &&
650 ( *resource.tab_placement == Tab::PLEFT ||
651 *resource.tab_placement == Tab::PRIGHT)) {
652 theme->getWindowStyle().tab.font.rotate(90);
653 } else {
654 theme->getWindowStyle().tab.font.rotate(0);
655 }
656
657 I18n *i18n = I18n::instance(); 644 I18n *i18n = I18n::instance();
658 645
659 const char *s = i18n->getMessage( 646 const char *s = i18n->getMessage(
@@ -663,44 +650,38 @@ void BScreen::reconfigure() {
663 int l = strlen(s); 650 int l = strlen(s);
664 651
665 //TODO: repeated from somewhere else? 652 //TODO: repeated from somewhere else?
666 geom_h = theme->getWindowStyle().font.height(); 653 geom_h = m_windowtheme.font().height();
667 geom_w = theme->getWindowStyle().font.textWidth(s, l); 654 geom_w = m_windowtheme.font().textWidth(s, l);
668 geom_w += getBevelWidth()*2; 655 geom_w += getBevelWidth()*2;
669 geom_h += getBevelWidth()*2; 656 geom_h += getBevelWidth()*2;
670 657
671 Pixmap tmp = geom_pixmap; 658 Pixmap tmp = geom_pixmap;
672 if (theme->getWindowStyle().l_focus.type() & FbTk::Texture::PARENTRELATIVE) { 659 if (m_windowtheme.labelFocusTexture().type() & FbTk::Texture::PARENTRELATIVE) {
673 if (theme->getWindowStyle().t_focus.type() == 660 if (m_windowtheme.titleFocusTexture().type() ==
674 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 661 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
675 geom_pixmap = None; 662 geom_pixmap = None;
676 XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, 663 geom_window.setBackgroundColor(m_windowtheme.titleFocusTexture().color());
677 theme->getWindowStyle().t_focus.color().pixel());
678 } else { 664 } else {
679 geom_pixmap = image_control->renderImage(geom_w, geom_h, 665 geom_pixmap = image_control->renderImage(geom_w, geom_h,
680 theme->getWindowStyle().t_focus); 666 m_windowtheme.titleFocusTexture());
681 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), 667 geom_window.setBackgroundPixmap(geom_pixmap);
682 geom_window, geom_pixmap);
683 } 668 }
684 } else { 669 } else {
685 if (theme->getWindowStyle().l_focus.type() == 670 if (m_windowtheme.labelFocusTexture().type() ==
686 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 671 (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
687 geom_pixmap = None; 672 geom_pixmap = None;
688 XSetWindowBackground(getBaseDisplay()->getXDisplay(), geom_window, 673 geom_window.setBackgroundColor(m_windowtheme.labelFocusTexture().color());
689 theme->getWindowStyle().l_focus.color().pixel());
690 } else { 674 } else {
691 geom_pixmap = image_control->renderImage(geom_w, geom_h, 675 geom_pixmap = image_control->renderImage(geom_w, geom_h,
692 theme->getWindowStyle().l_focus); 676 m_windowtheme.labelFocusTexture());
693 XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), 677 geom_window.setBackgroundPixmap(geom_pixmap);
694 geom_window, geom_pixmap);
695 } 678 }
696 } 679 }
697 if (tmp) 680 if (tmp)
698 image_control->removeImage(tmp); 681 image_control->removeImage(tmp);
699 682
700 XSetWindowBorderWidth(getBaseDisplay()->getXDisplay(), geom_window, 683 geom_window.setBorderWidth(theme->getBorderWidth());
701 theme->getBorderWidth()); 684 geom_window.setBorderColor(theme->getBorderColor());
702 XSetWindowBorder(getBaseDisplay()->getXDisplay(), geom_window,
703 theme->getBorderColor().pixel());
704 685
705 //reconfigure menus 686 //reconfigure menus
706 workspacemenu->reconfigure(); 687 workspacemenu->reconfigure();
@@ -1848,17 +1829,16 @@ void BScreen::showPosition(int x, int y) {
1848#ifdef XINERAMA 1829#ifdef XINERAMA
1849 unsigned int head = hasXinerama() ? getCurrHead() : 0; 1830 unsigned int head = hasXinerama() ? getCurrHead() : 0;
1850 1831
1851 XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, 1832 geom_window.moveResize(getHeadX(head) + (getHeadWidth(head) - geom_w) / 2,
1852 getHeadX(head) + (getHeadWidth(head) - geom_w) / 2, 1833 getHeadY(head) + (getHeadHeight(head) - geom_h) / 2,
1853 getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, geom_w, geom_h); 1834 geom_w, geom_h);
1854#else // !XINERMA 1835#else // !XINERMA
1855 XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, 1836 geom_window.moveResize((getWidth() - geom_w) / 2,
1856 (getWidth() - geom_w) / 2, 1837 (getHeight() - geom_h) / 2, geom_w, geom_h);
1857 (getHeight() - geom_h) / 2, geom_w, geom_h);
1858#endif // XINERAMA 1838#endif // XINERAMA
1859 1839
1860 XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); 1840 geom_window.show();
1861 XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); 1841 geom_window.raise();
1862 1842
1863 geom_visible = true; 1843 geom_visible = true;
1864 } 1844 }
@@ -1867,18 +1847,18 @@ void BScreen::showPosition(int x, int y) {
1867 1847
1868 snprintf(label, label_size, 1848 snprintf(label, label_size,
1869 I18n::instance()->getMessage( 1849 I18n::instance()->getMessage(
1870 FBNLS::ScreenSet, FBNLS::ScreenPositionFormat, 1850 FBNLS::ScreenSet, FBNLS::ScreenPositionFormat,
1871 "X: %4d x Y: %4d"), x, y); 1851 "X: %4d x Y: %4d"), x, y);
1872 1852
1873 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); 1853 geom_window.clear();
1874 1854
1875 theme->getWindowStyle().font.drawText( 1855 m_windowtheme.font().drawText(
1876 geom_window, 1856 geom_window.window(),
1877 getScreenNumber(), 1857 getScreenNumber(),
1878 theme->getWindowStyle().l_text_focus_gc, 1858 m_windowtheme.labelTextFocusGC(),
1879 label, strlen(label), 1859 label, strlen(label),
1880 theme->getBevelWidth(), theme->getBevelWidth() + 1860 theme->getBevelWidth(), theme->getBevelWidth() +
1881 theme->getWindowStyle().font.ascent()); 1861 m_windowtheme.font().ascent());
1882 1862
1883} 1863}
1884 1864
@@ -1888,16 +1868,15 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
1888#ifdef XINERAMA 1868#ifdef XINERAMA
1889 unsigned int head = hasXinerama() ? getCurrHead() : 0; 1869 unsigned int head = hasXinerama() ? getCurrHead() : 0;
1890 1870
1891 XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, 1871 geom_window.moveResize(getHeadX(head) + (getHeadWidth(head) - geom_w) / 2,
1892 getHeadX(head) + (getHeadWidth(head) - geom_w) / 2, 1872 getHeadY(head) + (getHeadHeight(head) - geom_h) / 2,
1893 getHeadY(head) + (getHeadHeight(head) - geom_h) / 2, geom_w, geom_h); 1873 geom_w, geom_h);
1894#else // !XINERMA 1874#else // !XINERMA
1895 XMoveResizeWindow(getBaseDisplay()->getXDisplay(), geom_window, 1875 geom_window.moveResize((getWidth() - geom_w) / 2,
1896 (getWidth() - geom_w) / 2, 1876 (getHeight() - geom_h) / 2, geom_w, geom_h);
1897 (getHeight() - geom_h) / 2, geom_w, geom_h);
1898#endif // XINERAMA 1877#endif // XINERAMA
1899 XMapWindow(getBaseDisplay()->getXDisplay(), geom_window); 1878 geom_window.show();
1900 XRaiseWindow(getBaseDisplay()->getXDisplay(), geom_window); 1879 geom_window.raise();
1901 1880
1902 geom_visible = true; 1881 geom_visible = true;
1903 } 1882 }
@@ -1906,25 +1885,25 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) {
1906 1885
1907 sprintf(label, 1886 sprintf(label,
1908 I18n::instance()->getMessage( 1887 I18n::instance()->getMessage(
1909 FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat, 1888 FBNLS::ScreenSet, FBNLS::ScreenGeometryFormat,
1910 "W: %4d x H: %4d"), gx, gy); 1889 "W: %4d x H: %4d"), gx, gy);
1911 1890
1912 XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); 1891 geom_window.clear();
1913 1892
1914 //TODO: geom window again?! repeated 1893 //TODO: geom window again?! repeated
1915 theme->getWindowStyle().font.drawText( 1894 m_windowtheme.font().drawText(
1916 geom_window, 1895 geom_window.window(),
1917 getScreenNumber(), 1896 getScreenNumber(),
1918 theme->getWindowStyle().l_text_focus_gc, 1897 m_windowtheme.labelTextFocusGC(),
1919 label, strlen(label), 1898 label, strlen(label),
1920 theme->getBevelWidth(), theme->getBevelWidth() + 1899 theme->getBevelWidth(), theme->getBevelWidth() +
1921 theme->getWindowStyle().font.ascent()); 1900 m_windowtheme.font().ascent());
1922} 1901}
1923 1902
1924 1903
1925void BScreen::hideGeometry() { 1904void BScreen::hideGeometry() {
1926 if (geom_visible) { 1905 if (geom_visible) {
1927 XUnmapWindow(getBaseDisplay()->getXDisplay(), geom_window); 1906 geom_window.hide();
1928 geom_visible = false; 1907 geom_visible = false;
1929 } 1908 }
1930} 1909}