summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-05 07:05:21 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-05 07:05:21 (GMT)
commit24bea22035e79c17fa6b6fdcd60f88e4eac467d8 (patch)
treee0cae9682c279558cbaa106d0572118ee76652db /src
parent9d71ad9c1477875001ecd19eb4cbbe1c4ba4eb40 (diff)
downloadfluxbox_lack-24bea22035e79c17fa6b6fdcd60f88e4eac467d8.zip
fluxbox_lack-24bea22035e79c17fa6b6fdcd60f88e4eac467d8.tar.bz2
add SetLayer key command
Diffstat (limited to 'src')
-rw-r--r--src/CurrentWindowCmd.cc13
-rw-r--r--src/CurrentWindowCmd.hh11
-rw-r--r--src/Layer.hh2
-rw-r--r--src/Remember.cc20
4 files changed, 27 insertions, 19 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 4c027d9..42ee69c 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -23,6 +23,7 @@
23#include "CurrentWindowCmd.hh" 23#include "CurrentWindowCmd.hh"
24 24
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "Layer.hh"
26#include "Window.hh" 27#include "Window.hh"
27#include "WindowCmd.hh" 28#include "WindowCmd.hh"
28#include "Screen.hh" 29#include "Screen.hh"
@@ -479,6 +480,18 @@ void FullscreenCmd::real_execute() {
479 fbwindow().setFullscreen(!fbwindow().isFullscreen()); 480 fbwindow().setFullscreen(!fbwindow().isFullscreen());
480} 481}
481 482
483FbTk::Command<void> *SetLayerCmd::parse(const string &command,
484 const string &args, bool trusted) {
485 int l = Layer::getNumFromString(args);
486 return (l == -1) ? 0 : new SetLayerCmd(l);
487}
488
489REGISTER_COMMAND_PARSER(setlayer, SetLayerCmd::parse, void);
490
491void SetLayerCmd::real_execute() {
492 fbwindow().moveToLayer(m_layer);
493}
494
482FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args, 495FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
483 bool trusted) { 496 bool trusted) {
484 typedef std::vector<string> StringTokens; 497 typedef std::vector<string> StringTokens;
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh
index 157855c..5d381a2 100644
--- a/src/CurrentWindowCmd.hh
+++ b/src/CurrentWindowCmd.hh
@@ -247,6 +247,17 @@ private:
247 int m_relative, m_un_relative; 247 int m_relative, m_un_relative;
248}; 248};
249 249
250class SetLayerCmd: public WindowHelperCmd {
251public:
252 explicit SetLayerCmd(int layer): m_layer(layer) { }
253 static FbTk::Command<void> *parse(const std::string &command,
254 const std::string &args, bool trusted);
255protected:
256 void real_execute();
257private:
258 int m_layer;
259};
260
250class MatchCmd: public WindowHelperBoolCmd { 261class MatchCmd: public WindowHelperBoolCmd {
251public: 262public:
252 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { }; 263 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { };
diff --git a/src/Layer.hh b/src/Layer.hh
index 58fb5b6..da8f04c 100644
--- a/src/Layer.hh
+++ b/src/Layer.hh
@@ -54,7 +54,7 @@ public:
54 54
55 explicit Layer(int i) : m_num(i) {}; 55 explicit Layer(int i) : m_num(i) {};
56 56
57 static int getNumFromString(string &str) { 57 static int getNumFromString(const string &str) {
58 int tempnum = 0; 58 int tempnum = 0;
59 if (sscanf(str.c_str(), "%d", &tempnum) == 1) 59 if (sscanf(str.c_str(), "%d", &tempnum) == 1)
60 return tempnum; 60 return tempnum;
diff --git a/src/Remember.cc b/src/Remember.cc
index ff0094c..f76fe9b 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -411,24 +411,8 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
411 else 411 else
412 had_error = true; 412 had_error = true;
413 } else if (strcasecmp(str_key.c_str(), "Layer") == 0) { 413 } else if (strcasecmp(str_key.c_str(), "Layer") == 0) {
414 unsigned int l; 414 int l = Layer::getNumFromString(str_label);
415 if (strcasecmp(str_label.c_str(), "DESKTOP") == 0) { 415 had_error = (l == -1);
416 l = Layer::DESKTOP;
417 } else if (strcasecmp(str_label.c_str(), "BOTTOM") == 0) {
418 l = Layer::BOTTOM;
419 } else if (strcasecmp(str_label.c_str(), "NORMAL") == 0) {
420 l = Layer::NORMAL;
421 } else if (strcasecmp(str_label.c_str(), "TOP") == 0) {
422 l = Layer::TOP;
423 } else if (strcasecmp(str_label.c_str(), "DOCK") == 0) {
424 l = Layer::DOCK;
425 } else if (strcasecmp(str_label.c_str(), "ABOVEDOCK") == 0) {
426 l = Layer::ABOVE_DOCK;
427 } else if (strcasecmp(str_label.c_str(), "MENU") == 0) {
428 l = Layer::MENU;
429 } else if (!getuint(str_label.c_str(), l)) {
430 had_error = true;
431 }
432 if (!had_error) 416 if (!had_error)
433 app.rememberLayer(l); 417 app.rememberLayer(l);
434 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) { 418 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) {