aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-24 12:12:45 (GMT)
committermarkt <markt>2007-07-24 12:12:45 (GMT)
commit363764db5b36dbffcc019cec8ffb405d357d7130 (patch)
tree6523b122a926e06abfa9b96f3b31fffe4868495d /src
parent9545871f7a0d44edf400715cd8cdd21d78f36884 (diff)
downloadfluxbox_paul-363764db5b36dbffcc019cec8ffb405d357d7130.zip
fluxbox_paul-363764db5b36dbffcc019cec8ffb405d357d7130.tar.bz2
fix ToggleDecor for fullscreen and decorationless windows, plus some other cleanup
Diffstat (limited to 'src')
-rw-r--r--src/FbCommands.cc2
-rw-r--r--src/FbTk/ImageImlib2.cc4
-rw-r--r--src/FbTk/KeyUtil.cc2
-rw-r--r--src/MenuCreator.cc2
-rw-r--r--src/Window.cc44
-rw-r--r--src/Window.hh1
-rw-r--r--src/fluxbox.cc2
-rw-r--r--src/fluxbox.hh2
-rw-r--r--src/main.cc6
9 files changed, 35 insertions, 30 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 04f266e..2faa267 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -152,7 +152,7 @@ int ExecuteCmd::run() {
152 152
153 // get shell path from the environment 153 // get shell path from the environment
154 // this process exits immediately, so we don't have to worry about memleaks 154 // this process exits immediately, so we don't have to worry about memleaks
155 char *shell = getenv("SHELL"); 155 const char *shell = getenv("SHELL");
156 if (!shell) 156 if (!shell)
157 shell = "/bin/sh"; 157 shell = "/bin/sh";
158 158
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc
index 2d3ff6c..b4ef415 100644
--- a/src/FbTk/ImageImlib2.cc
+++ b/src/FbTk/ImageImlib2.cc
@@ -52,7 +52,7 @@ ImageImlib2::ImageImlib2() {
52 52
53 // TODO: this are the potential candidates, 53 // TODO: this are the potential candidates,
54 // choose only sane ones. open for discussion 54 // choose only sane ones. open for discussion
55 static char* format_list[] = { 55 static const char* format_list[] = {
56 "PNG", // pngloader 56 "PNG", // pngloader
57 "JPEG", "JPG", "JFI", "JFIF", // jpegloader 57 "JPEG", "JPG", "JFI", "JFIF", // jpegloader
58// "TIFF", "TIF", // tiffloader 58// "TIFF", "TIF", // tiffloader
@@ -67,7 +67,7 @@ ImageImlib2::ImageImlib2() {
67 NULL 67 NULL
68 }; 68 };
69 69
70 char** format = NULL; 70 const char** format = NULL;
71 for(format = format_list; *format != NULL; format++) { 71 for(format = format_list; *format != NULL; format++) {
72 Image::registerType(*format, *this); 72 Image::registerType(*format, *this);
73 } 73 }
diff --git a/src/FbTk/KeyUtil.cc b/src/FbTk/KeyUtil.cc
index 1830dca..a6ca632 100644
--- a/src/FbTk/KeyUtil.cc
+++ b/src/FbTk/KeyUtil.cc
@@ -34,7 +34,7 @@
34namespace { 34namespace {
35 35
36struct t_modlist{ 36struct t_modlist{
37 char *str; 37 const char *str;
38 unsigned int mask; 38 unsigned int mask;
39 bool operator == (const char *modstr) const { 39 bool operator == (const char *modstr) const {
40 return (strcasecmp(str, modstr) == 0 && mask !=0); 40 return (strcasecmp(str, modstr) == 0 && mask !=0);
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 1aa8877..ef97b63 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -524,7 +524,7 @@ FbTk::Menu *MenuCreator::createMenuType(const string &type, int screen_num) {
524 menu->disableTitle(); // not titlebar 524 menu->disableTitle(); // not titlebar
525 if (screen->windowMenuFilename().empty() || 525 if (screen->windowMenuFilename().empty() ||
526 ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) { 526 ! createWindowMenuFromFile(screen->windowMenuFilename(), *menu, true)) {
527 char *default_menu[] = { 527 const char *default_menu[] = {
528 "shade", 528 "shade",
529 "stick", 529 "stick",
530 "maximize", 530 "maximize",
diff --git a/src/Window.cc b/src/Window.cc
index d8a3f46..a6f3194 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -262,7 +262,6 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
262 m_last_resize_h(1), m_last_resize_w(1), 262 m_last_resize_h(1), m_last_resize_w(1),
263 m_workspace_number(0), 263 m_workspace_number(0),
264 m_current_state(0), 264 m_current_state(0),
265 m_old_decoration(DECOR_NORMAL),
266 m_old_decoration_mask(0), 265 m_old_decoration_mask(0),
267 m_client(&client), 266 m_client(&client),
268 m_toggled_decos(false), 267 m_toggled_decos(false),
@@ -1243,8 +1242,7 @@ void FluxboxWindow::updateBlackboxHintsFromClient(const WinClient &client) {
1243 m_workspace_number = hint->stack; 1242 m_workspace_number = hint->stack;
1244 1243
1245 if (hint->flags & ATTRIB_DECORATION) { 1244 if (hint->flags & ATTRIB_DECORATION) {
1246 m_old_decoration = static_cast<Decoration>(hint->decoration); 1245 setDecoration(static_cast<Decoration>(hint->decoration), false);
1247 setDecoration(m_old_decoration, false);
1248 } 1246 }
1249} 1247}
1250 1248
@@ -1577,8 +1575,10 @@ void FluxboxWindow::setFullscreen(bool flag) {
1577 1575
1578 frame().setUseShape(false); 1576 frame().setUseShape(false);
1579 1577
1580 m_old_decoration_mask = decorationMask(); 1578 if (!m_toggled_decos)
1581 m_old_layernum =layerNum(); 1579 m_old_decoration_mask = decorationMask();
1580
1581 m_old_layernum = layerNum();
1582 m_old_pos_x = frame().x(); 1582 m_old_pos_x = frame().x();
1583 m_old_pos_y = frame().y(); 1583 m_old_pos_y = frame().y();
1584 m_old_width = frame().width(); 1584 m_old_width = frame().width();
@@ -1609,8 +1609,14 @@ void FluxboxWindow::setFullscreen(bool flag) {
1609 1609
1610 fullscreen = false; 1610 fullscreen = false;
1611 1611
1612 setDecorationMask(m_old_decoration_mask);
1613 frame().setUseShape(!m_shaped); 1612 frame().setUseShape(!m_shaped);
1613 if (m_toggled_decos) {
1614 if (m_old_decoration_mask & DECORM_TITLEBAR)
1615 setDecoration(DECOR_NONE);
1616 else
1617 setDecoration(DECOR_NORMAL);
1618 } else
1619 setDecorationMask(m_old_decoration_mask);
1614 1620
1615 // ensure we apply the sizehints here, otherwise some 1621 // ensure we apply the sizehints here, otherwise some
1616 // apps (eg xterm) end up a little bit .. crappy (visually) 1622 // apps (eg xterm) end up a little bit .. crappy (visually)
@@ -1624,7 +1630,6 @@ void FluxboxWindow::setFullscreen(bool flag) {
1624 moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h); 1630 moveResize(m_last_resize_x, m_last_resize_y, m_last_resize_w, m_last_resize_h);
1625 moveToLayer(m_old_layernum); 1631 moveToLayer(m_old_layernum);
1626 1632
1627 m_old_decoration_mask = 0;
1628 m_old_layernum = ::Layer::NORMAL; 1633 m_old_layernum = ::Layer::NORMAL;
1629 1634
1630 stateSig().notify(); 1635 stateSig().notify();
@@ -3205,22 +3210,20 @@ void FluxboxWindow::applyDecorations(bool initial) {
3205 3210
3206void FluxboxWindow::toggleDecoration() { 3211void FluxboxWindow::toggleDecoration() {
3207 //don't toggle decor if the window is shaded 3212 //don't toggle decor if the window is shaded
3208 if (isShaded()) 3213 if (isShaded() || isFullscreen())
3209 return; 3214 return;
3210 3215
3211 m_toggled_decos= true; 3216 m_toggled_decos = !m_toggled_decos;
3212 3217
3213 if (decorations.enabled) { //remove decorations 3218 if (m_toggled_decos) {
3214 decorations.enabled = false; 3219 m_old_decoration_mask = decorationMask();
3215 setDecoration(DECOR_NONE); 3220 if (decorations.titlebar)
3216 } else { //revert back to old decoration 3221 setDecoration(DECOR_NONE);
3217 decorations.enabled = true; 3222 else
3218 if (m_old_decoration == DECOR_NONE) { // make sure something happens
3219 setDecoration(DECOR_NORMAL); 3223 setDecoration(DECOR_NORMAL);
3220 } else { 3224 } else
3221 setDecoration(m_old_decoration); 3225 setDecorationMask(m_old_decoration_mask);
3222 } 3226
3223 }
3224} 3227}
3225 3228
3226unsigned int FluxboxWindow::decorationMask() const { 3229unsigned int FluxboxWindow::decorationMask() const {
@@ -3866,8 +3869,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) {
3866 } 3869 }
3867 3870
3868 if (net.flags & ATTRIB_DECORATION) { 3871 if (net.flags & ATTRIB_DECORATION) {
3869 m_old_decoration = static_cast<Decoration>(net.decoration); 3872 setDecoration(static_cast<Decoration>(net.decoration));
3870 setDecoration(m_old_decoration);
3871 } 3873 }
3872 3874
3873} 3875}
diff --git a/src/Window.hh b/src/Window.hh
index 340df7b..15de2bb 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -538,7 +538,6 @@ private:
538 unsigned int m_workspace_number; 538 unsigned int m_workspace_number;
539 unsigned long m_current_state; // NormalState | IconicState | Withdrawn 539 unsigned long m_current_state; // NormalState | IconicState | Withdrawn
540 540
541 Decoration m_old_decoration;
542 unsigned int m_old_decoration_mask; 541 unsigned int m_old_decoration_mask;
543 542
544 ClientList m_clientlist; 543 ClientList m_clientlist;
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 7745a89..d739944 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -1448,7 +1448,7 @@ string Fluxbox::getRcFilename() {
1448} 1448}
1449 1449
1450/// Provides default filename of data file 1450/// Provides default filename of data file
1451void Fluxbox::getDefaultDataFilename(char *name, string &filename) { 1451void Fluxbox::getDefaultDataFilename(const char *name, string &filename) {
1452 filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name); 1452 filename = string(getenv("HOME") + string("/.") + m_RC_PATH + string("/") + name);
1453} 1453}
1454 1454
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 51ecc06..0418901 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -196,7 +196,7 @@ public:
196 bool menuTimestampsChanged() const; 196 bool menuTimestampsChanged() const;
197 bool haveShape() const { return m_have_shape; } 197 bool haveShape() const { return m_have_shape; }
198 int shapeEventbase() const { return m_shape_eventbase; } 198 int shapeEventbase() const { return m_shape_eventbase; }
199 void getDefaultDataFilename(char *name, std::string &); 199 void getDefaultDataFilename(const char *name, std::string &);
200 // screen mouse was in at last key event 200 // screen mouse was in at last key event
201 BScreen *mouseScreen() { return m_mousescreen; } 201 BScreen *mouseScreen() { return m_mousescreen; }
202 // screen of window that last key event (i.e. focused window) went to 202 // screen of window that last key event (i.e. focused window) went to
diff --git a/src/main.cc b/src/main.cc
index 643c6a4..2d1ff0d 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -321,9 +321,13 @@ int main(int argc, char **argv) {
321 FbTk::FbStringUtil::shutdown(); 321 FbTk::FbStringUtil::shutdown();
322 322
323 if (restarting) { 323 if (restarting) {
324 const char *shell = getenv("SHELL");
325 if (!shell)
326 shell = "/bin/sh";
327
324 const char *arg = restart_argument.c_str(); 328 const char *arg = restart_argument.c_str();
325 if (arg) { 329 if (arg) {
326 execlp(arg, arg, (char *) NULL); 330 execlp(shell, shell, "-c", arg, (char *) NULL);
327 perror(arg); 331 perror(arg);
328 } 332 }
329 333