diff options
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r-- | src/CurrentWindowCmd.cc | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 33d8e8a..d7b05ab 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -31,13 +31,15 @@ | |||
31 | #include "WinClient.hh" | 31 | #include "WinClient.hh" |
32 | 32 | ||
33 | #include "FocusControl.hh" | 33 | #include "FocusControl.hh" |
34 | #include "FbTk/CommandRegistry.hh" | 34 | #include "FbTk/ObjectRegistry.hh" |
35 | #include "FbTk/stringstream.hh" | 35 | #include "FbTk/stringstream.hh" |
36 | #include "FbTk/StringUtil.hh" | 36 | #include "FbTk/StringUtil.hh" |
37 | 37 | ||
38 | #include <string> | 38 | #include <string> |
39 | #include <vector> | 39 | #include <vector> |
40 | 40 | ||
41 | using FbTk::Command; | ||
42 | |||
41 | namespace { | 43 | namespace { |
42 | 44 | ||
43 | FbTk::Command *createCurrentWindowCmd(const std::string &command, | 45 | FbTk::Command *createCurrentWindowCmd(const std::string &command, |
@@ -89,35 +91,35 @@ FbTk::Command *createCurrentWindowCmd(const std::string &command, | |||
89 | return 0; | 91 | return 0; |
90 | } | 92 | } |
91 | 93 | ||
92 | REGISTER_COMMAND_PARSER(minimizewindow, createCurrentWindowCmd); | 94 | REGISTER_OBJECT_PARSER(minimizewindow, createCurrentWindowCmd, Command); |
93 | REGISTER_COMMAND_PARSER(minimize, createCurrentWindowCmd); | 95 | REGISTER_OBJECT_PARSER(minimize, createCurrentWindowCmd, Command); |
94 | REGISTER_COMMAND_PARSER(iconify, createCurrentWindowCmd); | 96 | REGISTER_OBJECT_PARSER(iconify, createCurrentWindowCmd, Command); |
95 | REGISTER_COMMAND_PARSER(maximizewindow, createCurrentWindowCmd); | 97 | REGISTER_OBJECT_PARSER(maximizewindow, createCurrentWindowCmd, Command); |
96 | REGISTER_COMMAND_PARSER(maximize, createCurrentWindowCmd); | 98 | REGISTER_OBJECT_PARSER(maximize, createCurrentWindowCmd, Command); |
97 | REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd); | 99 | REGISTER_OBJECT_PARSER(maximizevertical, createCurrentWindowCmd, Command); |
98 | REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd); | 100 | REGISTER_OBJECT_PARSER(maximizehorizontal, createCurrentWindowCmd, Command); |
99 | REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd); | 101 | REGISTER_OBJECT_PARSER(raise, createCurrentWindowCmd, Command); |
100 | REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd); | 102 | REGISTER_OBJECT_PARSER(raiselayer, createCurrentWindowCmd, Command); |
101 | REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd); | 103 | REGISTER_OBJECT_PARSER(lower, createCurrentWindowCmd, Command); |
102 | REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd); | 104 | REGISTER_OBJECT_PARSER(lowerlayer, createCurrentWindowCmd, Command); |
103 | REGISTER_COMMAND_PARSER(activate, createCurrentWindowCmd); | 105 | REGISTER_OBJECT_PARSER(activate, createCurrentWindowCmd, Command); |
104 | REGISTER_COMMAND_PARSER(focus, createCurrentWindowCmd); | 106 | REGISTER_OBJECT_PARSER(focus, createCurrentWindowCmd, Command); |
105 | REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd); | 107 | REGISTER_OBJECT_PARSER(close, createCurrentWindowCmd, Command); |
106 | REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd); | 108 | REGISTER_OBJECT_PARSER(killwindow, createCurrentWindowCmd, Command); |
107 | REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd); | 109 | REGISTER_OBJECT_PARSER(kill, createCurrentWindowCmd, Command); |
108 | REGISTER_COMMAND_PARSER(shade, createCurrentWindowCmd); | 110 | REGISTER_OBJECT_PARSER(shade, createCurrentWindowCmd, Command); |
109 | REGISTER_COMMAND_PARSER(shadewindow, createCurrentWindowCmd); | 111 | REGISTER_OBJECT_PARSER(shadewindow, createCurrentWindowCmd, Command); |
110 | REGISTER_COMMAND_PARSER(shadeon, createCurrentWindowCmd); | 112 | REGISTER_OBJECT_PARSER(shadeon, createCurrentWindowCmd, Command); |
111 | REGISTER_COMMAND_PARSER(shadeoff, createCurrentWindowCmd); | 113 | REGISTER_OBJECT_PARSER(shadeoff, createCurrentWindowCmd, Command); |
112 | REGISTER_COMMAND_PARSER(stick, createCurrentWindowCmd); | 114 | REGISTER_OBJECT_PARSER(stick, createCurrentWindowCmd, Command); |
113 | REGISTER_COMMAND_PARSER(stickwindow, createCurrentWindowCmd); | 115 | REGISTER_OBJECT_PARSER(stickwindow, createCurrentWindowCmd, Command); |
114 | REGISTER_COMMAND_PARSER(toggledecor, createCurrentWindowCmd); | 116 | REGISTER_OBJECT_PARSER(toggledecor, createCurrentWindowCmd, Command); |
115 | REGISTER_COMMAND_PARSER(nexttab, createCurrentWindowCmd); | 117 | REGISTER_OBJECT_PARSER(nexttab, createCurrentWindowCmd, Command); |
116 | REGISTER_COMMAND_PARSER(prevtab, createCurrentWindowCmd); | 118 | REGISTER_OBJECT_PARSER(prevtab, createCurrentWindowCmd, Command); |
117 | REGISTER_COMMAND_PARSER(movetableft, createCurrentWindowCmd); | 119 | REGISTER_OBJECT_PARSER(movetableft, createCurrentWindowCmd, Command); |
118 | REGISTER_COMMAND_PARSER(movetabright, createCurrentWindowCmd); | 120 | REGISTER_OBJECT_PARSER(movetabright, createCurrentWindowCmd, Command); |
119 | REGISTER_COMMAND_PARSER(detachclient, createCurrentWindowCmd); | 121 | REGISTER_OBJECT_PARSER(detachclient, createCurrentWindowCmd, Command); |
120 | REGISTER_COMMAND_PARSER(windowmenu, createCurrentWindowCmd); | 122 | REGISTER_OBJECT_PARSER(windowmenu, createCurrentWindowCmd, Command); |
121 | 123 | ||
122 | }; // end anonymous namespace | 124 | }; // end anonymous namespace |
123 | 125 | ||
@@ -184,14 +186,14 @@ FbTk::Command *parseIntCmd(const string &command, const string &args, | |||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
186 | 188 | ||
187 | REGISTER_COMMAND_PARSER(sethead, parseIntCmd); | 189 | REGISTER_OBJECT_PARSER(sethead, parseIntCmd, Command); |
188 | REGISTER_COMMAND_PARSER(tab, parseIntCmd); | 190 | REGISTER_OBJECT_PARSER(tab, parseIntCmd, Command); |
189 | REGISTER_COMMAND_PARSER(sendtonextworkspace, parseIntCmd); | 191 | REGISTER_OBJECT_PARSER(sendtonextworkspace, parseIntCmd, Command); |
190 | REGISTER_COMMAND_PARSER(sendtoprevworkspace, parseIntCmd); | 192 | REGISTER_OBJECT_PARSER(sendtoprevworkspace, parseIntCmd, Command); |
191 | REGISTER_COMMAND_PARSER(taketonextworkspace, parseIntCmd); | 193 | REGISTER_OBJECT_PARSER(taketonextworkspace, parseIntCmd, Command); |
192 | REGISTER_COMMAND_PARSER(taketoprevworkspace, parseIntCmd); | 194 | REGISTER_OBJECT_PARSER(taketoprevworkspace, parseIntCmd, Command); |
193 | REGISTER_COMMAND_PARSER(sendtoworkspace, parseIntCmd); | 195 | REGISTER_OBJECT_PARSER(sendtoworkspace, parseIntCmd, Command); |
194 | REGISTER_COMMAND_PARSER(taketoworkspace, parseIntCmd); | 196 | REGISTER_OBJECT_PARSER(taketoworkspace, parseIntCmd, Command); |
195 | 197 | ||
196 | }; // end anonymous namespace | 198 | }; // end anonymous namespace |
197 | 199 | ||
@@ -254,7 +256,7 @@ void GoToTabCmd::real_execute() { | |||
254 | (*it)->focus(); | 256 | (*it)->focus(); |
255 | } | 257 | } |
256 | 258 | ||
257 | REGISTER_COMMAND(startmoving, StartMovingCmd); | 259 | REGISTER_OBJECT(startmoving, StartMovingCmd, Command); |
258 | 260 | ||
259 | void StartMovingCmd::real_execute() { | 261 | void StartMovingCmd::real_execute() { |
260 | const XEvent &last = Fluxbox::instance()->lastEvent(); | 262 | const XEvent &last = Fluxbox::instance()->lastEvent(); |
@@ -297,7 +299,7 @@ FbTk::Command *StartResizingCmd::parse(const string &cmd, const string &args, | |||
297 | return new StartResizingCmd(mode); | 299 | return new StartResizingCmd(mode); |
298 | } | 300 | } |
299 | 301 | ||
300 | REGISTER_COMMAND_PARSER(startresizing, StartResizingCmd::parse); | 302 | REGISTER_OBJECT_PARSER(startresizing, StartResizingCmd::parse, Command); |
301 | 303 | ||
302 | void StartResizingCmd::real_execute() { | 304 | void StartResizingCmd::real_execute() { |
303 | const XEvent &last = Fluxbox::instance()->lastEvent(); | 305 | const XEvent &last = Fluxbox::instance()->lastEvent(); |
@@ -332,11 +334,11 @@ FbTk::Command *MoveCmd::parse(const string &command, const string &args, | |||
332 | return new MoveCmd(dx, dy); | 334 | return new MoveCmd(dx, dy); |
333 | } | 335 | } |
334 | 336 | ||
335 | REGISTER_COMMAND_PARSER(move, MoveCmd::parse); | 337 | REGISTER_OBJECT_PARSER(move, MoveCmd::parse, Command); |
336 | REGISTER_COMMAND_PARSER(moveright, MoveCmd::parse); | 338 | REGISTER_OBJECT_PARSER(moveright, MoveCmd::parse, Command); |
337 | REGISTER_COMMAND_PARSER(moveleft, MoveCmd::parse); | 339 | REGISTER_OBJECT_PARSER(moveleft, MoveCmd::parse, Command); |
338 | REGISTER_COMMAND_PARSER(moveup, MoveCmd::parse); | 340 | REGISTER_OBJECT_PARSER(moveup, MoveCmd::parse, Command); |
339 | REGISTER_COMMAND_PARSER(movedown, MoveCmd::parse); | 341 | REGISTER_OBJECT_PARSER(movedown, MoveCmd::parse, Command); |
340 | 342 | ||
341 | MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) : | 343 | MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) : |
342 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 344 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } |
@@ -364,10 +366,10 @@ FbTk::Command *ResizeCmd::parse(const string &command, const string &args, | |||
364 | return new ResizeCmd(dx, dy); | 366 | return new ResizeCmd(dx, dy); |
365 | } | 367 | } |
366 | 368 | ||
367 | REGISTER_COMMAND_PARSER(resize, ResizeCmd::parse); | 369 | REGISTER_OBJECT_PARSER(resize, ResizeCmd::parse, Command); |
368 | REGISTER_COMMAND_PARSER(resizeto, ResizeCmd::parse); | 370 | REGISTER_OBJECT_PARSER(resizeto, ResizeCmd::parse, Command); |
369 | REGISTER_COMMAND_PARSER(resizehorizontal, ResizeCmd::parse); | 371 | REGISTER_OBJECT_PARSER(resizehorizontal, ResizeCmd::parse, Command); |
370 | REGISTER_COMMAND_PARSER(resizevertical, ResizeCmd::parse); | 372 | REGISTER_OBJECT_PARSER(resizevertical, ResizeCmd::parse, Command); |
371 | 373 | ||
372 | ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : | 374 | ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : |
373 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 375 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } |
@@ -428,7 +430,7 @@ FbTk::Command *MoveToCmd::parse(const string &cmd, const string &args, | |||
428 | 430 | ||
429 | } | 431 | } |
430 | 432 | ||
431 | REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse); | 433 | REGISTER_OBJECT_PARSER(moveto, MoveToCmd::parse, Command); |
432 | 434 | ||
433 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) : | 435 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) : |
434 | m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { } | 436 | m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { } |
@@ -465,7 +467,7 @@ void ResizeToCmd::real_execute() { | |||
465 | fbwindow().resize(m_step_size_x, m_step_size_y); | 467 | fbwindow().resize(m_step_size_x, m_step_size_y); |
466 | } | 468 | } |
467 | 469 | ||
468 | REGISTER_COMMAND(fullscreen, FullscreenCmd); | 470 | REGISTER_OBJECT(fullscreen, FullscreenCmd, Command); |
469 | 471 | ||
470 | FullscreenCmd::FullscreenCmd() { } | 472 | FullscreenCmd::FullscreenCmd() { } |
471 | void FullscreenCmd::real_execute() { | 473 | void FullscreenCmd::real_execute() { |
@@ -497,7 +499,7 @@ FbTk::Command *SetAlphaCmd::parse(const string &command, const string &args, | |||
497 | return new SetAlphaCmd(focused, relative, unfocused, un_rel); | 499 | return new SetAlphaCmd(focused, relative, unfocused, un_rel); |
498 | } | 500 | } |
499 | 501 | ||
500 | REGISTER_COMMAND_PARSER(setalpha, SetAlphaCmd::parse); | 502 | REGISTER_OBJECT_PARSER(setalpha, SetAlphaCmd::parse, Command); |
501 | 503 | ||
502 | SetAlphaCmd::SetAlphaCmd(int focused, bool relative, | 504 | SetAlphaCmd::SetAlphaCmd(int focused, bool relative, |
503 | int unfocused, bool un_relative) : | 505 | int unfocused, bool un_relative) : |
@@ -529,7 +531,7 @@ void SetAlphaCmd::real_execute() { | |||
529 | fbwindow().setUnfocusedAlpha(m_unfocus); | 531 | fbwindow().setUnfocusedAlpha(m_unfocus); |
530 | } | 532 | } |
531 | 533 | ||
532 | REGISTER_BOOLCOMMAND_WITH_ARGS(matches, MatchCmd); | 534 | REGISTER_OBJECT_WITH_ARGS_NSBASE(matches, MatchCmd, FbTk, BoolCommand); |
533 | 535 | ||
534 | bool MatchCmd::real_execute() { | 536 | bool MatchCmd::real_execute() { |
535 | return m_pat.match(winclient()); | 537 | return m_pat.match(winclient()); |