From http://www.jwz.org/xscreensaver/xscreensaver-5.27.tar.gz
[xscreensaver] / OSX / SaverListController.m
index 484cb1685449bdb50a625d1a7ccfe445c23e27eb..15b3089dffc4575f4e08814f2a9798ea510797ae 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 2012 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 2012-2014 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -36,6 +36,7 @@
 {
   // Extract the version number and release date from the version string.
   // Here's an area where I kind of wish I had "Two Problems".
+  // I guess I could add custom key to the Info.plist for this.
 
   NSArray *a = [[NSString stringWithCString: screensaver_id
                           encoding:NSASCIIStringEncoding]
                             [[[NSBundle mainBundle] bundlePath]
                               stringByAppendingPathComponent:
                                 @"iSaverRunner29t.png"]];
-  UIBarButtonItem *button = [[[UIBarButtonItem alloc]
-                               initWithImage: img
-                               style: UIBarButtonItemStylePlain
-                               target: self
-                               action: @selector(titleTapped:)]
-                              autorelease];
-  button.width = img.size.width;
-  self.navigationItem.rightBarButtonItem = button;
+  UIButton *button = [[UIButton alloc] init];
+  [button setFrame: CGRectMake(0, 0, img.size.width, img.size.height)];
+  [button setBackgroundImage:img forState:UIControlStateNormal];
+  [button addTarget:self
+          action:@selector(titleTapped:)
+          forControlEvents:UIControlEventTouchUpInside];
+  self.navigationItem.rightBarButtonItem = 
+    [[UIBarButtonItem alloc] initWithCustomView: button];
+  [button release];
 
   // The title bar
 
  */
 - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
 {
+  if (motion != UIEventSubtypeMotionShake)
+    return;
   NSMutableArray *a = [NSMutableArray arrayWithCapacity: 200];
   for (NSArray *sec in letter_sections)
     for (NSString *s in sec)