2017-03-28 06:23 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004213ncmpcppDefaultpublic2015-05-09 17:29
Reporterbrezerk 
Assigned TounK 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformLinuxOSGentooOS Version unstable
Product Version0.6.x 
Target VersionFixed in Version0.7.x 
Summary0004213: Whether the initial focus should be on the locked or the slave screen should be configurable.
DescriptionPatch will add new configuration option:

startup_slave_screen_keep_focus = yes/no

If set to yes, initial focus lock will stay on slave screen. Otherwise focus lock will be set on startup screen.
TagsNo tags attached.
Attached Files
  • patch file icon startup_slave_screen_focus_lock.patch (3,385 bytes) 2014-11-13 13:36 -
    From fcf72ce238a22645d534e3cbd2a71f135ff0b52a Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Thu, 13 Nov 2014 14:31:35 +0200
    Subject: [PATCH] Whether the initial focus should be on the locked or the
     slave screen should be configurable.
    
    ---
     NEWS             | 4 ++++
     doc/config       | 6 ++++++
     doc/ncmpcpp.1    | 3 +++
     src/ncmpcpp.cpp  | 8 ++++++++
     src/settings.cpp | 3 +++
     src/settings.h   | 1 +
     6 files changed, 25 insertions(+)
    
    diff --git a/NEWS b/NEWS
    index a677acc..74ecc24 100644
    --- a/NEWS
    +++ b/NEWS
    @@ -1,3 +1,7 @@
    +ncmpcpp-0.7.1 (????-??-??)
    +
    +* Whether the initial focus should be on the locked or the slave screen should be configurable.
    +
     ncmpcpp-0.7 (????-??-??)
     
     * Visualizer has now support for multiple colors (visualizer_color configuration variable takes the list of colors to be used).
    diff --git a/doc/config b/doc/config
    index 1a7d407..9592994 100644
    --- a/doc/config
    +++ b/doc/config
    @@ -407,6 +407,12 @@
     #startup_slave_screen = ""
     #
     ##
    +## If set to yes, initial focus lock will stay on slave screen.
    +## Otherwise focus lock will be set on startup screen.
    +##
    +#startup_slave_screen_keep_focus = yes
    +#
    +##
     ## Default width of locked screen (in %).
     ## Acceptable values are from 20 to 80.
     ##
    diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1
    index 2884e6d..ce4e79d 100644
    --- a/doc/ncmpcpp.1
    +++ b/doc/ncmpcpp.1
    @@ -271,6 +271,9 @@ Screen that has to be displayed at start (playlist by default).
     .B startup_slave_screen = SCREEN_NAME
     Slave screen that has to be displayed at start (nothing by default).
     .TP 
    +.B startup_slave_screen_keep_focus = yes/no
    +If set to yes, initial focus lock will stay on slave screen. Otherwise focus lock will be set on startup screen.
    +.TP 
     .B locked_screen_width_part = 20-80
     If you want to lock a screen, ncmpcpp asks for % of locked screen's width to be reserved before that and provides a default value, which is the one you can set here.
     .TP 
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index 862bf5f..12f17ef 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -142,7 +142,15 @@ int main(int argc, char **argv)
     		bool screen_locked = myScreen->lock();
     		if (screen_locked && slave_screen != myScreen->type())
     			toScreen(slave_screen)->switchTo();
    +
    +		// go to startup screen
    +		if (!Config.startup_slave_screen_keep_focus)
    +		{
    +			Actions::get(Actions::Type::MasterScreen).execute();
    +			toScreen(slave_screen)->refreshWindow();
    +		}
     	}
    +
     	
     	// local variables
     	bool key_pressed = false;
    diff --git a/src/settings.cpp b/src/settings.cpp
    index 3b65b9a..c70334b 100644
    --- a/src/settings.cpp
    +++ b/src/settings.cpp
    @@ -526,6 +526,9 @@ bool Configuration::read(const std::string &config_path)
     		}
     	}, defaults_to(startup_slave_screen_type, boost::none)
     	));
    +	p.add("startup_slave_screen_keep_focus", yes_no(
    +		startup_slave_screen_keep_focus, true
    +	));
     	p.add("locked_screen_width_part", assign_default<double>(
     		locked_screen_width_part, 50.0, [](double v) {
     			return v / 100;
    diff --git a/src/settings.h b/src/settings.h
    index 65b3a04..8da4086 100644
    --- a/src/settings.h
    +++ b/src/settings.h
    @@ -164,6 +164,7 @@ struct Configuration
     	bool ask_for_locked_screen_width_part;
     	bool allow_for_physical_item_deletion;
     	bool progressbar_boldness;
    +	bool startup_slave_screen_keep_focus;
     
     	unsigned mpd_connection_timeout;
     	unsigned crossfade_time;
    -- 
    2.1.3
    
    
    patch file icon startup_slave_screen_focus_lock.patch (3,385 bytes) 2014-11-13 13:36 +

-Relationships
+Relationships

-Notes

~0009506

unK (administrator)

The patch didn't apply cleanly, so I reworked it on top of the current master. Also, focus now stays on master by default.
+Notes

-Issue History
Date Modified Username Field Change
2014-11-13 13:36 brezerk New Issue
2014-11-13 13:36 brezerk Status new => assigned
2014-11-13 13:36 brezerk Assigned To => unK
2014-11-13 13:36 brezerk File Added: startup_slave_screen_focus_lock.patch
2015-05-09 17:29 unK Note Added: 0009506
2015-05-09 17:29 unK Status assigned => resolved
2015-05-09 17:29 unK Fixed in Version => 0.7.x
2015-05-09 17:29 unK Resolution open => fixed
+Issue History