HDTenEightyP/NetNews huggingface dataset:
From: dkarr@sierra.com (David Karr)
Subject: Re: getting XShape extension events into Xt
Organization: Sierra Geophysics,  Kirkland WA
X-Newsreader: Tin 1.1 PL4
Date: Fri, 6 Nov 1992 21:39:02 GMT

jeb@lazarus.nrtc.northrop.com (Jim Brennan) writes:
: I'm having this problem with Xt.  It appears that Xt does not
: recognize the ShapeNotifyMask used by the Shape Extension.  The
: ShapeNotify event is sent whenever the shape of a window changes.  In
: order to tell the Shape Extension the you are interested in the
: ShapeNotify event, a XShapeSelectInput call is made.  Then in the X
: Event loop, the application watches for an event type of event_base +
: ShapeNotify (see program #1).
: 
: This works great for when using an X Event loop.  The problem problem
: arises when you want have the ShapeNotify events come through
: Xt[App]MainLoop.  Looking in the extensions/shape.h file for
: X11R5, you'll notice that the ShapeNotifyMask is defined as (1L << 0)
: or 0x1.  Obviously this mask will not and does not work for a
: XtAddEventHandler call.
: 
: The question is this: is there any way to have Xt[App]MainLoop call a
: specified routine for extension events?

Issue 3 of "The X Resource" discusses the Shape extension, and it covers
the problem you are having.  You should probably read the article, but I
can provide a short summary of the problem.

Basically, you can't use XtAppMainLoop because the intrinsics do not yet
handle extension events properly.  Here is a snippet of code from the
article that shows what you have to do:

Widget top;
XtAppContext app;
int event_base, error_base;
XEvent event;
..
if (XShapeQueryExtension(XtDisplay(top), &event_base, &error_base))
    XShapeSelectInput(XtDisplay(top), XtWindow(top), ShapeNotifyMask);

for (;;)
{
    XtAppNextEvent(app, &event);

    if (event.type == event_base)
    {
    	/* code for handling shape extension events */
    }

    XtDispatchEvent(&event);
}

Read the article for more information about this.
--
David M. Karr
Sierra Geophysics, Inc.
ARPA: dkarr@sierra.com, UUNET: uunet!sgihbtn!dkarr
Phone: (206) 822-5200 (x343)
Xref: sparky comp.windows.x.intrinsics:523 comp.windows.x:19037
From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
Newsgroups: comp.windows.x.intrinsics,comp.windows.x
Subject: Re: Dragging pointer into popup causes problem
Date: 12 Nov 92 09:21:02 GMT
Article-I.D.: thunder.1992Nov12.092102.18405
Organization: McGill Research Centre for Intelligent Machines

In article <BxHCp6.2I0@acsu.buffalo.edu>, okeefe@cs.Buffalo.EDU (Paul O'Keefe) writes:

> My main app widget implements Tek-style crosshairs with event
> handlers for PointerMotion and CrossingEvents.

> If I drag the pointer into a popup window, ButtonMotion events
> continue to be reported to the main app widget even though no grab is
> in effect.

Well, a grab *is* in effect.  This is a bug in the protocl (misfeature,
perhaps, when I'm in a more tolerant mood): a button press starts a
grab, like it or not.  You can't suppress this grab; about all you can
do is explicitly ungrab, and that suffers from race conditions.  (It
also doesn't address the other context in which this commonly comes up,
that of two clients wanting to select for ButtonPress events on the
same window.)

					der Mouse

			    mouse@larry.mcrcim.mcgill.edu
Newsgroups: comp.windows.x.intrinsics
From: psn6493@usl.edu (Nagpal Prakash S)
Subject: Problem with event management
Organization: University of Southwestern Louisiana
Date: Fri, 13 Nov 1992 04:48:13 GMT

Hello Folks!
	I am having a problem with setting up an Event Handler.
Well actually this is what I am trying to do.
When you double click on a word in a text widget, the text is 
displayed in reverse video and copied to the cut buffer. I then 
read the cut buffer and display the word clicked on. But the 
event handler displays the word selected whether pointer is moved
into or out of the window, and once for each click of the mouse 
pointer. 
I used 

XtAddEventHandler(widget,(XtBuildEventMask(widget) | SelectNotify),
		True, ProcCalled, NULL );

all my event handler procedure does is 

words = XFetchBytes(XtDisplay(widget),&bytes);
printf("%s\n",words);
 
words is a char *, and bytes int.

Then I tried using translation tables.
My translations table consists of 
<Btn1Down>, <Btn1Up>, <Btn1Down>, <Btn1Up> :   ProcCalled();

But now what happens is that I have to use XtOverrideTranslations,
to enable the procedure to be called, but this then causes the 
word not to be highlighted or copied to the cut buffer.

Any suggestions - or am I doing something wrong

Any help is welcome. Thank you'll very very much.

Prakash S Nagpal.

prakash@usl.edu

-- 

	:o-   |_|
    	    < |_|
	:o-   |_|
Newsgroups: comp.windows.x.intrinsics
From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
Subject: Q: dpy db merging w/another db
Date: Mon, 09 Nov 1992 16:45:07 GMT
Reply-To: jay@vnet.ibm.com
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM Rochester, MN

I've currently got some code which looks vaguely like

   Display *dpy = XtDisplay(toplevel);
   XrmDatabase dpy_db, file_db;

   file_db = XrmGetFileDatabase("some_file");	/* db from file    */
   dpy_db = XtDatabase(dpy);			/* display's db    */

   XrmMergeDatabase(dpy_db, &file_db);		/* destroys dpy_db */

   dpy->db = file_db;	/* replace destroyed db with the merged db */

I do this since I need to load some resource values from a file used to
specify some widget resources, such as color and fonts.  These resource
files are used by a number of clients and to avoid duplicating the values
in each client's system app-defaults file, they are placed in these files
and each client loads them itself by calling code remarkably similar to
the above :).

However, the user may override some or all of these values in their own
app-defaults file, which is why the merge is from the dpy_db, which
XtAppInitialize() (actually XtDisplayInitialize(), I suppose) has so kindly
built for us, to the resource db from the file: the possible user settings
from their app-defaults file, contained in dpy_db, will override the file
defaults in file_db.

But... in the latest X Resource, it is noted that for R6, the consortium
will be changing the Xlib header files to disallow direct access to the
Display structures, since this is how the spec says they should be (ie.
opaque structures).

So, the above code will most likely break in R6.  Since I may not recall
that I'm doing things this way when R6 comes out (or by the time we get it
on AIX), I'd like to correct this so I don't have to worry about it.

Unfortunately, I can't seem to figure out how to do this.  Does anyone have
a way to correct my problem, that is, a ``correct'' way to merge the 
display database with another database and then replace the display's with
the newly created merged database?

Thanks.

-- 
: jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
: shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1992.  All rights reserved.
From: u_bornetun@decus.ch
Newsgroups: comp.windows.x.intrinsics
Subject: Widget writing: Keyboard traversal.
Date: 10 Nov 92 16:34:42 CET
Organization: DECUS (Switzerland)

Sorry 'bout the last one without a title. That's what happens when you have a
slow line and hit retrun a couple times too much. Here it is again:


Hi widget writers.

I have coded a pushbutton-similar widget under Motif, subclassing XmPrimitive.
It works fine, but now I want to integrate it with the Motif keyboard traversal 
facility. The question is how? All examples I've seen seem to avoid this
delicate issue. 

Is there anyone out there who knows how to do it (and is prepared to share that
knowledge)???

Thanks 
Ulrika
Xref: sparky comp.windows.x.intrinsics:487 comp.windows.x:18765
From: mtn@ece.arizona.edu (Mike Nguyen)
Newsgroups: comp.windows.x.intrinsics,comp.windows.x
Subject: Resizing
Date: 5 Nov 92 18:53:21 GMT
Reply-To: mtn@ece.arizona.edu (Mike Nguyen)
Distribution: world, local,local
Organization: University of Arizona Dept. of Electrical and Computer Engineering


In a box widget, is there anyway of not having the window resize itself if
say, a label widget was made a child of the box widget.  In my case, I have
a "quit" command widget that is a child of a "canvas" box widget.  However,
when the quit window is realize, the canvas window shrinks to the size of
the quit command widget.
Can anybody offer any suggestions?

Thanks in advance.

Mike Nguyen
mtn@desert-gw.ece.arizona.edu
Xref: sparky comp.windows.x.intrinsics:528 comp.windows.open-look:4482
From: johng@cres1.anu.edu.au (John Gallant)
Newsgroups: comp.windows.x.intrinsics,comp.windows.open-look
Subject: Linking, undefined symbols get_wmShellWidgetClass .. Help please
Date: 12 Nov 1992 22:15:51 GMT
Organization: Centre for Resource and Environment Studies, Australian National University
Distribution: world
NNTP-Posting-Host: 150.203.59.4

I have an application I have written using the Athena widget set running
on several flavours of Sun-4 under OpenWindows 2. I recently sent a copy
off to some colleagues to compile on their Sun (also a Sun-4 I think,
forgot to check this) which has OpenWindows 3. They got two undefined
symbols at link phase (these were dictated over the phone so there may
be slight errors):

	get_wmShellWidgetClass
	get_applicationShellWidgetClass

I have never seen these symbols before and neither I nor the guy
compiling the program can find any reference to either of these symbols
in any of the libraries. We have one machine with OpenWindows 3 here,
which has the libraries but not the include files for that version. I
compiled the program using the OW3 libraries without any problems.

I have no idea what is going on here, and I can't access the machine the
program is being compiled on since it isn't on the net. Does anyone have
any ideas on how we can fix/get around these undefined symbols? BTW this
is fairly urgent, the programs are supposed to be running on Monday.
Sound familiar ... ?

Thanks everyone


-- 
    John Gallant           johng@cres.anu.edu.au  "Every \item command in
Centre for Resource and      ph: +61 6 249 0666    item_list must have an
 Environmental Studies      fax: +61 6 249 0757    optional argument".
Australian National University                     Leslie Lamport, LaTeX
Xref: sparky comp.windows.x.intrinsics:505 comp.windows.x:18936
From: okeefe@cs.Buffalo.EDU (Paul O'Keefe)
Newsgroups: comp.windows.x.intrinsics,comp.windows.x
Subject: How to freeze the pointer
Date: 10 Nov 92 03:51:39 GMT
Organization: State University of New York at Buffalo/Comp Sci
Originator: okeefe@dubhe.cs.buffalo.edu


I want to implement a "snap-to" point-n-click data picking feature
where the cursor snaps to the nearest data point and freezes in position
while a popup is displayed in response to a button press button.

Ideas:
Remove the cursor and draw an X when a button is pressed.

Keep warping the cursor back to the place I want it if moved. (A real kludge.)

Do a server grab, but this could cause a conflict with the
window manager and doesn't seem like the right approach for an application.

Question: have a better idea?
From: moss@brl.mil
Newsgroups: comp.windows.x.intrinsics
Subject: Re: Question about pixmap
Date: 9 Nov 92 18:46:13 GMT
Reply-To: moss@brl.mil
Organization: Army Research Laboratory (provisional)

In article <1992Nov5.065635.13250@ccnews.nctu.edu.tw>, blshyu@nctu.edu.tw writes:
|>   I am trying to set resources of command widget and find this problem:
|> When I set the backgroundPixmap resource to a bitmap file supplied in the
|> X11R5 include/bitmaps, say, root_weave, the program gets the message:
|> 
|> Warning: No type converter registered for 'String' to 'Pixmap' conversion.
|> 
|> and the background is draw by the background color.
|> 
|>   Can you tell me what this warning message means and how to overcome this
|> problem?
|> 
|> -----------------------------------------------------------------------------
|> B. L. Shyu                                        <blshyu@ccnews.nctu.edu.tw>
|> National Chiau-Tung University

I assume you are using XtSetValues() or XtVaSetValues() and passing in
the name of the bitmap file (root_weave).  This is incorrect, you need
to pass a Pixmap in to Xt{Va}SetValues().  You can convert "root_weave"
to a Pixmap with XCreatePixmapFromBitmapData(), something like this
should work:

#include <X11/bitmaps/root_weave>

...

        mypixmap = XCreatePixmapFromBitmapData( XtDisplay( toplevel ),
                mydrawable,
                root_weave_bits, root_weave_width, root_weave_height,
                foreground.pixel, background.pixel, depth );

	XtVaSetValues( commandwidget, XtNbackgroundPixmap, mypixmap, NULL );
...

The clue is the type of the widget resource.  The command widget's
XtbackgroundPixmap resource is of type "Pixmap" not "String".  NB when you
place resources in a file and feed them to xrdb or as app-defaults, the
"String" to "Pixmap" conversion is done automatically.

-Gary
-- 
+-----------------------------------------------+------------------------+
| Gary Moss					| Internet: moss@brl.mil |
| Computer Scientist				|    Phone: 410 278-2979 |
| Ballistic Research Laboratory			|      DSN: 298-2979     |
| Aberdeen Proving Ground, Maryland, USA 	|      Fax: 410 278-5058 |
+-----------------------------------------------+------------------------+
From: jlothian@castle.ed.ac.uk (J Lothian)
Newsgroups: comp.windows.x.intrinsics
Subject: Re: Using Xlib functions on a (simple) widget
Date: 13 Nov 92 13:11:49 GMT
Distribution: eunet
Organization: Edinburgh University Computing Service

In article <BxLz0G.K4r@cs.vu.nl>, abakker@cs.vu.nl (Arno BAKKER) writes:
|> Hello,
|> 
|> how can I use Xlib functions like XDrawPoint() and XDrawLine() on a widget?
|> I tried the following: (based on the xhw3.c example)
|> 
|> 	toplevel = XtInitialize( ... );
|> 
|> 	/* I set arguments for simple widget here (x, y, width, height) */
|> 	simple = XtCreateManagedWidget("simple", simpleWidgetClass,
|>         	                 toplevel, sargs, XtNumber(sargs));
|> 
|> 	XtRealizeWidget( toplevel );
|> 
|> 	simplewin = XtWindow( simple );
|> 	display = XtDisplay( simple );
|> 
|> 	simplegc = XCreateGC( display, simplewin, 0L, NULL );
|> 
|> 	XDrawLine( display, simplegc, 1, 1, 50, 50 );
|> 
|> 	XFlushGC( display, simplegc );
|> 
|> 
|> 	XtMainLoop();
|> 
|> The widget comes up nicely, but no line.
|> What did I do wrong?
|> 
|> Thanks in advance,
|> 
|> 
|> 		Arno
|> 		
|> -- 
|> ===========Arno BAKKER
|> Department of Computer Science,
|> Vrije Univeristeit Amsterdam, Holland.

Are you remembering to handle Exposure events? Bear in mind that
you have to respond to these events by redrawing the contents
of your window (presumably by supplying a callback function).
See volume 1 & 2 of the O'Reilly X manuals for details.

By the way, what does XFlushGC() do? I can't find it in the
X manuals.

James

-------------------------------------------------------
James Lothian        |      "It's life, Jim, 
james@uk.ac.ed.caad  |   but not as we know it"
From: u_bornetun@decus.ch
Newsgroups: comp.windows.x.intrinsics
Subject: <None>
Date: 10 Nov 92 16:27:38 CET
Organization: DECUS (Switzerland)

Hi widget writers.

I have coded a pushbutton-similar widget under Motif, subclassing XmPrimitive.
It works fine, but now I want to integrate it with the Motif keyboard traversal 
facility. The question is how? All examples I've seen seem to avoid this
delicate issue. 

Is there anyone out there who knows how to do it (and is prepared to share that
knowledge)???

Thanks 
Ulrika
Newsgroups: comp.windows.x.intrinsics,comp.windows.x.motif
From: root@atinc.uucp (Operator)
Subject: using float data types via resources?
Organization: atinc.com
Date: Thu, 5 Nov 1992 23:13:25 GMT

I would like to have the user pass in floating point values using
the arg list when creating the widget.  The values never appear in
the widget's instance record.  When my initialize method is called,
I find that the appropriate fields are trashed. The default values
in the resource list sets the instance record OK.  Here's the
code that I use:
 
/**** this code fragment produces what I expect ****/
static float floatZero = 0.0;
static float float100 = 100.0;
static XtResource resources[] = {
    { XtNminvalue, XtCminvalue, XtRFloat, sizeof(float),
        XtOffset(FooWidget, foo.foop.p_minvalue),
        XtRFloat, (caddr_t)&floatZero },
 
    { XtNmaxvalue, XtCmaxvalue, XtRFloat, sizeof(float),
        XtOffset(FooWidget, foo.foop.p_maxvalue),
        XtRFloat, (caddr_t)&float100 },
};
 
/****** if I set these resources in the application , I get bad results ****/
/***  both foo.foop.p_minvalue & foo.foop.p_maxvalue are trashed  **/
 
    Arg args[5];
    argcnt = 0;
    XtSetArg(args[argcnt], XtNminvalue, 200.0); argcnt++;
    XtSetArg(args[argcnt], XtNmaxvalue, 1000.0); argcnt++;
    XtCreateManagedWidget( "foobar", fooWidgetClass, parent, args, argcnt);
 
Can anyone shed some light?

thankx, ronyd@atinc
From: kieron@root.co.uk (Kieron Drake)
Newsgroups: comp.windows.x.intrinsics
Subject: Re: getting XShape extension events into Xt
Keywords: Extensions, Shape, Events
Date: 11 Nov 92 16:18:00 GMT
Organization: UniSoft Ltd., London, England

In <42367@gremlin.nrtc.northrop.com> jeb@lazarus.nrtc.northrop.com (Jim Brennan) writes:
[ stuff deleted ]
>This works great for when using an X Event loop.  The problem problem
>arises when you want have the ShapeNotify events come through
>Xt[App]MainLoop.  Looking in the extensions/shape.h file for
>X11R5, you'll notice that the ShapeNotifyMask is defined as (1L << 0)
>or 0x1.  Obviously this mask will not and does not work for a
>XtAddEventHandler call.
True. In an ideal world of unlimited word sizes etc. what you'd want
to use would be (1L << (event_base+ShapeNotify)) but the Xt Intrinsics
only support core event handling. Anyway, whose to say that event_base
+ ShapeNotify isn't bigger than your word size?  That's why you have to
do it yourself, see below.

[ example code deleted ]

>	/* 
>	 * The following call does not do anything.  ShapeChangeEH is 
>	 * never called.  Any ideas on how to get it called?
>	 */
>	
>/*	XtAddEventHandler (shape, ShapeNotifyMask, False, ShapeChangeEH,
>			   event_base);*/



>	XtMainLoop ();
>}
The Xt Intrinics do not deal with any but the core events.
When dispatching an incoming event they use a table indexed by event.type
to get the mask used to match for an event handler and, as event_base +
ShapeNotify is guaranteed to be bigger than any core event type this is spotted
and a mask of 0 is used, guaranteeing that no event handler will match.
(In fact ShapeNotifyMask (1L<<0) is a misleading mask as its the same as
KeyPressMask. What happens when you hit a key stroke in that widget's
window?)

The only solution is to do XtAppMainLoop yourself. It's defined as:

	void XtAppMainLoop(app)
		XtAppContext app;
	{
	    XEvent event;

	    for (;;) {
		XtAppNextEvent(app, &event);
		XtDispatchEvent(&event);
	    }
	}

so replace your main loop call (use the "App" version of things, by
the way, it's cleaner) by:

	for (;;) {
		XEvent event;

		XtAppNextEvent(app, &event);
		/* app is the side effect of an XtAppInitialize call, */
		if (event.type == event_base + ShapeNotify)
			do_your_stuff(.....);
		else
			XtDispatchEvent(&event);
	}

Then things will work.

		kieron


-- 
kieron@root.co.uk	Tel: +44 71 729 3773 (or 071 729 3773 in the UK)
Kieron Drake		Fax: +44 71 729 3273 (or 071 729 3273 in the UK)
Senior Consultant, UniSoft Ltd., Spa house, Chapel Place, Rivington Street,
London EC2A 3DQ, UK
Newsgroups: comp.windows.x.intrinsics
From: daniel@juliet.osf.org (Daniel Dardailler)
Subject: Re: Question about pixmap
Organization: Open Software Foundation, Motif Team
Date: Thu, 5 Nov 1992 15:35:50 GMT

 
|> Warning: No type converter registered for 'String' to 'Pixmap' conversion.
|> 
|> and the background is draw by the background color.
|> 
|>   Can you tell me what this warning message means and how to overcome this
|> problem?
 
I don't think there is such a converter in Xt.
There is one in Motif, one in OLIT, I don't know about Athena.

Which toolkit are you using ?

Daniel
From: klee@wsl.dec.com (Ken Lee)
Newsgroups: comp.windows.x.intrinsics
Subject: Re: Widget writing: Keyboard traversal.
Date: 10 Nov 92 23:58:47 GMT
Article-I.D.: PA.1992Nov10.235847.29703
Reply-To: klee@wsl.dec.com
Organization: DEC Western Software Laboratory

|> I have coded a pushbutton-similar widget under Motif, subclassing XmPrimitive.
|> It works fine, but now I want to integrate it with the Motif keyboard traversal 
|> facility. The question is how? All examples I've seen seem to avoid this
|> delicate issue. 

Berlage's book *OSF/Motif: Concepts and Programming* discusses
keyboard traversal.  Basically, you register actions for enter
and leave events and either inherit or define highlight and unhighlight
XmPrimitive class methods.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee
Newsgroups: comp.windows.x.intrinsics
From: abakker@cs.vu.nl (Arno BAKKER)
Subject: Using Xlib functions on a (simple) widget
Organization: Dept. of Computer Science, Vrije Universiteit Amsterdam
Date: Thu, 12 Nov 1992 15:00:15 GMT

Hello,

how can I use Xlib functions like XDrawPoint() and XDrawLine() on a widget?
I tried the following: (based on the xhw3.c example)

	toplevel = XtInitialize( ... );

	/* I set arguments for simple widget here (x, y, width, height) */
	simple = XtCreateManagedWidget("simple", simpleWidgetClass,
        	                 toplevel, sargs, XtNumber(sargs));

	XtRealizeWidget( toplevel );

	simplewin = XtWindow( simple );
	display = XtDisplay( simple );

	simplegc = XCreateGC( display, simplewin, 0L, NULL );

	XDrawLine( display, simplegc, 1, 1, 50, 50 );

	XFlushGC( display, simplegc );


	XtMainLoop();

The widget comes up nicely, but no line.
What did I do wrong?

Thanks in advance,


		Arno
		
-- 
===========Arno BAKKER
Department of Computer Science,
Vrije Univeristeit Amsterdam, Holland.
From: oj@miki.pictel.com (Oliver Jones)
Newsgroups: comp.windows.x.intrinsics
Subject: Re: How to get PointerMotion w/o ButtonMotion events?
Date: 10 Nov 92 14:51:25 GMT
Organization: PictureTel Corporation

In article <BxHDrz.35o@acsu.buffalo.edu> okeefe@cs.Buffalo.EDU (Paul O'Keefe) writes:
>
>I only want PointerMotion events when NO buttons are pressed.
>   For speed, I bypass the translation manager,
>   so I'd have to remove the event handler while a button is down.
>
>Is there some other neat trick to get this behavior?

Any trick you use will have to be an Xt trick, because the X server
doesn't allow you do solicit something appropriate, like 
ButtonNoneMotionMask.

If I were you I'd write my MotionNotify event handler to
summarily ignore events which arrived with any button bits turned
on in the state member.

The other thing you could try would be to call XtAddEventHandler
when receiving ButtonRelease events, and XtRemoveEventHandler
when receiving ButtonPress events.  But, be sure to specify
OwnerGrabButtonMask in the XtAddEventHandler call.

Ollie Jones
Newsgroups: comp.windows.x.intrinsics,comp.windows.x.motif