diff src/toolbar-x.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 0e522484dd2a
children c42ec1d1cded
line wrap: on
line diff
--- a/src/toolbar-x.c	Mon Aug 13 10:27:41 2007 +0200
+++ b/src/toolbar-x.c	Mon Aug 13 10:28:48 2007 +0200
@@ -519,7 +519,7 @@
 static void
 x_clear_toolbar (struct frame *f, enum toolbar_pos pos, int thickness_change)
 {
-  Lisp_Object frame = Qnil;
+  Lisp_Object frame;
   struct device *d = XDEVICE (f->device);
   int x, y, width, height, vert;
 
@@ -687,18 +687,16 @@
      size. */
 
   in_specifier_change_function++;
+
   if (!in_resource_setting)
     /* mirror the value in the frame resources, unless already done. */
-    {
-      Arg al [1];
-      XtSetArg (al [0],
-		pos ==    TOP_TOOLBAR ? XtNtopToolBarHeight    :
-		pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight :
-		pos ==   LEFT_TOOLBAR ? XtNleftToolBarWidth    :
-		XtNrightToolBarWidth,
-		newval);
-      XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1);
-    }
+    Xt_SET_VALUE (FRAME_X_CONTAINER_WIDGET (f),
+		  pos ==    TOP_TOOLBAR ? XtNtopToolBarHeight    :
+		  pos == BOTTOM_TOOLBAR ? XtNbottomToolBarHeight :
+		  pos ==   LEFT_TOOLBAR ? XtNleftToolBarWidth    :
+		  XtNrightToolBarWidth,
+		  newval);
+
   if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f)))
     {
       int change = newval - oldval;
@@ -790,18 +788,16 @@
      size. */
 
   in_specifier_change_function++;
+
   if (!in_resource_setting)
     /* mirror the value in the frame resources, unless already done. */
-    {
-      Arg al [1];
-      XtSetArg (al [0],
-		pos ==    TOP_TOOLBAR ? XtNtopToolBarBorderWidth    :
-		pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth :
-		pos ==   LEFT_TOOLBAR ? XtNleftToolBarBorderWidth    :
-		XtNrightToolBarBorderWidth,
-		newval);
-      XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1);
-    }
+    Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f),
+		  pos ==    TOP_TOOLBAR ? XtNtopToolBarBorderWidth    :
+		  pos == BOTTOM_TOOLBAR ? XtNbottomToolBarBorderWidth :
+		  pos ==   LEFT_TOOLBAR ? XtNleftToolBarBorderWidth   :
+		  XtNrightToolBarBorderWidth,
+		  newval);
+
   if (XtIsRealized (FRAME_X_CONTAINER_WIDGET (f)))
     {
       int change = 2 * (newval - oldval);
@@ -838,6 +834,7 @@
 x_initialize_frame_toolbar_gcs (struct frame *f)
 {
   EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f);
+  EmacsFramePart *efp = &(ef->emacs_frame);
   XGCValues gcv;
   unsigned long flags = (GCForeground | GCBackground | GCGraphicsExposures);
 
@@ -845,9 +842,8 @@
    * If backgroundToolBarColor is specified, use it.
    * Otherwise use the background resource.
    */
-  if (ef->emacs_frame.background_toolbar_pixel == -1)
-    ef->emacs_frame.background_toolbar_pixel =
-      ef->emacs_frame.background_pixel;
+  if (efp->background_toolbar_pixel == (Pixel) (-1))
+    efp->background_toolbar_pixel = efp->background_pixel;
 
   /*
    * ####
@@ -858,50 +854,46 @@
    * used when toolbar captions are generated by the toolbar code
    * instead being incorporated into the icon image.
    */
-  if (ef->emacs_frame.foreground_toolbar_pixel == -1)
-    ef->emacs_frame.foreground_toolbar_pixel =
-      ef->emacs_frame.foreground_pixel;
+  if (efp->foreground_toolbar_pixel == (Pixel) (-1))
+    efp->foreground_toolbar_pixel = efp->foreground_pixel;
 
-  gcv.foreground = ef->emacs_frame.background_toolbar_pixel;
+  gcv.foreground = efp->background_toolbar_pixel;
   gcv.background = ef->core.background_pixel;
   gcv.graphics_exposures = False;
   FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f) =
     XtGetGC ((Widget) ef, flags, &gcv);
 
-  if (ef->emacs_frame.top_toolbar_shadow_pixel ==
-      ef->emacs_frame.bottom_toolbar_shadow_pixel)
+  if (efp->top_toolbar_shadow_pixel == efp->bottom_toolbar_shadow_pixel)
     {
-      ef->emacs_frame.top_toolbar_shadow_pixel =
-	ef->emacs_frame.background_toolbar_pixel;
-      ef->emacs_frame.bottom_toolbar_shadow_pixel =
-	ef->emacs_frame.background_toolbar_pixel;
+      efp->top_toolbar_shadow_pixel    = efp->background_toolbar_pixel;
+      efp->bottom_toolbar_shadow_pixel = efp->background_toolbar_pixel;
     }
 
-  x_generate_shadow_pixels (f, &ef->emacs_frame.top_toolbar_shadow_pixel,
-			    &ef->emacs_frame.bottom_toolbar_shadow_pixel,
-			    ef->emacs_frame.background_toolbar_pixel,
+  x_generate_shadow_pixels (f, &efp->top_toolbar_shadow_pixel,
+			    &efp->bottom_toolbar_shadow_pixel,
+			    efp->background_toolbar_pixel,
 			    ef->core.background_pixel);
 
-  gcv.foreground = ef->emacs_frame.top_toolbar_shadow_pixel;
+  gcv.foreground = efp->top_toolbar_shadow_pixel;
   gcv.background = ef->core.background_pixel;
   gcv.graphics_exposures = False;
   flags = GCForeground | GCBackground | GCGraphicsExposures;
-  if (ef->emacs_frame.top_toolbar_shadow_pixmap)
+  if (efp->top_toolbar_shadow_pixmap)
     {
       gcv.fill_style = FillOpaqueStippled;
-      gcv.stipple = ef->emacs_frame.top_toolbar_shadow_pixmap;
+      gcv.stipple = efp->top_toolbar_shadow_pixmap;
       flags |= GCStipple | GCFillStyle;
     }
   FRAME_X_TOOLBAR_TOP_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv);
 
-  gcv.foreground = ef->emacs_frame.bottom_toolbar_shadow_pixel;
+  gcv.foreground = efp->bottom_toolbar_shadow_pixel;
   gcv.background = ef->core.background_pixel;
   gcv.graphics_exposures = False;
   flags = GCForeground | GCBackground | GCGraphicsExposures;
-  if (ef->emacs_frame.bottom_toolbar_shadow_pixmap)
+  if (efp->bottom_toolbar_shadow_pixmap)
     {
       gcv.fill_style = FillOpaqueStippled;
-      gcv.stipple = ef->emacs_frame.bottom_toolbar_shadow_pixmap;
+      gcv.stipple = efp->bottom_toolbar_shadow_pixmap;
       flags |= GCStipple | GCFillStyle;
     }
   FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f) = XtGetGC ((Widget) ef, flags, &gcv);
@@ -939,10 +931,10 @@
   XtReleaseGC (ew, FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f));
 
   /* Seg fault if we try and use these again. */
-  FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC (f)  = (GC) - 1;
+  FRAME_X_TOOLBAR_BLANK_BACKGROUND_GC  (f) = (GC) - 1;
   FRAME_X_TOOLBAR_PIXMAP_BACKGROUND_GC (f) = (GC) - 1;
-  FRAME_X_TOOLBAR_TOP_SHADOW_GC (f)        = (GC) - 1;
-  FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC (f)     = (GC) - 1;
+  FRAME_X_TOOLBAR_TOP_SHADOW_GC        (f) = (GC) - 1;
+  FRAME_X_TOOLBAR_BOTTOM_SHADOW_GC     (f) = (GC) - 1;
 }
 
 static void
@@ -951,11 +943,8 @@
   EmacsFrame ef = (EmacsFrame) FRAME_X_TEXT_WIDGET (f);
 
   if (ef->emacs_frame.toolbar_shadow_thickness < MINIMUM_SHADOW_THICKNESS)
-    {
-      Arg al [1];
-      XtSetArg (al [0], XtNtoolBarShadowThickness, MINIMUM_SHADOW_THICKNESS);
-      XtSetValues (FRAME_X_TEXT_WIDGET (f), al, 1);
-    }
+    Xt_SET_VALUE (FRAME_X_TEXT_WIDGET (f),
+		  XtNtoolBarShadowThickness, MINIMUM_SHADOW_THICKNESS);
 
   x_initialize_frame_toolbar_gcs (f);
 }