Ticket #6901: 6901.patch

File 6901.patch, 5.2 KB (added by puckipedia, 7 years ago)
  • src/apps/pulse/Common.h

    From a11c662b4f2e1a36dd30bafda72e24977bbe7d46 Mon Sep 17 00:00:00 2001
    From: Puck Meerburg <puck@puckipedia.nl>
    Date: Mon, 30 Dec 2013 23:16:37 +0000
    Subject: [PATCH] Pulse: Fix #6901
    
    ---
     src/apps/pulse/Common.h             |  2 ++
     src/apps/pulse/DeskbarPulseView.cpp |  8 ++++++++
     src/apps/pulse/Prefs.cpp            | 16 +++++++++++++++-
     src/apps/pulse/Prefs.h              |  5 +++--
     src/apps/pulse/PrefsWindow.cpp      |  3 +++
     src/apps/pulse/PulseWindow.cpp      |  9 +++++++++
     6 files changed, 40 insertions(+), 3 deletions(-)
    
    diff --git a/src/apps/pulse/Common.h b/src/apps/pulse/Common.h
    index b21284c..df08285 100644
    a b enum {  
    6363#define DEFAULT_DESKBAR_ACTIVE_COLOR    0x20c02000
    6464#define DEFAULT_DESKBAR_IDLE_COLOR      0x20402000
    6565#define DEFAULT_DESKBAR_FRAME_COLOR     0x20202000
     66#define DEFAULT_PREFS_FOCUSED_TAB       0
    6667#define DEFAULT_NORMAL_FADE_COLORS      true
     68#define DEFAULT_OPEN_PREFWINDOW         false
    6769#define DEFAULT_DESKBAR_ICON_WIDTH      9
    6870
    6971#endif
  • src/apps/pulse/DeskbarPulseView.cpp

    diff --git a/src/apps/pulse/DeskbarPulseView.cpp b/src/apps/pulse/DeskbarPulseView.cpp
    index 959c49d..2fb1ac0 100644
    a b void DeskbarPulseView::AttachedToWindow() {  
    8585    // the current pulse rate and affecting other replicants
    8686    messagerunner = new BMessageRunner(messenger, new BMessage(PV_REPLICANT_PULSE),
    8787        200000, -1);
     88    if (prefs->open_prefwindow) {
     89        BMessenger(this).SendMessage(PV_PREFERENCES);
     90    }
    8891}
    8992
    9093void DeskbarPulseView::MouseDown(BPoint point) {
    void DeskbarPulseView::Remove() {  
    191194void DeskbarPulseView::SetMode(bool normal) {
    192195    if (normal) prefs->window_mode = NORMAL_WINDOW_MODE;
    193196    else prefs->window_mode = MINI_WINDOW_MODE;
     197    if (prefswindow == NULL || prefswindow->IsHidden()
     198        || prefswindow->IsMinimized())
     199        prefs->open_prefwindow = false;
     200    else
     201        prefs->open_prefwindow = true;
    194202    prefs->Save();
    195203    be_roster->Launch(APP_SIGNATURE);
    196204}
  • src/apps/pulse/Prefs.cpp

    diff --git a/src/apps/pulse/Prefs.cpp b/src/apps/pulse/Prefs.cpp
    index 0e00d89..f283acd 100644
    a b Prefs::Prefs()  
    109109        return;
    110110    }
    111111
     112    i = DEFAULT_PREFS_FOCUSED_TAB;
     113    if (!GetInt("prefs_focused_tab", &prefs_focused_tab, &i)) {
     114        fFatalError = true;
     115        return;
     116    }
     117
    112118    bool b = DEFAULT_NORMAL_FADE_COLORS;
    113119    if (!GetBool("normal_fade_colors", &normal_fade_colors, &b)) {
    114120        fFatalError = true;
    115121        return;
    116122    }
    117123
     124    b = DEFAULT_OPEN_PREFWINDOW;
     125    if (!GetBool("open_prefwindow", &open_prefwindow, &b)) {
     126        fFatalError = true;
     127        return;
     128    }
     129
    118130    // Use the default size unless it would prevent having at least
    119131    // a one pixel wide display per CPU... this will only happen with > quad
    120132    i = DEFAULT_DESKBAR_ICON_WIDTH;
    Prefs::Save()  
    293305        || !PutInt("deskbar_idle_color", &deskbar_idle_color)
    294306        || !PutInt("deskbar_frame_color", &deskbar_frame_color)
    295307        || !PutBool("normal_fade_colors", &normal_fade_colors)
    296         || !PutInt("deskbar_icon_width", &deskbar_icon_width))
     308        || !PutInt("prefs_focused_tab", &prefs_focused_tab)
     309        || !PutInt("deskbar_icon_width", &deskbar_icon_width)
     310        || !PutBool("open_prefwindow", &open_prefwindow))
    297311        return false;
    298312
    299313    return true;
  • src/apps/pulse/Prefs.h

    diff --git a/src/apps/pulse/Prefs.h b/src/apps/pulse/Prefs.h
    index 98296af..fbb399e 100644
    a b class Prefs {  
    2323        int window_mode, deskbar_icon_width;
    2424        BRect normal_window_rect, mini_window_rect, prefs_window_rect;
    2525        int normal_bar_color, mini_active_color, mini_idle_color, mini_frame_color,
    26             deskbar_active_color, deskbar_idle_color, deskbar_frame_color;
    27         bool normal_fade_colors;
     26            deskbar_active_color, deskbar_idle_color, deskbar_frame_color,
     27            prefs_focused_tab;
     28        bool normal_fade_colors, open_prefwindow;
    2829
    2930    private:
    3031        BFile *fFile;
  • src/apps/pulse/PrefsWindow.cpp

    diff --git a/src/apps/pulse/PrefsWindow.cpp b/src/apps/pulse/PrefsWindow.cpp
    index 85d7424..7b28514 100644
    a b PrefsWindow::PrefsWindow(BRect frame, const char *name,  
    9090    fTabView->SetResizingMode(B_FOLLOW_NONE);
    9191    ResizeTo(fTabView->Frame().Width(), fTabView->Frame().bottom + 16.0f
    9292        + okButton->Bounds().Height());
     93
     94    fTabView->Select(fPrefs->prefs_focused_tab);
    9395}
    9496
    9597
    9698PrefsWindow::~PrefsWindow()
    9799{
    98100    fPrefs->prefs_window_rect = Frame();
     101    fPrefs->prefs_focused_tab = fTabView->Selection();
    99102    fPrefs->Save();
    100103}
    101104
  • src/apps/pulse/PulseWindow.cpp

    diff --git a/src/apps/pulse/PulseWindow.cpp b/src/apps/pulse/PulseWindow.cpp
    index 10e71b6..025291c 100644
    a b PulseWindow::PulseWindow(BRect rect)  
    5555        fMiniPulseView->Hide();
    5656
    5757    fPrefsWindow = NULL;
     58    if (pulseapp->prefs->open_prefwindow) {
     59        BMessenger(this).SendMessage(PV_PREFERENCES);
     60    }
    5861}
    5962
    6063
    PulseWindow::SetMode(int newmode)  
    200203bool
    201204PulseWindow::QuitRequested()
    202205{
     206    PulseApp* app = (PulseApp*)be_app;
     207    if (fPrefsWindow == NULL || fPrefsWindow->IsHidden()
     208        || fPrefsWindow->IsMinimized())
     209        app->prefs->open_prefwindow = false;
     210    else
     211        app->prefs->open_prefwindow = true;
    203212    be_app->PostMessage(B_QUIT_REQUESTED);
    204213    return true;
    205214}