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: Mon, 06 Oct 2014 17:21:22 +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 Mon, 06 Oct 2014 13:21:10 +0900 (JST), Kazu Yamamoto (山本和彦) 
>>>>> <address@hidden> said:

> However, I noticed two bugs so far. I would like to report one of
> them here. I'm using two Mavericks. emacs-24.3.94-mac-4.94 gets a
> segfault if it is operated through Mac's *screen share*.

> I can reproduce this bug 100%. And I confirmed that this bug does
> not exist in pure emacs-24.3.94.

I could reproduce the bug, and it is a regression introduced in
emacs-24.3.91-mac-4.91 .  Please try the patch below.

Thanks for reporting this.  Next time, please report Mac port specific
bugs to address@hidden as guided with
M-x report-emacs-bug RET.

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/macappkit.h'
*** src/macappkit.h     2014-10-02 03:58:26 +0000
--- src/macappkit.h     2014-10-06 08:14:09 +0000
***************
*** 975,980 ****
--- 975,981 ----
  #if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
  @interface NSEvent (AvailableOn1050AndLater)
  - (CGEventRef)CGEvent;
+ - (const void * /* EventRef */)eventRef;
  @end
  #endif
  

=== modified file 'src/macappkit.m'
*** src/macappkit.m     2014-10-02 03:58:26 +0000
--- src/macappkit.m     2014-10-06 08:14:09 +0000
***************
*** 318,323 ****
--- 318,342 ----
                  pressure:[self pressure]];
  }
  
+ static void
+ mac_cgevent_set_unicode_string_from_event_ref (CGEventRef cgevent,
+                                              EventRef eventRef)
+ {
+   ByteCount size;
+ 
+   if (GetEventParameter (eventRef, kEventParamKeyUnicodes,
+                        typeUnicodeText, NULL, 0, &size, NULL) == noErr)
+     {
+       UniChar *text = alloca (size);
+ 
+       if (GetEventParameter (eventRef, kEventParamKeyUnicodes,
+                            typeUnicodeText, NULL, size, NULL,
+                            text) == noErr)
+       CGEventKeyboardSetUnicodeString (cgevent, size / sizeof (UniChar),
+                                        text);
+     }
+ }
+ 
  - (CGEventRef)coreGraphicsEvent
  {
    CGEventRef event;
***************
*** 328,334 ****
      {
        event = [self CGEvent];
        if (event)
!       return event;
      }
  
    /* Workaround for a bug on Mac OS X 10.4.  */
--- 347,370 ----
      {
        event = [self CGEvent];
        if (event)
!       {
!         /* Unicode string is not set if the keyboard event comes
!            from Screen Sharing on Mac OS X 10.6 and later.  */
!         if (NSEventMaskFromType ([self type]) & (NSKeyDownMask | NSKeyUpMask))
!           {
!             UniCharCount length;
! 
!             CGEventKeyboardGetUnicodeString (event, 0, &length, NULL);
!             if (length == 0)
!               {
!                 EventRef eventRef = (EventRef) [self eventRef];
! 
!                 mac_cgevent_set_unicode_string_from_event_ref (event,
!                                                                eventRef);
!               }
!           }
!         return event;
!       }
      }
  
    /* Workaround for a bug on Mac OS X 10.4.  */
***************
*** 369,389 ****
  #if __LP64__
        /* This seems to be unnecessary for 32-bit executables.  */
        {
-       ByteCount size;
        UInt32 keyboard_type;
        EventRef eventRef = (EventRef) [self eventRef];
  
!       if (GetEventParameter (eventRef, kEventParamKeyUnicodes,
!                              typeUnicodeText, NULL, 0, &size, NULL) == noErr)
!         {
!           UniChar *text = alloca (size);
! 
!           if (GetEventParameter (eventRef, kEventParamKeyUnicodes,
!                                  typeUnicodeText, NULL, size, NULL,
!                                  text) == noErr)
!             CGEventKeyboardSetUnicodeString (event, size / sizeof (UniChar),
!                                              text);
!         }
        if (GetEventParameter (eventRef, kEventParamKeyboardType,
                               typeUInt32, NULL, sizeof (UInt32), NULL,
                               &keyboard_type) == noErr)
--- 405,414 ----
  #if __LP64__
        /* This seems to be unnecessary for 32-bit executables.  */
        {
        UInt32 keyboard_type;
        EventRef eventRef = (EventRef) [self eventRef];
  
!       mac_cgevent_set_unicode_string_from_event_ref (event, eventRef);
        if (GetEventParameter (eventRef, kEventParamKeyboardType,
                               typeUInt32, NULL, sizeof (UInt32), NULL,
                               &keyboard_type) == noErr)




reply via email to

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