changeset 639:4b7d425dd3c2

[xemacs-hg @ 2001-07-28 05:08:58 by andyp] Stop flickering on OpenMotif.
author andyp
date Sat, 28 Jul 2001 05:09:03 +0000
parents 373ced43e288
children 191dd517b9d5
files lwlib/ChangeLog lwlib/lwlib-Xlw.c lwlib/lwlib-Xm.c lwlib/lwlib.c lwlib/lwlib.h src/ChangeLog src/glyphs-x.c src/glyphs.c src/glyphs.h src/gutter.c
diffstat 10 files changed, 111 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/ChangeLog	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/ChangeLog	Sat Jul 28 05:09:03 2001 +0000
@@ -1,3 +1,13 @@
+2001-07-26  Andy Piper  <andy@xemacs.org>
+
+	* lwlib-Xm.c (xm_update_progress): new function. Set Scale height
+	and width from normal height and width.
+	* lwlib-Xm.c (xm_create_progress): ditto.
+	* lwlib-Xm.c (xm_update_one_widget): call xm_update_progress.
+	* lwlib.c (lw_get_value_arg): new function. Return an argument
+	based on its name.
+	* lwlib.h: declare it.
+
 2001-05-21  Martin Buchholz  <martin@xemacs.org>
 
 	* lwlib-config.c: Remove.
--- a/lwlib/lwlib-Xlw.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/lwlib-Xlw.c	Sat Jul 28 05:09:03 2001 +0000
@@ -415,7 +415,7 @@
 {
   Widget* children;
   unsigned int num_children;
-  int i;
+  Dimension i;
   widget_value *cur = 0;
 
   XtRemoveAllCallbacks (widget, XtNcallback);
--- a/lwlib/lwlib-Xm.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/lwlib-Xm.c	Sat Jul 28 05:09:03 2001 +0000
@@ -336,6 +336,36 @@
   XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
 }
 
+static void
+xm_update_progress (widget_instance* instance, Widget scale,
+		      widget_value* val)
+{
+  Arg al[20];
+  int ac = 0;
+  Dimension height = 0;
+  Dimension width = 0;
+  if (!val->call_data)
+    {
+      XtSetArg (al [ac], XmNeditable, False);		ac++;
+    }
+  else
+    {
+      XtSetArg (al [ac], XmNeditable, val->enabled);		ac++;
+    }
+  height = (Dimension)lw_get_value_arg (val, XtNheight);
+  width = (Dimension)lw_get_value_arg (val, XtNwidth);
+  if (height > 0)
+    {
+      XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+    }
+  if (width > 0)
+    {
+      XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+    }
+
+  XtSetValues (scale, al, 1);
+}
+
 #ifdef LWLIB_MENUBARS_MOTIF
 
 static void
@@ -858,6 +888,10 @@
       xm_update_scrollbar (instance, widget, val);
     }
 #endif
+  else if (class == xmScaleWidgetClass)
+    {
+      xm_update_progress (instance, widget, val);
+    }
   /* Lastly update our global arg values. */
   if (val->args && val->args->nargs)
     XtSetValues (widget, val->args->args, val->args->nargs);
@@ -912,7 +946,7 @@
       if (radiobox)
 	{
 	  CompositeWidget radio = (CompositeWidget)widget;
-	  int i;
+	  unsigned int i;
 	  for (i = 0; i < radio->composite.num_children; i++)
 	    {
 	      int set = False;
@@ -1649,20 +1683,18 @@
 {
   Arg al[20];
   int ac = 0;
+  Dimension height = 0;
+  Dimension width = 0;
   Widget scale = 0;
   widget_value* val = instance->info->val;
-#if 0		/* This looks too awful, although more correct. */
   if (!val->call_data)
     {
-      XtSetArg (al [ac], XmNsensitive, False);		ac++;
+      XtSetArg (al [ac], XmNeditable, False);		ac++;
     }
   else
     {
-      XtSetArg (al [ac], XmNsensitive, val->enabled);		ac++;
+      XtSetArg (al [ac], XmNeditable, val->enabled);		ac++;
     }
-#else
-  XtSetArg (al [ac], XmNsensitive, True);		ac++;
-#endif
   XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
   XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
   XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
@@ -1671,6 +1703,18 @@
      look ugly.  I think this may be a LessTif bug but for now we just
      get rid of it. */
   XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+  
+  height = (Dimension)lw_get_value_arg (val, XtNheight);
+  width = (Dimension)lw_get_value_arg (val, XtNwidth);
+  if (height > 0)
+    {
+      XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+    }
+  if (width > 0)
+    {
+      XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+    }
+
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);
 
--- a/lwlib/lwlib.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/lwlib.c	Sat Jul 28 05:09:03 2001 +0000
@@ -1389,6 +1389,22 @@
     }
 }
 
+XtArgVal lw_get_value_arg (widget_value* wv, String name)
+{
+  int i;
+  if (wv->args)
+    {
+      for (i = 0; i < wv->args->nargs; i++)
+	{
+	  if (!strcmp (wv->args->args[i].name, name))
+	    {
+	      return wv->args->args[i].value;
+	    }
+	}
+    }
+  return (XtArgVal)0;
+}
+
 void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value)
 {
   int i = 0;
--- a/lwlib/lwlib.h	Thu Jul 26 21:10:48 2001 +0000
+++ b/lwlib/lwlib.h	Sat Jul 28 05:09:03 2001 +0000
@@ -214,6 +214,7 @@
 void lw_pop_down_all_widgets (LWLIB_ID id);
 void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset);
 void lw_add_widget_value_arg (widget_value* wv, String name, XtArgVal value);
+XtArgVal lw_get_value_arg (widget_value* wv, String name);
 void lw_copy_widget_value_args (widget_value* copy, widget_value* val);
 widget_value * copy_widget_value_tree (widget_value *val, change_type change);
 
--- a/src/ChangeLog	Thu Jul 26 21:10:48 2001 +0000
+++ b/src/ChangeLog	Sat Jul 28 05:09:03 2001 +0000
@@ -1,3 +1,12 @@
+2001-07-27  Andy Piper  <andy@xemacs.org>
+
+	* glyphs-x.c (x_progress_gauge_redisplay):
+	* glyphs.c (check_for_ignored_expose):
+	* glyphs.c (find_matching_subwindow):
+	* glyphs.h:
+	* gutter.c (output_gutter):
+	* gutter.c (redraw_exposed_gutter): warning elimination.
+
 2001-07-26  Adrian Aichner  <adrian@xemacs.org>
 
 	* event-Xt.c (handle_map_event): Fix word duplication typos.
--- a/src/glyphs-x.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/src/glyphs-x.c	Sat Jul 28 05:09:03 2001 +0000
@@ -80,6 +80,7 @@
 
 #ifdef LWLIB_WIDGETS_MOTIF
 #include <Xm/Xm.h>
+#include <Xm/Scale.h>
 #endif
 #include <X11/IntrinsicP.h>
 
@@ -2667,18 +2668,18 @@
 static void
 x_progress_gauge_redisplay (Lisp_Object image_instance)
 {
-  Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
-
-  if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
+  Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
+
+  if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
     {
       Arg al [1];
       Lisp_Object val;
 #ifdef ERROR_CHECK_GLYPHS
-      assert (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)));
+      assert (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p)));
 #endif
-      val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))->value;
+      val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p))->value;
       XtSetArg (al[0], XtNvalue, XINT (val));
-      XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, 1);
+      XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (p), al, 1);
     }
 }
 
--- a/src/glyphs.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/src/glyphs.c	Sat Jul 28 05:09:03 2001 +0000
@@ -4427,7 +4427,8 @@
 } *the_expose_ignore_blocktype;
 
 int
-check_for_ignored_expose (struct frame* f, int x, int y, int width, int height)
+check_for_ignored_expose (struct frame* f, unsigned int x, unsigned int y,
+			  unsigned int width, unsigned int height)
 {
   struct expose_ignore *ei, *prev;
   /* the ignore list is FIFO so we should generally get a match with
@@ -4499,7 +4500,9 @@
  See if there is a subwindow that completely encloses the requested
  area.
  ****************************************************************************/
-int find_matching_subwindow (struct frame* f, int x, int y, int width, int height)
+int find_matching_subwindow (struct frame* f, unsigned int x, 
+			     unsigned int y, unsigned int width, 
+			     unsigned int height)
 {
   Lisp_Object rest;
 
--- a/src/glyphs.h	Thu Jul 26 21:10:48 2001 +0000
+++ b/src/glyphs.h	Sat Jul 28 05:09:03 2001 +0000
@@ -1137,7 +1137,9 @@
 void unmap_subwindow (Lisp_Object subwindow);
 void map_subwindow (Lisp_Object subwindow, int x, int y,
 		    struct display_glyph_area *dga);
-int find_matching_subwindow (struct frame* f, int x, int y, int width, int height);
+int find_matching_subwindow (struct frame* f, 
+			     unsigned int x, unsigned int y, 
+			     unsigned int width, unsigned int height);
 void redisplay_widget (Lisp_Object widget);
 void update_widget_instances (Lisp_Object frame);
 void redisplay_subwindow (Lisp_Object subwindow);
@@ -1155,7 +1157,9 @@
   struct expose_ignore *next;
 };
 
-int check_for_ignored_expose (struct frame* f, int x, int y, int width, int height);
+int check_for_ignored_expose (struct frame* f, unsigned int x, 
+			      unsigned int y, unsigned int width, 
+			      unsigned int height);
 extern int hold_ignored_expose_registration;
 
 #endif /* INCLUDED_glyphs_h_ */
--- a/src/gutter.c	Thu Jul 26 21:10:48 2001 +0000
+++ b/src/gutter.c	Sat Jul 28 05:09:03 2001 +0000
@@ -424,7 +424,10 @@
       (f->extents_changed && w->gutter_extent_modiff[pos]))
     {
 #ifdef DEBUG_GUTTERS
-      printf ("gutter redisplay [%dx%d@%d+%d] triggered by %s,\n", 
+      stderr_out ("gutter redisplay [%s %dx%d@%d+%d] triggered by %s,\n", 
+	      pos == TOP_GUTTER ? "TOP" :
+	      pos == BOTTOM_GUTTER ? "BOTTOM" :
+	      pos == LEFT_GUTTER ? "LEFT" : "RIGHT",
 	      width, height, x, y, force ? "force" :
 	      f->faces_changed ? "f->faces_changed" :
 	      f->frame_changed ? "f->frame_changed" :
@@ -671,7 +674,7 @@
     return;
 
 #ifdef DEBUG_WIDGETS
-  printf ("redrawing gutter after expose %d+%d, %dx%d\n",
+  stderr_out ("redrawing gutter after expose %d+%d, %dx%d\n",
 	  x, y, width, height);
 #endif
   /* #### optimize this - redrawing the whole gutter for every expose