[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
address@hidden: Re: [Xpert]Default fonts for menus, dialogues, etc]
From: |
Richard Stallman |
Subject: |
address@hidden: Re: [Xpert]Default fonts for menus, dialogues, etc] |
Date: |
Thu, 6 Dec 2001 20:12:29 -0700 (MST) |
This gives information that ought to tell us how to find the actual
default foreground and background colors, first for the Athena widgets
and then for Lesstif/Motif. The first example starts by creating a
widget, but I suspect we can use any existing one.
Can someone use this to initialize the `menu' face so that we can
eliminate the fallback resources?
------- Start of forwarded message -------
From: address@hidden
X-Authentication-Warning: dino.conectiva.com.br: httpd set sender to
address@hidden using -f
To: address@hidden
Subject: Re: [Xpert]Default fonts for menus, dialogues, etc
Date: Wed, 05 Dec 2001 15:44:39 -0200 (BRDT)
Cc: address@hidden
In-Reply-To: <address@hidden>
Quoting Richard Stallman <address@hidden>:
Hi,
> Sorry, I didn't make myself clear. In xc/lib/Xt/Core.c, one field
> of the
> default resources of the core widget is:
> {XtNbackground, XtCBackground, XtRPixel,sizeof(Pixel),
> XtOffsetOf(CoreRec,core.background_pixel),
> XtRString, (XtPointer)"XtDefaultBackground"},
>
> Unfortunately, I have no idea what this really means. I don't really
> know Xt internals at all. What I can tell is that you are using the
> term "resources" in a way I don't understand.
I was talking about resources in it's internal representation and the
data associated for translating it from one type to another, i.e. translating
from the string representation to the binary representation.
> Could you possibly show me what a user program should do to find the
> value of XtDefaultBackground? Is XtDefaultBackground a C function?
The simplest program I can think of is this:
- --%<--
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
int
main(int argc, char *argv[])
{
XtAppContext appcon;
Widget widget;
XrmValue from, to;
Pixel fg, bg;
char *background = XtDefaultBackground;
char *foreground = XtDefaultForeground;
/* make sure Xt internals are initialized and get a valid widget pointer */
widget = XtAppInitialize(&appcon, "Test", NULL, 0,
&argc, argv, NULL, NULL, 0);
from.size = strlen(background);
from.addr = background;
to.size = sizeof(Pixel);
to.addr = (XtPointer)&bg;
XtConvertAndStore(widget, XtRString, &from, XtRPixel, &to);
printf("%s has the pixel value 0x%08x\n", background, bg);
from.size = strlen(foreground);
from.addr = foreground;
to.size = sizeof(Pixel);
to.addr = (XtPointer)&fg;
XtConvertAndStore(widget, XtRString, &from, XtRPixel, &to);
printf("%s has the pixel value 0x%08x\n", foreground, fg);
/* read from widget */
XtVaGetValues(widget, XtNbackground, &bg, XtNforeground, &fg, NULL);
printf("background: 0x%08x\nforeground: 0x%08x\n", bg, fg);
return (0);
}
- --%<--
compile as: gcc test.c -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lXt
> If so, could you tell me what arguments it wants?
>
> See lib/Xm/Visual.c for the function _XmBackgroundColorDefault.
>
> I am not sure what directory to look for that file name in. Is that a
> Motif source file? I don't have a copy of Motif, and I would hesitate
> to get one since it isn't free software.
No, it is in the lesstif sources :-)
> But if calling this function is the right thing for Emacs to do, in
> the Motif case, if you could just show me what arguments to give it
> then I would know everything I need.
Probably all you need to do then is some code like this, after the widget
is created:
Pixel defbackground, defforeground;
XtVaGetValues(widget, XtNbackground, &defbackground,
XtNforeground, &defforeground, NULL);
The sample code above also does this.
Paulo
------- End of forwarded message -------