Skip to content

Instantly share code, notes, and snippets.

@penguin2716
Created March 4, 2012 18:50
Show Gist options
  • Save penguin2716/1974344 to your computer and use it in GitHub Desktop.
Save penguin2716/1974344 to your computer and use it in GitHub Desktop.
mikutterの画像表示ウィンドウでCtrl+wかEscすると閉じるパッチ
--- core/addon/openimg/openimg.rb.org 2012-03-04 12:03:17.013064940 +0900
+++ core/addon/openimg/openimg.rb 2012-03-04 12:13:38.603705833 +0900
@@ -30,6 +30,14 @@
w.set_size_request(320, 240)
w.set_default_size(*@size).move(*@position)
w.signal_connect(:destroy){ w.destroy }
+ w.signal_connect(:key_press_event){ |w,e|
+ if Gdk::Keyval.to_name(e.keyval) == 'Escape' or
+ (Gdk::Window::ModifierType::CONTROL_MASK ==
+ e.state & Gdk::Window::CONTROL_MASK and
+ Gdk::Keyval.to_name(e.keyval) == 'w')
+ w.destroy
+ end
+ }
eventbox = Gtk::EventBox.new
w.add(eventbox)
size = DEFAULT_SIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment