aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 0d4e0e3..747eb3c 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -33,7 +33,7 @@
33 33
34#include "FbTk/Theme.hh" 34#include "FbTk/Theme.hh"
35#include "FbTk/Menu.hh" 35#include "FbTk/Menu.hh"
36#include "FbTk/CommandRegistry.hh" 36#include "FbTk/ObjectRegistry.hh"
37#include "FbTk/StringUtil.hh" 37#include "FbTk/StringUtil.hh"
38#include "FbTk/stringstream.hh" 38#include "FbTk/stringstream.hh"
39 39
@@ -123,9 +123,11 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) {
123 123
124namespace FbCommands { 124namespace FbCommands {
125 125
126REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(exec, FbCommands::ExecuteCmd); 126using FbTk::Command;
127REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execute, FbCommands::ExecuteCmd); 127
128REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(execcommand, FbCommands::ExecuteCmd); 128REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(exec, FbCommands::ExecuteCmd, Command);
129REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execute, FbCommands::ExecuteCmd, Command);
130REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(execcommand, FbCommands::ExecuteCmd, Command);
129 131
130ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) { 132ExecuteCmd::ExecuteCmd(const string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
131 133
@@ -193,9 +195,9 @@ FbTk::Command *ExportCmd::parse(const string &command, const string &args,
193 return new ExportCmd(name, value); 195 return new ExportCmd(name, value);
194} 196}
195 197
196REGISTER_COMMAND_PARSER(setenv, ExportCmd::parse); 198REGISTER_OBJECT_PARSER(setenv, ExportCmd::parse, Command);
197REGISTER_COMMAND_PARSER(export, ExportCmd::parse); 199REGISTER_OBJECT_PARSER(export, ExportCmd::parse, Command);
198REGISTER_COMMAND_PARSER(setresourcevalue, ExportCmd::parse); 200REGISTER_OBJECT_PARSER(setresourcevalue, ExportCmd::parse, Command);
199 201
200ExportCmd::ExportCmd(const string& name, const string& value) : 202ExportCmd::ExportCmd(const string& name, const string& value) :
201 m_name(name), m_value(value) { 203 m_name(name), m_value(value) {
@@ -233,20 +235,20 @@ void ExportCmd::execute() {
233 } 235 }
234} 236}
235 237
236REGISTER_COMMAND(exit, FbCommands::ExitFluxboxCmd); 238REGISTER_OBJECT(exit, FbCommands::ExitFluxboxCmd, Command);
237REGISTER_COMMAND(quit, FbCommands::ExitFluxboxCmd); 239REGISTER_OBJECT(quit, FbCommands::ExitFluxboxCmd, Command);
238 240
239void ExitFluxboxCmd::execute() { 241void ExitFluxboxCmd::execute() {
240 Fluxbox::instance()->shutdown(); 242 Fluxbox::instance()->shutdown();
241} 243}
242 244
243REGISTER_COMMAND(saverc, FbCommands::SaveResources); 245REGISTER_OBJECT(saverc, FbCommands::SaveResources, Command);
244 246
245void SaveResources::execute() { 247void SaveResources::execute() {
246 Fluxbox::instance()->save_rc(); 248 Fluxbox::instance()->save_rc();
247} 249}
248 250
249REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd); 251REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(restart, FbCommands::RestartFluxboxCmd, Command);
250 252
251RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){ 253RestartFluxboxCmd::RestartFluxboxCmd(const string &cmd):m_cmd(cmd){
252} 254}
@@ -258,21 +260,21 @@ void RestartFluxboxCmd::execute() {
258 Fluxbox::instance()->restart(m_cmd.c_str()); 260 Fluxbox::instance()->restart(m_cmd.c_str());
259} 261}
260 262
261REGISTER_COMMAND(reconfigure, FbCommands::ReconfigureFluxboxCmd); 263REGISTER_OBJECT(reconfigure, FbCommands::ReconfigureFluxboxCmd, Command);
262REGISTER_COMMAND(reconfig, FbCommands::ReconfigureFluxboxCmd); 264REGISTER_OBJECT(reconfig, FbCommands::ReconfigureFluxboxCmd, Command);
263 265
264void ReconfigureFluxboxCmd::execute() { 266void ReconfigureFluxboxCmd::execute() {
265 Fluxbox::instance()->reconfigure(); 267 Fluxbox::instance()->reconfigure();
266} 268}
267 269
268REGISTER_COMMAND(reloadstyle, FbCommands::ReloadStyleCmd); 270REGISTER_OBJECT(reloadstyle, FbCommands::ReloadStyleCmd, Command);
269 271
270void ReloadStyleCmd::execute() { 272void ReloadStyleCmd::execute() {
271 SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename()); 273 SetStyleCmd cmd(Fluxbox::instance()->getStyleFilename());
272 cmd.execute(); 274 cmd.execute();
273} 275}
274 276
275REGISTER_COMMAND_WITH_ARGS(setstyle, FbCommands::SetStyleCmd); 277REGISTER_OBJECT_WITH_ARGS(setstyle, FbCommands::SetStyleCmd, Command);
276 278
277SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) { 279SetStyleCmd::SetStyleCmd(const string &filename):m_filename(filename) {
278 280
@@ -285,7 +287,7 @@ void SetStyleCmd::execute() {
285 Fluxbox::instance()->getStyleOverlayFilename()); 287 Fluxbox::instance()->getStyleOverlayFilename());
286} 288}
287 289
288REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd); 290REGISTER_OBJECT_WITH_ARGS(keymode, FbCommands::KeyModeCmd, Command);
289 291
290KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") { 292KeyModeCmd::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); 293 string::size_type second_pos = m_keymode.find_first_of(" \t", 0);
@@ -302,7 +304,7 @@ void KeyModeCmd::execute() {
302 Fluxbox::instance()->keys()->keyMode(m_keymode); 304 Fluxbox::instance()->keys()->keyMode(m_keymode);
303} 305}
304 306
305REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd); 307REGISTER_OBJECT(hidemenus, FbCommands::HideMenuCmd, Command);
306 308
307void HideMenuCmd::execute() { 309void HideMenuCmd::execute() {
308 FbTk::Menu::hideShownMenu(); 310 FbTk::Menu::hideShownMenu();
@@ -316,7 +318,7 @@ FbTk::Command *ShowClientMenuCmd::parse(const string &command,
316 return new ShowClientMenuCmd(opts, pat); 318 return new ShowClientMenuCmd(opts, pat);
317} 319}
318 320
319REGISTER_COMMAND_PARSER(clientmenu, ShowClientMenuCmd::parse); 321REGISTER_OBJECT_PARSER(clientmenu, ShowClientMenuCmd::parse, Command);
320 322
321void ShowClientMenuCmd::execute() { 323void ShowClientMenuCmd::execute() {
322 BScreen *screen = Fluxbox::instance()->mouseScreen(); 324 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -339,7 +341,7 @@ void ShowClientMenuCmd::execute() {
339 ::showMenu(*screen, **m_menu); 341 ::showMenu(*screen, **m_menu);
340} 342}
341 343
342REGISTER_COMMAND_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd); 344REGISTER_OBJECT_WITH_ARGS(custommenu, FbCommands::ShowCustomMenuCmd, Command);
343 345
344ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} 346ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {}
345 347
@@ -354,7 +356,7 @@ void ShowCustomMenuCmd::execute() {
354 ::showMenu(*screen, **m_menu); 356 ::showMenu(*screen, **m_menu);
355} 357}
356 358
357REGISTER_COMMAND(rootmenu, FbCommands::ShowRootMenuCmd); 359REGISTER_OBJECT(rootmenu, FbCommands::ShowRootMenuCmd, Command);
358 360
359void ShowRootMenuCmd::execute() { 361void ShowRootMenuCmd::execute() {
360 BScreen *screen = Fluxbox::instance()->mouseScreen(); 362 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -364,7 +366,7 @@ void ShowRootMenuCmd::execute() {
364 ::showMenu(*screen, screen->rootMenu()); 366 ::showMenu(*screen, screen->rootMenu());
365} 367}
366 368
367REGISTER_COMMAND(workspacemenu, FbCommands::ShowWorkspaceMenuCmd); 369REGISTER_OBJECT(workspacemenu, FbCommands::ShowWorkspaceMenuCmd, Command);
368 370
369void ShowWorkspaceMenuCmd::execute() { 371void ShowWorkspaceMenuCmd::execute() {
370 BScreen *screen = Fluxbox::instance()->mouseScreen(); 372 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -374,7 +376,7 @@ void ShowWorkspaceMenuCmd::execute() {
374 ::showMenu(*screen, screen->workspaceMenu()); 376 ::showMenu(*screen, screen->workspaceMenu());
375} 377}
376 378
377REGISTER_COMMAND_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd); 379REGISTER_OBJECT_WITH_ARGS(setworkspacename, FbCommands::SetWorkspaceNameCmd, Command);
378 380
379SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid): 381SetWorkspaceNameCmd::SetWorkspaceNameCmd(const string &name, int spaceid):
380 m_name(name), m_workspace(spaceid) { 382 m_name(name), m_workspace(spaceid) {
@@ -403,7 +405,7 @@ void SetWorkspaceNameCmd::execute() {
403 Fluxbox::instance()->save_rc(); 405 Fluxbox::instance()->save_rc();
404} 406}
405 407
406REGISTER_COMMAND(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd); 408REGISTER_OBJECT(setworkspacenamedialog, FbCommands::WorkspaceNameDialogCmd, Command);
407 409
408void WorkspaceNameDialogCmd::execute() { 410void WorkspaceNameDialogCmd::execute() {
409 411
@@ -416,7 +418,7 @@ void WorkspaceNameDialogCmd::execute() {
416 win->show(); 418 win->show();
417} 419}
418 420
419REGISTER_COMMAND(commanddialog, FbCommands::CommandDialogCmd); 421REGISTER_OBJECT(commanddialog, FbCommands::CommandDialogCmd, Command);
420 422
421void CommandDialogCmd::execute() { 423void CommandDialogCmd::execute() {
422 BScreen *screen = Fluxbox::instance()->mouseScreen(); 424 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -443,7 +445,7 @@ void SetResourceValueCmd::execute() {
443 Fluxbox::instance()->save_rc(); 445 Fluxbox::instance()->save_rc();
444} 446}
445 447
446REGISTER_COMMAND(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd); 448REGISTER_OBJECT(setresourcevaluedialog, FbCommands::SetResourceValueDialogCmd, Command);
447 449
448void SetResourceValueDialogCmd::execute() { 450void SetResourceValueDialogCmd::execute() {
449 BScreen *screen = Fluxbox::instance()->mouseScreen(); 451 BScreen *screen = Fluxbox::instance()->mouseScreen();
@@ -454,7 +456,7 @@ void SetResourceValueDialogCmd::execute() {
454 win->show(); 456 win->show();
455}; 457};
456 458
457REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd); 459REGISTER_UNTRUSTED_OBJECT_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, Command);
458 460
459BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { } 461BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { }
460 462
@@ -502,7 +504,7 @@ FbTk::Command *DeiconifyCmd::parse(const string &command, const string &args,
502 return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest); 504 return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
503} 505}
504 506
505REGISTER_COMMAND_PARSER(deiconify, DeiconifyCmd::parse); 507REGISTER_OBJECT_PARSER(deiconify, DeiconifyCmd::parse, Command);
506 508
507DeiconifyCmd::DeiconifyCmd(Mode mode, 509DeiconifyCmd::DeiconifyCmd(Mode mode,
508 Destination dest) : m_mode(mode), m_dest(dest) { } 510 Destination dest) : m_mode(mode), m_dest(dest) { }