emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5a64d78 2/2: Merge branch 'master' of git.sv.gnu.or


From: Michael Albinus
Subject: [Emacs-diffs] master 5a64d78 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Tue, 14 Mar 2017 10:52:42 -0400 (EDT)

branch: master
commit 5a64d78854998c2ed6d9b8de1b593d8462b8fa39
Merge: a568d0a 726c6c9
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 src/nsimage.m |  14 --------
 src/nsmenu.m  |   5 ---
 src/nsterm.m  | 109 ++++++++++++++++++++++------------------------------------
 3 files changed, 41 insertions(+), 87 deletions(-)

diff --git a/src/nsimage.m b/src/nsimage.m
index 5136791..cc8abf7 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -179,13 +179,6 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
       return nil;
     }
 
-  /* The next two lines cause the DPI of the image to be ignored.
-     This seems to be the behavior users expect. */
-#ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
-  [image setScalesWhenResized: YES];
-#endif
-#endif
   [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
 
   [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
@@ -355,13 +348,6 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
           if ([bmr numberOfPlanes] >= 3)
               [bmr getBitmapDataPlanes: pixmapData];
 
-          /* The next two lines cause the DPI of the image to be ignored.
-             This seems to be the behavior users expect. */
-#ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
-          [self setScalesWhenResized: YES];
-#endif
-#endif
           [self setSize: NSMakeSize([bmr pixelsWide], [bmr pixelsHigh])];
 
           break;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 5c6442a..59ea385 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1519,11 +1519,6 @@ ns_popup_dialog (struct frame *f, Lisp_Object header, 
Lisp_Object contents)
   area.size.width = ICONSIZE;
   area.size.height= ICONSIZE;
   img = [[NSImage imageNamed: @"NSApplicationIcon"] copy];
-#ifdef NS_IMPL_COCOA
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
-  [img setScalesWhenResized: YES];
-#endif
-#endif
   [img setSize: NSMakeSize (ICONSIZE, ICONSIZE)];
   imgView = [[NSImageView alloc] initWithFrame: area];
   [imgView setImage: img];
diff --git a/src/nsterm.m b/src/nsterm.m
index f985786..b03ad52 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4108,9 +4108,6 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
   struct input_event event;
   char c;
 
-  NSDate *timeout_date = nil;
-  NSEvent *ns_event;
-
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
 
 #ifdef HAVE_NATIVE_FS
@@ -4168,69 +4165,70 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
       /* Inform fd_handler that select should be called */
       c = 'g';
       emacs_write_sig (selfds[1], &c, 1);
-
-      /* We rely on fd_handler timing out to cause
-         nextEventMatchingMask below to return, so set it's timeout to
-         an unreasonably long time. */
-      timeout_date = [NSDate distantFuture];
     }
   else if (nr == 0 && timeout)
     {
-      /* No file descriptor, just a timeout, no need to wake
-         fd_handler. Set nextEventMatchingMask timeout. */
+      /* No file descriptor, just a timeout, no need to wake fd_handler  */
       double time = timespectod (*timeout);
-      timeout_date = [NSDate dateWithTimeIntervalSinceNow: time];
+      timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time
+                                                      target: NSApp
+                                                    selector:
+                                  @selector (timeout_handler:)
+                                                    userInfo: 0
+                                                     repeats: NO]
+                      retain];
+    }
+  else /* No timeout and no file descriptors, can this happen?  */
+    {
+      /* Send appdefined so we exit from the loop */
+      ns_send_appdefined (-1);
     }
 
-  /* Listen for a new NSEvent. */
-  ns_event = [NSApp nextEventMatchingMask: NSEventMaskAny
-                                untilDate: timeout_date
-                                   inMode: NSDefaultRunLoopMode
-                                  dequeue: NO];
+  block_input ();
+  ns_init_events (&event);
+
+  [NSApp run];
 
+  ns_finish_events ();
   if (nr > 0 && readfds)
     {
       c = 's';
       emacs_write_sig (selfds[1], &c, 1);
     }
+  unblock_input ();
 
-  if (ns_event != nil)
+  t = last_appdefined_event_data;
+
+  if (t != NO_APPDEFINED_DATA)
     {
-      if ([ns_event type] == NSEventTypeApplicationDefined)
-        {
-          if ([ns_event data1] < 0)
-            {
-              /* The NX_APPDEFINED event we received was a timeout. */
-              result = 0;
-            }
-          else
-            {
-              /* Received back from select () in fd_handler; copy the results 
*/
-              pthread_mutex_lock (&select_mutex);
-              if (readfds) *readfds = select_readfds;
-              if (writefds) *writefds = select_writefds;
-              pthread_mutex_unlock (&select_mutex);
-              result = [ns_event data1];
-            }
+      last_appdefined_event_data = NO_APPDEFINED_DATA;
 
-          /* Remove the NX_APPDEFINED event from the queue as it's no
-             longer needed. */
-          [NSApp nextEventMatchingMask: NSEventMaskAny
-                             untilDate: nil
-                                inMode: NSDefaultRunLoopMode
-                               dequeue: YES];
+      if (t == -2)
+        {
+          /* The NX_APPDEFINED event we received was a timeout. */
+          result = 0;
         }
-      else
+      else if (t == -1)
         {
-          /* A real NSEvent came in. */
+          /* The NX_APPDEFINED event we received was the result of
+             at least one real input event arriving.  */
           errno = EINTR;
           result = -1;
         }
+      else
+        {
+          /* Received back from select () in fd_handler; copy the results */
+          pthread_mutex_lock (&select_mutex);
+          if (readfds) *readfds = select_readfds;
+          if (writefds) *writefds = select_writefds;
+          pthread_mutex_unlock (&select_mutex);
+          result = t;
+        }
     }
   else
     {
-      /* Reading from the NSEvent queue timed out. */
-      result = 0;
+      errno = EINTR;
+      result = -1;
     }
 
   return result;
@@ -5936,31 +5934,6 @@ not_in_argv (NSString *arg)
 }
 
 
-#ifdef NS_IMPL_COCOA
-/* Needed to pick up Ctrl-tab and possibly other events that Mac OS X
-   decided not to send key-down for.
-   See http://osdir.com/ml/editors.vim.mac/2007-10/msg00141.html
-   This only applies on Tiger and earlier.
-   If it matches one of these, send it on to keyDown. */
--(void)keyUp: (NSEvent *)theEvent
-{
-  int flags = [theEvent modifierFlags];
-  int code = [theEvent keyCode];
-
-  NSTRACE ("[EmacsView keyUp:]");
-
-  if (floor (NSAppKitVersionNumber) <= 824 /*NSAppKitVersionNumber10_4*/ &&
-      code == 0x30 && (flags & NSEventModifierFlagControl) && !(flags & 
NSEventModifierFlagCommand))
-    {
-      if (NS_KEYLOG)
-        fprintf (stderr, "keyUp: passed test");
-      ns_fake_keydown = YES;
-      [self keyDown: theEvent];
-    }
-}
-#endif
-
-
 /* <NSTextInput> implementation (called through super interpretKeyEvents:]). */
 
 



reply via email to

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