aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-06-23 14:16:05 (GMT)
committerrathnor <rathnor>2003-06-23 14:16:05 (GMT)
commit09a5c23c5b099af531842ae7868e98bc8d717dac (patch)
treecf5ea34c09ee3d16ddc2e9abfc1bd2880a94067d /src/Window.cc
parent2e6baffb9bf988901f9fa02f651efc9b2528d7b5 (diff)
downloadfluxbox-09a5c23c5b099af531842ae7868e98bc8d717dac.zip
fluxbox-09a5c23c5b099af531842ae7868e98bc8d717dac.tar.bz2
fix grouping to persist over restart, plus various related bugs.
Also move a large proportion of window initialisation from FluxboxWindow to WinClient
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc338
1 files changed, 105 insertions, 233 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2affa8e..be5d81f 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.194 2003/06/22 21:29:32 fluxgen Exp $ 25// $Id: Window.cc,v 1.195 2003/06/23 14:16:05 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -61,6 +61,8 @@
61#include <cstdio> 61#include <cstdio>
62#include <iostream> 62#include <iostream>
63#include <cassert> 63#include <cassert>
64#include <functional>
65#include <algorithm>
64 66
65using namespace std; 67using namespace std;
66 68
@@ -232,7 +234,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
232 m_diesig(*this), 234 m_diesig(*this),
233 moving(false), resizing(false), shaded(false), maximized(false), 235 moving(false), resizing(false), shaded(false), maximized(false),
234 iconic(false), focused(false), 236 iconic(false), focused(false),
235 stuck(false), send_focus_message(false), m_managed(false), 237 stuck(false), m_managed(false),
236 m_screen(scr), 238 m_screen(scr),
237 m_timer(this), 239 m_timer(this),
238 display(0), 240 display(0),
@@ -255,42 +257,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t
255} 257}
256 258
257 259
258FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm,
259 FbTk::MenuTheme &menutheme,
260 FbTk::XLayer &layer):
261 oplock(false),
262 m_hintsig(*this),
263 m_statesig(*this),
264 m_layersig(*this),
265 m_workspacesig(*this),
266 m_diesig(*this),
267 moving(false), resizing(false), shaded(false), maximized(false),
268 iconic(false), focused(false),
269 stuck(false), send_focus_message(false), m_managed(false),
270 m_screen(scr),
271 m_timer(this),
272 display(0),
273 m_layermenu(new LayerMenu<FluxboxWindow>(menutheme,
274 scr.screenNumber(),
275 scr.imageControl(),
276 *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
277 this,
278 false)),
279 m_windowmenu(menutheme, scr.screenNumber(), scr.imageControl()),
280 m_old_decoration(DECOR_NORMAL),
281 m_client(new WinClient(w, *this)),
282 m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)),
283 m_strut(0),
284 m_layeritem(m_frame->window(), layer),
285 m_layernum(layer.getLayerNum()),
286 m_parent(scr.rootWindow()) {
287 assert(w != 0);
288 init();
289
290}
291
292
293
294FluxboxWindow::~FluxboxWindow() { 260FluxboxWindow::~FluxboxWindow() {
295#ifdef DEBUG 261#ifdef DEBUG
296 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<")"<<endl; 262 cerr<<__FILE__<<"("<<__LINE__<<"): starting ~FluxboxWindow("<<this<<")"<<endl;
@@ -344,7 +310,10 @@ void FluxboxWindow::init() {
344 m_layermenu->setInternalMenu(); 310 m_layermenu->setInternalMenu();
345 311
346 m_attaching_tab = 0; 312 m_attaching_tab = 0;
313
347 assert(m_client); 314 assert(m_client);
315 m_client->m_win = this;
316 m_client->setGroupLeftWindow(None); // nothing to the left.
348 317
349 // check for shape extension and whether the window is shaped 318 // check for shape extension and whether the window is shaped
350 m_shaped = false; 319 m_shaped = false;
@@ -433,16 +402,17 @@ void FluxboxWindow::init() {
433 functions.resize = functions.move = functions.iconify = functions.maximize = true; 402 functions.resize = functions.move = functions.iconify = functions.maximize = true;
434 functions.close = decorations.close = false; 403 functions.close = decorations.close = false;
435 404
436 getBlackboxHints(); 405 if (m_client->getBlackboxHint() != 0)
437 if (! m_client->blackbox_hint) 406 getBlackboxHints();
407 else
438 getMWMHints(); 408 getMWMHints();
439 409
440 // get size, aspect, minimum/maximum size and other hints set 410 // get size, aspect, minimum/maximum size and other hints set
441 // by the client 411 // by the client
442 412
443 getWMProtocols(); 413 getWMProtocols();
444 getWMHints(); 414 if (m_client->window_group != None)
445 getWMNormalHints(); 415 Fluxbox::instance()->saveGroupSearch(m_client->window_group, this);
446 416
447 //!! 417 //!!
448 // fetch client size and placement 418 // fetch client size and placement
@@ -589,13 +559,23 @@ void FluxboxWindow::attachClient(WinClient &client) {
589 frame().setClientWindow(client); 559 frame().setClientWindow(client);
590 FbTk::EventManager &evm = *FbTk::EventManager::instance(); 560 FbTk::EventManager &evm = *FbTk::EventManager::instance();
591 561
562 // get the current window on the end of our client list
563 Window leftwin = None;
564 ClientList::iterator client_it = clientList().end();
565 ClientList::iterator client_it_end = clientList().end();
566 --client_it;
567 if (client_it != client_it_end)
568 leftwin = (*client_it)->window();
569
570 client.setGroupLeftWindow(leftwin);
571
592 if (client.fbwindow() != 0) { 572 if (client.fbwindow() != 0) {
593 FluxboxWindow *old_win = client.fbwindow(); // store old window 573 FluxboxWindow *old_win = client.fbwindow(); // store old window
594 574
595 Fluxbox *fb = Fluxbox::instance(); 575 Fluxbox *fb = Fluxbox::instance();
596 // make sure we set new window search for each client 576 // make sure we set new window search for each client
597 ClientList::iterator client_it = old_win->clientList().begin(); 577 client_it = old_win->clientList().begin();
598 ClientList::iterator client_it_end = old_win->clientList().end(); 578 client_it_end = old_win->clientList().end();
599 for (; client_it != client_it_end; ++client_it) { 579 for (; client_it != client_it_end; ++client_it) {
600 // setup eventhandlers for client 580 // setup eventhandlers for client
601 fb->saveWindowSearch((*client_it)->window(), this); 581 fb->saveWindowSearch((*client_it)->window(), this);
@@ -628,10 +608,12 @@ void FluxboxWindow::attachClient(WinClient &client) {
628 btn->setOnClick(set_client_cmd); 608 btn->setOnClick(set_client_cmd);
629 evm.add(*this, btn->window()); // we take care of button events for this 609 evm.add(*this, btn->window()); // we take care of button events for this
630 610
611 (*client_it)->saveBlackboxAttribs(m_blackbox_attrib);
631 } 612 }
632 613
633 // add client and move over all attached clients 614 // add client and move over all attached clients
634 // from the old window to this list 615 // from the old window to this list
616 // all the "left window"s will remain the same, except for the first.
635 m_clientlist.splice(m_clientlist.end(), old_win->m_clientlist); 617 m_clientlist.splice(m_clientlist.end(), old_win->m_clientlist);
636 old_win->m_client = 0; 618 old_win->m_client = 0;
637 619
@@ -659,8 +641,16 @@ void FluxboxWindow::attachClient(WinClient &client) {
659 client.m_win = this; 641 client.m_win = this;
660 642
661 Fluxbox::instance()->saveWindowSearch(client.window(), this); 643 Fluxbox::instance()->saveWindowSearch(client.window(), this);
644 client.saveBlackboxAttribs(m_blackbox_attrib);
662 } 645 }
663 646
647 // make sure that the state etc etc is updated for the new client
648 // TODO: one day these should probably be neatened to only act on the
649 // affected clients if possible
650 m_statesig.notify();
651 m_workspacesig.notify();
652 m_layersig.notify();
653
664 frame().reconfigure(); 654 frame().reconfigure();
665 655
666 // keep the current window on top 656 // keep the current window on top
@@ -889,7 +879,7 @@ void FluxboxWindow::getWMProtocols() {
889 if (proto[i] == fbatoms->getWMDeleteAtom()) 879 if (proto[i] == fbatoms->getWMDeleteAtom())
890 functions.close = true; 880 functions.close = true;
891 else if (proto[i] == fbatoms->getWMTakeFocusAtom()) 881 else if (proto[i] == fbatoms->getWMTakeFocusAtom())
892 send_focus_message = true; 882 m_client->send_focus_message = true;
893 else if (proto[i] == fbatoms->getFluxboxStructureMessagesAtom()) 883 else if (proto[i] == fbatoms->getFluxboxStructureMessagesAtom())
894 screen().addNetizen(m_client->window()); 884 screen().addNetizen(m_client->window());
895 } 885 }
@@ -902,125 +892,13 @@ void FluxboxWindow::getWMProtocols() {
902} 892}
903 893
904 894
905void FluxboxWindow::getWMHints() { 895void FluxboxWindow::getMWMHints() {
906 //!! 896 const WinClient::MwmHints *hint = m_client->getMwmHint();
907 XWMHints *wmhint = XGetWMHints(display, m_client->window());
908 if (! wmhint) {
909 iconic = false;
910 m_focus_mode = F_PASSIVE;
911 m_client->window_group = None;
912 m_client->initial_state = NormalState;
913 } else {
914 m_client->wm_hint_flags = wmhint->flags;
915 if (wmhint->flags & InputHint) {
916 if (wmhint->input) {
917 if (send_focus_message)
918 m_focus_mode = F_LOCALLYACTIVE;
919 else
920 m_focus_mode = F_PASSIVE;
921 } else {
922 if (send_focus_message)
923 m_focus_mode = F_GLOBALLYACTIVE;
924 else
925 m_focus_mode = F_NOINPUT;
926 }
927 } else
928 m_focus_mode = F_PASSIVE;
929
930 if (wmhint->flags & StateHint)
931 m_client->initial_state = wmhint->initial_state;
932 else
933 m_client->initial_state = NormalState;
934
935 if (wmhint->flags & WindowGroupHint) {
936 if (! m_client->window_group) {
937 m_client->window_group = wmhint->window_group;
938 Fluxbox::instance()->saveGroupSearch(m_client->window_group, this);
939 }
940 } else
941 m_client->window_group = None;
942
943 XFree(wmhint);
944 }
945}
946
947
948void FluxboxWindow::getWMNormalHints() {
949 long icccm_mask;
950 XSizeHints sizehint;
951 if (! XGetWMNormalHints(display, m_client->window(), &sizehint, &icccm_mask)) {
952 m_client->min_width = m_client->min_height =
953 m_client->base_width = m_client->base_height =
954 m_client->width_inc = m_client->height_inc = 1;
955 m_client->max_width = 0; // unbounded
956 m_client->max_height = 0;
957 m_client->min_aspect_x = m_client->min_aspect_y =
958 m_client->max_aspect_x = m_client->max_aspect_y = 1;
959 m_client->win_gravity = NorthWestGravity;
960 } else {
961 m_client->normal_hint_flags = sizehint.flags;
962
963 if (sizehint.flags & PMinSize) {
964 m_client->min_width = sizehint.min_width;
965 m_client->min_height = sizehint.min_height;
966 } else
967 m_client->min_width = m_client->min_height = 1;
968
969 if (sizehint.flags & PMaxSize) {
970 m_client->max_width = sizehint.max_width;
971 m_client->max_height = sizehint.max_height;
972 } else {
973 m_client->max_width = 0; // unbounded
974 m_client->max_height = 0;
975 }
976
977 if (sizehint.flags & PResizeInc) {
978 m_client->width_inc = sizehint.width_inc;
979 m_client->height_inc = sizehint.height_inc;
980 } else
981 m_client->width_inc = m_client->height_inc = 1;
982
983 if (sizehint.flags & PAspect) {
984 m_client->min_aspect_x = sizehint.min_aspect.x;
985 m_client->min_aspect_y = sizehint.min_aspect.y;
986 m_client->max_aspect_x = sizehint.max_aspect.x;
987 m_client->max_aspect_y = sizehint.max_aspect.y;
988 } else
989 m_client->min_aspect_x = m_client->min_aspect_y =
990 m_client->max_aspect_x = m_client->max_aspect_y = 1;
991
992 if (sizehint.flags & PBaseSize) {
993 m_client->base_width = sizehint.base_width;
994 m_client->base_height = sizehint.base_height;
995 } else
996 m_client->base_width = m_client->base_height = 0;
997
998 if (sizehint.flags & PWinGravity)
999 m_client->win_gravity = sizehint.win_gravity;
1000 else
1001 m_client->win_gravity = NorthWestGravity;
1002 }
1003}
1004 897
898 if (!hint) return;
1005 899
1006void FluxboxWindow::getMWMHints() { 900 if (hint->flags & MwmHintsDecorations) {
1007 int format; 901 if (hint->decorations & MwmDecorAll) {
1008 Atom atom_return;
1009 unsigned long num, len;
1010 Atom motif_wm_hints = XInternAtom(display, "_MOTIF_WM_HINTS", False);
1011 if (!(m_client->property(motif_wm_hints, 0,
1012 PropMwmHintsElements, false,
1013 motif_wm_hints, &atom_return,
1014 &format, &num, &len,
1015 (unsigned char **) &m_client->mwm_hint) &&
1016 m_client->mwm_hint)) {
1017 return;
1018 }
1019 if (num != static_cast<unsigned int>(PropMwmHintsElements))
1020 return;
1021
1022 if (m_client->mwm_hint->flags & MwmHintsDecorations) {
1023 if (m_client->mwm_hint->decorations & MwmDecorAll) {
1024 decorations.titlebar = decorations.handle = decorations.border = 902 decorations.titlebar = decorations.handle = decorations.border =
1025 decorations.iconify = decorations.maximize = 903 decorations.iconify = decorations.maximize =
1026 decorations.close = decorations.menu = true; 904 decorations.close = decorations.menu = true;
@@ -1029,41 +907,41 @@ void FluxboxWindow::getMWMHints() {
1029 decorations.iconify = decorations.maximize = 907 decorations.iconify = decorations.maximize =
1030 decorations.close = decorations.tab = false; 908 decorations.close = decorations.tab = false;
1031 decorations.menu = true; 909 decorations.menu = true;
1032 if (m_client->mwm_hint->decorations & MwmDecorBorder) 910 if (hint->decorations & MwmDecorBorder)
1033 decorations.border = true; 911 decorations.border = true;
1034 if (m_client->mwm_hint->decorations & MwmDecorHandle) 912 if (hint->decorations & MwmDecorHandle)
1035 decorations.handle = true; 913 decorations.handle = true;
1036 if (m_client->mwm_hint->decorations & MwmDecorTitle) { 914 if (hint->decorations & MwmDecorTitle) {
1037 //only tab on windows with titlebar 915 //only tab on windows with titlebar
1038 decorations.titlebar = decorations.tab = true; 916 decorations.titlebar = decorations.tab = true;
1039 } 917 }
1040 918
1041 if (m_client->mwm_hint->decorations & MwmDecorMenu) 919 if (hint->decorations & MwmDecorMenu)
1042 decorations.menu = true; 920 decorations.menu = true;
1043 if (m_client->mwm_hint->decorations & MwmDecorIconify) 921 if (hint->decorations & MwmDecorIconify)
1044 decorations.iconify = true; 922 decorations.iconify = true;
1045 if (m_client->mwm_hint->decorations & MwmDecorMaximize) 923 if (hint->decorations & MwmDecorMaximize)
1046 decorations.maximize = true; 924 decorations.maximize = true;
1047 } 925 }
1048 } 926 }
1049 927
1050 if (m_client->mwm_hint->flags & MwmHintsFunctions) { 928 if (hint->flags & MwmHintsFunctions) {
1051 if (m_client->mwm_hint->functions & MwmFuncAll) { 929 if (hint->functions & MwmFuncAll) {
1052 functions.resize = functions.move = functions.iconify = 930 functions.resize = functions.move = functions.iconify =
1053 functions.maximize = functions.close = true; 931 functions.maximize = functions.close = true;
1054 } else { 932 } else {
1055 functions.resize = functions.move = functions.iconify = 933 functions.resize = functions.move = functions.iconify =
1056 functions.maximize = functions.close = false; 934 functions.maximize = functions.close = false;
1057 935
1058 if (m_client->mwm_hint->functions & MwmFuncResize) 936 if (hint->functions & MwmFuncResize)
1059 functions.resize = true; 937 functions.resize = true;
1060 if (m_client->mwm_hint->functions & MwmFuncMove) 938 if (hint->functions & MwmFuncMove)
1061 functions.move = true; 939 functions.move = true;
1062 if (m_client->mwm_hint->functions & MwmFuncIconify) 940 if (hint->functions & MwmFuncIconify)
1063 functions.iconify = true; 941 functions.iconify = true;
1064 if (m_client->mwm_hint->functions & MwmFuncMaximize) 942 if (hint->functions & MwmFuncMaximize)
1065 functions.maximize = true; 943 functions.maximize = true;
1066 if (m_client->mwm_hint->functions & MwmFuncClose) 944 if (hint->functions & MwmFuncClose)
1067 functions.close = true; 945 functions.close = true;
1068 } 946 }
1069 } 947 }
@@ -1073,50 +951,37 @@ void FluxboxWindow::getMWMHints() {
1073 951
1074 952
1075void FluxboxWindow::getBlackboxHints() { 953void FluxboxWindow::getBlackboxHints() {
1076 int format; 954 const FluxboxWindow::BlackboxHints *hint = m_client->getBlackboxHint();
1077 Atom atom_return; 955 if (!hint) return;
1078 unsigned long num, len; 956
1079 FbAtoms *atoms = FbAtoms::instance(); 957 if (hint->flags & ATTRIB_SHADED)
1080 958 shaded = (hint->attrib & ATTRIB_SHADED);
1081 if (XGetWindowProperty(display, m_client->window(), 959
1082 atoms->getFluxboxHintsAtom(), 0, 960 if ((hint->flags & ATTRIB_MAXHORIZ) &&
1083 PropBlackboxHintsElements, False, 961 (hint->flags & ATTRIB_MAXVERT))
1084 atoms->getFluxboxHintsAtom(), &atom_return, 962 maximized = ((hint->attrib &
1085 &format, &num, &len, 963 (ATTRIB_MAXHORIZ |
1086 (unsigned char **) &m_client->blackbox_hint) == Success && 964 ATTRIB_MAXVERT)) ? 1 : 0);
1087 m_client->blackbox_hint) { 965 else if (hint->flags & ATTRIB_MAXVERT)
1088 966 maximized = ((hint->attrib &
1089 if (num == (unsigned)PropBlackboxHintsElements) { 967 ATTRIB_MAXVERT) ? 2 : 0);
1090 if (m_client->blackbox_hint->flags & ATTRIB_SHADED) 968 else if (hint->flags & ATTRIB_MAXHORIZ)
1091 shaded = (m_client->blackbox_hint->attrib & ATTRIB_SHADED); 969 maximized = ((hint->attrib &
1092 970 ATTRIB_MAXHORIZ) ? 3 : 0);
1093 if ((m_client->blackbox_hint->flags & ATTRIB_MAXHORIZ) && 971
1094 (m_client->blackbox_hint->flags & ATTRIB_MAXVERT)) 972 if (hint->flags & ATTRIB_OMNIPRESENT)
1095 maximized = ((m_client->blackbox_hint->attrib & 973 stuck = (hint->attrib &
1096 (ATTRIB_MAXHORIZ | 974 ATTRIB_OMNIPRESENT);
1097 ATTRIB_MAXVERT)) ? 1 : 0); 975
1098 else if (m_client->blackbox_hint->flags & ATTRIB_MAXVERT) 976 if (hint->flags & ATTRIB_WORKSPACE)
1099 maximized = ((m_client->blackbox_hint->attrib & 977 m_workspace_number = hint->workspace;
1100 ATTRIB_MAXVERT) ? 2 : 0); 978
1101 else if (m_client->blackbox_hint->flags & ATTRIB_MAXHORIZ) 979 if (hint->flags & ATTRIB_STACK)
1102 maximized = ((m_client->blackbox_hint->attrib & 980 m_workspace_number = hint->stack;
1103 ATTRIB_MAXHORIZ) ? 3 : 0); 981
1104 982 if (hint->flags & ATTRIB_DECORATION) {
1105 if (m_client->blackbox_hint->flags & ATTRIB_OMNIPRESENT) 983 m_old_decoration = static_cast<Decoration>(hint->decoration);
1106 stuck = (m_client->blackbox_hint->attrib & 984 setDecoration(m_old_decoration);
1107 ATTRIB_OMNIPRESENT);
1108
1109 if (m_client->blackbox_hint->flags & ATTRIB_WORKSPACE)
1110 m_workspace_number = m_client->blackbox_hint->workspace;
1111
1112 if (m_client->blackbox_hint->flags & ATTRIB_STACK)
1113 m_workspace_number = m_client->blackbox_hint->stack;
1114
1115 if (m_client->blackbox_hint->flags & ATTRIB_DECORATION) {
1116 m_old_decoration = static_cast<Decoration>(m_client->blackbox_hint->decoration);
1117 setDecoration(m_old_decoration);
1118 }
1119 }
1120 } 985 }
1121} 986}
1122 987
@@ -1201,7 +1066,7 @@ bool FluxboxWindow::setInputFocus() {
1201 return (*it)->fbwindow()->setCurrentClient(**it, true); 1066 return (*it)->fbwindow()->setCurrentClient(**it, true);
1202 } 1067 }
1203 } else { 1068 } else {
1204 if (m_focus_mode == F_LOCALLYACTIVE || m_focus_mode == F_PASSIVE) { 1069 if (m_client->getFocusMode() == WinClient::F_LOCALLYACTIVE || m_client->getFocusMode() == WinClient::F_PASSIVE) {
1205 XSetInputFocus(display, m_client->window(), 1070 XSetInputFocus(display, m_client->window(),
1206 RevertToPointerRoot, CurrentTime); 1071 RevertToPointerRoot, CurrentTime);
1207 } else { 1072 } else {
@@ -1214,8 +1079,7 @@ bool FluxboxWindow::setInputFocus() {
1214 1079
1215 frame().setFocus(true); 1080 frame().setFocus(true);
1216 1081
1217 if (send_focus_message) 1082 m_client->sendFocus();
1218 m_client->sendFocus();
1219 1083
1220 if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus()) 1084 if ((screen().isSloppyFocus() || screen().isSemiSloppyFocus())
1221 && screen().doAutoRaise()) 1085 && screen().doAutoRaise())
@@ -1428,7 +1292,7 @@ void FluxboxWindow::setLayerNum(int layernum) {
1428 1292
1429 m_blackbox_attrib.flags |= ATTRIB_STACK; 1293 m_blackbox_attrib.flags |= ATTRIB_STACK;
1430 m_blackbox_attrib.stack = layernum; 1294 m_blackbox_attrib.stack = layernum;
1431 saveBlackboxHints(); 1295 saveBlackboxAttribs();
1432 1296
1433#ifdef DEBUG 1297#ifdef DEBUG
1434 cerr<<this<<" notify layer signal"<<endl; 1298 cerr<<this<<" notify layer signal"<<endl;
@@ -1688,14 +1552,18 @@ void FluxboxWindow::installColormap(bool install) {
1688} 1552}
1689 1553
1690/** 1554/**
1691 Saves blackbox hints for every client in our list 1555 Saves blackbox attributes for every client in our list
1692 */ 1556 */
1693void FluxboxWindow::saveBlackboxHints() { 1557void FluxboxWindow::saveBlackboxAttribs() {
1694 for_each(m_clientlist.begin(), m_clientlist.end(), 1558 for_each(m_clientlist.begin(), m_clientlist.end(),
1695 FbTk::ChangeProperty(display, FbAtoms::instance()->getFluxboxAttributesAtom(), 1559 FbTk::ChangeProperty(
1696 PropModeReplace, 1560 display,
1697 (unsigned char *)&m_blackbox_attrib, 1561 FbAtoms::instance()->getFluxboxAttributesAtom(),
1698 PropBlackboxAttributesElements)); 1562 PropModeReplace,
1563 (unsigned char *)&m_blackbox_attrib,
1564 PropBlackboxAttributesElements
1565 )
1566 );
1699} 1567}
1700 1568
1701/** 1569/**
@@ -1715,7 +1583,7 @@ void FluxboxWindow::setState(unsigned long new_state) {
1715 PropModeReplace, 1583 PropModeReplace,
1716 (unsigned char *)state, 2)); 1584 (unsigned char *)state, 2));
1717 1585
1718 saveBlackboxHints(); 1586 saveBlackboxAttribs();
1719 //notify state changed 1587 //notify state changed
1720 m_statesig.notify(); 1588 m_statesig.notify();
1721} 1589}
@@ -1833,7 +1701,11 @@ void FluxboxWindow::restoreAttributes() {
1833 PropBlackboxAttributesElements, false, 1701 PropBlackboxAttributesElements, false,
1834 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo, 1702 fbatoms->getFluxboxAttributesAtom(), &atom_return, &foo,
1835 &nitems, &ulfoo, (unsigned char **) &net) && 1703 &nitems, &ulfoo, (unsigned char **) &net) &&
1836 net && nitems == (unsigned)PropBlackboxAttributesElements) { 1704 net) {
1705 if (nitems != (unsigned)PropBlackboxAttributesElements) {
1706 XFree(net);
1707 return;
1708 }
1837 m_blackbox_attrib.flags = net->flags; 1709 m_blackbox_attrib.flags = net->flags;
1838 m_blackbox_attrib.attrib = net->attrib; 1710 m_blackbox_attrib.attrib = net->attrib;
1839 m_blackbox_attrib.workspace = net->workspace; 1711 m_blackbox_attrib.workspace = net->workspace;
@@ -2179,7 +2051,7 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
2179 } break; 2051 } break;
2180 2052
2181 case XA_WM_HINTS: 2053 case XA_WM_HINTS:
2182 getWMHints(); 2054 m_client->updateWMHints();
2183 break; 2055 break;
2184 2056
2185 case XA_WM_ICON_NAME: 2057 case XA_WM_ICON_NAME:
@@ -2199,7 +2071,7 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) {
2199 break; 2071 break;
2200 2072
2201 case XA_WM_NORMAL_HINTS: { 2073 case XA_WM_NORMAL_HINTS: {
2202 getWMNormalHints(); 2074 m_client->updateWMNormalHints();
2203 2075
2204 if ((m_client->normal_hint_flags & PMinSize) && 2076 if ((m_client->normal_hint_flags & PMinSize) &&
2205 (m_client->normal_hint_flags & PMaxSize)) { 2077 (m_client->normal_hint_flags & PMaxSize)) {