summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-13 11:47:13 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-13 11:47:28 +0100
commitdfc0e4c663922b462f9a75833a594561e7dc4efa (patch)
tree1b811cf6d5ea9877a21ab8425797d1274b91cefd /src
parent194b63c424cf280dee3c53099affdb11ade6ce3c (diff)
downloadpluggit-dfc0e4c663922b462f9a75833a594561e7dc4efa.tar.gz
pluggit-dfc0e4c663922b462f9a75833a594561e7dc4efa.tar.bz2
pluggit-dfc0e4c663922b462f9a75833a594561e7dc4efa.zip
SourceX11: Implement window picking by ID
Diffstat (limited to 'src')
-rw-r--r--src/Main.cxx7
-rw-r--r--src/SourceX11.cxx10
2 files changed, 15 insertions, 2 deletions
diff --git a/src/Main.cxx b/src/Main.cxx
index 2bb4511..b4bf99a 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -17,6 +17,7 @@ class Main extends View, Runnable
public DFBSurfacePixelFormat m_format;
public std::string m_title;
public bool m_interactive;
+ public long m_window;
public bool m_always_all;
public long m_interval_all;
public long m_interval_hot;
@@ -25,6 +26,7 @@ class Main extends View, Runnable
public Config() :
m_format(DSPF_UNKNOWN),
m_interactive(false),
+ m_window(0),
m_always_all(false),
m_interval_all(400),
m_interval_hot(100),
@@ -76,6 +78,7 @@ class Main extends View, Runnable
m_options.addOption( new Options::OptionFormat ( "-f", "--format", "<pixelformat>", "Pixel format of view", m_config.m_format ) );
m_options.addOption( new Options::OptionString ( "-t", "--title", "<string>", "Title of window to show", m_config.m_title ) );
m_options.addOption( new Options::OptionBool ( "-i", "--interactive", "", "Use interactive window picking", m_config.m_interactive ) );
+ m_options.addOption( new Options::OptionLong ( "-w", "--window", "", "Pick window by id", m_config.m_window ) );
m_options.addOption( new Options::OptionBool ( "-a", "--all", "", "Always all", m_config.m_always_all ) );
m_options.addOption( new Options::OptionLong ( "-A", "--inter-all", "<ms>", "Interval all", m_config.m_interval_all ) );
m_options.addOption( new Options::OptionLong ( "-H", "--inter-hot", "<ms>", "Interval hot", m_config.m_interval_hot ) );
@@ -111,7 +114,9 @@ class Main extends View, Runnable
SourceX11::Config::WINDOW_SELECTION_INTERACTIVE :
(m_config.m_title.size() > 0 ?
SourceX11::Config::WINDOW_SELECTION_TITLE :
- SourceX11::Config::WINDOW_SELECTION_NONE), m_config.m_title );
+ (m_config.m_window != 0 ?
+ SourceX11::Config::WINDOW_SELECTION_ID :
+ SourceX11::Config::WINDOW_SELECTION_NONE)), m_config.m_title, m_config.m_window );
m_source = new SourceX11( this, config );
#endif
diff --git a/src/SourceX11.cxx b/src/SourceX11.cxx
index eaa347d..dc60e4b 100644
--- a/src/SourceX11.cxx
+++ b/src/SourceX11.cxx
@@ -43,16 +43,19 @@ class SourceX11 extends Source, Runnable
public typedef enum {
WINDOW_SELECTION_NONE,
WINDOW_SELECTION_TITLE,
+ WINDOW_SELECTION_ID,
WINDOW_SELECTION_INTERACTIVE
} WindowSelection;
private WindowSelection m_selection;
private std::string m_title;
+ private long m_window;
- public Config( WindowSelection selection, const std::string &title = std::string() ) {
+ public Config( WindowSelection selection, const std::string &title = std::string(), long window = 0) {
m_selection = selection;
m_title = title;
+ m_window = window;
}
};
@@ -76,6 +79,11 @@ class SourceX11 extends Source, Runnable
m_window = m_root;
break;
+ case Config::WINDOW_SELECTION_ID:
+ m_window = (Window)config.m_window;
+ if (m_window == None)
+ throw new Exception( "Invalid Window id: %ld\n", config.m_window );
+ break;
case Config::WINDOW_SELECTION_TITLE:
m_window = findWindow( config.m_title );
if (m_window == None)