[comp.windows.x] Novice X11 question on Borders

hall@lilac.cis.ohio-state.edu (john hall) (02/10/89)

Question on X11:

Inconsistent (to me) results on border colors:

I an having trouble getting white on black text with a white border.

When I ask for black on white text, I get the black border.    


47      mywindow = XCreateSimpleWindow( mydisplay,
48          DefaultRootWindow( mydisplay),
49          myhint.x, myhint.y, myhint.width, myhint.height,
50          50, myforeground, mybackground);
51
52      XSetStandardProperties( mydisplay, mywindow, hello, hello,
53          None, argv, argc, &myhint);
54
55      mygc = XCreateGC( mydisplay, mywindow, 0, 0);
56      XSetBackground( mydisplay, mygc, mybackground);
57      XSetForeground( mydisplay, mygc, myforeground);
58      XSetWindowBorder( mydisplay, mywindow, myforeground);
59


Direct mail is fine.  I will post a solution to the net to prevent
multiple solutions clogging the network.

Help is appreciated.

hall@tulip.cis.ohio-state.edu (john hall) (02/14/89)

Thanks to:
Tom LaStrange <toml%hpfcdq@hp-sde.sde.hp.com>
spencer@crim.eecs.umich.edu (Spencer W. Thomas)

Problem: I want white text and border, black background.
		 I was having trouble gettinG the white border.

47      mywindow = XCreateSimpleWindow( mydisplay,
48          DefaultRootWindow( mydisplay),
49          myhint.x, myhint.y, myhint.width, myhint.height,
50          50, myforeground, mybackground);
                ^^^^^^^^^^^^

My helpers pointed out that the border color for the above
call is the color specified in myforeground.  The variable
name (blame Intro to X Window system) is misleading.

However, my problem is that myforeground is WHITE and I still
get a BLACK border.  Using essentially the same code ( copy
and change) I have created a subwindow that does have the
correct border color ==>  But I am still mystified why the
top level window does not want to display a white border.

Thanks for the help, though.

John Hall

dana@dino.bellcore.com (Dana A. Chee) (02/14/89)

In article <35027@tut.cis.ohio-state.edu> hall@tulip.cis.ohio-state.edu (john hall) writes:

   However, my problem is that myforeground is WHITE and I still
   get a BLACK border.  Using essentially the same code ( copy
   and change) I have created a subwindow that does have the
   correct border color ==>  But I am still mystified why the
   top level window does not want to display a white border.

   Thanks for the help, though.

   John Hall

The reason is that the window managers control the border colors on
the top level windows (at least awm and twm do).  For a test, kill
your window manager and then run the program.  You should see what you
expect.  My vote isn't in yet if I like the idea, but since you can't
query a window for its border (pixel/tile), when the window manager
reparents the top window to add title bars, etc, it can't set the
parent's border to be the same as the child had (I wish it could, though).

--
+*************************************************************************+
*  Dana Chee				(201) 829-4488			  *
*  Bellcore								  *
*  Room 2Q-250								  *
*  445 South Street			ARPA: dana@bellcore.com		  *
*  Morristown,  NJ  07960-1910		UUCP: {gateways}!bellcore!dana	  *
+*************************************************************************+