Browse Source

Launcher: Remove the Launcher app, and all hacks in support of it

The Launcher's functionality has been replaced by the app shortcuts in
the system menu.

There were various window management hacks to ensure that the launcher
stayed below all other windows while also being movable, etc.
Andreas Kling 5 years ago
parent
commit
dd2900eda0

+ 0 - 8
Applications/Launcher/Makefile

@@ -1,8 +0,0 @@
-include ../../Makefile.common
-
-OBJS = \
-    main.o
-
-APP = Launcher
-
-include ../Makefile.common

+ 0 - 94
Applications/Launcher/main.cpp

@@ -1,94 +0,0 @@
-#include <LibCore/CConfigFile.h>
-#include <LibCore/CUserInfo.h>
-#include <LibGUI/GApplication.h>
-#include <LibGUI/GBoxLayout.h>
-#include <LibGUI/GButton.h>
-#include <LibGUI/GWidget.h>
-#include <LibGUI/GWindow.h>
-#include <LibDraw/GraphicsBitmap.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-static RefPtr<GWindow> make_launcher_window();
-
-void handle_sigchld(int)
-{
-    dbgprintf("Launcher(%d) Got SIGCHLD\n", getpid());
-    int pid = waitpid(-1, nullptr, 0);
-    dbgprintf("Launcher(%d) waitpid() returned %d\n", getpid(), pid);
-    ASSERT(pid > 0);
-}
-
-int main(int argc, char** argv)
-{
-    if (chdir(get_current_user_home_path().characters()) < 0)
-        perror("chdir");
-
-    GApplication app(argc, argv);
-
-    signal(SIGCHLD, handle_sigchld);
-
-    auto launcher_window = make_launcher_window();
-    launcher_window->show();
-
-    return app.exec();
-}
-
-class LauncherButton final : public GButton {
-public:
-    LauncherButton(const String& name, const String& icon_path, const String& exec_path, GWidget* parent)
-        : GButton(parent)
-        , m_executable_path(exec_path)
-    {
-        set_tooltip(name);
-        set_button_style(ButtonStyle::CoolBar);
-        set_icon(GraphicsBitmap::load_from_file(icon_path));
-        set_preferred_size(50, 50);
-        set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
-        on_click = [this](GButton&) {
-            pid_t child_pid = fork();
-            if (!child_pid) {
-                int rc = execl(m_executable_path.characters(), m_executable_path.characters(), nullptr);
-                if (rc < 0)
-                    perror("execl");
-            }
-        };
-    }
-    virtual ~LauncherButton() {}
-
-private:
-    String m_executable_path;
-};
-
-RefPtr<GWindow> make_launcher_window()
-{
-    auto config = CConfigFile::get_for_app("Launcher");
-    auto vertical = config->read_bool_entry("Launcher", "Vertical", true);
-
-    auto window = GWindow::construct();
-    window->set_title("Launcher");
-    int launcher_size = (config->groups().size() - 1) * 50;
-    window->set_rect(50, 50, vertical ? 50 : launcher_size, vertical ? launcher_size : 50);
-    window->set_show_titlebar(false);
-    window->set_window_type(GWindowType::Launcher);
-
-    auto widget = GWidget::construct();
-    widget->set_fill_with_background_color(true);
-    widget->set_layout(make<GBoxLayout>(vertical ? Orientation::Vertical : Orientation::Horizontal));
-    widget->layout()->set_spacing(0);
-    widget->layout()->set_margins({ 5, 0, 5, 0 });
-    window->set_main_widget(widget);
-
-    for (auto& group : config->groups()) {
-        if (group != "Launcher")
-            new LauncherButton(config->read_entry(group, "Name", group),
-                config->read_entry(group, "Icon", ""),
-                config->read_entry(group, "Path", ""),
-                widget);
-    }
-
-    return window;
-}

+ 0 - 46
Base/home/anon/Launcher.ini

@@ -1,46 +0,0 @@
-[Launcher]
-Vertical=1
-
-[Terminal]
-Path=/bin/Terminal
-Icon=/res/icons/32x32/app-terminal.png
-
-[TextEditor]
-Path=/bin/TextEditor
-Icon=/res/icons/32x32/app-texteditor.png
-
-[VisualBuilder]
-Path=/bin/VisualBuilder
-Icon=/res/icons/32x32/app-visual-builder.png
-
-[IRCClient]
-Path=/bin/IRCClient
-Icon=/res/icons/32x32/app-irc-client.png
-
-[FileManager]
-Path=/bin/FileManager
-Icon=/res/icons/32x32/filetype-folder.png
-
-[Minesweeper]
-Path=/bin/Minesweeper
-Icon=/res/icons/32x32/app-minesweeper.png
-
-[Snake]
-Path=/bin/Snake
-Icon=/res/icons/32x32/app-snake.png
-
-[SystemMonitor]
-Path=/bin/SystemMonitor
-Icon=/res/icons/32x32/app-system-monitor.png
-
-[PaintBrush]
-Path=/bin/PaintBrush
-Icon=/res/icons/32x32/app-paintbrush.png
-
-[Piano]
-Path=/bin/Piano
-Icon=/res/icons/32x32/app-piano.png
-
-[ChanViewer]
-Path=/bin/ChanViewer
-Icon=/res/icons/32x32/app-chanviewer.png

+ 0 - 1
Kernel/build-root-filesystem.sh

@@ -76,7 +76,6 @@ cp ../Applications/Downloader/Downloader mnt/bin/Downloader
 cp ../Applications/FileManager/FileManager mnt/bin/FileManager
 cp ../Applications/FontEditor/FontEditor mnt/bin/FontEditor
 cp ../Applications/IRCClient/IRCClient mnt/bin/IRCClient
-cp ../Applications/Launcher/Launcher mnt/bin/Launcher
 cp ../Applications/SystemMonitor/SystemMonitor mnt/bin/SystemMonitor
 cp ../Applications/Taskbar/Taskbar mnt/bin/Taskbar
 cp ../Applications/Terminal/Terminal mnt/bin/Terminal

+ 0 - 1
Kernel/makeall.sh

@@ -48,7 +48,6 @@ build_targets="$build_targets ../Applications/Downloader"
 build_targets="$build_targets ../Applications/FileManager"
 build_targets="$build_targets ../Applications/FontEditor"
 build_targets="$build_targets ../Applications/IRCClient"
-build_targets="$build_targets ../Applications/Launcher"
 build_targets="$build_targets ../Applications/PaintBrush"
 build_targets="$build_targets ../Applications/Piano"
 build_targets="$build_targets ../Applications/QuickShow"

+ 0 - 1
Libraries/LibGUI/GWindowType.h

@@ -9,5 +9,4 @@ enum class GWindowType {
     Taskbar,
     Tooltip,
     Menubar,
-    Launcher,
 };

+ 0 - 1
Servers/WindowServer/WSAPITypes.h

@@ -28,7 +28,6 @@ enum WSAPI_WindowType {
     Taskbar,
     Tooltip,
     Menubar,
-    Launcher,
 };
 
 struct WSAPI_WindowBackingStoreInfo {

+ 0 - 3
Servers/WindowServer/WSClientConnection.cpp

@@ -215,9 +215,6 @@ bool WSClientConnection::handle_message(const WSAPI_ClientMessage& message, cons
         case WSAPI_WindowType::Menubar:
             ws_window_type = WSWindowType::Menubar;
             break;
-        case WSAPI_WindowType::Launcher:
-            ws_window_type = WSWindowType::Launcher;
-            break;
         case WSAPI_WindowType::Invalid:
         default:
             dbgprintf("Unknown WSAPI_WindowType: %d\n", message.window.type);

+ 0 - 2
Servers/WindowServer/WSWindow.cpp

@@ -140,8 +140,6 @@ static WSAPI_WindowType to_api(WSWindowType ws_type)
         return WSAPI_WindowType::Tooltip;
     case WSWindowType::Menubar:
         return WSAPI_WindowType::Menubar;
-    case WSWindowType::Launcher:
-        return WSAPI_WindowType::Launcher;
     default:
         ASSERT_NOT_REACHED();
     }

+ 1 - 1
Servers/WindowServer/WSWindow.h

@@ -45,7 +45,7 @@ public:
 
     bool is_movable() const
     {
-        return m_type == WSWindowType::Normal || m_type == WSWindowType::Launcher;
+        return m_type == WSWindowType::Normal;
     }
 
     WSWindowFrame& frame() { return m_frame; }

+ 1 - 5
Servers/WindowServer/WSWindowManager.h

@@ -299,8 +299,6 @@ IterationDecision WSWindowManager::for_each_visible_window_of_type_from_back_to_
 template<typename Callback>
 IterationDecision WSWindowManager::for_each_visible_window_from_back_to_front(Callback callback)
 {
-    if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Launcher, callback) == IterationDecision::Break)
-        return IterationDecision::Break;
     if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Normal, callback) == IterationDecision::Break)
         return IterationDecision::Break;
     if (for_each_visible_window_of_type_from_back_to_front(WSWindowType::Taskbar, callback) == IterationDecision::Break)
@@ -350,9 +348,7 @@ IterationDecision WSWindowManager::for_each_visible_window_from_front_to_back(Ca
         return IterationDecision::Break;
     if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Tooltip, callback) == IterationDecision::Break)
         return IterationDecision::Break;
-    if (for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, callback) == IterationDecision::Break)
-        return IterationDecision::Break;
-    return for_each_visible_window_of_type_from_front_to_back(WSWindowType::Launcher, callback);
+    return for_each_visible_window_of_type_from_front_to_back(WSWindowType::Normal, callback);
 }
 
 template<typename Callback>

+ 0 - 1
Servers/WindowServer/WSWindowType.h

@@ -9,5 +9,4 @@ enum class WSWindowType {
     Taskbar,
     Tooltip,
     Menubar,
-    Launcher,
 };