emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r110524: * nsterm.m (hold_event_q): N


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110524: * nsterm.m (hold_event_q): New static variable.
Date: Fri, 12 Oct 2012 19:50:39 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110524
fixes bug: http://debbugs.gnu.org/12384
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Fri 2012-10-12 19:50:39 +0200
message:
  * nsterm.m (hold_event_q): New static variable.
  (EV_TRAILER, sendScrollEventAtLoc:fromEvent:): Call hold_event if
  ! q_event_ptr.
  (hold_event): New function.
  (ns_read_socket): If hold_event_q have events, store them and
  return.
  (setPosition:portion:whole:): Send SIGIO to ourselves if apploopnr
  is zero (Bug#12384).
modified:
  src/ChangeLog
  src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-10-12 16:32:40 +0000
+++ b/src/ChangeLog     2012-10-12 17:50:39 +0000
@@ -1,3 +1,14 @@
+2012-10-12  Jan Djärv  <address@hidden>
+
+       * nsterm.m (hold_event_q): New static variable.
+       (EV_TRAILER, sendScrollEventAtLoc:fromEvent:): Call hold_event if
+       ! q_event_ptr.
+       (hold_event): New function.
+       (ns_read_socket): If hold_event_q have events, store them and
+       return (Bug#12384).
+       (setPosition:portion:whole:): Send SIGIO to ourselves if apploopnr
+       is zero (Bug#12384).
+
 2012-10-12  Juanma Barranquero  <address@hidden>
 
        * makefile.w32-in ($(BLD)/w32select.$(O)): Update dependencies.

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2012-10-10 15:10:57 +0000
+++ b/src/nsterm.m      2012-10-12 17:50:39 +0000
@@ -208,6 +208,13 @@
   *ns_pending_service_args;
 static BOOL ns_do_open_file = NO;
 
+static struct {
+  struct input_event *q;
+  int nr, cap;
+} hold_event_q = {
+  NULL, 0, 0
+};
+
 /* Convert modifiers in a NeXTstep event to emacs style modifiers.  */
 #define NS_FUNCTION_KEY_MASK 0x800000
 #define NSLeftControlKeyMask    (0x000001 | NSControlKeyMask)
@@ -273,7 +280,7 @@
           kbd_buffer_store_event_hold (emacs_event, q_event_ptr);       \
         }                                                               \
       else                                                              \
-        kbd_buffer_store_event (emacs_event);                           \
+        hold_event (emacs_event);                                       \
       EVENT_INIT (*emacs_event);                                        \
       ns_send_appdefined (-1);                                          \
     }
@@ -292,6 +299,19 @@
 
    ========================================================================== 
*/
 
+static void
+hold_event (struct input_event *event)
+{
+  if (hold_event_q.nr == hold_event_q.cap)
+    {
+      if (hold_event_q.cap == 0) hold_event_q.cap = 10;
+      else hold_event_q.cap *= 2;
+      hold_event_q.q = (struct input_event *)
+        xrealloc (hold_event_q.q, hold_event_q.cap * sizeof (*hold_event_q.q));
+    }
+
+  hold_event_q.q[hold_event_q.nr++] = *event;
+}
 
 static Lisp_Object
 append2 (Lisp_Object list, Lisp_Object item)
@@ -3348,6 +3368,15 @@
   if ([NSApp modalWindow] != nil)
     return -1;
 
+  if (hold_event_q.nr > 0) 
+    {
+      int i;
+      for (i = 0; i < hold_event_q.nr; ++i)
+        kbd_buffer_store_event_hold (&hold_event_q.q[i], hold_quit);
+      hold_event_q.nr = 0;
+      return i;
+    }
+
   block_input ();
   n_emacs_events_pending = 0;
   EVENT_INIT (ev);
@@ -6645,6 +6674,12 @@
       [self setFloatValue: pos knobProportion: por];
 #endif
     }
+
+  /* Events may come here even if the event loop is not running.
+     If we don't enter the event loop, the scroll bar will not update.
+     So send SIGIO to ourselves.  */
+  if (apploopnr == 0) kill (0, SIGIO);
+
   return self;
 }
 
@@ -6685,7 +6720,7 @@
       kbd_buffer_store_event_hold (emacs_event, q_event_ptr);
     }
   else
-    kbd_buffer_store_event (emacs_event);
+    hold_event (emacs_event);
   EVENT_INIT (*emacs_event);
   ns_send_appdefined (-1);
 }


reply via email to

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