emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Mac port


From: YAMAMOTO Mitsuharu
Subject: Re: Emacs Mac port
Date: Tue, 16 Apr 2013 11:11:40 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Tue, 16 Apr 2013 09:17:33 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

>> Sorry, I don't understand.  I was asking why the code that makes
>> the corners of the window round cannot be run directly from the GUI
>> drawing code of the Mac display back-end, e.g., from the update_end
>> method.  Why does it _have_ to be run from the expose handler?

> I actually tried to round the bottom corners by calling some
> undocumented API from update_end_hook in the very first trial.
> Repeated rounding made the corner shaper because of anti-aliasing
> there.

s/shaper/sharper/

The attached images shows the difference.

PNG image

PNG image

Below is the patch of the first trial that I finally rejected myself,
against the previous version (emacs-24.3-mac-4.0) of the Mac port.

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/macappkit.h'
*** src/macappkit.h     2013-03-19 06:08:36 +0000
--- src/macappkit.h     2013-04-03 00:24:59 +0000
***************
*** 807,812 ****
--- 807,816 ----
  @end
  #endif
  
+ @interface NSWindow (Undocumented)
+ - (void)_maskRoundedBottomCorners:(NSRect)clipRect;
+ @end
+ 
  #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
  @interface NSMenu (AvailableOn1060AndLater)
  - (BOOL)popUpMenuPositioningItem:(NSMenuItem *)item

=== modified file 'src/macappkit.m'
*** src/macappkit.m     2013-04-03 00:08:55 +0000
--- src/macappkit.m     2013-04-03 00:24:59 +0000
***************
*** 3610,3615 ****
--- 3610,3616 ----
  
    unset_global_focus_view_frame ();
    [frameController unlockFocusOnEmacsView];
+   mac_mask_rounded_bottom_corners (f);
    [window enableFlushWindow];
  }
  
***************
*** 3715,3720 ****
--- 3716,3736 ----
    [frameController invalidateCursorRectsForEmacsView];
  }
  
+ void
+ mac_mask_rounded_bottom_corners (struct frame *f)
+ {
+   NSWindow *window = FRAME_MAC_WINDOW_OBJECT (f);
+ 
+   if ([window respondsToSelector:@selector(_maskRoundedBottomCorners:)])
+     {
+       NSView *contentView = [window contentView];
+       NSRect rect = [contentView visibleRect];
+ 
+       rect = [contentView convertRect:rect toView:nil];
+       [window _maskRoundedBottomCorners:rect];
+     }
+ }
+ 
  
  /************************************************************************
                           View and Drawing

=== modified file 'src/macterm.c'
*** src/macterm.c       2013-01-12 05:16:32 +0000
--- src/macterm.c       2013-04-03 00:24:59 +0000
***************
*** 2836,2841 ****
--- 2836,2842 ----
    block_input ();
  
    mac_invert_rectangles (f, rects, nrects);
+   mac_mask_rounded_bottom_corners (f);
  
    x_flush (f);
  
***************
*** 2863,2868 ****
--- 2864,2870 ----
    }
  
    mac_invert_rectangles (f, rects, nrects);
+   mac_mask_rounded_bottom_corners (f);
  
    x_flush (f);
  

=== modified file 'src/macterm.h'
*** src/macterm.h       2013-03-18 02:33:51 +0000
--- src/macterm.h       2013-04-03 00:24:59 +0000
***************
*** 651,656 ****
--- 651,657 ----
  
  extern int mac_tracking_area_works_with_cursor_rects_invalidation_p (void);
  extern void mac_invalidate_frame_cursor_rects (struct frame *f);
+ extern void mac_mask_rounded_bottom_corners (struct frame *);
  extern int mac_webkit_supports_svg_p (void);
  
  extern CFTypeRef mac_sound_create (Lisp_Object, Lisp_Object);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]