aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-01-07 20:08:56 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-01-07 20:08:56 (GMT)
commitec3125aeb95a06f08cd4895c5b7c3a8911c1b368 (patch)
tree136d27f04589d0191c48b0abe940c9eb0a17a0db /src/Screen.cc
parentdbfddf8e0bcf8e7abbba671eff64c9679332a774 (diff)
downloadfluxbox-ec3125aeb95a06f08cd4895c5b7c3a8911c1b368.zip
fluxbox-ec3125aeb95a06f08cd4895c5b7c3a8911c1b368.tar.bz2
switch FbWinFrameTheme to use FocusableTheme
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc110
1 files changed, 61 insertions, 49 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 7174cda..8e5d8af 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -321,11 +321,12 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
321 m_resize_sig(*this), 321 m_resize_sig(*this),
322 m_bg_change_sig(*this), 322 m_bg_change_sig(*this),
323 m_layermanager(num_layers), 323 m_layermanager(num_layers),
324 m_windowtheme(new FbWinFrameTheme(scrn)), 324 m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")),
325 m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")),
325 // the order of windowtheme and winbutton theme is important 326 // the order of windowtheme and winbutton theme is important
326 // because winbutton need to rescale the pixmaps in winbutton theme 327 // because winbutton need to rescale the pixmaps in winbutton theme
327 // after fbwinframe have resized them 328 // after fbwinframe have resized them
328 m_winbutton_theme(new WinButtonTheme(scrn, *m_windowtheme)), 329 m_winbutton_theme(new WinButtonTheme(scrn, *m_focused_windowtheme)),
329 m_menutheme(new FbTk::MenuTheme(scrn)), 330 m_menutheme(new FbTk::MenuTheme(scrn)),
330 m_root_window(scrn), 331 m_root_window(scrn),
331 m_geom_window(m_root_window, 332 m_geom_window(m_root_window,
@@ -425,8 +426,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
425 m_root_theme.reset(new RootTheme(imageControl())); 426 m_root_theme.reset(new RootTheme(imageControl()));
426 m_root_theme->reconfigTheme(); 427 m_root_theme->reconfigTheme();
427 428
428 m_windowtheme->setFocusedAlpha(*resource.focused_alpha); 429 focusedWinFrameTheme()->setAlpha(*resource.focused_alpha);
429 m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); 430 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha);
430 m_menutheme->setAlpha(*resource.menu_alpha); 431 m_menutheme->setAlpha(*resource.menu_alpha);
431 m_menutheme->setMenuMode(*resource.menu_mode); 432 m_menutheme->setMenuMode(*resource.menu_mode);
432 // clamp values 433 // clamp values
@@ -445,7 +446,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
445 446
446 imageControl().setDither(*resource.image_dither); 447 imageControl().setDither(*resource.image_dither);
447 448
448 winFrameTheme()->reconfigSig().attach(this);// for geom window 449 focusedWinFrameTheme()->reconfigSig().attach(this);// for geom window
449 450
450 451
451 geom_visible = false; 452 geom_visible = false;
@@ -867,8 +868,8 @@ void BScreen::addExtraWindowMenu(const FbTk::FbString &label, FbTk::Menu *menu)
867void BScreen::reconfigure() { 868void BScreen::reconfigure() {
868 Fluxbox *fluxbox = Fluxbox::instance(); 869 Fluxbox *fluxbox = Fluxbox::instance();
869 870
870 m_windowtheme->setFocusedAlpha(*resource.focused_alpha); 871 focusedWinFrameTheme()->setAlpha(*resource.focused_alpha);
871 m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha); 872 unfocusedWinFrameTheme()->setAlpha(*resource.unfocused_alpha);
872 m_menutheme->setAlpha(*resource.menu_alpha); 873 m_menutheme->setAlpha(*resource.menu_alpha);
873 m_menutheme->setMenuMode(*resource.menu_mode); 874 m_menutheme->setMenuMode(*resource.menu_mode);
874 875
@@ -1301,7 +1302,6 @@ FluxboxWindow *BScreen::createWindow(Window client) {
1301 workspace->updateClientmenu(); 1302 workspace->updateClientmenu();
1302 } else { 1303 } else {
1303 win = new FluxboxWindow(*winclient, 1304 win = new FluxboxWindow(*winclient,
1304 winFrameTheme(),
1305 *layerManager().getLayer(Layer::NORMAL)); 1305 *layerManager().getLayer(Layer::NORMAL));
1306 1306
1307 if (!win->isManaged()) { 1307 if (!win->isManaged()) {
@@ -1339,7 +1339,6 @@ FluxboxWindow *BScreen::createWindow(WinClient &client) {
1339 } 1339 }
1340 1340
1341 FluxboxWindow *win = new FluxboxWindow(client, 1341 FluxboxWindow *win = new FluxboxWindow(client,
1342 winFrameTheme(),
1343 *layerManager().getLayer(Layer::NORMAL)); 1342 *layerManager().getLayer(Layer::NORMAL));
1344 1343
1345#ifdef SLIT 1344#ifdef SLIT
@@ -1793,13 +1792,12 @@ void BScreen::showPosition(int x, int y) {
1793 1792
1794 m_pos_window.clear(); 1793 m_pos_window.clear();
1795 1794
1796 winFrameTheme()->font().drawText(m_pos_window, 1795 focusedWinFrameTheme()->font().drawText(m_pos_window, screenNumber(),
1797 screenNumber(), 1796 focusedWinFrameTheme()->iconbarTheme().text().textGC(),
1798 winFrameTheme()->focusedIconbarTheme().text().textGC(), 1797 label, strlen(label),
1799 label, strlen(label), 1798 focusedWinFrameTheme()->bevelWidth(),
1800 winFrameTheme()->bevelWidth(), 1799 focusedWinFrameTheme()->bevelWidth() +
1801 winFrameTheme()->bevelWidth() + 1800 focusedWinFrameTheme()->font().ascent());
1802 winFrameTheme()->font().ascent());
1803 1801
1804} 1802}
1805 1803
@@ -1845,13 +1843,12 @@ void BScreen::showGeometry(int gx, int gy) {
1845 m_geom_window.clear(); 1843 m_geom_window.clear();
1846 1844
1847 //!! TODO: geom window again?! repeated 1845 //!! TODO: geom window again?! repeated
1848 winFrameTheme()->font().drawText(m_geom_window, 1846 focusedWinFrameTheme()->font().drawText(m_geom_window, screenNumber(),
1849 screenNumber(), 1847 focusedWinFrameTheme()->iconbarTheme().text().textGC(),
1850 winFrameTheme()->focusedIconbarTheme().text().textGC(), 1848 label, strlen(label),
1851 label, strlen(label), 1849 focusedWinFrameTheme()->bevelWidth(),
1852 winFrameTheme()->bevelWidth(), 1850 focusedWinFrameTheme()->bevelWidth() +
1853 winFrameTheme()->bevelWidth() + 1851 focusedWinFrameTheme()->font().ascent());
1854 winFrameTheme()->font().ascent());
1855} 1852}
1856 1853
1857 1854
@@ -1908,32 +1905,39 @@ void BScreen::renderGeomWindow() {
1908 "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(), 1905 "W: %04d x H: %04d", "Representative maximum sized text for width and height dialog").c_str(),
1909 0, 0); 1906 0, 0);
1910 1907
1911 int geom_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2; 1908 int geom_h = focusedWinFrameTheme()->font().height() +
1912 int geom_w = winFrameTheme()->font().textWidth(label, strlen(label)) + winFrameTheme()->bevelWidth()*2; 1909 focusedWinFrameTheme()->bevelWidth()*2;
1910 int geom_w = focusedWinFrameTheme()->font().textWidth(label, strlen(label))
1911 + focusedWinFrameTheme()->bevelWidth()*2;
1913 m_geom_window.resize(geom_w, geom_h); 1912 m_geom_window.resize(geom_w, geom_h);
1914 1913
1915 m_geom_window.setBorderWidth(winFrameTheme()->border(true).width()); 1914 m_geom_window.setBorderWidth(focusedWinFrameTheme()->border().width());
1916 m_geom_window.setBorderColor(winFrameTheme()->border(true).color()); 1915 m_geom_window.setBorderColor(focusedWinFrameTheme()->border().color());
1917 1916
1918 1917
1919 Pixmap tmp = geom_pixmap; 1918 Pixmap tmp = geom_pixmap;
1920 1919
1921 if (winFrameTheme()->focusedIconbarTheme().texture().type() & FbTk::Texture::PARENTRELATIVE) { 1920 if (focusedWinFrameTheme()->iconbarTheme().texture().type() &
1922 if (!winFrameTheme()->titleFocusTexture().usePixmap()) { 1921 FbTk::Texture::PARENTRELATIVE) {
1922 if (!focusedWinFrameTheme()->titleTexture().usePixmap()) {
1923 geom_pixmap = None; 1923 geom_pixmap = None;
1924 m_geom_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color()); 1924 m_geom_window.setBackgroundColor(
1925 focusedWinFrameTheme()->titleTexture().color());
1925 } else { 1926 } else {
1926 geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(), 1927 geom_pixmap = imageControl().renderImage(m_geom_window.width(),
1927 winFrameTheme()->titleFocusTexture()); 1928 m_geom_window.height(),
1929 focusedWinFrameTheme()->titleTexture());
1928 m_geom_window.setBackgroundPixmap(geom_pixmap); 1930 m_geom_window.setBackgroundPixmap(geom_pixmap);
1929 } 1931 }
1930 } else { 1932 } else {
1931 if (!winFrameTheme()->focusedIconbarTheme().texture().usePixmap()) { 1933 if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
1932 geom_pixmap = None; 1934 geom_pixmap = None;
1933 m_geom_window.setBackgroundColor(winFrameTheme()->focusedIconbarTheme().texture().color()); 1935 m_geom_window.setBackgroundColor(
1936 focusedWinFrameTheme()->iconbarTheme().texture().color());
1934 } else { 1937 } else {
1935 geom_pixmap = imageControl().renderImage(m_geom_window.width(), m_geom_window.height(), 1938 geom_pixmap = imageControl().renderImage(m_geom_window.width(),
1936 winFrameTheme()->focusedIconbarTheme().texture()); 1939 m_geom_window.height(),
1940 focusedWinFrameTheme()->iconbarTheme().texture());
1937 m_geom_window.setBackgroundPixmap(geom_pixmap); 1941 m_geom_window.setBackgroundPixmap(geom_pixmap);
1938 } 1942 }
1939 } 1943 }
@@ -1946,32 +1950,40 @@ void BScreen::renderGeomWindow() {
1946 1950
1947void BScreen::renderPosWindow() { 1951void BScreen::renderPosWindow() {
1948 1952
1949 int pos_h = winFrameTheme()->font().height() + winFrameTheme()->bevelWidth()*2; 1953 int pos_h = focusedWinFrameTheme()->font().height() +
1950 int pos_w = winFrameTheme()->font().textWidth("0:00000 x 0:00000", 17) + winFrameTheme()->bevelWidth()*2; 1954 focusedWinFrameTheme()->bevelWidth()*2;
1955 int pos_w = focusedWinFrameTheme()->font().textWidth("0:00000 x 0:00000",
1956 17) +
1957 focusedWinFrameTheme()->bevelWidth()*2;
1951 m_pos_window.resize(pos_w, pos_h); 1958 m_pos_window.resize(pos_w, pos_h);
1952 1959
1953 m_pos_window.setBorderWidth(winFrameTheme()->border(true).width()); 1960 m_pos_window.setBorderWidth(focusedWinFrameTheme()->border().width());
1954 m_pos_window.setBorderColor(winFrameTheme()->border(true).color()); 1961 m_pos_window.setBorderColor(focusedWinFrameTheme()->border().color());
1955 1962
1956 1963
1957 Pixmap tmp = pos_pixmap; 1964 Pixmap tmp = pos_pixmap;
1958 1965
1959 if (winFrameTheme()->focusedIconbarTheme().texture().type() & FbTk::Texture::PARENTRELATIVE) { 1966 if (focusedWinFrameTheme()->iconbarTheme().texture().type() &
1960 if (!winFrameTheme()->titleFocusTexture().usePixmap()) { 1967 FbTk::Texture::PARENTRELATIVE) {
1968 if (!focusedWinFrameTheme()->titleTexture().usePixmap()) {
1961 pos_pixmap = None; 1969 pos_pixmap = None;
1962 m_pos_window.setBackgroundColor(winFrameTheme()->titleFocusTexture().color()); 1970 m_pos_window.setBackgroundColor(
1971 focusedWinFrameTheme()->titleTexture().color());
1963 } else { 1972 } else {
1964 pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(), 1973 pos_pixmap = imageControl().renderImage(m_pos_window.width(),
1965 winFrameTheme()->titleFocusTexture()); 1974 m_pos_window.height(),
1975 focusedWinFrameTheme()->titleTexture());
1966 m_pos_window.setBackgroundPixmap(pos_pixmap); 1976 m_pos_window.setBackgroundPixmap(pos_pixmap);
1967 } 1977 }
1968 } else { 1978 } else {
1969 if (!winFrameTheme()->focusedIconbarTheme().texture().usePixmap()) { 1979 if (!focusedWinFrameTheme()->iconbarTheme().texture().usePixmap()) {
1970 pos_pixmap = None; 1980 pos_pixmap = None;
1971 m_pos_window.setBackgroundColor(winFrameTheme()->focusedIconbarTheme().texture().color()); 1981 m_pos_window.setBackgroundColor(
1982 focusedWinFrameTheme()->iconbarTheme().texture().color());
1972 } else { 1983 } else {
1973 pos_pixmap = imageControl().renderImage(m_pos_window.width(), m_pos_window.height(), 1984 pos_pixmap = imageControl().renderImage(m_pos_window.width(),
1974 winFrameTheme()->focusedIconbarTheme().texture()); 1985 m_pos_window.height(),
1986 focusedWinFrameTheme()->iconbarTheme().texture());
1975 m_pos_window.setBackgroundPixmap(pos_pixmap); 1987 m_pos_window.setBackgroundPixmap(pos_pixmap);
1976 } 1988 }
1977 } 1989 }