aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2007-01-07 11:55:14 (GMT)
committersimonb <simonb>2007-01-07 11:55:14 (GMT)
commit1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de (patch)
tree1de2b149b23e589a36c81bd2aa51092db7b6e190 /src
parentcfd33dd7a8f392253d8af9f418d86dc3083fc27d (diff)
downloadfluxbox-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.zip
fluxbox-1cc7b60aa2c2e7a26f9ff6f1461ca0b8a97be8de.tar.bz2
per-window transparency, including apps and menu support, plus some
infrastructure and related changes. Thanks for original patch from Julien Trolet, dmxen at sourceforge dot net
Diffstat (limited to 'src')
-rw-r--r--src/BoolMenuItem.hh29
-rw-r--r--src/FbTk/Menu.hh2
-rw-r--r--src/FbTk/MenuItem.hh16
-rw-r--r--src/FbTk/Resource.hh1
-rw-r--r--src/FbWinFrame.cc68
-rw-r--r--src/FbWinFrame.hh11
-rw-r--r--src/IntResMenuItem.hh59
-rw-r--r--src/Makefile.am3
-rw-r--r--src/MenuCreator.cc101
-rw-r--r--src/Remember.cc50
-rw-r--r--src/Remember.hh8
-rw-r--r--src/Screen.cc8
-rw-r--r--src/Slit.cc2
-rw-r--r--src/Toolbar.cc4
-rw-r--r--src/Window.cc8
-rw-r--r--src/Window.hh17
16 files changed, 335 insertions, 52 deletions
diff --git a/src/BoolMenuItem.hh b/src/BoolMenuItem.hh
index 914185d..29eef15 100644
--- a/src/BoolMenuItem.hh
+++ b/src/BoolMenuItem.hh
@@ -38,6 +38,7 @@ public:
38 BoolMenuItem(const FbTk::FbString &label, bool &item): 38 BoolMenuItem(const FbTk::FbString &label, bool &item):
39 FbTk::MenuItem(label), m_item(item) { 39 FbTk::MenuItem(label), m_item(item) {
40 FbTk::MenuItem::setSelected(m_item); 40 FbTk::MenuItem::setSelected(m_item);
41 setToggleItem(true);
41 } 42 }
42 bool isSelected() const { return m_item; } 43 bool isSelected() const { return m_item; }
43 // toggle state 44 // toggle state
@@ -50,4 +51,30 @@ private:
50 bool &m_item; 51 bool &m_item;
51}; 52};
52 53
53#endif // BOOLRESMENUITEM_HH 54/// a bool menu item
55template <typename Type>
56class BoolResMenuItem: public FbTk::MenuItem {
57public:
58 BoolResMenuItem(const FbTk::FbString &label, Type &res,
59 FbTk::RefCount<FbTk::Command> &cmd):
60 FbTk::MenuItem(label, cmd), m_res(res) {
61 FbTk::MenuItem::setSelected(*m_res);
62 setToggleItem(true);
63 }
64 BoolResMenuItem(const FbTk::FbString &label, Type &res):
65 FbTk::MenuItem(label), m_res(res) {
66 FbTk::MenuItem::setSelected(*m_res);
67 setToggleItem(true);
68 }
69 bool isSelected() const { return *m_res; }
70 // toggle state
71 void click(int button, int time) { setSelected(!*m_res); FbTk::MenuItem::click(button, time); }
72 void setSelected(bool value) {
73 m_res = value;
74 FbTk::MenuItem::setSelected(*m_res);
75 }
76private:
77 Type &m_res;
78};
79
80#endif // BOOLMENUITEM_HH
diff --git a/src/FbTk/Menu.hh b/src/FbTk/Menu.hh
index 7863fcb..28eb70a 100644
--- a/src/FbTk/Menu.hh
+++ b/src/FbTk/Menu.hh
@@ -116,7 +116,7 @@ public:
116 /// set label string 116 /// set label string
117 void setLabel(const FbString &labelstr); 117 void setLabel(const FbString &labelstr);
118 /// move menu to x,y 118 /// move menu to x,y
119 void move(int x, int y); 119 virtual void move(int x, int y);
120 virtual void updateMenu(int active_index = -1); 120 virtual void updateMenu(int active_index = -1);
121 void setItemSelected(unsigned int index, bool val); 121 void setItemSelected(unsigned int index, bool val);
122 void setItemEnabled(unsigned int index, bool val); 122 void setItemEnabled(unsigned int index, bool val);
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh
index 94f0775..d73c270 100644
--- a/src/FbTk/MenuItem.hh
+++ b/src/FbTk/MenuItem.hh
@@ -90,21 +90,21 @@ public:
90 virtual ~MenuItem() { } 90 virtual ~MenuItem() { }
91 91
92 inline void setCommand(RefCount<Command> &cmd) { m_command = cmd; } 92 inline void setCommand(RefCount<Command> &cmd) { m_command = cmd; }
93 virtual inline void setSelected(bool selected) { m_selected = selected; } 93 virtual void setSelected(bool selected) { m_selected = selected; }
94 virtual inline void setEnabled(bool enabled) { m_enabled = enabled; } 94 virtual void setEnabled(bool enabled) { m_enabled = enabled; }
95 virtual inline void setLabel(const FbString &label) { m_label = label; } 95 virtual void setLabel(const FbString &label) { m_label = label; }
96 virtual inline void setToggleItem(bool val) { m_toggle_item = val; } 96 virtual void setToggleItem(bool val) { m_toggle_item = val; }
97 void setIcon(const std::string &filename, int screen_num); 97 void setIcon(const std::string &filename, int screen_num);
98 virtual Menu *submenu() { return m_submenu; } 98 virtual Menu *submenu() { return m_submenu; }
99 /** 99 /**
100 @name accessors 100 @name accessors
101 */ 101 */
102 //@{ 102 //@{
103 virtual inline const std::string &label() const { return m_label; } 103 virtual const std::string &label() const { return m_label; }
104 virtual const Menu *submenu() const { return m_submenu; } 104 virtual const Menu *submenu() const { return m_submenu; }
105 virtual inline bool isEnabled() const { return m_enabled; } 105 virtual bool isEnabled() const { return m_enabled; }
106 virtual inline bool isSelected() const { return m_selected; } 106 virtual bool isSelected() const { return m_selected; }
107 virtual inline bool isToggleItem() const { return m_toggle_item; } 107 virtual bool isToggleItem() const { return m_toggle_item; }
108 virtual unsigned int width(const MenuTheme &theme) const; 108 virtual unsigned int width(const MenuTheme &theme) const;
109 virtual unsigned int height(const MenuTheme &theme) const; 109 virtual unsigned int height(const MenuTheme &theme) const;
110 virtual void draw(FbDrawable &drawable, 110 virtual void draw(FbDrawable &drawable,
diff --git a/src/FbTk/Resource.hh b/src/FbTk/Resource.hh
index bdce09d..55eeddc 100644
--- a/src/FbTk/Resource.hh
+++ b/src/FbTk/Resource.hh
@@ -192,6 +192,7 @@ public:
192 /// @return string value of resource 192 /// @return string value of resource
193 std::string getString() const; 193 std::string getString() const;
194 194
195 inline T& get() { return m_value; }
195 inline T& operator*() { return m_value; } 196 inline T& operator*() { return m_value; }
196 inline const T& operator*() const { return m_value; } 197 inline const T& operator*() const { return m_value; }
197 inline T *operator->() { return &m_value; } 198 inline T *operator->() { return &m_value; }
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index e41d1df..5d191d0 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -83,6 +83,7 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
83 m_use_handle(true), 83 m_use_handle(true),
84 m_focused(false), 84 m_focused(false),
85 m_visible(false), 85 m_visible(false),
86 m_use_default_alpha(2),
86 m_button_pm(0), 87 m_button_pm(0),
87 m_tabmode(screen.getDefaultInternalTabs()?INTERNAL:EXTERNAL), 88 m_tabmode(screen.getDefaultInternalTabs()?INTERNAL:EXTERNAL),
88 m_active_gravity(0), 89 m_active_gravity(0),
@@ -91,6 +92,9 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
91 m_button_size(1), 92 m_button_size(1),
92 m_width_before_shade(1), 93 m_width_before_shade(1),
93 m_height_before_shade(1), 94 m_height_before_shade(1),
95 m_shaded(false),
96 m_focused_alpha(0),
97 m_unfocused_alpha(0),
94 m_double_click_time(0), 98 m_double_click_time(0),
95 m_themelistener(*this), 99 m_themelistener(*this),
96 m_shape(new Shape(m_window, theme.shapePlace())), 100 m_shape(new Shape(m_window, theme.shapePlace())),
@@ -443,7 +447,7 @@ void FbWinFrame::alignTabs() {
443 447
444void FbWinFrame::notifyMoved(bool clear) { 448void FbWinFrame::notifyMoved(bool clear) {
445 // not important if no alpha... 449 // not important if no alpha...
446 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 450 unsigned char alpha = getAlpha(m_focused);
447 if (alpha == 255) 451 if (alpha == 255)
448 return; 452 return;
449 453
@@ -505,8 +509,8 @@ void FbWinFrame::setFocus(bool newvalue) {
505 509
506 m_focused = newvalue; 510 m_focused = newvalue;
507 511
508 if (FbTk::Transparent::haveRender() && theme().focusedAlpha() != theme().unfocusedAlpha()) { 512 if (FbTk::Transparent::haveRender() && getAlpha(true) != getAlpha(false)) { // different alpha for focused and unfocused
509 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 513 unsigned char alpha = getAlpha(m_focused);
510 if (FbTk::Transparent::haveComposite()) { 514 if (FbTk::Transparent::haveComposite()) {
511 m_tab_container.setAlpha(255); 515 m_tab_container.setAlpha(255);
512 m_window.setOpaque(alpha); 516 m_window.setOpaque(alpha);
@@ -527,6 +531,46 @@ void FbWinFrame::setFocus(bool newvalue) {
527 clearAll(); 531 clearAll();
528} 532}
529 533
534void FbWinFrame::setAlpha(bool focused, unsigned char alpha) {
535 if (m_use_default_alpha == 2)
536 {
537 /// Set basic defaults
538 m_focused_alpha = getAlpha(true);
539 m_unfocused_alpha = getAlpha(false);
540 }
541 m_use_default_alpha = 0;
542
543 if (focused)
544 m_focused_alpha = alpha;
545 else
546 m_unfocused_alpha = alpha;
547
548 if(m_focused == focused)
549 m_window.setOpaque(alpha);
550}
551
552unsigned char FbWinFrame::getAlpha(bool focused) const
553{
554 return getUseDefaultAlpha() ?
555 (focused ? theme().focusedAlpha() : theme().unfocusedAlpha())
556 : (focused ? m_focused_alpha : m_unfocused_alpha);
557}
558
559void FbWinFrame::setUseDefaultAlpha(bool default_alpha)
560{
561 if (getUseDefaultAlpha() == default_alpha)
562 return;
563
564 if (!default_alpha && m_use_default_alpha == 2) {
565 m_focused_alpha = theme().focusedAlpha();
566 m_unfocused_alpha = theme().unfocusedAlpha();
567 }
568
569 m_use_default_alpha = default_alpha;
570
571 m_window.setOpaque(getAlpha(m_focused));
572}
573
530void FbWinFrame::setDoubleClickTime(unsigned int time) { 574void FbWinFrame::setDoubleClickTime(unsigned int time) {
531 m_double_click_time = time; 575 m_double_click_time = time;
532} 576}
@@ -1056,7 +1100,7 @@ void FbWinFrame::reconfigure() {
1056 // update transparency settings 1100 // update transparency settings
1057 if (FbTk::Transparent::haveRender()) { 1101 if (FbTk::Transparent::haveRender()) {
1058 unsigned char alpha = 1102 unsigned char alpha =
1059 (m_focused ? theme().focusedAlpha() : theme().unfocusedAlpha()); 1103 getAlpha(m_focused);
1060 if (FbTk::Transparent::haveComposite()) { 1104 if (FbTk::Transparent::haveComposite()) {
1061 m_tab_container.setAlpha(255); 1105 m_tab_container.setAlpha(255);
1062 m_window.setOpaque(alpha); 1106 m_window.setOpaque(alpha);
@@ -1281,7 +1325,7 @@ void FbWinFrame::applyTitlebar() {
1281 getCurrentFocusPixmap(label_pm, title_pm, 1325 getCurrentFocusPixmap(label_pm, title_pm,
1282 label_color, title_color); 1326 label_color, title_color);
1283 1327
1284 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1328 unsigned char alpha = getAlpha (m_focused);
1285 m_titlebar.setAlpha(alpha); 1329 m_titlebar.setAlpha(alpha);
1286 m_label.setAlpha(alpha); 1330 m_label.setAlpha(alpha);
1287 1331
@@ -1332,7 +1376,7 @@ void FbWinFrame::renderHandles() {
1332 1376
1333void FbWinFrame::applyHandles() { 1377void FbWinFrame::applyHandles() {
1334 1378
1335 unsigned char alpha = (m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1379 unsigned char alpha = getAlpha (m_focused);
1336 m_handle.setAlpha(alpha); 1380 m_handle.setAlpha(alpha);
1337 m_grip_left.setAlpha(alpha); 1381 m_grip_left.setAlpha(alpha);
1338 m_grip_right.setAlpha(alpha); 1382 m_grip_right.setAlpha(alpha);
@@ -1452,7 +1496,7 @@ void FbWinFrame::applyButton(FbTk::Button &btn) {
1452 btn.setPressedColor(m_button_pressed_color); 1496 btn.setPressedColor(m_button_pressed_color);
1453 1497
1454 if (focused()) { // focused 1498 if (focused()) { // focused
1455 btn.setAlpha(theme().focusedAlpha()); 1499 btn.setAlpha(getAlpha(true));
1456 1500
1457 btn.setGC(m_theme.buttonPicFocusGC()); 1501 btn.setGC(m_theme.buttonPicFocusGC());
1458 if (m_button_pm) 1502 if (m_button_pm)
@@ -1460,7 +1504,7 @@ void FbWinFrame::applyButton(FbTk::Button &btn) {
1460 else 1504 else
1461 btn.setBackgroundColor(m_button_color); 1505 btn.setBackgroundColor(m_button_color);
1462 } else { // unfocused 1506 } else { // unfocused
1463 btn.setAlpha(theme().unfocusedAlpha()); 1507 btn.setAlpha(getAlpha(false));
1464 1508
1465 btn.setGC(m_theme.buttonPicUnfocusGC()); 1509 btn.setGC(m_theme.buttonPicUnfocusGC());
1466 if (m_button_unfocused_pm) 1510 if (m_button_unfocused_pm)
@@ -1513,7 +1557,7 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
1513} 1557}
1514 1558
1515void FbWinFrame::applyTabContainer() { 1559void FbWinFrame::applyTabContainer() {
1516 m_tab_container.setAlpha(m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1560 m_tab_container.setAlpha(getAlpha(m_focused));
1517 1561
1518 // do the parent container 1562 // do the parent container
1519 Pixmap tabcontainer_pm = None; 1563 Pixmap tabcontainer_pm = None;
@@ -1608,7 +1652,7 @@ void FbWinFrame::applyFocusLabel(FbTk::TextButton &button) {
1608 1652
1609 button.setGC(theme().labelTextFocusGC()); 1653 button.setGC(theme().labelTextFocusGC());
1610 button.setJustify(theme().justify()); 1654 button.setJustify(theme().justify());
1611 button.setAlpha(m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1655 button.setAlpha(getAlpha(m_focused));
1612 1656
1613 if (m_labelbutton_focused_pm != 0) { 1657 if (m_labelbutton_focused_pm != 0) {
1614 button.setBackgroundPixmap(m_labelbutton_focused_pm); 1658 button.setBackgroundPixmap(m_labelbutton_focused_pm);
@@ -1621,7 +1665,7 @@ void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) {
1621 1665
1622 button.setGC(theme().labelTextActiveGC()); 1666 button.setGC(theme().labelTextActiveGC());
1623 button.setJustify(theme().justify()); 1667 button.setJustify(theme().justify());
1624 button.setAlpha(m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1668 button.setAlpha(getAlpha(m_focused));
1625 1669
1626 if (m_labelbutton_active_pm != 0) { 1670 if (m_labelbutton_active_pm != 0) {
1627 button.setBackgroundPixmap(m_labelbutton_active_pm); 1671 button.setBackgroundPixmap(m_labelbutton_active_pm);
@@ -1634,7 +1678,7 @@ void FbWinFrame::applyUnfocusLabel(FbTk::TextButton &button) {
1634 1678
1635 button.setGC(theme().labelTextUnfocusGC()); 1679 button.setGC(theme().labelTextUnfocusGC());
1636 button.setJustify(theme().justify()); 1680 button.setJustify(theme().justify());
1637 button.setAlpha(m_focused?theme().focusedAlpha():theme().unfocusedAlpha()); 1681 button.setAlpha(getAlpha(m_focused));
1638 1682
1639 if (m_labelbutton_unfocused_pm != 0) { 1683 if (m_labelbutton_unfocused_pm != 0) {
1640 button.setBackgroundPixmap(m_labelbutton_unfocused_pm); 1684 button.setBackgroundPixmap(m_labelbutton_unfocused_pm);
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 26076ed..182add4 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -127,6 +127,13 @@ public:
127 bool setTabMode(TabMode tabmode); 127 bool setTabMode(TabMode tabmode);
128 inline void updateTabProperties() { alignTabs(); } 128 inline void updateTabProperties() { alignTabs(); }
129 129
130 /// Alpha settings
131 void setAlpha(bool focused, unsigned char value);
132 unsigned char getAlpha(bool focused) const;
133
134 void setUseDefaultAlpha(bool use_default);
135 bool getUseDefaultAlpha() const { return m_use_default_alpha; }
136
130 /// add a button to the left of the label 137 /// add a button to the left of the label
131 void addLeftButton(FbTk::Button *btn); 138 void addLeftButton(FbTk::Button *btn);
132 /// add a button to the right of the label 139 /// add a button to the right of the label
@@ -322,6 +329,8 @@ private:
322 bool m_use_handle; ///< if we should use handle 329 bool m_use_handle; ///< if we should use handle
323 bool m_focused; ///< focused/unfocused mode 330 bool m_focused; ///< focused/unfocused mode
324 bool m_visible; ///< if we are currently showing 331 bool m_visible; ///< if we are currently showing
332 unsigned char m_use_default_alpha;
333 ///< do we use screen or window alpha settings ? (0 = window, 1 = default, 2 = default and window never set)
325 334
326 /** 335 /**
327 @name pixmaps and colors for rendering 336 @name pixmaps and colors for rendering
@@ -377,6 +386,8 @@ private:
377 unsigned int m_width_before_shade, ///< width before shade, so we can restore it when we unshade 386 unsigned int m_width_before_shade, ///< width before shade, so we can restore it when we unshade
378 m_height_before_shade; ///< height before shade, so we can restore it when we unshade 387 m_height_before_shade; ///< height before shade, so we can restore it when we unshade
379 bool m_shaded; ///< wheter we're shaded or not 388 bool m_shaded; ///< wheter we're shaded or not
389 unsigned char m_focused_alpha; ///< focused alpha value
390 unsigned char m_unfocused_alpha; ///< unfocused alpha value
380 unsigned int m_double_click_time; ///< the time period that's considerd to be a double click 391 unsigned int m_double_click_time; ///< the time period that's considerd to be a double click
381 struct MouseButtonAction { 392 struct MouseButtonAction {
382 FbTk::RefCount<FbTk::Command> click; ///< what to do when we release mouse button 393 FbTk::RefCount<FbTk::Command> click; ///< what to do when we release mouse button
diff --git a/src/IntResMenuItem.hh b/src/IntResMenuItem.hh
index a0e102d..0be2775 100644
--- a/src/IntResMenuItem.hh
+++ b/src/IntResMenuItem.hh
@@ -27,18 +27,71 @@
27#include "MenuItem.hh" 27#include "MenuItem.hh"
28#include "Resource.hh" 28#include "Resource.hh"
29 29
30#include <string>
31
30/// Changes an resource integer value between min and max 32/// Changes an resource integer value between min and max
33template <typename Type>
31class IntResMenuItem: public FbTk::MenuItem { 34class IntResMenuItem: public FbTk::MenuItem {
32public: 35public:
33 IntResMenuItem(const FbTk::FbString &label, FbTk::Resource<int> &res, int min_val, int max_val, FbTk::Menu &host_menu); 36 IntResMenuItem(const FbTk::FbString &label, Type &res, int min_val, int max_val, FbTk::Menu &host_menu) :
37 FbTk::MenuItem(label, host_menu), m_org_label(FbTk::MenuItem::label()),
38 m_max(max_val), m_min(min_val), m_res(res) {
39 updateLabel();
40 }
41
42 /* Utility, but doesn't get found in anonymous namespace? */
43 std::string appendIntValue(const std::string &label, int value) {
44 char *buff = new char[label.size() + 16];
45 sprintf(buff, "%s: %d", label.c_str(), value);
46 std::string ret(buff);
47 delete [] buff;
48 return ret;
49 }
50
51 void click(int button, int time) {
52 static int last_time = -201;
53 int inc_val = 1;
54 // check double click
55 //!! TODO: must have some sort of "global" double click time in FbTk
56 if (time - last_time <= 200)
57 inc_val = 5;
58
34 59
35 void click(int button, int time); 60 last_time = time;
61
62 if ((button == 4 || button == 3)&& *m_res < m_max) // scroll up
63 m_res.get() += inc_val;
64 else if ((button == 5 || button == 1) && *m_res > m_min) // scroll down
65 m_res.get() -= inc_val;
66
67 // clamp value
68 if (*m_res > m_max)
69 m_res.get() = m_max;
70 else if (*m_res < m_min)
71 m_res.get() = m_min;
72
73 // update label
74 updateLabel();
75 // call other commands
76 FbTk::MenuItem::click(button, time);
77
78 // show new value, which for us means forcing a full menu update
79 // since the text is drawn onto the background!
80 if (menu()) {
81 menu()->frameWindow().updateBackground(false);
82 menu()->clearWindow();
83 }
84 }
36 85
86 void updateLabel() {
87 setLabel(appendIntValue(m_org_label, *m_res));
88 }
89
37private: 90private:
38 std::string m_org_label; ///< original label 91 std::string m_org_label; ///< original label
39 const int m_max; ///< maximum value the integer can have 92 const int m_max; ///< maximum value the integer can have
40 const int m_min; ///< minimum value the integer can have 93 const int m_min; ///< minimum value the integer can have
41 FbTk::Resource<int> &m_res; ///< resource item to be changed 94 Type &m_res; ///< resource item to be changed
42}; 95};
43 96
44#endif // INTRESMENUITEM_HH 97#endif // INTRESMENUITEM_HH
diff --git a/src/Makefile.am b/src/Makefile.am
index b86e2c9..5b74800 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,7 +100,7 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
100 Workspace.cc Workspace.hh \ 100 Workspace.cc Workspace.hh \
101 FbCommands.hh FbCommands.cc LayerMenu.hh LayerMenu.cc \ 101 FbCommands.hh FbCommands.cc LayerMenu.hh LayerMenu.cc \
102 Layer.hh \ 102 Layer.hh \
103 IntResMenuItem.hh IntResMenuItem.cc FbMenu.hh FbMenu.cc \ 103 IntResMenuItem.hh FbMenu.hh FbMenu.cc \
104 WinClient.hh WinClient.cc \ 104 WinClient.hh WinClient.cc \
105 Strut.hh \ 105 Strut.hh \
106 Xinerama.hh \ 106 Xinerama.hh \
@@ -116,6 +116,7 @@ fluxbox_SOURCES = AtomHandler.hh ArrowButton.hh ArrowButton.cc \
116 TextTheme.hh TextTheme.cc \ 116 TextTheme.hh TextTheme.cc \
117 BorderTheme.hh BorderTheme.cc \ 117 BorderTheme.hh BorderTheme.cc \
118 CommandDialog.hh CommandDialog.cc SendToMenu.hh SendToMenu.cc \ 118 CommandDialog.hh CommandDialog.cc SendToMenu.hh SendToMenu.cc \
119 AlphaMenu.hh AlphaMenu.cc ObjectResource.hh \
119 CompareWindow.hh \ 120 CompareWindow.hh \
120 Parser.hh Parser.cc FbMenuParser.hh FbMenuParser.cc \ 121 Parser.hh Parser.cc FbMenuParser.hh FbMenuParser.cc \
121 StyleMenuItem.hh StyleMenuItem.cc \ 122 StyleMenuItem.hh StyleMenuItem.cc \
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 31ef06d..5264a4d 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -35,7 +35,9 @@
35#include "WorkspaceMenu.hh" 35#include "WorkspaceMenu.hh"
36#include "LayerMenu.hh" 36#include "LayerMenu.hh"
37#include "SendToMenu.hh" 37#include "SendToMenu.hh"
38#include "AlphaMenu.hh"
38#include "Layer.hh" 39#include "Layer.hh"
40#include "BoolMenuItem.hh"
39 41
40#include "FbMenuParser.hh" 42#include "FbMenuParser.hh"
41#include "StyleMenuItem.hh" 43#include "StyleMenuItem.hh"
@@ -50,6 +52,7 @@
50#include "FbTk/FileUtil.hh" 52#include "FbTk/FileUtil.hh"
51#include "FbTk/MenuSeparator.hh" 53#include "FbTk/MenuSeparator.hh"
52#include "FbTk/MenuIcon.hh" 54#include "FbTk/MenuIcon.hh"
55#include "FbTk/Transparent.hh"
53 56
54#include <iostream> 57#include <iostream>
55 58
@@ -155,7 +158,7 @@ private:
155 FbTk::Menu *m_menu; 158 FbTk::Menu *m_menu;
156}; 159};
157 160
158class MenuContext: public LayerObject { 161class MenuContext: public LayerObject, public AlphaObject {
159public: 162public:
160 void moveToLayer(int layer_number) { 163 void moveToLayer(int layer_number) {
161 if (WindowCmd<void>::window() == 0) 164 if (WindowCmd<void>::window() == 0)
@@ -167,6 +170,43 @@ public:
167 return -1; 170 return -1;
168 return WindowCmd<void>::window()->layerItem().getLayerNum(); 171 return WindowCmd<void>::window()->layerItem().getLayerNum();
169 } 172 }
173
174 int getFocusedAlpha() const {
175 if (WindowCmd<void>::window() == 0)
176 return 255;
177 return WindowCmd<void>::window()->getFocusedAlpha();
178 }
179
180 int getUnfocusedAlpha() const {
181 if (WindowCmd<void>::window() == 0)
182 return 255;
183 return WindowCmd<void>::window()->getUnfocusedAlpha();
184 }
185
186 bool getUseDefaultAlpha() const {
187 if (WindowCmd<void>::window() == 0)
188 return true;
189 return WindowCmd<void>::window()->getUseDefaultAlpha();
190 }
191
192 void setFocusedAlpha(int alpha) {
193 if (WindowCmd<void>::window() == 0)
194 return;
195 WindowCmd<void>::window()->setFocusedAlpha(alpha);
196 }
197
198 void setUnfocusedAlpha(int alpha) {
199 if (WindowCmd<void>::window() == 0)
200 return;
201 WindowCmd<void>::window()->setUnfocusedAlpha(alpha);
202 }
203
204 void setUseDefaultAlpha(bool use_default) {
205 if (WindowCmd<void>::window() == 0)
206 return;
207 WindowCmd<void>::window()->setUseDefaultAlpha(use_default);
208 }
209
170}; 210};
171 211
172static void translateMenuItem(Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor); 212static void translateMenuItem(Parser &parse, ParseItem &item, FbTk::StringConvertor &labelconvertor);
@@ -489,6 +529,7 @@ FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
489 "lower", 529 "lower",
490 "sendto", 530 "sendto",
491 "layer", 531 "layer",
532 "alpha",
492 "extramenus", 533 "extramenus",
493 "separator", 534 "separator",
494 "close", 535 "close",
@@ -510,9 +551,14 @@ bool MenuCreator::createWindowMenuItem(const string &type,
510 typedef FbTk::RefCount<FbTk::Command> RefCmd; 551 typedef FbTk::RefCount<FbTk::Command> RefCmd;
511 _FB_USES_NLS; 552 _FB_USES_NLS;
512 553
554 static MenuContext context;
555
513 if (type == "shade") { 556 if (type == "shade") {
514 RefCmd shade_cmd(new WindowCmd<void>(&FluxboxWindow::shade)); 557 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isShaded, &FluxboxWindow::shade, false);
515 menu.insert(label.empty()?_FB_XTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label, shade_cmd); 558 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >(
559 label.empty()?_FB_XTEXT(Windowmenu, Shade, "Shade", "Shade the window"):label,
560 res));
561
516 } else if (type == "maximize") { 562 } else if (type == "maximize") {
517 RefCmd maximize_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeFull)); 563 RefCmd maximize_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeFull));
518 RefCmd maximize_vert_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeVertical)); 564 RefCmd maximize_vert_cmd(new WindowCmd<void>(&FluxboxWindow::maximizeVertical));
@@ -532,41 +578,60 @@ bool MenuCreator::createWindowMenuItem(const string &type,
532 maximize_item->setCommand(3, maximize_horiz_cmd); 578 maximize_item->setCommand(3, maximize_horiz_cmd);
533 menu.insert(maximize_item); 579 menu.insert(maximize_item);
534 } else if (type == "iconify") { 580 } else if (type == "iconify") {
535 RefCmd iconify_cmd(new WindowCmd<void>(&FluxboxWindow::iconify)); 581 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isIconic, &FluxboxWindow::toggleIconic, false);
536 menu.insert(label.empty() ? 582 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >(
537 _FB_XTEXT(Windowmenu, Iconify, 583 label.empty() ?
538 "Iconify", "Iconify the window") : 584 _FB_XTEXT(Windowmenu, Iconify,
539 label, iconify_cmd); 585 "Iconify", "Iconify the window") :
586 label, res));
540 } else if (type == "close") { 587 } else if (type == "close") {
541 RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::close)); 588 RefCmd close_cmd(new WindowCmd<void>(&FluxboxWindow::close));
542 menu.insert(label.empty() ? 589 menu.insert(label.empty() ?
543 _FB_XTEXT(Windowmenu, Close, 590 _FB_XTEXT(Windowmenu, Close,
544 "Close", "Close the window") : 591 "Close", "Close the window") :
545 label, close_cmd); 592 label, close_cmd);
546 } else if (type == "kill" || type == "killwindow") { 593 } else if (type == "kill" || type == "killwindow") {
547 RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill)); 594 RefCmd kill_cmd(new WindowCmd<void>(&FluxboxWindow::kill));
548 menu.insert(label.empty() ? 595 menu.insert(label.empty() ?
549 _FB_XTEXT(Windowmenu, Kill, 596 _FB_XTEXT(Windowmenu, Kill,
550 "Kill", "Kill the window"): 597 "Kill", "Kill the window"):
551 label, kill_cmd); 598 label, kill_cmd);
552 } else if (type == "lower") { 599 } else if (type == "lower") {
553 RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::lower)); 600 RefCmd lower_cmd(new WindowCmd<void>(&FluxboxWindow::lower));
554 menu.insert( label.empty() ? 601 menu.insert( label.empty() ?
555 _FB_XTEXT(Windowmenu, Lower, 602 _FB_XTEXT(Windowmenu, Lower,
556 "Lower", "Lower the window"): 603 "Lower", "Lower the window"):
557 label, lower_cmd); 604 label, lower_cmd);
558 } else if (type == "raise") { 605 } else if (type == "raise") {
559 RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::raise)); 606 RefCmd raise_cmd(new WindowCmd<void>(&FluxboxWindow::raise));
560 menu.insert(label.empty() ? 607 menu.insert(label.empty() ?
561 _FB_XTEXT(Windowmenu, Raise, 608 _FB_XTEXT(Windowmenu, Raise,
562 "Raise", "Raise the window"): 609 "Raise", "Raise the window"):
563 label, raise_cmd); 610 label, raise_cmd);
611
564 } else if (type == "stick") { 612 } else if (type == "stick") {
565 RefCmd stick_cmd(new WindowCmd<void>(&FluxboxWindow::stick)); 613 static ObjectResource<FluxboxWindow, bool> res(&WindowCmd<void>::window, &FluxboxWindow::isStuck, &FluxboxWindow::stick, false);
566 menu.insert(label.empty() ? 614 menu.insert(new BoolResMenuItem<ObjectResource<FluxboxWindow, bool> >(
567 _FB_XTEXT(Windowmenu, Stick, 615 label.empty() ?
568 "Stick", "Stick the window"): 616 _FB_XTEXT(Windowmenu, Stick,
569 label, stick_cmd); 617 "Stick", "Stick the window"):
618 label, res));
619#ifdef HAVE_XRENDER
620 } else if (type == "alpha") {
621 if (FbTk::Transparent::haveComposite() ||
622 FbTk::Transparent::haveRender()) {
623 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
624 if (screen == 0)
625 return false;
626
627 menu.insert(label.empty() ? _FB_XTEXT(Configmenu, Transparency, "Transparency",
628 "Menu containing various transparency options"): label,
629 new AlphaMenu(screen->menuTheme(),
630 screen->imageControl(),
631 *screen->layerManager().getLayer(Layer::MENU),
632 context));
633 }
634#endif // HAVE_XRENDER
570 } else if (type == "extramenus") { 635 } else if (type == "extramenus") {
571 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber()); 636 BScreen *screen = Fluxbox::instance()->findScreen(menu.screenNumber());
572 BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin(); 637 BScreen::ExtraMenus::iterator it = screen->extraWindowMenus().begin();
@@ -584,8 +649,6 @@ bool MenuCreator::createWindowMenuItem(const string &type,
584 if (screen == 0) 649 if (screen == 0)
585 return false; 650 return false;
586 651
587 static MenuContext context;
588
589 FbTk::Menu *submenu = new LayerMenu(screen->menuTheme(), 652 FbTk::Menu *submenu = new LayerMenu(screen->menuTheme(),
590 screen->imageControl(), 653 screen->imageControl(),
591 *screen->layerManager().getLayer(Layer::MENU), 654 *screen->layerManager().getLayer(Layer::MENU),
diff --git a/src/Remember.cc b/src/Remember.cc
index f084677..6db1f9c 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -40,6 +40,7 @@
40#include "FbTk/MenuItem.hh" 40#include "FbTk/MenuItem.hh"
41#include "FbTk/App.hh" 41#include "FbTk/App.hh"
42#include "FbTk/stringstream.hh" 42#include "FbTk/stringstream.hh"
43#include "FbTk/Transparent.hh"
43 44
44 45
45#include <X11/Xlib.h> 46#include <X11/Xlib.h>
@@ -155,6 +156,10 @@ FbTk::Menu *createRememberMenu(BScreen &screen) {
155 Remember::REM_DECOSTATE)); 156 Remember::REM_DECOSTATE));
156 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"), 157 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Shaded, "Shaded", "Remember shaded"),
157 Remember::REM_SHADEDSTATE)); 158 Remember::REM_SHADEDSTATE));
159 if (FbTk::Transparent::haveComposite()
160 || FbTk::Transparent::haveRender())
161 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Alpha, "Transparency", "Remember window tranparency settings"),
162 Remember::REM_ALPHA));
158 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Layer, "Layer", "Remember Layer"), 163 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, Layer, "Layer", "Remember Layer"),
159 Remember::REM_LAYER)); 164 Remember::REM_LAYER));
160 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, SaveOnClose, "Save on close", "Save remembered attributes on close"), 165 menu->insert(new RememberMenuItem(_FB_XTEXT(Remember, SaveOnClose, "Save on close", "Save remembered attributes on close"),
@@ -241,6 +246,7 @@ Application::Application(bool grouped)
241 tabstate_remember = 246 tabstate_remember =
242 workspace_remember = 247 workspace_remember =
243 head_remember = 248 head_remember =
249 alpha_remember =
244 save_on_close_remember = false; 250 save_on_close_remember = false;
245} 251}
246 252
@@ -477,6 +483,30 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
477 else 483 else
478 had_error = 1; 484 had_error = 1;
479 } 485 }
486 } else if (strcasecmp(str_key.c_str(), "Alpha") == 0) {
487 int focused_a, unfocused_a;
488 if (sscanf(str_label.c_str(), "%i %i", &focused_a, &unfocused_a) == 2)
489 {
490 // clamp;
491 if (focused_a > 255)
492 focused_a = 255;
493 if (unfocused_a > 255)
494 unfocused_a = 255;
495 if (focused_a <= 0)
496 focused_a = 0;
497 if (unfocused_a <= 0)
498 unfocused_a = 0;
499
500 app.rememberAlpha(focused_a, unfocused_a);
501 } else if (sscanf(str_label.c_str(), "%i", &focused_a) == 1) {
502 if (focused_a > 255)
503 focused_a = 255;
504 if (focused_a <= 0)
505 focused_a = 0;
506 app.rememberAlpha(focused_a, focused_a);
507 }
508 else
509 had_error = 1;
480 } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) { 510 } else if (strcasecmp(str_key.c_str(), "Sticky") == 0) {
481 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0)); 511 app.rememberStuckstate((strcasecmp(str_label.c_str(), "yes") == 0));
482 } else if (strcasecmp(str_key.c_str(), "Jump") == 0) { 512 } else if (strcasecmp(str_key.c_str(), "Jump") == 0) {
@@ -807,6 +837,12 @@ void Remember::save() {
807 if (a.save_on_close_remember) { 837 if (a.save_on_close_remember) {
808 apps_file << " [Close]\t{" << ((a.save_on_close)?"yes":"no") << "}" << endl; 838 apps_file << " [Close]\t{" << ((a.save_on_close)?"yes":"no") << "}" << endl;
809 } 839 }
840 if (a.alpha_remember) {
841 if (a.focused_alpha == a.unfocused_alpha)
842 apps_file << " [Alpha]\t{" << a.focused_alpha << "}" << endl;
843 else
844 apps_file << " [Alpha]\t{" << a.focused_alpha << " " << a.unfocused_alpha << "}" << endl;
845 }
810 apps_file << "[end]" << endl; 846 apps_file << "[end]" << endl;
811 } 847 }
812 apps_file.close(); 848 apps_file.close();
@@ -860,6 +896,8 @@ bool Remember::isRemembered(WinClient &winclient, Attribute attrib) {
860 case REM_SAVEONCLOSE: 896 case REM_SAVEONCLOSE:
861 return app->save_on_close_remember; 897 return app->save_on_close_remember;
862 break; 898 break;
899 case REM_ALPHA:
900 return app->alpha_remember;
863 case REM_LASTATTRIB: 901 case REM_LASTATTRIB:
864 default: 902 default:
865 return false; // should never get here 903 return false; // should never get here
@@ -903,6 +941,9 @@ void Remember::rememberAttrib(WinClient &winclient, Attribute attrib) {
903 case REM_STUCKSTATE: 941 case REM_STUCKSTATE:
904 app->rememberStuckstate(win->isStuck()); 942 app->rememberStuckstate(win->isStuck());
905 break; 943 break;
944 case REM_ALPHA:
945 app->rememberAlpha(win->frame().getAlpha(true), win->frame().getAlpha(false));
946 break;
906 // case REM_TABSTATE: 947 // case REM_TABSTATE:
907 // break; 948 // break;
908 case REM_JUMPWORKSPACE: 949 case REM_JUMPWORKSPACE:
@@ -957,6 +998,9 @@ void Remember::forgetAttrib(WinClient &winclient, Attribute attrib) {
957 case REM_SHADEDSTATE: 998 case REM_SHADEDSTATE:
958 app->forgetShadedstate(); 999 app->forgetShadedstate();
959 break; 1000 break;
1001 case REM_ALPHA:
1002 app->forgetAlpha();
1003 break;
960// case REM_TABSTATE: 1004// case REM_TABSTATE:
961// break; 1005// break;
962 case REM_JUMPWORKSPACE: 1006 case REM_JUMPWORKSPACE:
@@ -1004,6 +1048,12 @@ void Remember::setupFrame(FluxboxWindow &win) {
1004 if (app->decostate_remember) 1048 if (app->decostate_remember)
1005 win.setDecorationMask(app->decostate); 1049 win.setDecorationMask(app->decostate);
1006 1050
1051 if (app->alpha_remember) {
1052 win.frame().setUseDefaultAlpha(false);
1053 win.frame().setAlpha(true,app->focused_alpha);
1054 win.frame().setAlpha(false,app->unfocused_alpha);
1055 }
1056
1007 BScreen &screen = winclient.screen(); 1057 BScreen &screen = winclient.screen();
1008 1058
1009 // now check if fluxbox is restarting 1059 // now check if fluxbox is restarting
diff --git a/src/Remember.hh b/src/Remember.hh
index 42edca3..d78e226 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -58,6 +58,7 @@ public:
58 inline void forgetJumpworkspace() { jumpworkspace_remember = false; } 58 inline void forgetJumpworkspace() { jumpworkspace_remember = false; }
59 inline void forgetLayer() { layer_remember = false; } 59 inline void forgetLayer() { layer_remember = false; }
60 inline void forgetSaveOnClose() { save_on_close_remember = false; } 60 inline void forgetSaveOnClose() { save_on_close_remember = false; }
61 inline void forgetAlpha() { alpha_remember = false; }
61 62
62 inline void rememberWorkspace(int ws) 63 inline void rememberWorkspace(int ws)
63 { workspace = ws; workspace_remember = true; } 64 { workspace = ws; workspace_remember = true; }
@@ -85,6 +86,8 @@ public:
85 { layer = layernum; layer_remember = true; } 86 { layer = layernum; layer_remember = true; }
86 inline void rememberSaveOnClose(bool state) 87 inline void rememberSaveOnClose(bool state)
87 { save_on_close = state; save_on_close_remember = true; } 88 { save_on_close = state; save_on_close_remember = true; }
89 inline void rememberAlpha(int focused_a, int unfocused_a)
90 { focused_alpha = focused_a; unfocused_alpha = unfocused_a; alpha_remember = true; }
88 91
89 92
90 bool workspace_remember; 93 bool workspace_remember;
@@ -103,6 +106,10 @@ public:
103 // 2 - lowerleft 106 // 2 - lowerleft
104 // 3 - lowerright 107 // 3 - lowerright
105 108
109 bool alpha_remember;
110 int focused_alpha;
111 int unfocused_alpha;
112
106 bool shadedstate_remember; 113 bool shadedstate_remember;
107 bool shadedstate; 114 bool shadedstate;
108 115
@@ -161,6 +168,7 @@ public:
161 //REM_TABSTATE, ... external tabs disabled atm 168 //REM_TABSTATE, ... external tabs disabled atm
162 REM_WORKSPACE, 169 REM_WORKSPACE,
163 REM_HEAD, 170 REM_HEAD,
171 REM_ALPHA,
164 REM_LASTATTRIB // not actually used 172 REM_LASTATTRIB // not actually used
165 }; 173 };
166 174
diff --git a/src/Screen.cc b/src/Screen.cc
index 5ea6202..58f195a 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1689,7 +1689,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1689 *resource.max_over_tabs, save_and_reconfigure)); 1689 *resource.max_over_tabs, save_and_reconfigure));
1690 1690
1691 FbTk::MenuItem *tab_width_item = 1691 FbTk::MenuItem *tab_width_item =
1692 new IntResMenuItem(_FB_XTEXT(Configmenu, ExternalTabWidth, 1692 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Configmenu, ExternalTabWidth,
1693 "External Tab Width", 1693 "External Tab Width",
1694 "Width of external-style tabs"), 1694 "Width of external-style tabs"),
1695 resource.tab_width, 10, 3000, /* silly number */ 1695 resource.tab_width, 10, 3000, /* silly number */
@@ -1791,7 +1791,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1791 } 1791 }
1792 1792
1793 FbTk::MenuItem *focused_alpha_item = 1793 FbTk::MenuItem *focused_alpha_item =
1794 new IntResMenuItem(_FB_XTEXT(Configmenu, FocusedAlpha, 1794 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Configmenu, FocusedAlpha,
1795 "Focused Window Alpha", 1795 "Focused Window Alpha",
1796 "Transparency level of the focused window"), 1796 "Transparency level of the focused window"),
1797 resource.focused_alpha, 0, 255, *alpha_menu); 1797 resource.focused_alpha, 0, 255, *alpha_menu);
@@ -1799,7 +1799,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1799 alpha_menu->insert(focused_alpha_item); 1799 alpha_menu->insert(focused_alpha_item);
1800 1800
1801 FbTk::MenuItem *unfocused_alpha_item = 1801 FbTk::MenuItem *unfocused_alpha_item =
1802 new IntResMenuItem(_FB_XTEXT(Configmenu, 1802 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Configmenu,
1803 UnfocusedAlpha, 1803 UnfocusedAlpha,
1804 "Unfocused Window Alpha", 1804 "Unfocused Window Alpha",
1805 "Transparency level of unfocused windows"), 1805 "Transparency level of unfocused windows"),
@@ -1809,7 +1809,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1809 alpha_menu->insert(unfocused_alpha_item); 1809 alpha_menu->insert(unfocused_alpha_item);
1810 1810
1811 FbTk::MenuItem *menu_alpha_item = 1811 FbTk::MenuItem *menu_alpha_item =
1812 new IntResMenuItem(_FB_XTEXT(Configmenu, MenuAlpha, 1812 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Configmenu, MenuAlpha,
1813 "Menu Alpha", "Transparency level of menu"), 1813 "Menu Alpha", "Transparency level of menu"),
1814 resource.menu_alpha, 0, 255, *alpha_menu); 1814 resource.menu_alpha, 0, 255, *alpha_menu);
1815 menu_alpha_item->setCommand(saverc_cmd); 1815 menu_alpha_item->setCommand(saverc_cmd);
diff --git a/src/Slit.cc b/src/Slit.cc
index e95708e..e9e2e91 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -1276,7 +1276,7 @@ void Slit::setupMenu() {
1276 1276
1277 // this saves resources and clears the slit window to update alpha value 1277 // this saves resources and clears the slit window to update alpha value
1278 FbTk::MenuItem *alpha_menuitem = 1278 FbTk::MenuItem *alpha_menuitem =
1279 new IntResMenuItem(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"), 1279 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"),
1280 m_rc_alpha, 1280 m_rc_alpha,
1281 0, 255, m_slitmenu); 1281 0, 255, m_slitmenu);
1282 // setup command for alpha value 1282 // setup command for alpha value
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index c0d3f88..4d2f191 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -845,7 +845,7 @@ void Toolbar::setupMenus(bool skip_new_placement) {
845 reconfig_toolbar_and_save_resource)); 845 reconfig_toolbar_and_save_resource));
846 846
847 MenuItem *toolbar_menuitem = 847 MenuItem *toolbar_menuitem =
848 new IntResMenuItem(_FB_XTEXT(Toolbar, WidthPercent, 848 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Toolbar, WidthPercent,
849 "Toolbar width percent", 849 "Toolbar width percent",
850 "Percentage of screen width taken by toolbar"), 850 "Percentage of screen width taken by toolbar"),
851 m_rc_width_percent, 851 m_rc_width_percent,
@@ -922,7 +922,7 @@ void Toolbar::setupMenus(bool skip_new_placement) {
922 922
923 // this saves resources and clears the slit window to update alpha value 923 // this saves resources and clears the slit window to update alpha value
924 FbTk::MenuItem *alpha_menuitem = 924 FbTk::MenuItem *alpha_menuitem =
925 new IntResMenuItem(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"), 925 new IntResMenuItem< FbTk::Resource<int> >(_FB_XTEXT(Common, Alpha, "Alpha", "Transparency level"),
926 m_rc_alpha, 926 m_rc_alpha,
927 0, 255, menu()); 927 0, 255, menu());
928 // setup command for alpha value 928 // setup command for alpha value
diff --git a/src/Window.cc b/src/Window.cc
index 56bf796..ca42c96 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -49,6 +49,7 @@
49#include "FbTk/KeyUtil.hh" 49#include "FbTk/KeyUtil.hh"
50#include "FbTk/SimpleCommand.hh" 50#include "FbTk/SimpleCommand.hh"
51#include "FbTk/Select2nd.hh" 51#include "FbTk/Select2nd.hh"
52#include "FbTk/Transparent.hh"
52 53
53#ifdef HAVE_CONFIG_H 54#ifdef HAVE_CONFIG_H
54#include "config.h" 55#include "config.h"
@@ -1503,6 +1504,13 @@ void FluxboxWindow::show() {
1503 frame().show(); 1504 frame().show();
1504} 1505}
1505 1506
1507void FluxboxWindow::toggleIconic() {
1508 if (isIconic())
1509 deiconify();
1510 else
1511 iconify();
1512}
1513
1506/** 1514/**
1507 Unmaps the window and removes it from workspace list 1515 Unmaps the window and removes it from workspace list
1508*/ 1516*/
diff --git a/src/Window.hh b/src/Window.hh
index 142b451..429747f 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -201,6 +201,19 @@ public:
201 void hide(bool interrupt_moving); 201 void hide(bool interrupt_moving);
202 void iconify(); 202 void iconify();
203 void deiconify(bool reassoc = true, bool do_raise = true); 203 void deiconify(bool reassoc = true, bool do_raise = true);
204
205 // ------------------
206 // Per window transparency addons
207 unsigned char getFocusedAlpha() const { return frame().getAlpha(true); }
208 unsigned char getUnfocusedAlpha() const { return frame().getAlpha(false); }
209 void setFocusedAlpha(unsigned char alpha) { frame().setAlpha(true, alpha); }
210 void setUnfocusedAlpha(unsigned char alpha) { frame().setAlpha(false, alpha); }
211 void updateAlpha(bool focused, unsigned char alpha) { frame().setAlpha(focused, alpha); }
212
213 bool getUseDefaultAlpha() const { return frame().getUseDefaultAlpha(); }
214 void setUseDefaultAlpha(bool default_alpha) { frame().setUseDefaultAlpha(default_alpha); }
215 // ------------------
216
204 /// close current client 217 /// close current client
205 void close(); 218 void close();
206 /// kill current client 219 /// kill current client
@@ -225,6 +238,8 @@ public:
225 void shadeOff(); 238 void shadeOff();
226 /// toggles sticky 239 /// toggles sticky
227 void stick(); 240 void stick();
241 /// toggles iconic
242 void toggleIconic();
228 void raise(); 243 void raise();
229 void lower(); 244 void lower();
230 void tempRaise(); 245 void tempRaise();
@@ -320,7 +335,9 @@ public:
320 inline bool isManaged() const { return m_initialized; } 335 inline bool isManaged() const { return m_initialized; }
321 inline bool isFocused() const { return focused; } 336 inline bool isFocused() const { return focused; }
322 bool isVisible() const; 337 bool isVisible() const;
338 inline bool isIconic() { return iconic; }
323 inline bool isIconic() const { return iconic; } 339 inline bool isIconic() const { return iconic; }
340 inline bool isShaded() { return shaded; }
324 inline bool isShaded() const { return shaded; } 341 inline bool isShaded() const { return shaded; }
325 inline bool isFullscreen() const { return fullscreen; } 342 inline bool isFullscreen() const { return fullscreen; }
326 inline bool isMaximized() const { return maximized == MAX_FULL; } 343 inline bool isMaximized() const { return maximized == MAX_FULL; }