unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* stipple in menu?
@ 2002-04-20 17:35 Pavel Janík
  2002-04-20 18:33 ` Jan D.
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Pavel Janík @ 2002-04-20 17:35 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Hi,

my users (a small group of beginners with Emacs) have found a small
problem with the default build of Emacs:

"GNU Emacs 21.2.50.1 (i386-suse-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2002-04-20 on SnowWhite"

I have not noticed that myself, because I use menu exceptionally.

The menu uses stipple to show disabled menus. Some letter look very ugly,
expecially upper case K. I have fixed this today by removing the stipple
completely and defined another GC to draw. The result is quite good
IMHO. Two screenshots attached. See the letter K in Kill menu-item, letter
k or x. Those are unreadable in old look. OK to commit this?


[-- Attachment #2: Old look --]
[-- Type: image/png, Size: 4596 bytes --]

[-- Attachment #3: New look --]
[-- Type: image/png, Size: 4349 bytes --]

[-- Attachment #4: Type: text/plain, Size: 117 bytes --]


-- 
Pavel Janík

An innovation a day keeps the monopolist away.
                  -- Alan Cox in linux-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-20 17:35 stipple in menu? Pavel Janík
@ 2002-04-20 18:33 ` Jan D.
  2002-04-20 19:51   ` Pavel Janík
  2002-04-21 13:48 ` Kim F. Storm
  2002-04-22  7:46 ` Richard Stallman
  2 siblings, 1 reply; 14+ messages in thread
From: Jan D. @ 2002-04-20 18:33 UTC (permalink / raw)
  Cc: emacs-devel



Pavel Janík wrote:
> 
> The menu uses stipple to show disabled menus. Some letter look very ugly,
> expecially upper case K. I have fixed this today by removing the stipple
> completely and defined another GC to draw. The result is quite good
> IMHO.

How does it look on a monochrome display?  I suspect that is the reason for the
stipple in the first place.

	Jan D.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-20 18:33 ` Jan D.
@ 2002-04-20 19:51   ` Pavel Janík
  2002-04-22 19:30     ` Jan D.
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Janík @ 2002-04-20 19:51 UTC (permalink / raw)
  Cc: emacs-devel

   From: "Jan D." <jan.h.d@swipnet.se>
   Date: Sat, 20 Apr 2002 20:33:16 +0200

   > How does it look on a monochrome display?  I suspect that is the reason for the
   > stipple in the first place.

I do not know, I do not have access to monochrome display and my XFree86
driver for my cards does not support monochrome. Can you, please, test it?


--- xlwmenuP.h.~1.5.~	Mon Oct 29 20:06:53 2001
+++ xlwmenuP.h	Sat Apr 20 19:25:18 2002
@@ -20,11 +20,12 @@
 
 
 /* New fields for the XlwMenu widget instance record */
-typedef struct _XlwMenu_part 
+typedef struct _XlwMenu_part
 {
   /* slots set by the resources */
   XFontStruct*	font;
   Pixel		foreground;
+  Pixel		disabled_foreground;
   Pixel		button_foreground;
   Dimension	margin;
   Dimension	horizontal_spacing;
@@ -44,7 +45,7 @@
   /* True means top_shadow_color and/or bottom_shadow_color must be freed.  */
   unsigned free_top_shadow_color_p : 1;
   unsigned free_bottom_shadow_color_p : 1;
-  
+
   /* State of the XlwMenu */
   int			old_depth;
   widget_value**	old_stack;
@@ -63,7 +64,7 @@
   GC			foreground_gc;
   GC			button_gc;
   GC			background_gc;
-  GC			inactive_gc;
+  GC			disabled_gc;
   GC			inactive_button_gc;
   GC			shadow_top_gc;
   GC			shadow_bottom_gc;
@@ -73,20 +74,20 @@
 } XlwMenuPart;
 
 /* Full instance record declaration */
-typedef struct _XlwMenuRec 
+typedef struct _XlwMenuRec
 {
   CorePart	core;
   XlwMenuPart	menu;
 } XlwMenuRec;
 
 /* New fields for the XlwMenu widget class record */
-typedef struct 
+typedef struct
 {
   int	dummy;
 } XlwMenuClassPart;
 
 /* Full class record declaration. */
-typedef struct _XlwMenuClassRec 
+typedef struct _XlwMenuClassRec
 {
   CoreClassPart		core_class;
   XlwMenuClassPart	menu_class;


--- xlwmenu.h.~1.4.~	Mon Oct 29 20:06:53 2001
+++ xlwmenu.h	Sat Apr 20 19:26:01 2002
@@ -10,6 +10,8 @@
 #include "lwlib.h"
 
 /* Resource names used by the XlwMenu widget */
+#define XtNdisabledForeground "disabledForeground"
+#define XtCDisabledForeground "DisabledForeground"
 #define XtNbuttonForeground "buttonForeground"
 #define XtCButtonForeground "ButtonForeground"
 #define XtNmargin "margin"


--- xlwmenu.c.~1.48.~	Sat Apr 20 15:02:54 2002
+++ xlwmenu.c	Sat Apr 20 19:26:18 2002
@@ -139,6 +139,8 @@
      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, "gray60"},
   {XtNbuttonForeground, XtCButtonForeground, XtRPixel, sizeof(Pixel),
      offset(menu.button_foreground), XtRString, "XtDefaultForeground"},
   {XtNmargin, XtCMargin, XtRDimension,  sizeof(Dimension),
@@ -983,7 +985,7 @@
       if (val->enabled)
 	text_gc = mw->menu.foreground_gc;
       else
-	text_gc = mw->menu.inactive_gc;
+	text_gc = mw->menu.disabled_gc;
       deco_gc = mw->menu.foreground_gc;
 
       if (separator_p)
@@ -1455,13 +1457,10 @@
 				&xgcv);
 
   xgcv.font = mw->menu.font->fid;
-  xgcv.foreground = mw->menu.foreground;
+  xgcv.foreground = mw->menu.disabled_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);
+  mw->menu.disabled_gc = XtGetGC ((Widget)mw,
+				  (GCFont | GCForeground | GCBackground), &xgcv);
 
   xgcv.font = mw->menu.font->fid;
   xgcv.foreground = mw->menu.button_foreground;
@@ -1486,13 +1485,13 @@
 {
   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.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.inactive_gc = (GC) -1;
+  mw->menu.disabled_gc = (GC) -1;
   mw->menu.inactive_button_gc = (GC) -1;
   mw->menu.background_gc = (GC) -1;
 }

-- 
Pavel Janík

And finally even emacs became warezz ..
                  -- Sascha Luedecke in gnu.emacs.help

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-21 13:48 ` Kim F. Storm
@ 2002-04-21 13:25   ` Pavel Janík
  2002-04-21 14:20     ` Miles Bader
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Janík @ 2002-04-21 13:25 UTC (permalink / raw)
  Cc: emacs-devel

   From: storm@cua.dk (Kim F. Storm)
   Date: 21 Apr 2002 15:48:11 +0200

   > Doesn't this assume that the menu bar is using black on light-gray.
   > My menu bar is using white on (some dark shade of green), so with
   > your change, I'd have to modify the Xresources or something to
   > get a sensible color...?

My code is only proof of concept. The value gray60 is arbitrary (it looks
OK on my screen). Can you propose the reasonable default?
-- 
Pavel Janík

Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

                  -- Rik van Riel in linux-kernel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-20 17:35 stipple in menu? Pavel Janík
  2002-04-20 18:33 ` Jan D.
@ 2002-04-21 13:48 ` Kim F. Storm
  2002-04-21 13:25   ` Pavel Janík
  2002-04-22  7:46 ` Richard Stallman
  2 siblings, 1 reply; 14+ messages in thread
From: Kim F. Storm @ 2002-04-21 13:48 UTC (permalink / raw)
  Cc: emacs-devel

Pavel@Janik.cz (Pavel Janík) writes:

> Hi,
> 
> my users (a small group of beginners with Emacs) have found a small
> problem with the default build of Emacs:
> 
> "GNU Emacs 21.2.50.1 (i386-suse-linux-gnu, X toolkit, Xaw3d scroll bars)
>  of 2002-04-20 on SnowWhite"
> 
> I have not noticed that myself, because I use menu exceptionally.
> 
> The menu uses stipple to show disabled menus. Some letter look very ugly,
> expecially upper case K. I have fixed this today by removing the stipple
> completely and defined another GC to draw. The result is quite good
> IMHO. Two screenshots attached. See the letter K in Kill menu-item, letter
> k or x. Those are unreadable in old look. OK to commit this?
>

Doesn't this assume that the menu bar is using black on light-gray.
My menu bar is using white on (some dark shade of green), so with
your change, I'd have to modify the Xresources or something to
get a sensible color...?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-21 13:25   ` Pavel Janík
@ 2002-04-21 14:20     ` Miles Bader
  0 siblings, 0 replies; 14+ messages in thread
From: Miles Bader @ 2002-04-21 14:20 UTC (permalink / raw)
  Cc: Kim F. Storm, emacs-devel

Pavel@Janik.cz (Pavel Janík) writes:
>    > Doesn't this assume that the menu bar is using black on light-gray.
>    > My menu bar is using white on (some dark shade of green)
> 
> My code is only proof of concept. The value gray60 is arbitrary (it looks
> OK on my screen). Can you propose the reasonable default?

Try using x_alloc_lighter_color (in xterm.c), with DELTA > 1 if fg < bg,
and DELTA < 1 if fg > bg.

-Miles
-- 
"I distrust a research person who is always obviously busy on a task."
   --Robert Frosch, VP, GM Research

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-20 17:35 stipple in menu? Pavel Janík
  2002-04-20 18:33 ` Jan D.
  2002-04-21 13:48 ` Kim F. Storm
@ 2002-04-22  7:46 ` Richard Stallman
  2002-04-22 12:38   ` Pavel Janík
  2 siblings, 1 reply; 14+ messages in thread
From: Richard Stallman @ 2002-04-22  7:46 UTC (permalink / raw)
  Cc: emacs-devel

When we added the stipple feature, other programs typically used
stipple for this.  What do other GUI programs typically use for this
purpose nowadays?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-22  7:46 ` Richard Stallman
@ 2002-04-22 12:38   ` Pavel Janík
  2002-04-23 19:30     ` Richard Stallman
  0 siblings, 1 reply; 14+ messages in thread
From: Pavel Janík @ 2002-04-22 12:38 UTC (permalink / raw)
  Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 678 bytes --]

   From: Richard Stallman <rms@gnu.org>
   Date: Mon, 22 Apr 2002 01:46:48 -0600 (MDT)

   > When we added the stipple feature, other programs typically used
   > stipple for this.  What do other GUI programs typically use for this
   > purpose nowadays?

Some (like Mozilla) use lighter gray color for text and stipple for
icons. Others (like OpenOffice) use embossed text (see attached
screenshot). I think that GTK does that too.  I do not have access to other
modern GUI programs right now.
-- 
Pavel Janík

/*
 * For moronic filesystems that do not allow holes in file.
 * We may have to extend the file.
 */
                  -- 2.4.0-test2 fs/buffer.c

[-- Attachment #2: oo.png --]
[-- Type: image/png, Size: 1057 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-20 19:51   ` Pavel Janík
@ 2002-04-22 19:30     ` Jan D.
  0 siblings, 0 replies; 14+ messages in thread
From: Jan D. @ 2002-04-22 19:30 UTC (permalink / raw)
  Cc: emacs-devel

Pavel Janík wrote:
>    From: "Jan D." <jan.h.d@swipnet.se>
>    Date: Sat, 20 Apr 2002 20:33:16 +0200
> 
>    > How does it look on a monochrome display?  I suspect that is the reason for the
>    > stipple in the first place.
> 
> I do not know, I do not have access to monochrome display and my XFree86
> driver for my cards does not support monochrome. Can you, please, test it?
> 

As expected, either white (== background) or black (== foreground) 
depending on which pixel one chooses for the shading colour.  In the 
first case, it doesn't show at all, in the second case there is no 
difference from other entries.

However, I suspect not many people have monochrome displays nowdays. 
But if we wan't to keep support for monochrome displays, you can check 
with DefaultDepthOfScreen (XtScreen (mw)) == 1 if this is a monochrome 
screen and then fall back to stipple.

Or even simpler, if disabled_foreground is equal to the foreground pixel 
or equal to the background pixel, you should fall back to stipple.

But then again, it's been many years since I've seen a pure monochrome 
display.

	Jan D.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-22 12:38   ` Pavel Janík
@ 2002-04-23 19:30     ` Richard Stallman
  2002-04-23 20:00       ` Pavel Janík
  2002-05-06 18:56       ` Pavel Janík
  0 siblings, 2 replies; 14+ messages in thread
From: Richard Stallman @ 2002-04-23 19:30 UTC (permalink / raw)
  Cc: emacs-devel

Can you make Emacs use stipple on some displays (perhaps on monochrome
displays, or perhaps only on black-and-white displays), and your newer
method otherwise?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-23 19:30     ` Richard Stallman
@ 2002-04-23 20:00       ` Pavel Janík
  2002-04-25  6:05         ` Richard Stallman
  2002-05-06 18:56       ` Pavel Janík
  1 sibling, 1 reply; 14+ messages in thread
From: Pavel Janík @ 2002-04-23 20:00 UTC (permalink / raw)
  Cc: emacs-devel

   From: Richard Stallman <rms@gnu.org>
   Date: Tue, 23 Apr 2002 13:30:08 -0600 (MDT)

   > Can you make Emacs use stipple on some displays (perhaps on monochrome
   > displays, or perhaps only on black-and-white displays), and your newer
   > method otherwise?

Yes, I'll do that.
-- 
Pavel Janík

Gnus is by far the best newsreader I've ever used. Gnus is also by far
the best MUA I've ever used. Keep up the fantastic work!
                  -- Paul D. Campbell in gnu.emacs.gnus

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-23 20:00       ` Pavel Janík
@ 2002-04-25  6:05         ` Richard Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2002-04-25  6:05 UTC (permalink / raw)
  Cc: emacs-devel

       > Can you make Emacs use stipple on some displays (perhaps on monochrome
       > displays, or perhaps only on black-and-white displays), and your newer
       > method otherwise?

    Yes, I'll do that.

Thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-04-23 19:30     ` Richard Stallman
  2002-04-23 20:00       ` Pavel Janík
@ 2002-05-06 18:56       ` Pavel Janík
  2002-05-07 20:07         ` Richard Stallman
  1 sibling, 1 reply; 14+ messages in thread
From: Pavel Janík @ 2002-05-06 18:56 UTC (permalink / raw)


   From: Richard Stallman <rms@gnu.org>
   Date: Tue, 23 Apr 2002 13:30:08 -0600 (MDT)

   > Can you make Emacs use stipple on some displays (perhaps on monochrome
   > displays, or perhaps only on black-and-white displays), and your newer
   > method otherwise?

Done. Thanks go to Jan, Kim and Miles for their help and testing.

Please test new behavior. Disabled menu-items should now use normal colors
instead of stipple.

If you have unusual color setup and you find a bug, please report your
configuration together with a screenshot of emacs -q with menu File opened.
-- 
Pavel Janík

panic("aha1740.c"); /* Goodbye */
                  -- 2.2.16 drivers/scsi/aha1740.c

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: stipple in menu?
  2002-05-06 18:56       ` Pavel Janík
@ 2002-05-07 20:07         ` Richard Stallman
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Stallman @ 2002-05-07 20:07 UTC (permalink / raw)
  Cc: emacs-devel

Thanks for bringing this to completion.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-05-07 20:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20 17:35 stipple in menu? Pavel Janík
2002-04-20 18:33 ` Jan D.
2002-04-20 19:51   ` Pavel Janík
2002-04-22 19:30     ` Jan D.
2002-04-21 13:48 ` Kim F. Storm
2002-04-21 13:25   ` Pavel Janík
2002-04-21 14:20     ` Miles Bader
2002-04-22  7:46 ` Richard Stallman
2002-04-22 12:38   ` Pavel Janík
2002-04-23 19:30     ` Richard Stallman
2002-04-23 20:00       ` Pavel Janík
2002-04-25  6:05         ` Richard Stallman
2002-05-06 18:56       ` Pavel Janík
2002-05-07 20:07         ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).