aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-10 14:27:57 (GMT)
committerfluxgen <fluxgen>2003-05-10 14:27:57 (GMT)
commit08b94c624320a6f0bd61d6ae716a3b2fc6f3ded8 (patch)
treeebedc3c2fc4bda0221927c9b9f5ef9c2a23a013a /src/Window.cc
parentc9638d0473d9fb02ddb062b7db74bda299f027f4 (diff)
downloadfluxbox-08b94c624320a6f0bd61d6ae716a3b2fc6f3ded8.zip
fluxbox-08b94c624320a6f0bd61d6ae716a3b2fc6f3ded8.tar.bz2
moved BlackboxHints from BaseDisplay
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc115
1 files changed, 59 insertions, 56 deletions
diff --git a/src/Window.cc b/src/Window.cc
index e7a7496..b27f82e 100644
--- a/src/Window.cc
+++ b/src/Window.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: Window.cc,v 1.165 2003/05/08 15:14:50 rathnor Exp $ 25// $Id: Window.cc,v 1.166 2003/05/10 14:27:57 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -213,6 +213,9 @@ void LayerMenuItem<FluxboxWindow>::click(int button, int time) {
213} 213}
214 214
215 215
216//int FluxboxWindow::PropBlackboxHintsElements = 5;
217//int FluxboxWindow::PropBlackboxAttributesElements = 8;
218
216FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, 219FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm,
217 FbTk::MenuTheme &menutheme, 220 FbTk::MenuTheme &menutheme,
218 FbTk::XLayer &layer): 221 FbTk::XLayer &layer):
@@ -1050,33 +1053,33 @@ void FluxboxWindow::getBlackboxHints() {
1050 (unsigned char **) &m_client->blackbox_hint) == Success && 1053 (unsigned char **) &m_client->blackbox_hint) == Success &&
1051 m_client->blackbox_hint) { 1054 m_client->blackbox_hint) {
1052 1055
1053 if (num == PropBlackboxHintsElements) { 1056 if (num == (unsigned)PropBlackboxHintsElements) {
1054 if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_SHADED) 1057 if (m_client->blackbox_hint->flags & ATTRIB_SHADED)
1055 shaded = (m_client->blackbox_hint->attrib & BaseDisplay::ATTRIB_SHADED); 1058 shaded = (m_client->blackbox_hint->attrib & ATTRIB_SHADED);
1056 1059
1057 if ((m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_MAXHORIZ) && 1060 if ((m_client->blackbox_hint->flags & ATTRIB_MAXHORIZ) &&
1058 (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_MAXVERT)) 1061 (m_client->blackbox_hint->flags & ATTRIB_MAXVERT))
1059 maximized = ((m_client->blackbox_hint->attrib & 1062 maximized = ((m_client->blackbox_hint->attrib &
1060 (BaseDisplay::ATTRIB_MAXHORIZ | 1063 (ATTRIB_MAXHORIZ |
1061 BaseDisplay::ATTRIB_MAXVERT)) ? 1 : 0); 1064 ATTRIB_MAXVERT)) ? 1 : 0);
1062 else if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_MAXVERT) 1065 else if (m_client->blackbox_hint->flags & ATTRIB_MAXVERT)
1063 maximized = ((m_client->blackbox_hint->attrib & 1066 maximized = ((m_client->blackbox_hint->attrib &
1064 BaseDisplay::ATTRIB_MAXVERT) ? 2 : 0); 1067 ATTRIB_MAXVERT) ? 2 : 0);
1065 else if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_MAXHORIZ) 1068 else if (m_client->blackbox_hint->flags & ATTRIB_MAXHORIZ)
1066 maximized = ((m_client->blackbox_hint->attrib & 1069 maximized = ((m_client->blackbox_hint->attrib &
1067 BaseDisplay::ATTRIB_MAXHORIZ) ? 3 : 0); 1070 ATTRIB_MAXHORIZ) ? 3 : 0);
1068 1071
1069 if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_OMNIPRESENT) 1072 if (m_client->blackbox_hint->flags & ATTRIB_OMNIPRESENT)
1070 stuck = (m_client->blackbox_hint->attrib & 1073 stuck = (m_client->blackbox_hint->attrib &
1071 BaseDisplay::ATTRIB_OMNIPRESENT); 1074 ATTRIB_OMNIPRESENT);
1072 1075
1073 if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_WORKSPACE) 1076 if (m_client->blackbox_hint->flags & ATTRIB_WORKSPACE)
1074 workspace_number = m_client->blackbox_hint->workspace; 1077 workspace_number = m_client->blackbox_hint->workspace;
1075 1078
1076 if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_STACK) 1079 if (m_client->blackbox_hint->flags & ATTRIB_STACK)
1077 workspace_number = m_client->blackbox_hint->stack; 1080 workspace_number = m_client->blackbox_hint->stack;
1078 1081
1079 if (m_client->blackbox_hint->flags & BaseDisplay::ATTRIB_DECORATION) { 1082 if (m_client->blackbox_hint->flags & ATTRIB_DECORATION) {
1080 old_decoration = static_cast<Decoration>(m_client->blackbox_hint->decoration); 1083 old_decoration = static_cast<Decoration>(m_client->blackbox_hint->decoration);
1081 setDecoration(old_decoration); 1084 setDecoration(old_decoration);
1082 } 1085 }
@@ -1363,7 +1366,7 @@ void FluxboxWindow::setWorkspace(int n) {
1363 1366
1364 workspace_number = n; 1367 workspace_number = n;
1365 1368
1366 blackbox_attrib.flags |= BaseDisplay::ATTRIB_WORKSPACE; 1369 blackbox_attrib.flags |= ATTRIB_WORKSPACE;
1367 blackbox_attrib.workspace = workspace_number; 1370 blackbox_attrib.workspace = workspace_number;
1368 1371
1369 // notify workspace change 1372 // notify workspace change
@@ -1376,7 +1379,7 @@ void FluxboxWindow::setWorkspace(int n) {
1376void FluxboxWindow::setLayerNum(int layernum) { 1379void FluxboxWindow::setLayerNum(int layernum) {
1377 m_layernum = layernum; 1380 m_layernum = layernum;
1378 1381
1379 blackbox_attrib.flags |= BaseDisplay::ATTRIB_STACK; 1382 blackbox_attrib.flags |= ATTRIB_STACK;
1380 blackbox_attrib.stack = layernum; 1383 blackbox_attrib.stack = layernum;
1381 saveBlackboxHints(); 1384 saveBlackboxHints();
1382 1385
@@ -1396,14 +1399,14 @@ void FluxboxWindow::shade() {
1396 1399
1397 if (shaded) { 1400 if (shaded) {
1398 shaded = false; 1401 shaded = false;
1399 blackbox_attrib.flags ^= BaseDisplay::ATTRIB_SHADED; 1402 blackbox_attrib.flags ^= ATTRIB_SHADED;
1400 blackbox_attrib.attrib ^= BaseDisplay::ATTRIB_SHADED; 1403 blackbox_attrib.attrib ^= ATTRIB_SHADED;
1401 1404
1402 setState(NormalState); 1405 setState(NormalState);
1403 } else { 1406 } else {
1404 shaded = true; 1407 shaded = true;
1405 blackbox_attrib.flags |= BaseDisplay::ATTRIB_SHADED; 1408 blackbox_attrib.flags |= ATTRIB_SHADED;
1406 blackbox_attrib.attrib |= BaseDisplay::ATTRIB_SHADED; 1409 blackbox_attrib.attrib |= ATTRIB_SHADED;
1407 // shading is the same as iconic 1410 // shading is the same as iconic
1408 setState(IconicState); 1411 setState(IconicState);
1409 } 1412 }
@@ -1414,16 +1417,16 @@ void FluxboxWindow::shade() {
1414void FluxboxWindow::stick() { 1417void FluxboxWindow::stick() {
1415 1418
1416 if (stuck) { 1419 if (stuck) {
1417 blackbox_attrib.flags ^= BaseDisplay::ATTRIB_OMNIPRESENT; 1420 blackbox_attrib.flags ^= ATTRIB_OMNIPRESENT;
1418 blackbox_attrib.attrib ^= BaseDisplay::ATTRIB_OMNIPRESENT; 1421 blackbox_attrib.attrib ^= ATTRIB_OMNIPRESENT;
1419 1422
1420 stuck = false; 1423 stuck = false;
1421 1424
1422 } else { 1425 } else {
1423 stuck = true; 1426 stuck = true;
1424 1427
1425 blackbox_attrib.flags |= BaseDisplay::ATTRIB_OMNIPRESENT; 1428 blackbox_attrib.flags |= ATTRIB_OMNIPRESENT;
1426 blackbox_attrib.attrib |= BaseDisplay::ATTRIB_OMNIPRESENT; 1429 blackbox_attrib.attrib |= ATTRIB_OMNIPRESENT;
1427 1430
1428 } 1431 }
1429 1432
@@ -1774,13 +1777,13 @@ void FluxboxWindow::restoreAttributes() {
1774 unsigned long ulfoo, nitems; 1777 unsigned long ulfoo, nitems;
1775 FbAtoms *fbatoms = FbAtoms::instance(); 1778 FbAtoms *fbatoms = FbAtoms::instance();
1776 1779
1777 BaseDisplay::BlackboxAttributes *net; 1780 BlackboxAttributes *net;
1778 if (XGetWindowProperty(display, m_client->window(), 1781 if (XGetWindowProperty(display, m_client->window(),
1779 fbatoms->getFluxboxAttributesAtom(), 0l, 1782 fbatoms->getFluxboxAttributesAtom(), 0l,
1780 PropBlackboxAttributesElements, false, 1783 PropBlackboxAttributesElements, false,
1781 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo, 1784 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
1782 &nitems, &ulfoo, (unsigned char **) &net) == 1785 &nitems, &ulfoo, (unsigned char **) &net) ==
1783 Success && net && nitems == PropBlackboxAttributesElements) { 1786 Success && net && nitems == (unsigned)PropBlackboxAttributesElements) {
1784 blackbox_attrib.flags = net->flags; 1787 blackbox_attrib.flags = net->flags;
1785 blackbox_attrib.attrib = net->attrib; 1788 blackbox_attrib.attrib = net->attrib;
1786 blackbox_attrib.workspace = net->workspace; 1789 blackbox_attrib.workspace = net->workspace;
@@ -1794,8 +1797,8 @@ void FluxboxWindow::restoreAttributes() {
1794 } else 1797 } else
1795 return; 1798 return;
1796 1799
1797 if (blackbox_attrib.flags & BaseDisplay::ATTRIB_SHADED && 1800 if (blackbox_attrib.flags & ATTRIB_SHADED &&
1798 blackbox_attrib.attrib & BaseDisplay::ATTRIB_SHADED) { 1801 blackbox_attrib.attrib & ATTRIB_SHADED) {
1799 int save_state = 1802 int save_state =
1800 ((current_state == IconicState) ? NormalState : current_state); 1803 ((current_state == IconicState) ? NormalState : current_state);
1801 1804
@@ -1812,29 +1815,29 @@ void FluxboxWindow::restoreAttributes() {
1812 } else if (current_state == WithdrawnState) 1815 } else if (current_state == WithdrawnState)
1813 current_state = NormalState; 1816 current_state = NormalState;
1814 1817
1815 if (blackbox_attrib.flags & BaseDisplay::ATTRIB_OMNIPRESENT && 1818 if (blackbox_attrib.flags & ATTRIB_OMNIPRESENT &&
1816 blackbox_attrib.attrib & BaseDisplay::ATTRIB_OMNIPRESENT) { 1819 blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) {
1817 stuck = true; 1820 stuck = true;
1818 1821
1819 current_state = NormalState; 1822 current_state = NormalState;
1820 } 1823 }
1821 1824
1822 if (blackbox_attrib.flags & BaseDisplay::ATTRIB_STACK) { 1825 if (blackbox_attrib.flags & ATTRIB_STACK) {
1823 //!! TODO check value? 1826 //!! TODO check value?
1824 m_layernum = blackbox_attrib.stack; 1827 m_layernum = blackbox_attrib.stack;
1825 } 1828 }
1826 1829
1827 if ((blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ) || 1830 if ((blackbox_attrib.flags & ATTRIB_MAXHORIZ) ||
1828 (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT)) { 1831 (blackbox_attrib.flags & ATTRIB_MAXVERT)) {
1829 int x = blackbox_attrib.premax_x, y = blackbox_attrib.premax_y; 1832 int x = blackbox_attrib.premax_x, y = blackbox_attrib.premax_y;
1830 unsigned int w = blackbox_attrib.premax_w, h = blackbox_attrib.premax_h; 1833 unsigned int w = blackbox_attrib.premax_w, h = blackbox_attrib.premax_h;
1831 maximized = false; 1834 maximized = false;
1832 if ((blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ) && 1835 if ((blackbox_attrib.flags & ATTRIB_MAXHORIZ) &&
1833 (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT)) 1836 (blackbox_attrib.flags & ATTRIB_MAXVERT))
1834 maximized = true; 1837 maximized = true;
1835 else if (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXVERT) 1838 else if (blackbox_attrib.flags & ATTRIB_MAXVERT)
1836 maximizeVertical(); 1839 maximizeVertical();
1837 else if (blackbox_attrib.flags & BaseDisplay::ATTRIB_MAXHORIZ) 1840 else if (blackbox_attrib.flags & ATTRIB_MAXHORIZ)
1838 maximizeHorizontal(); 1841 maximizeHorizontal();
1839 1842
1840 blackbox_attrib.premax_x = x; 1843 blackbox_attrib.premax_x = x;
@@ -3071,34 +3074,34 @@ unsigned int FluxboxWindow::getClientHeight() const { return m_client->height();
3071unsigned int FluxboxWindow::getClientWidth() const { return m_client->width(); } 3074unsigned int FluxboxWindow::getClientWidth() const { return m_client->width(); }
3072int FluxboxWindow::initialState() const { return m_client->initial_state; } 3075int FluxboxWindow::initialState() const { return m_client->initial_state; }
3073 3076
3074void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) { 3077void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
3075 if ((net.flags & BaseDisplay::ATTRIB_SHADED) && 3078 if ((net.flags & ATTRIB_SHADED) &&
3076 ((blackbox_attrib.attrib & BaseDisplay::ATTRIB_SHADED) != 3079 ((blackbox_attrib.attrib & ATTRIB_SHADED) !=
3077 (net.attrib & BaseDisplay::ATTRIB_SHADED))) 3080 (net.attrib & ATTRIB_SHADED)))
3078 shade(); 3081 shade();
3079 3082
3080 if ((net.flags & (BaseDisplay::ATTRIB_MAXVERT | BaseDisplay::ATTRIB_MAXHORIZ)) && 3083 if ((net.flags & (ATTRIB_MAXVERT | ATTRIB_MAXHORIZ)) &&
3081 ((blackbox_attrib.attrib & (BaseDisplay::ATTRIB_MAXVERT | BaseDisplay::ATTRIB_MAXHORIZ)) != 3084 ((blackbox_attrib.attrib & (ATTRIB_MAXVERT | ATTRIB_MAXHORIZ)) !=
3082 (net.attrib & (BaseDisplay::ATTRIB_MAXVERT | BaseDisplay::ATTRIB_MAXHORIZ)))) { 3085 (net.attrib & (ATTRIB_MAXVERT | ATTRIB_MAXHORIZ)))) {
3083 if (maximized) { 3086 if (maximized) {
3084 maximize(); 3087 maximize();
3085 } else { 3088 } else {
3086 if ((net.flags & BaseDisplay::ATTRIB_MAXHORIZ) && (net.flags & BaseDisplay::ATTRIB_MAXVERT)) 3089 if ((net.flags & ATTRIB_MAXHORIZ) && (net.flags & ATTRIB_MAXVERT))
3087 maximize(); 3090 maximize();
3088 else if (net.flags & BaseDisplay::ATTRIB_MAXVERT) 3091 else if (net.flags & ATTRIB_MAXVERT)
3089 maximizeVertical(); 3092 maximizeVertical();
3090 else if (net.flags & BaseDisplay::ATTRIB_MAXHORIZ) 3093 else if (net.flags & ATTRIB_MAXHORIZ)
3091 maximizeHorizontal(); 3094 maximizeHorizontal();
3092 3095
3093 } 3096 }
3094 } 3097 }
3095 3098
3096 if ((net.flags & BaseDisplay::ATTRIB_OMNIPRESENT) && 3099 if ((net.flags & ATTRIB_OMNIPRESENT) &&
3097 ((blackbox_attrib.attrib & BaseDisplay::ATTRIB_OMNIPRESENT) != 3100 ((blackbox_attrib.attrib & ATTRIB_OMNIPRESENT) !=
3098 (net.attrib & BaseDisplay::ATTRIB_OMNIPRESENT))) 3101 (net.attrib & ATTRIB_OMNIPRESENT)))
3099 stick(); 3102 stick();
3100 3103
3101 if ((net.flags & BaseDisplay::ATTRIB_WORKSPACE) && 3104 if ((net.flags & ATTRIB_WORKSPACE) &&
3102 (workspace_number != net.workspace)) { 3105 (workspace_number != net.workspace)) {
3103 3106
3104 screen.reassociateWindow(this, net.workspace, true); 3107 screen.reassociateWindow(this, net.workspace, true);
@@ -3109,13 +3112,13 @@ void FluxboxWindow::changeBlackboxHints(const BaseDisplay::BlackboxHints &net) {
3109 deiconify(); 3112 deiconify();
3110 } 3113 }
3111 3114
3112 if (net.flags & BaseDisplay::ATTRIB_STACK) { 3115 if (net.flags & ATTRIB_STACK) {
3113 if ((unsigned int) m_layernum != net.stack) { 3116 if ((unsigned int) m_layernum != net.stack) {
3114 moveToLayer(net.stack); 3117 moveToLayer(net.stack);
3115 } 3118 }
3116 } 3119 }
3117 3120
3118 if (net.flags & BaseDisplay::ATTRIB_DECORATION) { 3121 if (net.flags & ATTRIB_DECORATION) {
3119 old_decoration = static_cast<Decoration>(net.decoration); 3122 old_decoration = static_cast<Decoration>(net.decoration);
3120 setDecoration(old_decoration); 3123 setDecoration(old_decoration);
3121 } 3124 }