emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] xwidget_mvp 5f55a43 1/2: Cleanups


From: Joakim Verona
Subject: [Emacs-diffs] xwidget_mvp 5f55a43 1/2: Cleanups
Date: Thu, 12 Feb 2015 21:50:53 +0000

branch: xwidget_mvp
commit 5f55a4394c59a3cc5b792daed5c7372e8f88fc54
Author: Joakim Verona <address@hidden>
Commit: Joakim Verona <address@hidden>

    Cleanups
    
    Mostly as adviced by Paul Eggert.
---
 configure.ac        |   28 +++---
 src/dispextern.h    |    9 +-
 src/emacs.c         |    2 +-
 src/emacsgtkfixed.c |   59 +++--------
 src/keyboard.c      |    7 +-
 src/lisp.h          |    1 +
 src/termhooks.h     |    1 +
 src/window.c        |    2 +-
 src/xdisp.c         |   73 ++++++-------
 src/xterm.c         |    9 +-
 src/xwidget.c       |  277 +++++++++++++++++++++------------------------------
 11 files changed, 193 insertions(+), 275 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3874cf1..4e3fa1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -374,7 +374,8 @@ otherwise for the first of `gfile' or `inotify' that is 
usable.])
  ],
  [with_file_notification=$with_features])
 
-OPTION_DEFAULT_OFF([xwidgets],[enable use of some gtk widgets in Emacs 
buffers])
+OPTION_DEFAULT_OFF([xwidgets],
+  [enable use of some gtk widgets in Emacs buffers])
 
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
@@ -2529,23 +2530,24 @@ HAVE_XWIDGETS=no
 HAVE_WEBKIT=no
 HAVE_GIR=no
 
-if test "${with_xwidgets}" != "no" && test "${USE_GTK_TOOLKIT}" = "GTK3"  && 
test "$window_system" != "none" ; then
-   echo "xwidgets enabled, checking webkit, and others"
-   HAVE_XWIDGETS=yes
-   AC_DEFINE(HAVE_XWIDGETS, 1, [Define to 1 if you have xwidgets support.])
-dnl xwidgets
-dnl - enable only if GTK3 is enabled, and we have a window system
-dnl - check for webkit and gobject introspection
+if test "$with_xwidgets" != "no" && test "$USE_GTK_TOOLKIT" = "GTK3" &&
+   test "$window_system" != "none"
+then
+  HAVE_XWIDGETS=yes
+  AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
 
-
-#webkit version for gtk3.
+  dnl xwidgets
+  dnl - enable only if GTK3 is enabled, and we have a window system
+  dnl - check for webkit and gobject introspection
+  dnl webkit version for gtk3.
   WEBKIT_REQUIRED=1.4.0
   WEBKIT_MODULES="webkitgtk-3.0 >= $WEBKIT_REQUIRED"
 
   if test "${with_gtk3}" = "yes"; then
     PKG_CHECK_MODULES(WEBKIT, $WEBKIT_MODULES, HAVE_WEBKIT=yes, HAVE_WEBKIT=no)
     if test $HAVE_WEBKIT = yes; then
-        AC_DEFINE(HAVE_WEBKIT_OSR, 1, [Define to 1 if you have webkit_osr 
support.])
+        AC_DEFINE([HAVE_WEBKIT_OSR], 1,
+         [Define to 1 if you have webkit_osr support.])
     fi
   fi
 
@@ -2553,10 +2555,8 @@ dnl - check for webkit and gobject introspection
   GIR_MODULES="gobject-introspection-1.0 >= $GIR_REQUIRED"
   PKG_CHECK_MODULES(GIR, $GIR_MODULES, HAVE_GIR=yes, HAVE_GIR=no)
   if test $HAVE_GIR = yes; then
-     AC_DEFINE(HAVE_GIR, 1, [Define to 1 if you have GIR support.])
+     AC_DEFINE([HAVE_GIR], 1, [Define to 1 if you have GIR support.])
   fi
-
-
 fi
 
 CFLAGS=$OLD_CFLAGS
diff --git a/src/dispextern.h b/src/dispextern.h
index 5ec1b37..2d0db35 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -504,7 +504,7 @@ struct glyph
     int img_id;
 
 #ifdef HAVE_XWIDGETS
-    struct xwidget* xwidget;
+    struct xwidget *xwidget;
 #endif
     /* Sub-structure for type == STRETCH_GLYPH.  */
     struct
@@ -1358,7 +1358,7 @@ struct glyph_string
   struct image *img;
 
 #ifdef HAVE_XWIDGETS
-  struct xwidget* xwidget;
+  struct xwidget *xwidget;
 #endif
   /* Slice */
   struct glyph_slice slice;
@@ -2526,9 +2526,10 @@ struct it
   ptrdiff_t image_id;
 
 #ifdef HAVE_XWIDGETS
-  /* If what == IT_XWIDGET*/
-  struct xwidget* xwidget;
+  /* If what == IT_XWIDGET.  */
+  struct xwidget *xwidget;
 #endif
+
   /* Values from `slice' property.  */
   struct it_slice slice;
 
diff --git a/src/emacs.c b/src/emacs.c
index 0b92752..7bcc512 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1438,7 +1438,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       syms_of_xmenu ();
       syms_of_fontset ();
 #ifdef HAVE_XWIDGETS
-      syms_of_xwidget();
+      syms_of_xwidget ();
 #endif
       syms_of_xsettings ();
 #ifdef HAVE_X_SM
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index 76b169d..c83d42a 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -34,27 +34,10 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 # pragma GCC diagnostic ignored "-Wunused-local-typedefs"
 #endif
 
-//#define EMACS_TYPE_FIXED emacs_fixed_get_type ()
-/* #define EMACS_FIXED(obj) \ */
-/*   G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed) */
-
 typedef struct _EmacsFixed EmacsFixed;
 typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
 typedef struct _EmacsFixedClass EmacsFixedClass;
 
-/* struct _EmacsFixed */
-/* { */
-/*   GtkFixed container; */
-
-/*   /\*< private >*\/ */
-/*   EmacsFixedPrivate *priv; */
-/* }; */
-
-/* struct _EmacsFixedClass */
-/* { */
-/*   GtkFixedClass parent_class; */
-/* }; */
-
 struct _EmacsFixedPrivate
 {
   struct frame *f;
@@ -84,11 +67,6 @@ static void emacs_fixed_gtk_widget_size_allocate (GtkWidget 
*widget,
   EmacsFixedClass *klass;
   GtkWidgetClass *parent_class;
   struct GtkFixedPrivateL* priv;
-  GtkFixedChild *child;
-  GtkAllocation child_allocation;
-  GtkRequisition child_requisition;
-  GList *children;
-  struct xwidget_view* xv;
 
   klass = EMACS_FIXED_GET_CLASS (widget);
   parent_class = g_type_class_peek_parent (klass);
@@ -110,16 +88,17 @@ static void emacs_fixed_gtk_widget_size_allocate 
(GtkWidget *widget,
                                 allocation->height);
     }
 
-  for (children = priv->children;
-       children;
-       children = children->next)
+  for (GList *children = priv->children; children; children = children->next)
     {
-      child = children->data;
+      GtkFixedChild *child = children->data;
 
       if (!gtk_widget_get_visible (child->widget))
         continue;
 
+      GtkRequisition child_requisition;
       gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
+
+      GtkAllocation child_allocation;
       child_allocation.x = child->x;
       child_allocation.y = child->y;
 
@@ -132,17 +111,16 @@ static void emacs_fixed_gtk_widget_size_allocate 
(GtkWidget *widget,
       child_allocation.width = child_requisition.width;
       child_allocation.height = child_requisition.height;
 
+      struct xwidget_view *xv
+       = g_object_get_data (G_OBJECT (child->widget), XG_XWIDGET_VIEW);
+      if (xv)
+       {
+         child_allocation.width = xv->clip_right;
+         child_allocation.height = xv->clip_bottom - xv->clip_top;
+       }
 
-
-      xv = (struct xwidget_view*) g_object_get_data (G_OBJECT (child->widget), 
XG_XWIDGET_VIEW);
-      if(xv){
-        child_allocation.width = xv->clip_right;
-        child_allocation.height = xv->clip_bottom - xv->clip_top;
-      }
       gtk_widget_size_allocate (child->widget, &child_allocation);
-
     }
-
 }
 
 #endif  /* HAVE_XWIDGETS */
@@ -150,14 +128,12 @@ static void emacs_fixed_gtk_widget_size_allocate 
(GtkWidget *widget,
 static void
 emacs_fixed_class_init (EmacsFixedClass *klass)
 {
-  GtkWidgetClass *widget_class;
-
-  widget_class = (GtkWidgetClass*) klass;
+  GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
 
   widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
   widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
 #ifdef HAVE_XWIDGETS
-  widget_class->size_allocate =  emacs_fixed_gtk_widget_size_allocate;
+  widget_class->size_allocate = emacs_fixed_gtk_widget_size_allocate;
 #endif
   g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
 }
@@ -178,7 +154,7 @@ emacs_fixed_init (EmacsFixed *fixed)
  *
  * Returns: a new #EmacsFixed.
  */
-GtkWidget*
+GtkWidget *
 emacs_fixed_new (struct frame *f)
 {
   EmacsFixed *fixed = g_object_new (EMACS_TYPE_FIXED, NULL);
@@ -217,10 +193,7 @@ emacs_fixed_get_preferred_height (GtkWidget *widget,
    (Bug#8919), and so users can resize our frames as they wish.  */
 
 void
-XSetWMSizeHints (Display* d,
-                 Window w,
-                 XSizeHints* hints,
-                 Atom prop)
+XSetWMSizeHints (Display *d, Window w, XSizeHints* hints, Atom prop)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (d);
   struct frame *f = x_top_window_to_frame (dpyinfo, w);
diff --git a/src/keyboard.c b/src/keyboard.c
index a9ff77d..860617b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6087,9 +6087,9 @@ make_lispy_event (struct input_event *event)
 #ifdef HAVE_XWIDGETS
     case XWIDGET_EVENT:
       {
-        return  Fcons (Qxwidget_event,event->arg);
+        return Fcons (Qxwidget_event,event->arg);
       }
-#endif /* HAVE_XWIDGETS */
+#endif
 
 
 #if defined HAVE_GFILENOTIFY || defined HAVE_INOTIFY
@@ -11111,7 +11111,8 @@ syms_of_keyboard (void)
 
 #ifdef HAVE_XWIDGETS
   DEFSYM (Qxwidget_event,"xwidget-event");
-#endif /* HAVE_XWIDGETS */
+#endif
+
 #ifdef USE_FILE_NOTIFY
   DEFSYM (Qfile_notify, "file-notify");
 #endif /* USE_FILE_NOTIFY */
diff --git a/src/lisp.h b/src/lisp.h
index 87bc3ef..2da142b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -781,6 +781,7 @@ enum pvec_type
   PVEC_WINDOW_CONFIGURATION,
   PVEC_SUBR,
   PVEC_OTHER,
+
 #ifdef HAVE_XWIDGETS
   PVEC_XWIDGET,
   PVEC_XWIDGET_VIEW,
diff --git a/src/termhooks.h b/src/termhooks.h
index 58ae239..d65d5ba 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -240,6 +240,7 @@ enum event_kind
   /* events generated by xwidgets*/
    , XWIDGET_EVENT
 #endif
+
 #ifdef USE_FILE_NOTIFY
   /* File or directory was changed.  */
   , FILE_NOTIFY_EVENT
diff --git a/src/window.c b/src/window.c
index 1c94d7b..e261846 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4563,7 +4563,7 @@ Signal an error when WINDOW is the only window on its 
frame.  */)
       /* Block input.  */
       block_input ();
 #ifdef HAVE_XWIDGETS
-      xwidget_view_delete_all_in_window(w);
+      xwidget_view_delete_all_in_window (w);
 #endif
       window_resize_apply (p, horflag);
       /* If this window is referred to by the dpyinfo's mouse
diff --git a/src/xdisp.c b/src/xdisp.c
index 17458bf..d3cbd25 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -846,7 +846,7 @@ static int next_element_from_buffer (struct it *);
 static int next_element_from_composition (struct it *);
 static int next_element_from_image (struct it *);
 #ifdef HAVE_XWIDGETS
- static int next_element_from_xwidget(struct it *);
+static int next_element_from_xwidget (struct it *);
 #endif
 static int next_element_from_stretch (struct it *);
 static void load_overlay_strings (struct it *, ptrdiff_t);
@@ -5136,7 +5136,7 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
              || (CONSP (value) && EQ (XCAR (value), Qspace))
 #ifdef HAVE_XWIDGETS
              || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p)
-                && valid_xwidget_spec_p(value))
+                && valid_xwidget_spec_p (value))
 #endif
              );
 
@@ -5221,7 +5221,6 @@ handle_single_display_spec (struct it *it, Lisp_Object 
spec, Lisp_Object object,
           it->position = start_pos;
          it->object = NILP (object) ? it->w->contents : object;
          *position = start_pos;
-
           it->xwidget = lookup_xwidget(value);
        }
 #endif
@@ -6725,9 +6724,9 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct 
it *it) =
   next_element_from_string,
   next_element_from_c_string,
   next_element_from_image,
-  next_element_from_stretch
+  next_element_from_stretch,
 #ifdef HAVE_XWIDGETS
-  ,next_element_from_xwidget
+  next_element_from_xwidget,
 #endif
 };
 
@@ -8041,7 +8040,7 @@ next_element_from_image (struct it *it)
 }
 
 #ifdef HAVE_XWIDGETS
-/* im not sure about this FIXME JAVE*/
+/* I'm not sure about this.  FIXME JAVE */
 static int
 next_element_from_xwidget (struct it *it)
 {
@@ -24088,13 +24087,13 @@ calc_pixel_width_or_height (double *res, struct it 
*it, Lisp_Object prop,
 
              return OK_PIXELS (width_p ? img->width : img->height);
            }
-#ifdef HAVE_XWIDGETS
+# ifdef HAVE_XWIDGETS
          if (FRAME_WINDOW_P (it->f) && valid_xwidget_spec_p (prop))
            {
-              //TODO dont return dummy size
-              return OK_PIXELS (width_p ? 100 : 100);
+              // TODO: Don't return dummy size.
+              return OK_PIXELS (100);
             }
-#endif
+# endif
 #endif
          if (EQ (car, Qplus) || EQ (car, Qminus))
            {
@@ -24940,15 +24939,15 @@ compute_overhangs_and_x (struct glyph_string *s, int 
x, int backward_p)
 #ifdef HAVE_XWIDGETS
 #define BUILD_XWIDGET_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
      do                                                                        
\
-       { \
-        s = (struct glyph_string *) alloca (sizeof *s);                \
+       {                                                               \
+        s = alloca (sizeof *s);                                        \
         INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL);          \
         fill_xwidget_glyph_string (s);                                 \
-        append_glyph_string (&HEAD, &TAIL, s);                         \
-        ++START;                                                       \
+        append_glyph_string (&(HEAD), &(TAIL), s);                     \
+        ++(START);                                                     \
          s->x = (X);                                                   \
        }                                                               \
-     while (0)
+     while (false)
 #endif
 
 
@@ -25105,11 +25104,13 @@ compute_overhangs_and_x (struct glyph_string *s, int 
x, int backward_p)
                                        HL, X, LAST_X);                 \
              break;
 
-#define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X)  \
+#ifdef HAVE_XWIDGETS
+# define BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X) \
             case XWIDGET_GLYPH:                                         \
               BUILD_XWIDGET_GLYPH_STRING (START, END, HEAD, TAIL,       \
                                           HL, X, LAST_X);               \
               break;
+#endif
 
 #define BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)   \
            case GLYPHLESS_GLYPH:                                       \
@@ -25131,14 +25132,14 @@ compute_overhangs_and_x (struct glyph_string *s, int 
x, int backward_p)
 
 
 #ifdef HAVE_XWIDGETS
-#define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X)     \
-BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X)   \
-BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X)  \
-BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
+# define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X)    \
+    BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X)       \
+    BUILD_GLYPH_STRINGS_XW(START, END, HEAD, TAIL, HL, X, LAST_X)      \
+    BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
 #else
-#define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X)     \
-BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X)   \
-BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
+# define BUILD_GLYPH_STRINGS(START, END, HEAD, TAIL, HL, X, LAST_X)    \
+    BUILD_GLYPH_STRINGS_1(START, END, HEAD, TAIL, HL, X, LAST_X)       \
+    BUILD_GLYPH_STRINGS_2(START, END, HEAD, TAIL, HL, X, LAST_X)
 #endif
 
 
@@ -25784,12 +25785,11 @@ produce_image_glyph (struct it *it)
 static void
 produce_xwidget_glyph (struct it *it)
 {
-  struct xwidget* xw;
-  struct face *face;
+  struct xwidget *xw;
   int glyph_ascent, crop;
   eassert (it->what == IT_XWIDGET);
 
-  face = FACE_FROM_ID (it->f, it->face_id);
+  struct face *face = FACE_FROM_ID (it->f, it->face_id);
   eassert (face);
   /* Make sure X resources of the face is loaded.  */
   prepare_face_for_display (it->f, face);
@@ -25810,8 +25810,8 @@ produce_xwidget_glyph (struct it *it)
     {
       if (face->box_line_width > 0)
        {
-           it->ascent += face->box_line_width;
-           it->descent += face->box_line_width;
+         it->ascent += face->box_line_width;
+         it->descent += face->box_line_width;
        }
 
       if (it->start_of_box_run_p)
@@ -25823,18 +25823,16 @@ produce_xwidget_glyph (struct it *it)
 
   /* Automatically crop wide image glyphs at right edge so we can
      draw the cursor on same display row.  */
-  if ((crop = it->pixel_width - (it->last_visible_x - it->current_x), crop > 0)
-      && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4))
-    {
-      it->pixel_width -= crop;
-    }
+  crop = it->pixel_width - (it->last_visible_x - it->current_x);
+  if (crop > 0 && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4))
+    it->pixel_width -= crop;
 
   if (it->glyph_row)
     {
-      struct glyph *glyph;
       enum glyph_row_area area = it->area;
+      struct glyph *glyph
+       = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
 
-      glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
       if (it->glyph_row->reversed_p)
        {
          struct glyph *g;
@@ -25872,7 +25870,6 @@ produce_xwidget_glyph (struct it *it)
          glyph->glyph_not_available_p = 0;
          glyph->face_id = it->face_id;
           glyph->u.xwidget = it->xwidget;
-          
//assert_valid_xwidget_id(glyph->u.xwidget_id,"produce_xwidget_glyph");
          glyph->font_type = FONT_TYPE_UNKNOWN;
          if (it->bidi_p)
            {
@@ -27600,11 +27597,9 @@ get_window_cursor_type (struct window *w, struct glyph 
*glyph, int *width,
   /* Use normal cursor if not blinked off.  */
   if (!w->cursor_off_p)
     {
-
 #ifdef HAVE_XWIDGETS
-      if (glyph != NULL && glyph->type == XWIDGET_GLYPH){
+      if (glyph != NULL && glyph->type == XWIDGET_GLYPH)
         return NO_CURSOR;
-      }
 #endif
       if (glyph != NULL && glyph->type == IMAGE_GLYPH)
        {
diff --git a/src/xterm.c b/src/xterm.c
index 37784d3..0f425e6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2681,11 +2681,10 @@ x_draw_glyph_string (struct glyph_string *s)
 
 #ifdef HAVE_XWIDGETS
     case XWIDGET_GLYPH:
-      //erase xwidget background
-      //x_draw_glyph_string_background (s, 0);
       x_draw_xwidget_glyph_string (s);
       break;
 #endif
+
     case STRETCH_GLYPH:
       x_draw_stretch_glyph_string (s);
       break;
@@ -8031,10 +8030,10 @@ x_draw_bar_cursor (struct window *w, struct glyph_row 
*row, int width, enum text
     return;
 
 #ifdef HAVE_XWIDGETS
-  if (cursor_glyph->type == XWIDGET_GLYPH){
-    return; //experimental avoidance of cursor on xwidget
-  }
+  if (cursor_glyph->type == XWIDGET_GLYPH)
+    return; // Experimental avoidance of cursor on xwidget.
 #endif
+
   /* If on an image, draw like a normal cursor.  That's usually better
      visible than drawing a bar, esp. if the image is large so that
      the bar might not be in the window.  */
diff --git a/src/xwidget.c b/src/xwidget.c
index 282caa2..bde7a95 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -34,17 +34,17 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include <X11/cursorfont.h>
 
 #ifndef makedev
-#include <sys/types.h>
-#endif /* makedev */
+# include <sys/types.h>
+#endif
 
 #ifdef BSD_SYSTEM
-#include <sys/ioctl.h>
-#endif /* ! defined (BSD_SYSTEM) */
+# include <sys/ioctl.h>
+#endif
 
 #include "systime.h"
 
 #ifndef INCLUDED_FCNTL
-#include <fcntl.h>
+# include <fcntl.h>
 #endif
 #include <ctype.h>
 #include <errno.h>
@@ -61,7 +61,6 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "termopts.h"
 #include "termchar.h"
-//#include "emacs-icon.h"
 #include "disptab.h"
 #include "buffer.h"
 #include "window.h"
@@ -343,28 +342,27 @@ xwidget_show_view (struct xwidget_view *xv)
 }
 
 
-/* hide an xvidget view */
+/* Hide an xvidget view.  */
 static void
 xwidget_hide_view (struct xwidget_view *xv)
 {
   xv->hidden = 1;
-  //gtk_widget_hide(xw->widgetwindow);
   gtk_fixed_move (GTK_FIXED (xv->emacswindow), xv->widgetwindow,
                   10000, 10000);
 }
 
 
 
-/* when the off-screen webkit master view changes this signal is called.
-   it copies the bitmap from the off-screen instance */
+/* When the off-screen webkit master view changes this signal is called.
+   It copies the bitmap from the off-screen instance.  */
 gboolean
 offscreen_damage_event (GtkWidget * widget, GdkEvent * event,
                         gpointer xv_widget)
 {
-  // Queue a redraw of onscreen widget
+  // Queue a redraw of onscreen widget.
   // There is a guard against receiving an invalid widget,
   // which should only happen if we failed to remove the
-  // the specific signal handler for the damage event
+  // specific signal handler for the damage event.
   if (GTK_IS_WIDGET (xv_widget))
     gtk_widget_queue_draw (GTK_WIDGET (xv_widget));
   else
@@ -378,18 +376,17 @@ static void
 store_xwidget_event_string (struct xwidget *xw, const char *eventname,
                             const char *eventstr)
 {
-  //refactor attempt
   struct input_event event;
   Lisp_Object xwl;
   XSETXWIDGET (xwl, xw);
   EVENT_INIT (event);
   event.kind = XWIDGET_EVENT;
-  event.frame_or_window = Qnil;        //frame;
+  event.frame_or_window = Qnil;
 
   event.arg = Qnil;
   event.arg = Fcons (build_string (eventstr), event.arg);
-  event.arg = Fcons (xwl, event.arg);  //TODO
-  event.arg = Fcons (intern (eventname), event.arg);   //interning should be ok
+  event.arg = Fcons (xwl, event.arg);
+  event.arg = Fcons (intern (eventname), event.arg);
   kbd_buffer_store_event (&event);
 
 }
@@ -429,10 +426,9 @@ webkit_mime_type_policy_typedecision_requested_cb 
(WebKitWebView *webView,
                                                    WebKitWebPolicyDecision 
*policy_decision,
                                                    gpointer user_data)
 {
-  printf ("mime policy requested\n");
-  // this function makes webkit send a download signal for all unknown
-  // mime types TODO defer the decision to lisp, so that its possible
-  // to make Emacs handle text mime for instance
+  // This function makes webkit send a download signal for all unknown
+  // mime types. TODO Defer the decision to lisp, so that its possible
+  // to make Emacs handle teext mime for instance.xs
   if (!webkit_web_view_can_show_mime_type (webView, mimetype))
     {
       webkit_web_policy_decision_download (policy_decision);
@@ -446,22 +442,16 @@ webkit_mime_type_policy_typedecision_requested_cb 
(WebKitWebView *webView,
 
 
 gboolean
-webkit_new_window_policy_decision_requested_cb (WebKitWebView *
-                                                          webView,
-                                                          WebKitWebFrame *
-                                                          frame,
-                                                          WebKitNetworkRequest
-                                                          * request,
-                                                          
WebKitWebNavigationAction
-                                                          * navigation_action,
-                                                          
WebKitWebPolicyDecision
-                                                          * policy_decision,
-                                                          gpointer user_data)
+webkit_new_window_policy_decision_requested_cb (WebKitWebView *webView,
+                                                WebKitWebFrame *frame,
+                                                WebKitNetworkRequest *request,
+                                                WebKitWebNavigationAction 
*navigation_action,
+                                                WebKitWebPolicyDecision 
*policy_decision,
+                                                gpointer user_data)
 {
   struct xwidget *xw =
     (struct xwidget *) g_object_get_data (G_OBJECT (webView), XG_XWIDGET);
-  printf ("webkit_new_window_policy_decision_requested_cb %s\n",
-          webkit_web_navigation_action_get_original_uri (navigation_action));
+  webkit_web_navigation_action_get_original_uri (navigation_action);
 
   store_xwidget_event_string (xw, "new-window-policy-decision-requested",
                               webkit_web_navigation_action_get_original_uri
@@ -470,17 +460,12 @@ webkit_new_window_policy_decision_requested_cb 
(WebKitWebView *
 }
 
 gboolean
-webkit_navigation_policy_decision_requested_cb (WebKitWebView *
-                                                          webView,
-                                                          WebKitWebFrame *
-                                                          frame,
-                                                          WebKitNetworkRequest
-                                                          * request,
-                                                          
WebKitWebNavigationAction
-                                                          * navigation_action,
-                                                          
WebKitWebPolicyDecision
-                                                          * policy_decision,
-                                                          gpointer user_data)
+webkit_navigation_policy_decision_requested_cb (WebKitWebView *webView,
+                                                WebKitWebFrame *frame,
+                                                WebKitNetworkRequest *request,
+                                                WebKitWebNavigationAction 
*navigation_action,
+                                                WebKitWebPolicyDecision * 
policy_decision,
+                                                gpointer user_data)
 {
   struct xwidget *xw =
     (struct xwidget *) g_object_get_data (G_OBJECT (webView), XG_XWIDGET);
@@ -490,7 +475,7 @@ webkit_navigation_policy_decision_requested_cb 
(WebKitWebView *
   return FALSE;
 }
 
-//for gtk3 offscreen rendered widgets
+// For gtk3 offscreen rendered widgets.
 static gboolean
 xwidget_osr_draw_cb (GtkWidget * widget, cairo_t * cr, gpointer data)
 {
@@ -500,7 +485,7 @@ xwidget_osr_draw_cb (GtkWidget * widget, cairo_t * cr, 
gpointer data)
     (struct xwidget_view *) g_object_get_data (G_OBJECT (widget),
                                                XG_XWIDGET_VIEW);
 
-  cairo_rectangle (cr, 0, 0, xv->clip_right, xv->clip_bottom); //xw->width, 
xw->height);
+  cairo_rectangle (cr, 0, 0, xv->clip_right, xv->clip_bottom);
   cairo_clip (cr);
 
   if (xw->widgetscrolledwindow_osr != NULL)
@@ -515,13 +500,13 @@ xwidget_osr_event_forward (GtkWidget * widget,
                            GdkEvent * event,
                            gpointer user_data)
 {
-  /* copy events that arrive at the outer widget to the offscreen widget */
+  /* Copy events that arrive at the outer widget to the offscreen widget. */
   struct xwidget *xw =
     (struct xwidget *) g_object_get_data (G_OBJECT (widget), XG_XWIDGET);
   GdkEvent *eventcopy = gdk_event_copy (event);
-  eventcopy->any.window = gtk_widget_get_window (xw->widget_osr);      // works
+  eventcopy->any.window = gtk_widget_get_window (xw->widget_osr);
 
-  //TODO this might leak events. they should be deallocated later,
+  //TODO This might leak events. They should be deallocated later,
   //perhaps in xwgir_event_cb
   gtk_main_do_event (eventcopy);
   return TRUE;                 //dont propagate this event furter
@@ -541,7 +526,7 @@ xwidget_osr_event_set_embedder (GtkWidget * widget,
 }
 
 
-/* Initializes and does initial placement of an xwidget view on screen */
+/* Initializes and does initial placement of an xwidget view on screen. */
 static struct xwidget_view *
 xwidget_init_view (struct xwidget *xww,
                    struct glyph_string *s,
@@ -559,7 +544,8 @@ xwidget_init_view (struct xwidget *xww,
   if (EQ (xww->type, Qwebkit_osr))
     {
       xv->widget = gtk_drawing_area_new ();
-      gtk_widget_set_app_paintable (xv->widget, TRUE); //because expose event 
handling
+      // Expose event handling.
+      gtk_widget_set_app_paintable (xv->widget, TRUE);
       gtk_widget_add_events (xv->widget, GDK_ALL_EVENTS_MASK);
 
       /* Draw the view on damage-event */
@@ -568,7 +554,6 @@ xwidget_init_view (struct xwidget *xww,
 
       if (EQ (xww->type, Qwebkit_osr))
         {
-          /* //forward events. this isnt compatible with the set_embedded 
strategy */
           g_signal_connect (G_OBJECT (xv->widget), "button-press-event",
                             G_CALLBACK (xwidget_osr_event_forward), NULL);
           g_signal_connect (G_OBJECT (xv->widget), "button-release-event",
@@ -578,36 +563,37 @@ xwidget_init_view (struct xwidget *xww,
         }
       else
         {
-          //xwgir debug , orthogonal to forwarding
+          // xwgir debug , orthogonal to forwarding
           g_signal_connect (G_OBJECT (xv->widget), "enter-notify-event",
                             G_CALLBACK (xwidget_osr_event_set_embedder), xv);
         }
-
-      //draw
       g_signal_connect (G_OBJECT (xv->widget), "draw",
                         G_CALLBACK (xwidget_osr_draw_cb), NULL);
-
     }
-  //else return NULL;
-
-  //widget realization
+  // Widget realization.
 
-  //make container widget 1st, and put the actual widget inside the
-  //container later, drawing should crop container window if necessary
-  //to handle case where xwidget is partially obscured by other emacs
-  //windows other containers than gtk_fixed where explored, but
-  //gtk_fixed had the most predictable behaviour so far.
+  // Make container widget 1st, and put the actual widget inside the
+  // container later.  Drawing should crop container window if necessary
+  // to handle case where xwidget is partially obscured by other Emacs
+  // windows.  Other containers than gtk_fixed where explored, but
+  // gtk_fixed had the most predictable behaviour so far.
   xv->emacswindow = FRAME_GTK_WIDGET (s->f);
   xv->widgetwindow = gtk_fixed_new ();
   gtk_widget_set_has_window (xv->widgetwindow, TRUE);
   gtk_container_add (GTK_CONTAINER (xv->widgetwindow), xv->widget);
 
-  //store some xwidget data in the gtk widgets
-  g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, (gpointer) (s->f)); 
//the emacs frame
-  g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, (gpointer) (xww));     
//the xwidget
-  g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, (gpointer) (xv)); 
//the xwidget
-  g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, (gpointer) 
(xww));       //the xwidget window
-  g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW, (gpointer) 
(xv));   //the xwidget window
+  // Store some xwidget data in the gtk widgets.
+  // The emacs frame.
+  g_object_set_data (G_OBJECT (xv->widget), XG_FRAME_DATA, (gpointer) (s->f));
+  // The xwidget.
+  g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET, (gpointer) (xww));
+  // The xwidget.
+  g_object_set_data (G_OBJECT (xv->widget), XG_XWIDGET_VIEW, (gpointer) (xv));
+  // The xwidget window.
+  g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET, (gpointer) 
(xww));
+  // the xwidget view.
+  g_object_set_data (G_OBJECT (xv->widgetwindow), XG_XWIDGET_VIEW,
+                     (gpointer) (xv));
 
 
   gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xww->width,
@@ -626,11 +612,9 @@ xwidget_init_view (struct xwidget *xww,
 void
 x_draw_xwidget_glyph_string (struct glyph_string *s)
 {
-  /*
-     this method is called by the redisplay engine and places the
-     xwidget on screen.  moving and clipping is done here. also view
-     init.
-
+  /* This method is called by the redisplay engine and places the
+     xwidget on screen.  Moving and clipping is done here.  Also view
+     initialization.
    */
   struct xwidget *xww = s->xwidget;
   struct xwidget_view *xv = xwidget_view_lookup (xww, s->w);
@@ -643,14 +627,14 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
   int y = s->y + (s->height / 2) - (xww->height / 2);
   int moved = 0;
 
-  /* We do it here in the display loop because there is no other
-     time to know things like window placement etc.
+  /* We do initialization here in the display loop because there is no
+     other time to know things like window placement etc.
    */
   xv = xwidget_init_view (xww, s, x, y);
 
-  //calculate clipping, which is used for all manner of onscreen
-  //xwidget views each widget border can get clipped by other emacs
-  //objects so there are four clipping variables
+  // Calculate clipping, which is used for all manner of onscreen
+  // xwidget views.  Each widget border can get clipped by other emacs
+  // objects so there are four clipping variables.
   clip_right =
     min (xww->width,
          WINDOW_RIGHT_EDGE_X (s->w) - x -
@@ -667,32 +651,28 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
          WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
   clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);
 
-  //we are conserned with movement of the onscreen area. the area
-  //might sit still when the widget actually moves this happens when
-  //an emacs window border moves across a widget window so, if any
-  //corner of the outer widget clippng window moves, that counts as
-  //movement here, even if it looks like no movement happens because
-  //the widget sits still inside the clipping area.  the widget can
-  //also move inside the clipping area, which happens later
+  // We are conserned with movement of the onscreen area. The area
+  // might sit still when the widget actually moves.  This happens
+  // when an Emacs window border moves across a widget window. So, if
+  // any corner of the outer widget clipping window moves, that counts
+  // as movement here, even if it looks like no movement happens
+  // because the widget sits still inside the clipping area.  The
+  // widget can also move inside the clipping area, which happens
+  // later
   moved = (xv->x + xv->clip_left != x + clip_left)
     || ((xv->y + xv->clip_top) != (y + clip_top));
   xv->x = x;
   xv->y = y;
-  if (moved)                   //has it moved?
+  if (moved) // Has it moved?
     {
-      if (1)
-        //!xwidget_hidden(xv))
-        //hidden equals not being seen during redisplay
-        {
-          //TODO should be possible to use xwidget_show_view here
           gtk_fixed_move (GTK_FIXED (FRAME_GTK_WIDGET (s->f)),
                           xv->widgetwindow, x + clip_left, y + clip_top);
-        }
     }
-  //clip the widget window if some parts happen to be outside drawable
-  //area an emacs window is not a gtk window, a gtk window covers the
-  //entire frame cliping might have changed even if we havent actualy
-  //moved, we try figure out when we need to reclip for real
+  // Clip the widget window if some parts happen to be outside
+  // drawable area. An Emacs window is not a gtk window. A gtk window
+  // covers the entire frame. Clipping might have changed even if we
+  // havent actualy moved, we try figure out when we need to reclip
+  // for real.
   if ((xv->clip_right != clip_right)
       || (xv->clip_bottom != clip_bottom)
       || (xv->clip_top != clip_top) || (xv->clip_left != clip_left))
@@ -707,10 +687,10 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
       xv->clip_top = clip_top;
       xv->clip_left = clip_left;
     }
-  //if emacs wants to repaint the area where the widget lives, queue a
-  //redraw TODO it seems its possible to get out of sync with emacs
-  //redraws so emacs bg sometimes shows up instead of xwidget its just
-  //a visual glitch though
+  // If emacs wants to repaint the area where the widget lives, queue
+  // a redraw. It seems its possible to get out of sync with emacs
+  // redraws so emacs background sometimes shows up instead of the
+  // xwidgets background. It's just a visual glitch though.
   if (!xwidget_hidden (xv))
     {
       gtk_widget_queue_draw (xv->widgetwindow);
@@ -734,7 +714,7 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
 
 DEFUN ("xwidget-webkit-goto-uri",
        Fxwidget_webkit_goto_uri, Sxwidget_webkit_goto_uri,
-       2, 2, 0, doc:   /* Make the webkit instance referenced by
+       2, 2, 0, doc:   /* Make the xwidget webkit instance referenced by
                            XWIDGET browse URI. */
        )
   (Lisp_Object xwidget, Lisp_Object uri)
@@ -748,7 +728,7 @@ DEFUN ("xwidget-webkit-goto-uri",
 
 DEFUN ("xwidget-webkit-execute-script",
        Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script,
-       2, 2, 0, doc:   /* webkit exec js. */
+       2, 2, 0, doc:   /* Make the Webkit XWIDGET execute javascript SCRIPT. */
        )
   (Lisp_Object xwidget, Lisp_Object script)
 {
@@ -766,21 +746,19 @@ XWIDGET.  This can be used to work around the lack of a 
return value
 from the exec method.  */ )
   (Lisp_Object xwidget)
 {
-  //TODO support multibyte strings
+  // TODO support multibyte strings
   WEBKIT_FN_INIT ();
   const gchar *str =
     webkit_web_view_get_title (WEBKIT_WEB_VIEW (xw->widget_osr));
   if (str == 0)
     {
-      //TODO maybe return Qnil instead. I suppose webkit returns
-      //nullpointer when doc is not properly loaded or something
-      printf ("xwidget-webkit-get-title null webkit title\n");
+      // TODO maybe return Qnil instead. I suppose webkit returns
+      // nullpointer when doc is not properly loaded or something
       return build_string ("");
     }
   return build_string (str);
 }
 
-//TODO missnamed
 DEFUN ("xwidget-disable-plugin-for-mime",
        Fxwidget_disable_plugin_for_mime, Sxwidget_disable_plugin_for_mime,
        1, 1, 0, doc:   /* */ )
@@ -816,16 +794,13 @@ DEFUN ("xwidget-resize", Fxwidget_resize, 
Sxwidget_resize, 3, 3, 0, doc:
 
   xw->width = w;
   xw->height = h;
-  //if theres a osr resize it 1st
+  // If there is a offscreen widget resize it 1st.
   if (xw->widget_osr)
     {
       gtk_widget_set_size_request (GTK_WIDGET (xw->widget_osr),
                                    xw->width, xw->height);     //minimum size
       gtk_window_resize (GTK_WINDOW (xw->widgetwindow_osr), xw->width,
                          xw->height);
-      /* gtk_window_resize (GTK_WINDOW (xw->widgetscrolledwindow_osr),
-         xw->width, */
-      /*                    xw->height); */
       gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW
                                                   (xw->
                                                    widgetscrolledwindow_osr),
@@ -845,13 +820,8 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 
3, 3, 0, doc:
         {
           xv = XXWIDGET_VIEW (XCAR (tail));
           if (XXWIDGET (xv->model) == xw)
-            {
-              /* gtk_layout_set_size (GTK_CONTAINER
-                 (xv->widgetwindow), xw->width, */
-              /*                      xw->height); */
               gtk_widget_set_size_request (GTK_WIDGET (xv->widget), xw->width,
                                            xw->height);
-            }
         }
     }
 
@@ -862,7 +832,9 @@ DEFUN ("xwidget-resize", Fxwidget_resize, Sxwidget_resize, 
3, 3, 0, doc:
 
 DEFUN ("xwidget-set-adjustment",
        Fxwidget_set_adjustment, Sxwidget_set_adjustment, 4, 4, 0, doc:
-       /* set scrolling  */
+       /* Set native scrolling for XWIDGET. AXIS can be 'vertical or
+          'horizontal. If RELATIVE is t, scroll relative, otherwise absolutely.
+       VALUE is the amount to scroll, either relatively or absolutely.  */
 )
   (Lisp_Object xwidget, Lisp_Object axis, Lisp_Object relative,
    Lisp_Object value)
@@ -909,9 +881,7 @@ DEFUN ("xwidget-size-request",
        /* Desired size of the XWIDGET.
 
           This can be used to read the xwidget desired size, and
-          resizes the Emacs allocated area accordingly.
-
-          (TODO crashes if arg not osr widget) */
+          resizes the Emacs allocated area accordingly.  */
 )
   (Lisp_Object xwidget)
 {
@@ -991,7 +961,7 @@ DEFUN ("xwidget-view-info",
 
 DEFUN ("xwidget-view-model",
        Fxwidget_view_model, Sxwidget_view_model,
-       1, 1, 0, doc:   /* Get XWIDGET-VIEW model. */
+       1, 1, 0, doc:  /* Get XWIDGET-VIEW model. */
        )
   (Lisp_Object xwidget_view)
 {
@@ -1001,7 +971,7 @@ DEFUN ("xwidget-view-model",
 
 DEFUN ("xwidget-view-window",
        Fxwidget_view_window, Sxwidget_view_window,
-       1, 1, 0, doc:/* Get XWIDGET-VIEW window. */
+       1, 1, 0, doc:  /* Get XWIDGET-VIEW window. */
        )
   (Lisp_Object xwidget_view)
 {
@@ -1012,7 +982,7 @@ DEFUN ("xwidget-view-window",
 
 DEFUN ("delete-xwidget-view",
        Fdelete_xwidget_view, Sdelete_xwidget_view,
-       1, 1, 0, doc:/* Delete the XWIDGET-VIEW. */
+       1, 1, 0, doc:  /* Delete the XWIDGET-VIEW. */
        )
   (Lisp_Object xwidget_view)
 {
@@ -1020,16 +990,12 @@ DEFUN ("delete-xwidget-view",
   struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view);
   gtk_widget_destroy (xv->widgetwindow);
   Vxwidget_view_list = Fdelq (xwidget_view, Vxwidget_view_list);
-  // xv->model still has signals pointing to the view
-  // there can be several views. find the matchin signals and delete them
-  int i;
-  i = g_signal_handlers_disconnect_matched  (XXWIDGET 
(xv->model)->widgetwindow_osr,
-                                             G_SIGNAL_MATCH_DATA,
-                                             0, 0, 0, 0,
-                                             xv->widget);
-  printf ("delete view num signals %d\n",i);
-
-
+  // xv->model still has signals pointing to the view. There can be
+  // several views. Find the matching signals and delete them all.
+  g_signal_handlers_disconnect_matched  (XXWIDGET 
(xv->model)->widgetwindow_osr,
+                                         G_SIGNAL_MATCH_DATA,
+                                         0, 0, 0, 0,
+                                         xv->widget);
   return Qnil;
 }
 
@@ -1206,33 +1172,14 @@ valid_xwidget_spec_p (Lisp_Object object)
   int valid_p = 0;
 
   if (CONSP (object) && EQ (XCAR (object), Qxwidget))
-    {
-      /* Lisp_Object tem; */
-
-      /* for (tem = XCDR (object); CONSP (tem); tem = XCDR (tem)) */
-      /*   if (EQ (XCAR (tem), QCtype)) */
-      /*     { */
-      /*       tem = XCDR (tem); */
-      /*       if (CONSP (tem) && SYMBOLP (XCAR (tem))) */
-      /*         { */
-      /*        struct xwidget_type *type; */
-      /*        type = lookup_xwidget_type (XCAR (tem)); */
-      /*        if (type) */
-      /*          valid_p = type->valid_p (object); */
-      /*         } */
-
-      /*       break; */
-      /*     } */
-      //never mind type support for now
       valid_p = 1;
-    }
 
   return valid_p;
 }
 
 
 
-/* find a value associated with key in spec */
+/* Find a value associated with key in spec.  */
 Lisp_Object
 xwidget_spec_value (Lisp_Object spec, Lisp_Object key, int *found)
 {
@@ -1292,7 +1239,7 @@ lookup_xwidget (Lisp_Object spec)
 {
   /* When a xwidget lisp spec is found initialize the C struct that is
      used in the C code.  This is done by redisplay so values change
-     if the spec changes.  So, take special care of one-shot events
+     if the spec changes.  So, take special care of one-shot events.
    */
   int found = 0;
   Lisp_Object value;
@@ -1316,7 +1263,8 @@ xwidget_start_redisplay (void)
     }
 }
 
-/* The xwidget was touched during redisplay, so it isnt a candidate for 
hiding*/
+/* The xwidget was touched during redisplay, so it isn't a candidate
+   for hiding.  */
 void
 xwidget_touch (struct xwidget_view *xv)
 {
@@ -1338,13 +1286,12 @@ xwidget_end_redisplay (struct window *w, struct 
glyph_matrix *matrix)
   int i;
   int area;
 
-
   xwidget_start_redisplay ();
-  //iterate desired glyph matrix of window here, hide gtk widgets
-  //not in the desired matrix.
+  // Iterate desired glyph matrix of window here, hide gtk widgets
+  // not in the desired matrix.
 
-  //this only takes care of xwidgets in active windows.
-  //if a window goes away from screen xwidget views wust be deleted
+  // This only takes care of xwidgets in active windows.  if a window
+  // goes away from screen xwidget views wust be deleted
 
   //  dump_glyph_matrix(matrix, 2);
   for (i = 0; i < matrix->nrows; ++i)
@@ -1363,7 +1310,7 @@ xwidget_end_redisplay (struct window *w, struct 
glyph_matrix *matrix)
                   if (glyph->type == XWIDGET_GLYPH)
                     {
                       /*
-                         the only call to xwidget_end_redisplay is in dispnew
+                        The only call to xwidget_end_redisplay is in dispnew
                          xwidget_end_redisplay(w->current_matrix);
                        */
                       xwidget_touch (xwidget_view_lookup (glyph->u.xwidget,
@@ -1381,8 +1328,8 @@ xwidget_end_redisplay (struct window *w, struct 
glyph_matrix *matrix)
         {
           struct xwidget_view *xv = XXWIDGET_VIEW (XCAR (tail));
 
-          //"touched" is only meaningful for the current window, so
-          //disregard other views
+          // "touched" is only meaningful for the current window, so
+          // disregard other views.
           if (XWINDOW (xv->w) == w)
             {
               if (xwidget_touched (xv))



reply via email to

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