emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114113: * xterm.h (struct scroll_bar): Prefer int t


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114113: * xterm.h (struct scroll_bar): Prefer int to Lisp_Object
Date: Tue, 03 Sep 2013 09:44:01 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114113
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-09-03 13:35:47 +0400
message:
  * xterm.h (struct scroll_bar): Prefer int to Lisp_Object
  for 'dragging' member.
  * gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
  * xterm.c (xt_action_hook, xm_scroll_callback, xg_scroll_callback)
  (xg_end_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
  (x_set_toolkit_scroll_bar_thumb, x_scroll_bar_create)
  (x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
  (x_scroll_bar_handle_click, x_scroll_bar_note_movement)
  (x_scroll_bar_report_motion): Related users changed.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/gtkutil.c                  gtkutil.c-20091113204419-o5vbwnq5f7feedwu-2527
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
  src/xterm.h                    xterm.h-20091113204419-o5vbwnq5f7feedwu-228
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-09-03 06:56:25 +0000
+++ b/src/ChangeLog     2013-09-03 09:35:47 +0000
@@ -1,3 +1,15 @@
+2013-09-03  Dmitry Antipov  <address@hidden>
+
+       * xterm.h (struct scroll_bar): Prefer int to Lisp_Object
+       for 'dragging' member.
+       * gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
+       * xterm.c (xt_action_hook, xm_scroll_callback, xg_scroll_callback)
+       (xg_end_scroll_callback, xaw_jump_callback, xaw_scroll_callback)
+       (x_set_toolkit_scroll_bar_thumb, x_scroll_bar_create)
+       (x_scroll_bar_set_handle, XTset_vertical_scroll_bar)
+       (x_scroll_bar_handle_click, x_scroll_bar_note_movement)
+       (x_scroll_bar_report_motion): Related users changed.
+
 2013-09-03  Jan Djärv  <address@hidden>
 
        * nsfont.m (INVALID_GLYPH): New define.

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2013-08-29 07:27:27 +0000
+++ b/src/gtkutil.c     2013-09-03 09:35:47 +0000
@@ -3783,7 +3783,7 @@
 
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
 
-  if (wscroll && NILP (bar->dragging))
+  if (wscroll && bar->dragging == -1)
     {
       GtkAdjustment *adj;
       gdouble shown;

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-09-02 15:48:59 +0000
+++ b/src/xterm.c       2013-09-03 09:35:47 +0000
@@ -4141,9 +4141,9 @@
                               scroll_bar_end_scroll, 0, 0);
       w = XWINDOW (window_being_scrolled);
 
-      if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging))
+      if (XSCROLL_BAR (w->vertical_scroll_bar)->dragging != -1)
        {
-         XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil;
+         XSCROLL_BAR (w->vertical_scroll_bar)->dragging = -1;
          /* The thumb size is incorrect while dragging: fix it.  */
          set_vertical_scroll_bar (w);
        }
@@ -4281,32 +4281,32 @@
   switch (cs->reason)
     {
     case XmCR_DECREMENT:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_up_arrow;
       break;
 
     case XmCR_INCREMENT:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_down_arrow;
       break;
 
     case XmCR_PAGE_DECREMENT:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_above_handle;
       break;
 
     case XmCR_PAGE_INCREMENT:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_below_handle;
       break;
 
     case XmCR_TO_TOP:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_to_top;
       break;
 
     case XmCR_TO_BOTTOM:
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       part = scroll_bar_to_bottom;
       break;
 
@@ -4322,7 +4322,7 @@
        whole = XM_SB_MAX - slider_size;
        portion = min (cs->value, whole);
        part = scroll_bar_handle;
-       bar->dragging = make_number (cs->value);
+       bar->dragging = cs->value;
       }
       break;
 
@@ -4370,24 +4370,24 @@
           whole = gtk_adjustment_get_upper (adj) -
             gtk_adjustment_get_page_size (adj);
           portion = min ((int)position, whole);
-          bar->dragging = make_number ((int)portion);
+          bar->dragging = portion;
         }
       break;
     case GTK_SCROLL_STEP_BACKWARD:
       part = scroll_bar_up_arrow;
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       break;
     case GTK_SCROLL_STEP_FORWARD:
       part = scroll_bar_down_arrow;
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       break;
     case GTK_SCROLL_PAGE_BACKWARD:
       part = scroll_bar_above_handle;
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       break;
     case GTK_SCROLL_PAGE_FORWARD:
       part = scroll_bar_below_handle;
-      bar->dragging = Qnil;
+      bar->dragging = -1;
       break;
     }
 
@@ -4401,7 +4401,7 @@
   return FALSE;
 }
 
-/* Callback for button release. Sets dragging to Qnil when dragging is done.  
*/
+/* Callback for button release. Sets dragging to -1 when dragging is done.  */
 
 static gboolean
 xg_end_scroll_callback (GtkWidget *widget,
@@ -4409,7 +4409,7 @@
                         gpointer user_data)
 {
   struct scroll_bar *bar = user_data;
-  bar->dragging = Qnil;
+  bar->dragging = -1;
   if (WINDOWP (window_being_scrolled))
     {
       x_send_scroll_bar_event (window_being_scrolled,
@@ -4457,7 +4457,7 @@
     part = scroll_bar_handle;
 
   window_being_scrolled = bar->window;
-  bar->dragging = make_number (portion);
+  bar->dragging = portion;
   last_scroll_bar_part = part;
   x_send_scroll_bar_event (bar->window, part, portion, whole);
 }
@@ -4496,7 +4496,7 @@
     part = scroll_bar_move_ratio;
 
   window_being_scrolled = bar->window;
-  bar->dragging = Qnil;
+  bar->dragging = -1;
   last_scroll_bar_part = part;
   x_send_scroll_bar_event (bar->window, part, position, height);
 }
@@ -4772,7 +4772,7 @@
       shown = (float) portion / whole;
     }
 
-  if (NILP (bar->dragging))
+  if (bar->dragging == -1)
     {
       int size, value;
 
@@ -4807,7 +4807,7 @@
                   NULL);
 
     /* Massage the top+shown values.  */
-    if (NILP (bar->dragging) || last_scroll_bar_part == scroll_bar_down_arrow)
+    if (bar->dragging == -1 || last_scroll_bar_part == scroll_bar_down_arrow)
       top = max (0, min (1, top));
     else
       top = old_top;
@@ -4819,7 +4819,7 @@
        for `NARROWPROTO'.  See s/freebsd.h for an example.  */
     if (top != old_top || shown != old_shown)
       {
-       if (NILP (bar->dragging))
+       if (bar->dragging == -1)
          XawScrollbarSetThumb (widget, top, shown);
        else
          {
@@ -4910,7 +4910,7 @@
   bar->height = height;
   bar->start = 0;
   bar->end = 0;
-  bar->dragging = Qnil;
+  bar->dragging = -1;
   bar->fringe_extended_p = 0;
 
   /* Add bar to its frame's list of scroll bars.  */
@@ -4968,7 +4968,7 @@
 static void
 x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int 
rebuild)
 {
-  int dragging = ! NILP (bar->dragging);
+  bool dragging = bar->dragging != -1;
   Window w = bar->x_window;
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
   GC gc = f->output_data.x->normal_gc;
@@ -5261,7 +5261,7 @@
 #else /* not USE_TOOLKIT_SCROLL_BARS */
   /* Set the scroll bar's current state, unless we're currently being
      dragged.  */
-  if (NILP (bar->dragging))
+  if (bar->dragging == -1)
     {
       int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, height);
 
@@ -5471,14 +5471,13 @@
 
 #ifndef USE_TOOLKIT_SCROLL_BARS
     /* If the user has released the handle, set it to its final position.  */
-    if (event->type == ButtonRelease
-       && ! NILP (bar->dragging))
+    if (event->type == ButtonRelease && bar->dragging != -1)
       {
        int new_start = y - XINT (bar->dragging);
        int new_end = new_start + bar->end - bar->start;
 
        x_scroll_bar_set_handle (bar, new_start, new_end, 0);
-       bar->dragging = Qnil;
+       bar->dragging = -1;
       }
 #endif
 
@@ -5505,10 +5504,10 @@
   XSETVECTOR (last_mouse_scroll_bar, bar);
 
   /* If we're dragging the bar, display it.  */
-  if (! NILP (bar->dragging))
+  if (bar->dragging != -1)
     {
       /* Where should the handle be now?  */
-      int new_start = event->y - XINT (bar->dragging);
+      int new_start = event->y - bar->dragging;
 
       if (new_start != bar->start)
        {
@@ -5560,8 +5559,8 @@
 
       win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER;
 
-      if (! NILP (bar->dragging))
-       win_y -= XINT (bar->dragging);
+      if (bar->dragging != -1)
+       win_y -= bar->dragging;
 
       if (win_y < 0)
        win_y = 0;
@@ -5571,7 +5570,7 @@
       *fp = f;
       *bar_window = bar->window;
 
-      if (! NILP (bar->dragging))
+      if (bar->dragging != -1)
        *part = scroll_bar_handle;
       else if (win_y < bar->start)
        *part = scroll_bar_above_handle;

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2013-08-30 12:17:44 +0000
+++ b/src/xterm.h       2013-09-03 09:35:47 +0000
@@ -806,8 +806,8 @@
   /* If the scroll bar handle is currently being dragged by the user,
      this is the number of pixels from the top of the handle to the
      place where the user grabbed it.  If the handle isn't currently
-     being dragged, this is Qnil.  */
-  Lisp_Object dragging;
+     being dragged, this is -1.  */
+  int dragging;
 
   /* 1 if the background of the fringe that is adjacent to a scroll
      bar is extended to the gap between the fringe and the bar.  */


reply via email to

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