Skip to content

Commit

Permalink
for #263, branch -sdb - exit and quit are backwards compatible
Browse files Browse the repository at this point in the history
* but they may not work if the debugger is active
  • Loading branch information
Cecil committed Jul 31, 2016
1 parent 8060def commit b591c14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
._*
*.rl
*.log
.byebug_history
Makefile
VERSION.txt
*-custom.yaml
Expand Down
7 changes: 4 additions & 3 deletions lib/shoes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
else
# Normal shoes:
# redefine quit and exit in Ruby to be Shoes implemented methods.
# secret_exit_hook # or not
secret_exit_hook # maintains backwards compatibility
end
ARGV.delete_if { |x| x =~ /-psn_/ }

Expand Down Expand Up @@ -167,8 +167,8 @@ def self.splash
para link(strong("Run an App")) { Shoes.show_selector and close }, :margin => 10, :margin_bottom => 4
para link(strong("Read the Manual")) { Shoes.show_manual and close }, :margin => 10, :margin_bottom => 4
para link(strong("Maintain Shoes")) {Shoes.cobbler and close}, :margin => 10
para link(strong("Debug an App (remote)")) {Shoes.remote_debug and close}, :margin => 10, :margin_bottom => 4
para link(strong("Profile an App")) {Shoes.profiler and close}, :margin => 10, :margin_bottom => 4
#para link(strong("Debug an App (remote)")) {Shoes.remote_debug and close}, :margin => 10, :margin_bottom => 4
#para link(strong("Profile an App")) {Shoes.profiler and close}, :margin => 10, :margin_bottom => 4
para link(strong("Bundle an App (shy)")) { Shoes.package_app and close }, :margin => 10, :margin_bottom => 4
para link(strong("Package an App with Shoes")) {Shoes.app_package and close }, :margin => 10, :margin_bottom => 4
# para link("Obsolete: Package") { Shoes.make_pack and close }, :margin => 10, :margin_bottom => 4
Expand Down Expand Up @@ -264,6 +264,7 @@ def self.run(path)
end
end

# This is the real entry point for shows. It's called from the C startup code
def self.args!(osx_launch = nil)
if (ARGV.empty?)
Shoes.splash if !osx_launch || osx_launch == '0'
Expand Down
7 changes: 4 additions & 3 deletions shoes/ruby.c
Original file line number Diff line number Diff line change
Expand Up @@ -4704,8 +4704,8 @@ shoes_ruby_init()
rb_define_singleton_method(cShoes, "log", CASTHOOK(shoes_log), 0);
rb_define_singleton_method(cShoes, "show_console", CASTHOOK(shoes_app_console), 0); // New in 3.2.23
rb_define_singleton_method(cShoes, "terminal", CASTHOOK(shoes_app_terminal), -1); // New in 3.3.2 replaces console
rb_define_singleton_method(cShoes, "quit", CASTHOOK(shoes_app_quit), 0);
rb_define_singleton_method(cShoes, "exit", CASTHOOK(shoes_app_quit), 0);
rb_define_singleton_method(cShoes, "quit", CASTHOOK(shoes_app_quit), 0); // Shoes 3.3.2
//rb_define_singleton_method(cShoes, "exit", CASTHOOK(shoes_app_quit), 0);

//
// Canvas methods
Expand All @@ -4728,7 +4728,7 @@ shoes_ruby_init()
rb_define_method(rb_mKernel, "pattern", CASTHOOK(shoes_pattern_method), 1);
//rb_define_method(rb_mKernel, "quit", CASTHOOK(shoes_app_quit), 0);
//rb_define_method(rb_mKernel, "exit", CASTHOOK(shoes_app_quit), 0);
rb_define_method(rb_mKernel, "secret_exit_hook", CASTHOOK(shoes_exit_setup),0);
rb_define_method(rb_mKernel, "secret_exit_hook", CASTHOOK(shoes_exit_setup),0); //unused?

rb_define_method(rb_mKernel, "debug", CASTHOOK(shoes_canvas_debug), 1);
rb_define_method(rb_mKernel, "info", CASTHOOK(shoes_canvas_info), 1);
Expand Down Expand Up @@ -5240,6 +5240,7 @@ shoes_ruby_init()
rb_define_method(rb_mKernel, "font", CASTHOOK(shoes_font), 1);
}

// unused
VALUE shoes_exit_setup(VALUE self) {
rb_define_method(rb_mKernel, "quit", CASTHOOK(shoes_app_quit), 0);
rb_define_method(rb_mKernel, "exit", CASTHOOK(shoes_app_quit), 0);
Expand Down

0 comments on commit b591c14

Please sign in to comment.