Commits

Jeff Sickel committed 0b35418

magnification toggle

Comments (0)

Files changed (3)

 Setting the value to 1 or deleting the default will return to displaying the
 title bar during normal operation.  
 
+An additional default has been added to enable gesture support for multi-touch
+trackpads.  The initial value can be set with:
+
+	% defaults write com.bell-labs.plan9.drawterm MagnificationToggle 1
+
+to allow a pinch or expand magnification gesture to be used to toggle between
+fullscreen and regular windowed mode.  The default is to not toggle when the
+gesture is used.
+
 
 INSTALLATION
 --------------

gui-osx-cocoa/main-cocoa.m

 /* symbols from fns.h that do not need the rest brought in */
 extern void		chandevinit(void);
 extern void		chandevreset(void);
-extern int errfmt(Fmt*);
 extern void	osinit(void);
 extern void		printinit(void);
 extern void		procinit0(void);
 
 int main(int argc, char *argv[])
 {
-	Proc *p;
-
 	/* store these to pass to cpumain */
 	threadargc = argc;
 	threadargv = argv;

gui-osx-cocoa/screen.m

 } in;
 
 void initcpu(void);
-
 void	topwin(void);
 
 static void hidebars(int);
 
 void _flushmemscreen(Rectangle r);
 
+NSDictionary*
+dtdefaults()
+{
+	NSUserDefaults *defaults;
+	NSDictionary *dict;
+	defaults = [NSUserDefaults standardUserDefaults];
+	dict = [defaults persistentDomainForName:@"com.bell-labs.plan9.drawterm"];
+	return dict;
+}
+
 @implementation appdelegate
 
 @synthesize arrowCursor = _arrowCursor;
 - (void)applicationDidFinishLaunching:(id)arg
 {
 	NSProcessInfo *pinfo;
-	NSUserDefaults *defaults;
 	NSDictionary *dict;
 
 	pinfo = [NSProcessInfo processInfo];
 	Winstyle = NSTitledWindowMask | NSClosableWindowMask |
 		NSMiniaturizableWindowMask | NSResizableWindowMask;
 
-	defaults = [NSUserDefaults standardUserDefaults];
-	dict = [defaults persistentDomainForName:@"com.bell-labs.plan9.drawterm"];
+	dict = dtdefaults();
 	if(dict != nil) {
 		id obj = [dict objectForKey:@"TitledWindow"];
 		if(obj != nil && ![obj boolValue])
 static void
 getgesture(NSEvent *e)
 {
+	NSDictionary *dict;
+	id obj;
+
+	dict = dtdefaults();
+
 	switch([e type]){
 	case NSEventTypeMagnify:
-		if(fabs([e magnification]) > Minpinch)
-			togglefs();
+		if(dict != nil && (obj = [dict objectForKey:@"MagnificationToggle"])){
+			if([obj boolValue] && (fabs([e magnification]) > Minpinch))
+				togglefs();
+		}
 		break;
 	}
 }