aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2012-10-07 11:17:17 +0200
committerJan Djärv2012-10-07 11:17:17 +0200
commit3bc0a2f7e99de90d469b55fcfc9f3f82a99eb0b9 (patch)
tree15b7f685a1da23c31599e837e0bf3b088cfe1470 /src
parent31bcb42062a9c80f9b7b6116a73353f37aac07f7 (diff)
downloademacs-3bc0a2f7e99de90d469b55fcfc9f3f82a99eb0b9.tar.gz
emacs-3bc0a2f7e99de90d469b55fcfc9f3f82a99eb0b9.zip
* nsfns.m (ns_in_resize): Remove.
(x_set_icon_name, ns_set_name, ns_set_name_as_filename): Remove ns_in_resize check. * nsterm.m (ns_in_resize): Remove. (ns_resize_handle_rect, mouseDown, mouseUp, mouseDragged): Remove. (ns_clear_frame, sendEvent, windowDidResize, drawRect:): Remove ns_in_resize check. (ns_clear_frame_area): Remove resize handle code. Fixes: debbugs:12479
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/nsfns.m10
-rw-r--r--src/nsterm.m136
3 files changed, 15 insertions, 143 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a30dde5e4ea..44dc7286278 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12012-10-07 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsterm.m (ns_in_resize): Remove (Bug#12479).
4 (ns_resize_handle_rect, mouseDown, mouseUp, mouseDragged): Remove.
5 (ns_clear_frame, sendEvent, windowDidResize, drawRect:): Remove ns_in_resize
6 check.
7 (ns_clear_frame_area): Remove resize handle code.
8
9 * nsfns.m (ns_in_resize): Remove.
10 (x_set_icon_name, ns_set_name, ns_set_name_as_filename): Remove ns_in_resize
11 check.
12
12012-10-07 Paul Eggert <eggert@cs.ucla.edu> 132012-10-07 Paul Eggert <eggert@cs.ucla.edu>
2 14
3 Improve sys_siglist detection. 15 Improve sys_siglist detection.
diff --git a/src/nsfns.m b/src/nsfns.m
index f22198401e0..d66b1c32b07 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -93,8 +93,6 @@ EmacsTooltip *ns_tooltip;
93/* Need forward declaration here to preserve organizational integrity of file */ 93/* Need forward declaration here to preserve organizational integrity of file */
94Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object); 94Lisp_Object Fx_open_connection (Lisp_Object, Lisp_Object, Lisp_Object);
95 95
96extern BOOL ns_in_resize;
97
98/* Static variables to handle applescript execution. */ 96/* Static variables to handle applescript execution. */
99static Lisp_Object as_script, *as_result; 97static Lisp_Object as_script, *as_result;
100static int as_status; 98static int as_status;
@@ -433,9 +431,6 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
433 NSView *view = FRAME_NS_VIEW (f); 431 NSView *view = FRAME_NS_VIEW (f);
434 NSTRACE (x_set_icon_name); 432 NSTRACE (x_set_icon_name);
435 433
436 if (ns_in_resize)
437 return;
438
439 /* see if it's changed */ 434 /* see if it's changed */
440 if (STRINGP (arg)) 435 if (STRINGP (arg))
441 { 436 {
@@ -511,9 +506,6 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
511{ 506{
512 NSTRACE (ns_set_name); 507 NSTRACE (ns_set_name);
513 508
514 if (ns_in_resize)
515 return;
516
517 /* Make sure that requests from lisp code override requests from 509 /* Make sure that requests from lisp code override requests from
518 Emacs redisplay code. */ 510 Emacs redisplay code. */
519 if (explicit) 511 if (explicit)
@@ -612,7 +604,7 @@ ns_set_name_as_filename (struct frame *f)
612 NSString *str; 604 NSString *str;
613 NSTRACE (ns_set_name_as_filename); 605 NSTRACE (ns_set_name_as_filename);
614 606
615 if (f->explicit_name || ! NILP (f->title) || ns_in_resize) 607 if (f->explicit_name || ! NILP (f->title))
616 return; 608 return;
617 609
618 block_input (); 610 block_input ();
diff --git a/src/nsterm.m b/src/nsterm.m
index 0d0be9281ee..75f33fea75e 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -183,7 +183,6 @@ static int ns_window_num = 0;
183static NSRect uRect; 183static NSRect uRect;
184#endif 184#endif
185static BOOL gsaved = NO; 185static BOOL gsaved = NO;
186BOOL ns_in_resize = NO;
187static BOOL ns_fake_keydown = NO; 186static BOOL ns_fake_keydown = NO;
188int ns_tmp_flags; /* FIXME */ 187int ns_tmp_flags; /* FIXME */
189struct nsfont_info *ns_tmp_font; /* FIXME */ 188struct nsfont_info *ns_tmp_font; /* FIXME */
@@ -493,17 +492,6 @@ ns_release_autorelease_pool (void *pool)
493 492
494 ========================================================================== */ 493 ========================================================================== */
495 494
496static NSRect
497ns_resize_handle_rect (NSWindow *window)
498{
499 NSRect r = [window frame];
500 r.origin.x = r.size.width - RESIZE_HANDLE_SIZE;
501 r.origin.y = 0;
502 r.size.width = r.size.height = RESIZE_HANDLE_SIZE;
503 return r;
504}
505
506
507// 495//
508// Window constraining 496// Window constraining
509// ------------------- 497// -------------------
@@ -1983,8 +1971,6 @@ ns_clear_frame (struct frame *f)
1983 NSRect r; 1971 NSRect r;
1984 1972
1985 NSTRACE (ns_clear_frame); 1973 NSTRACE (ns_clear_frame);
1986 if (ns_in_resize)
1987 return;
1988 1974
1989 /* comes on initial frame because we have 1975 /* comes on initial frame because we have
1990 after-make-frame-functions = select-frame */ 1976 after-make-frame-functions = select-frame */
@@ -2004,10 +1990,6 @@ ns_clear_frame (struct frame *f)
2004 NSRectFill (r); 1990 NSRectFill (r);
2005 ns_unfocus (f); 1991 ns_unfocus (f);
2006 1992
2007#ifdef NS_IMPL_COCOA
2008 [[view window] display]; /* redraw resize handle */
2009#endif
2010
2011 /* as of 2006/11 or so this is now needed */ 1993 /* as of 2006/11 or so this is now needed */
2012 ns_redraw_scroll_bars (f); 1994 ns_redraw_scroll_bars (f);
2013 unblock_input (); 1995 unblock_input ();
@@ -2033,35 +2015,8 @@ ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
2033 ns_focus (f, &r, 1); 2015 ns_focus (f, &r, 1);
2034 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set]; 2016 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
2035 2017
2036#ifdef NS_IMPL_COCOA
2037 {
2038 /* clip out the resize handle */
2039 NSWindow *window = [FRAME_NS_VIEW (f) window];
2040 NSRect ir
2041 = [view convertRect: ns_resize_handle_rect (window) fromView: nil];
2042
2043 ir = NSIntersectionRect (r, ir);
2044 if (NSIsEmptyRect (ir))
2045 {
2046#endif
2047
2048 NSRectFill (r); 2018 NSRectFill (r);
2049 2019
2050#ifdef NS_IMPL_COCOA
2051 }
2052 else
2053 {
2054 NSRect r1 = r, r2 = r; /* upper and lower non-intersecting */
2055 r1.size.height -= ir.size.height;
2056 r2.origin.y += r1.size.height;
2057 r2.size.width -= ir.size.width;
2058 r2.size.height = ir.size.height;
2059 NSRectFill (r1);
2060 NSRectFill (r2);
2061 }
2062 }
2063#endif
2064
2065 ns_unfocus (f); 2020 ns_unfocus (f);
2066 return; 2021 return;
2067} 2022}
@@ -4314,34 +4269,6 @@ ns_term_shutdown (int sig)
4314 return; 4269 return;
4315 } 4270 }
4316 4271
4317#ifdef NS_IMPL_COCOA
4318 /* pass mouse down in resize handle and subsequent drags directly to
4319 EmacsWindow so we can generate continuous redisplays */
4320 if (ns_in_resize)
4321 {
4322 if (type == NSLeftMouseDragged)
4323 {
4324 [window mouseDragged: theEvent];
4325 return;
4326 }
4327 else if (type == NSLeftMouseUp)
4328 {
4329 [window mouseUp: theEvent];
4330 return;
4331 }
4332 }
4333 else if (type == NSLeftMouseDown)
4334 {
4335 NSRect r = ns_resize_handle_rect (window);
4336 if (NSPointInRect ([theEvent locationInWindow], r))
4337 {
4338 ns_in_resize = YES;
4339 [window mouseDown: theEvent];
4340 return;
4341 }
4342 }
4343#endif
4344
4345 if (type == NSApplicationDefined) 4272 if (type == NSApplicationDefined)
4346 { 4273 {
4347 /* Events posted by ns_send_appdefined interrupt the run loop here. 4274 /* Events posted by ns_send_appdefined interrupt the run loop here.
@@ -5567,12 +5494,7 @@ not_in_argv (NSString *arg)
5567 5494
5568 if (cols > 0 && rows > 0) 5495 if (cols > 0 && rows > 0)
5569 { 5496 {
5570 if (ns_in_resize) 5497 [self updateFrameSize: YES];
5571 x_set_window_size (emacsframe, 0, cols, rows);
5572 else
5573 {
5574 [self updateFrameSize: YES];
5575 }
5576 } 5498 }
5577 5499
5578 ns_send_appdefined (-1); 5500 ns_send_appdefined (-1);
@@ -6198,7 +6120,7 @@ not_in_argv (NSString *arg)
6198 6120
6199 NSTRACE (drawRect); 6121 NSTRACE (drawRect);
6200 6122
6201 if (!emacsframe || !emacsframe->output_data.ns || ns_in_resize) 6123 if (!emacsframe || !emacsframe->output_data.ns)
6202 return; 6124 return;
6203 6125
6204 ns_clear_frame_area (emacsframe, x, y, width, height); 6126 ns_clear_frame_area (emacsframe, x, y, width, height);
@@ -6535,60 +6457,6 @@ not_in_argv (NSString *arg)
6535 return [super constrainFrameRect:frameRect toScreen:screen]; 6457 return [super constrainFrameRect:frameRect toScreen:screen];
6536} 6458}
6537 6459
6538
6539/* called only on resize clicks by special case in EmacsApp-sendEvent */
6540- (void)mouseDown: (NSEvent *)theEvent
6541{
6542 if (ns_in_resize)
6543 {
6544 NSSize size = [[theEvent window] frame].size;
6545 grabOffset = [theEvent locationInWindow];
6546 grabOffset.x = size.width - grabOffset.x;
6547 }
6548 else
6549 [super mouseDown: theEvent];
6550}
6551
6552
6553/* stop resizing */
6554- (void)mouseUp: (NSEvent *)theEvent
6555{
6556 if (ns_in_resize)
6557 {
6558 struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
6559 ns_in_resize = NO;
6560 ns_set_name_as_filename (f);
6561 [self display];
6562 ns_send_appdefined (-1);
6563 }
6564 else
6565 [super mouseUp: theEvent];
6566}
6567
6568
6569/* send resize events */
6570- (void)mouseDragged: (NSEvent *)theEvent
6571{
6572 if (ns_in_resize)
6573 {
6574 NSPoint p = [theEvent locationInWindow];
6575 NSSize size, vettedSize, origSize = [self frame].size;
6576
6577 size.width = p.x + grabOffset.x;
6578 size.height = origSize.height - p.y + grabOffset.y;
6579
6580 if (size.width == origSize.width && size.height == origSize.height)
6581 return;
6582
6583 vettedSize = [[self delegate] windowWillResize: self toSize: size];
6584 [[NSNotificationCenter defaultCenter]
6585 postNotificationName: NSWindowDidResizeNotification
6586 object: self];
6587 }
6588 else
6589 [super mouseDragged: theEvent];
6590}
6591
6592@end /* EmacsWindow */ 6460@end /* EmacsWindow */
6593 6461
6594 6462