emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lwlib/xlwmenu.c


From: Pavel Janík
Subject: [Emacs-diffs] Changes to emacs/lwlib/xlwmenu.c
Date: Mon, 06 May 2002 14:55:42 -0400

Index: emacs/lwlib/xlwmenu.c
diff -c emacs/lwlib/xlwmenu.c:1.51 emacs/lwlib/xlwmenu.c:1.52
*** emacs/lwlib/xlwmenu.c:1.51  Mon Apr 29 05:10:28 2002
--- emacs/lwlib/xlwmenu.c       Mon May  6 14:55:30 2002
***************
*** 139,144 ****
--- 139,146 ----
       offset(menu.font),XtRString, "XtDefaultFont"},
    {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
       offset(menu.foreground), XtRString, "XtDefaultForeground"},
+   {XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel),
+    offset(menu.disabled_foreground), XtRString, (XtPointer)NULL},
    {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel),
       offset(menu.button_foreground), XtRString, "XtDefaultForeground"},
    {XtNmargin, XtCMargin, XtRDimension,  sizeof(Dimension),
***************
*** 997,1003 ****
        if (val->enabled)
        text_gc = mw->menu.foreground_gc;
        else
!       text_gc = mw->menu.inactive_gc;
        deco_gc = mw->menu.foreground_gc;
  
        if (separator_p)
--- 999,1005 ----
        if (val->enabled)
        text_gc = mw->menu.foreground_gc;
        else
!       text_gc = mw->menu.disabled_gc;
        deco_gc = mw->menu.foreground_gc;
  
        if (separator_p)
***************
*** 1453,1458 ****
--- 1455,1462 ----
       XlwMenuWidget mw;
  {
    XGCValues xgcv;
+   XColor temp;
+   int delta;
  
    xgcv.font = mw->menu.font->fid;
    xgcv.foreground = mw->menu.foreground;
***************
*** 1469,1481 ****
                                &xgcv);
  
    xgcv.font = mw->menu.font->fid;
-   xgcv.foreground = mw->menu.foreground;
    xgcv.background = mw->core.background_pixel;
!   xgcv.fill_style = FillStippled;
!   xgcv.stipple = mw->menu.gray_pixmap;
!   mw->menu.inactive_gc = XtGetGC ((Widget)mw,
!                                 (GCFont | GCForeground | GCBackground
!                                  | GCFillStyle | GCStipple), &xgcv);
  
    xgcv.font = mw->menu.font->fid;
    xgcv.foreground = mw->menu.button_foreground;
--- 1473,1519 ----
                                &xgcv);
  
    xgcv.font = mw->menu.font->fid;
    xgcv.background = mw->core.background_pixel;
! 
! #define BRIGHTNESS(color) (((color) & 0xff) + (((color) >> 8) & 0xff) + 
(((color) >> 16) & 0xff))
! 
!   /* Allocate color for disabled menu-items.  */
!   if (BRIGHTNESS(mw->menu.foreground) < BRIGHTNESS(mw->core.background_pixel))
!     {
!       delta = 2.3;
!       temp.pixel = mw->menu.foreground;
!     }
!   else
!     {
!       delta = 1.2;
!       temp.pixel = mw->core.background_pixel;
!     }
! 
!   x_alloc_lighter_color_for_widget ((Widget) mw, XtDisplay ((Widget) mw),
!                                   mw->core.colormap,
!                                   &temp.pixel,
!                                   delta,
!                                   0x8000);
!   mw->menu.disabled_foreground = temp.pixel;
! 
!   if (mw->menu.foreground == mw->menu.disabled_foreground
!       || mw->core.background_pixel == mw->menu.disabled_foreground)
!     {
!       /* Too few colors, use stipple.  */
!       xgcv.foreground = mw->menu.foreground;
!       xgcv.fill_style = FillStippled;
!       xgcv.stipple = mw->menu.gray_pixmap;
!       mw->menu.disabled_gc = XtGetGC ((Widget)mw,
!                                     (GCFont | GCForeground | GCBackground
!                                      | GCFillStyle | GCStipple), &xgcv);
!     }
!   else
!     {
!       /* Many colors available, use disabled pixel.  */
!       xgcv.foreground = mw->menu.disabled_foreground;
!       mw->menu.disabled_gc = XtGetGC ((Widget)mw,
!                                     (GCFont | GCForeground | GCBackground), 
&xgcv);
!     }
  
    xgcv.font = mw->menu.font->fid;
    xgcv.foreground = mw->menu.button_foreground;
***************
*** 1500,1512 ****
  {
    XtReleaseGC ((Widget) mw, mw->menu.foreground_gc);
    XtReleaseGC ((Widget) mw, mw->menu.button_gc);
!   XtReleaseGC ((Widget) mw, mw->menu.inactive_gc);
    XtReleaseGC ((Widget) mw, mw->menu.inactive_button_gc);
    XtReleaseGC ((Widget) mw, mw->menu.background_gc);
    /* let's get some segvs if we try to use these... */
    mw->menu.foreground_gc = (GC) -1;
    mw->menu.button_gc = (GC) -1;
!   mw->menu.inactive_gc = (GC) -1;
    mw->menu.inactive_button_gc = (GC) -1;
    mw->menu.background_gc = (GC) -1;
  }
--- 1538,1550 ----
  {
    XtReleaseGC ((Widget) mw, mw->menu.foreground_gc);
    XtReleaseGC ((Widget) mw, mw->menu.button_gc);
!   XtReleaseGC ((Widget) mw, mw->menu.disabled_gc);
    XtReleaseGC ((Widget) mw, mw->menu.inactive_button_gc);
    XtReleaseGC ((Widget) mw, mw->menu.background_gc);
    /* let's get some segvs if we try to use these... */
    mw->menu.foreground_gc = (GC) -1;
    mw->menu.button_gc = (GC) -1;
!   mw->menu.disabled_gc = (GC) -1;
    mw->menu.inactive_button_gc = (GC) -1;
    mw->menu.background_gc = (GC) -1;
  }
***************
*** 2050,2055 ****
--- 2088,2095 ----
  
    if (current == item)
      {
+       if (mw->menu.old_depth < 2)
+       return current;
        current = mw->menu.old_stack [mw->menu.old_depth - 2]->contents;
  
        while (lw_separator_p (current->name, &separator, 0) || 
!current->enabled)



reply via email to

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