aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 1569704..5e7f6dc 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -31,7 +31,7 @@
31 31
32#include "FbTk/Theme.hh" 32#include "FbTk/Theme.hh"
33#include "FbTk/Menu.hh" 33#include "FbTk/Menu.hh"
34#include "FbTk/ObjectRegistry.hh" 34#include "FbTk/CommandParser.hh"
35#include "FbTk/StringUtil.hh" 35#include "FbTk/StringUtil.hh"
36#include "FbTk/stringstream.hh" 36#include "FbTk/stringstream.hh"
37 37
@@ -123,9 +123,9 @@ namespace FbCommands {
123 123
124using FbTk::Command; 124using FbTk::Command;
125 125
126REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(exec, FbCommands::ExecuteCmd, Command); 126REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(exec, FbCommands::ExecuteCmd, void);
127REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execute, FbCommands::ExecuteCmd, Command); 127REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execute, FbCommands::ExecuteCmd, void);
128REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, Command); 128REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, void);
129 129
130ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) { 130ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
131 131
@@ -176,7 +176,7 @@ int ExecuteCmd::run() {
176 return pid; // compiler happy -> we are happy ;) 176 return pid; // compiler happy -> we are happy ;)
177} 177}
178 178
179FbTk::Command *ExportCmd::parse(const string &command, const string &args, 179FbTk::Command<void> *ExportCmd::parse(const string &command, const string &args,
180 bool trusted) { 180 bool trusted) {
181 string name = args; 181 string name = args;
182 FbTk::StringUtil::removeFirstWhitespace(name); 182 FbTk::StringUtil::removeFirstWhitespace(name);
@@ -193,9 +193,9 @@ FbTk::Command *ExportCmd::parse(const string &command, const string &args,
193 return new ExportCmd(name, value); 193 return new ExportCmd(name, value);
194} 194}
195 195
196REGISTER_OBJECT_PARSER(setenv, ExportCmd::parse, Command); 196REGISTER_COMMAND_PARSER(setenv, ExportCmd::parse, void);
197REGISTER_OBJECT_PARSER(export, ExportCmd::parse, Command); 197REGISTER_COMMAND_PARSER(export, ExportCmd::parse, void);
198REGISTER_OBJECT_PARSER(setresourcevalue, ExportCmd::parse, Command); 198REGISTER_COMMAND_PARSER(setresourcevalue, ExportCmd::parse, void);
199 199
200ExportCmd::ExportCmd(const string& name, const string& value) : 200ExportCmd::ExportCmd(const string& name, const string& value) :
201 m_name(name), m_value(value) { 201 m_name(name), m_value(value) {
@@ -233,20 +233,20 @@ void ExportCmd::execute() {
233 } 233 }
234} 234}
235 235
236REGISTER_OBJECT(exit, FbCommands::ExitFluxboxCmd, Command); 236REGISTER_COMMAND(exit, FbCommands::ExitFluxboxCmd, void);
237REGISTER_OBJECT(quit, FbCommands::ExitFluxboxCmd, Command); 237REGISTER_COMMAND(quit, FbCommands::ExitFluxboxCmd, void);
238 238
239void ExitFluxboxCmd::execute() { 239void ExitFluxboxCmd::execute() {
240 Fluxbox::instance()->shutdown(); 240 Fluxbox::instance()->shutdown();
241} 241}
242 242
243REGISTER_OBJECT(saverc, FbCommands::SaveResources, Command); 243REGISTER_COMMAND(saverc, FbCommands::SaveResources, void);
244 244
245void SaveResources::execute() { 245void SaveResources::execute() {
246 Fluxbox::instance()->save_rc(); 246 Fluxbox::instance()->save_rc();
247} 247}
248 248
249REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, Command); 249REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, void);
250 250
251RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){ 251RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){
252} 252}
@@ -258,21 +258,21 @@ void RestartFluxboxCmd::execute() {
258 Fluxbox::instance()->restart(m_cmd.c_str()); 258 Fluxbox::instance()->restart(m_cmd.c_str());
259} 259}
260 260
261REGISTER_OBJECT(reconfigure, FbCommands::ReconfigureFluxboxCmd, Command); 261REGISTER_COMMAND(reconfigure, FbCommands::ReconfigureFluxboxCmd, void);
262REGISTER_OBJECT(reconfig, FbCommands::ReconfigureFluxboxCmd, Command); 262REGISTER_COMMAND(reconfig, FbCommands::ReconfigureFluxboxCmd, void);
263 263
264void ReconfigureFluxboxCmd::execute() { 264void ReconfigureFluxboxCmd::execute() {
265 Fluxbox::instance()->reconfigure(); 265 Fluxbox::instance()->reconfigure();
266} 266}
267 267
268REGISTER_OBJECT(reloadstyle, FbCommands::ReloadStyleCmd, Command); 268REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd, void);
269 269
270void ReloadStyleCmd::execute() { 270void ReloadStyleCmd::execute() {
271 SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); 271 SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename());
272 cmd.execute(); 272 cmd.execute();
273} 273}
274 274
275REGISTER_OBJECT_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, Command); 275REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, void);
276 276
277SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { 277SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
278 278
@@ -285,7 +285,7 @@ void SetStyleCmd::execute() {
285 Fluxbox::instance()->getStyleOverlayFilename()); 285 Fluxbox::instance()->getStyleOverlayFilename());
286} 286}
287 287
288REGISTER_OBJECT_WITH_ARGS(keymode, FbCommands::KeyModeCmd, Command); 288REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void);
289 289
290KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") { 290KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") {
291 string::size_type second_pos = m_keymode.find_first_of(" \t", 0); 291 string::size_type second_pos = m_keymode.find_first_of(" \t", 0);
@@ -302,13 +302,13 @@ void KeyModeCmd::execute() {
302 Fluxbox::instance()->keys()->keyMode(m_keymode); 302 Fluxbox::instance()->keys()->keyMode(m_keymode);
303} 303}
304 304
305REGISTER_OBJECT(hidemenus, FbCommands::HideMenuCmd, Command); 305REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void);
306 306
307void HideMenuCmd::execute() { 307void HideMenuCmd::execute() {
308 FbTk::Menu::hideShownMenu(); 308 FbTk::Menu::hideShownMenu();
309} 309}
310 310
311FbTk::Command *ShowClientMenuCmd::parse(const string &command, 311FbTk::Command<void> *ShowClientMenuCmd::parse(const string &command,
312 const string &args, bool trusted) { 312 const string &args, bool trusted) {
313 int opts; 313 int opts;
314 string pat; 314 string pat;
@@ -316,7 +316,7 @@ FbTk::Command *ShowClientMenuCmd::parse(const string &command,
316 return new ShowClientMenuCmd(opts, pat); 316 return new ShowClientMenuCmd(opts, pat);
317} 317}
318 318
319REGISTER_OBJECT_PARSER(clientmenu, ShowClientMenuCmd::parse, Command); 319REGISTER_COMMAND_PARSER(clientmenu, ShowClientMenuCmd::parse, void);
320 320
321void ShowClientMenuCmd::execute() { 321void ShowClientMenuCmd::execute() {
322 BScreen *screen = Fluxbox::instance()->mouseScreen(); 322 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -339,7 +339,7 @@ void ShowClientMenuCmd::execute() {
339 ::showMenu(*screen, **m_menu); 339 ::showMenu(*screen, **m_menu);
340} 340}
341 341
342REGISTER_OBJECT_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, Command); 342REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, void);
343 343
344ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} 344ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {}
345 345
@@ -354,7 +354,7 @@ void ShowCustomMenuCmd::execute() {
354 ::showMenu(*screen, **m_menu); 354 ::showMenu(*screen, **m_menu);
355} 355}
356 356
357REGISTER_OBJECT(rootmenu, FbCommands::ShowRootMenuCmd, Command); 357REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd, void);
358 358
359void ShowRootMenuCmd::execute() { 359void ShowRootMenuCmd::execute() {
360 BScreen *screen = Fluxbox::instance()->mouseScreen(); 360 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -364,7 +364,7 @@ void ShowRootMenuCmd::execute() {
364 ::showMenu(*screen, screen->rootMenu()); 364 ::showMenu(*screen, screen->rootMenu());
365} 365}
366 366
367REGISTER_OBJECT(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, Command); 367REGISTER_COMMAND(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, void);
368 368
369void ShowWorkspaceMenuCmd::execute() { 369void ShowWorkspaceMenuCmd::execute() {
370 BScreen *screen = Fluxbox::instance()->mouseScreen(); 370 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -374,7 +374,7 @@ void ShowWorkspaceMenuCmd::execute() {
374 ::showMenu(*screen, screen->workspaceMenu()); 374 ::showMenu(*screen, screen->workspaceMenu());
375} 375}
376 376
377REGISTER_OBJECT_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, Command); 377REGISTER_COMMAND_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, void);
378 378
379SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid): 379SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid):
380 m_name(name), m_workspace(spaceid) { 380 m_name(name), m_workspace(spaceid) {
@@ -403,7 +403,7 @@ void SetWorkspaceNameCmd::execute() {
403 Fluxbox::instance()->save_rc(); 403 Fluxbox::instance()->save_rc();
404} 404}
405 405
406REGISTER_OBJECT(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, Command); 406REGISTER_COMMAND(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, void);
407 407
408void WorkspaceNameDialogCmd::execute() { 408void WorkspaceNameDialogCmd::execute() {
409 409
@@ -416,7 +416,7 @@ void WorkspaceNameDialogCmd::execute() {
416 win->show(); 416 win->show();
417} 417}
418 418
419REGISTER_OBJECT(commanddialog, FbCommands::CommandDialogCmd, Command); 419REGISTER_COMMAND(commanddialog, FbCommands::CommandDialogCmd, void);
420 420
421void CommandDialogCmd::execute() { 421void CommandDialogCmd::execute() {
422 BScreen *screen = Fluxbox::instance()->mouseScreen(); 422 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -443,7 +443,7 @@ void SetResourceValueCmd::execute() {
443 Fluxbox::instance()->save_rc(); 443 Fluxbox::instance()->save_rc();
444} 444}
445 445
446REGISTER_OBJECT(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, Command); 446REGISTER_COMMAND(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, void);
447 447
448void SetResourceValueDialogCmd::execute() { 448void SetResourceValueDialogCmd::execute() {
449 BScreen *screen = Fluxbox::instance()->mouseScreen(); 449 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -454,7 +454,7 @@ void SetResourceValueDialogCmd::execute() {
454 win->show(); 454 win->show();
455}; 455};
456 456
457REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, Command); 457REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, void);
458 458
459BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { } 459BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { }
460 460
@@ -469,7 +469,7 @@ void BindKeyCmd::execute() {
469 } 469 }
470} 470}
471 471
472FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args, 472FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args,
473 bool trusted) { 473 bool trusted) {
474 FbTk_istringstream iss(args.c_str()); 474 FbTk_istringstream iss(args.c_str());
475 string mode; 475 string mode;
@@ -502,7 +502,7 @@ FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args,
502 return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest); 502 return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
503} 503}
504 504
505REGISTER_OBJECT_PARSER(deiconify, DeiconifyCmd::parse, Command); 505REGISTER_COMMAND_PARSER(deiconify, DeiconifyCmd::parse, void);
506 506
507DeiconifyCmd::DeiconifyCmd(Mode mode, 507DeiconifyCmd::DeiconifyCmd(Mode mode,
508 Destination dest) : m_mode(mode), m_dest(dest) { } 508 Destination dest) : m_mode(mode), m_dest(dest) { }