From 9bc606c9368da6f98e166b58d76d29dc8d7e9a64 Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Tue, 31 Jul 2007 23:20:06 +0000
Subject: use some decorations on applications' torn menus, and fix restart
 without an argument

---
 src/Ewmh.cc            |  7 +++++--
 src/FbTk/XmbFontImp.cc |  4 +++-
 src/main.cc            | 18 ++++++++++--------
 util/fbrun/FbRun.cc    |  8 ++++----
 util/fbrun/fbrun.xpm   |  2 +-
 5 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index 9764998..7e5a50c 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -297,8 +297,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
             } else if (atoms[l] == m_net_wm_window_type_dialog) {
                 // dialog windows should not be tabable
                 win.setTabable(false);
-            } else if (atoms[l] == m_net_wm_window_type_menu ||
-                       atoms[l] == m_net_wm_window_type_toolbar) {
+            } else if (atoms[l] == m_net_wm_window_type_menu) {
                 /*
                  * _NET_WM_WINDOW_TYPE_TOOLBAR and _NET_WM_WINDOW_TYPE_MENU
                  * indicate toolbar and pinnable menu windows, respectively
@@ -306,6 +305,10 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
                  * application). Windows of this type may set the
                  * WM_TRANSIENT_FOR hint indicating the main application window.
                  */
+                win.setDecorationMask(FluxboxWindow::DECOR_TINY);
+                win.setIconHidden(true);
+                win.moveToLayer(Layer::ABOVE_DOCK);
+            } else if (atoms[l] == m_net_wm_window_type_toolbar) {
                 win.setDecorationMask(FluxboxWindow::DECOR_NONE);
                 win.setIconHidden(true);
                 win.moveToLayer(Layer::ABOVE_DOCK);
diff --git a/src/FbTk/XmbFontImp.cc b/src/FbTk/XmbFontImp.cc
index 025f96d..3a45b09 100644
--- a/src/FbTk/XmbFontImp.cc
+++ b/src/FbTk/XmbFontImp.cc
@@ -115,7 +115,9 @@ const char *getFontElement(const char *pattern, char *buf, int bufsiz, ...) {
 XFontSet createFontSet(const char *fontname, bool& utf8mode) {
     Display *display = FbTk::App::instance()->display();
     XFontSet fs;
-    char **missing, *def = "-";
+    char **missing;
+    const char *constdef = "-";
+    char *def = const_cast<char *>(constdef);
     int nmissing;
     string orig_locale = "";
 
diff --git a/src/main.cc b/src/main.cc
index 2d1ff0d..4554123 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -321,14 +321,16 @@ int main(int argc, char **argv) {
     FbTk::FbStringUtil::shutdown();
 
     if (restarting) {
-        const char *shell = getenv("SHELL");
-        if (!shell)
-            shell = "/bin/sh";
-
-        const char *arg = restart_argument.c_str();
-        if (arg) {
-            execlp(shell, shell, "-c", arg, (char *) NULL);
-            perror(arg);
+        if (!restart_argument.empty()) {
+            const char *shell = getenv("SHELL");
+            if (!shell)
+                shell = "/bin/sh";
+
+            const char *arg = restart_argument.c_str();
+            if (arg) {
+                execlp(shell, shell, "-c", arg, (const char *) NULL);
+                perror(arg);
+            }
         }
 
         // fall back in case the above execlp doesn't work
diff --git a/util/fbrun/FbRun.cc b/util/fbrun/FbRun.cc
index 908b3c2..8d449b3 100644
--- a/util/fbrun/FbRun.cc
+++ b/util/fbrun/FbRun.cc
@@ -79,8 +79,8 @@ FbRun::FbRun(int x, int y, size_t width):
     XClassHint *class_hint = XAllocClassHint();
     if (class_hint == 0)
         throw string("Out of memory");
-    class_hint->res_name = "fbrun";
-    class_hint->res_class = "FbRun";
+    class_hint->res_name = const_cast<char *>("fbrun");
+    class_hint->res_class = const_cast<char *>("FbRun");
     XSetClassHint(m_display, window(), class_hint);
 
     XFree(class_hint);
@@ -89,7 +89,7 @@ FbRun::FbRun(int x, int y, size_t width):
     Pixmap pm;
     XpmCreatePixmapFromData(m_display,
                             window(),
-                            fbrun_xpm,
+                            const_cast<char **>(fbrun_xpm),
                             &pm,
                             &mask,
                             0); // attribs
@@ -120,7 +120,7 @@ void FbRun::run(const std::string &command) {
     // fork and execute program
     if (!fork()) {
 
-        char *shell = getenv("SHELL");
+        const char *shell = getenv("SHELL");
         if (!shell)
             shell = "/bin/sh";
 
diff --git a/util/fbrun/fbrun.xpm b/util/fbrun/fbrun.xpm
index 856f214..0ee2c18 100644
--- a/util/fbrun/fbrun.xpm
+++ b/util/fbrun/fbrun.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * fbrun_xpm[] = {
+static const char * fbrun_xpm[] = {
 "32 32 433 2",
 "  	c None",
 ". 	c #000000",
-- 
cgit v0.11.2