[comp.windows.x] Question

rory@maccs.dcss.mcmaster.ca (Rory Jacobs) (01/31/91)

Hi,

I spent the afternoon discovering that useing ButtonMotionMask
(a mask for a MotionNotify), does not work on the sun sparcstaion
(sun 4) I am using, when the ButtonPress event is selected!
Is this my imagination?  The reason I wonder about this is
O'Reilly volume one, by Adrian Nye, example code is on the system
(came with the X window Release 4 distribution), that has both.
It doesn't work either.  Did they pass on non-working code just
to torture us new x boys (newxbys)?


Volume one of O'Reilly brings up my second point, any suggested
reference out there fro the athena widget set?

   Thanks in advace,
      Rory Jacobs

Rory Jacobs                                   Who me?!?
rory@maccs.dcss.mcmaster.ca                   Let's go Flyers!
...!uunet!uati!utgpu!maccs!rory               I thought it was easy...
Department of Computer Science and Systems    Boring (yawn)!
McMaster University, Hamilton, Ont            Let's have some fun.

mouse@lightning.mcrcim.mcgill.EDU (02/05/91)

> Subject: question

Surely you can come up with something more informative than that! :-)

> I spent the afternoon discovering that useing ButtonMotionMask (a
> mask for a MotionNotify), does not work on the sun sparcstaion (sun
> 4) I am using, when the ButtonPress event is selected!

Whose server?  OpenWindows?  MIT?  Other?

> Is this my imagination?

Probably not, but most likely you have some mistake in your program,
rather than the fault lying in the server.

From what you say, it sounds as though you are asking for
ButtonPressMask|ButtonMotionMask on a window, and are getting
ButtonPress events but no MotionNotify events.  According to my reading
of the protocol document, this ought to work (ie, you should get both
ButtonPress events and (when appropriate) MotionNotify events), and in
a simple test program I just tried it does work.  (I'm using the MIT R4
server.)

If you are asking for ButtonPressMask|ButtonMotionMask but aren't
seeing MotionNotify events even when a button is down, something odd is
going wrong, and I would have to see the code to guess what's the
matter.  If this is not true, I'd need to know in what way it is
inaccurate....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

daniel@vicorp.com (Daniel Dee) (02/27/91)

I wonder if anybody can give me some insight into this. Or maybe 
tell me if it is a bug.

I am using XCopyArea to copy a region in a window into a pixmap
and then to copy it back from the pixmap to the window. The problem
I am encountering is this: the region is being copied onto the
window with a black band on top and on the right side of the
pixmap exactly equal in size to the position of the origin of
the window from the upper-left hand corner of the screen. 
That is,

       Pixmap                   Screen

       +------+        +-----------------------------+
       |      |        |    Window                   |
       |      |        |  +-----------------+        |
       |   |  |        |  |                 |        |
       +---|--+        |  |  +------+       |        |
           |           |  |  |XXXXXX|       |        | 
           +-XCopyArea------>|X +---|       |        | 
                       |  |  |X |   |       |        | 
                       |  |  +------+       |        |
                       |  +-----------------+        | 
                       |                             | 
                       |                             | 
                       |                             | 
                       +-----------------------------+



If the origin of the Window is (X,Y) from the upper-left hand corner
of the Screen, then the copied Pixmap will leave a band (shown as
XXXXX region in the diagram above) on the left with width X,
and top with height Y.

The rest of the Pixmap seems to copy correctly. As far as I can tell,
I am not doing anything wrong. All I can figure out is that 
XCopyArea thought that Pixmap is the Window and like the 
Window, it is offset (X,Y) from the origin of the Screen. It then 
thinks that the region from (0,0) to (X,Y) on the Pixmap is outside 
the valid display region, which is true for the Window and not 
for the Pixmap. Hence only the region starting from (X,Y) of the 
Pixmap is copied onto the window by XCopyArea.

Am I wrong? If I am right, then this seems like a bug.
Anybody has any idea. Any insight will be appreciated. 
Thank you.

-- Daniel (ddee@vicorp.com)

mouse@lightning.mcrcim.mcgill.EDU (02/28/91)

> I am using XCopyArea to copy a region in a window into a pixmap and
> then to copy it back from the pixmap to the window.  The problem I am
> encountering is this: the region is being copied onto the window with
> a black band on top and on the right side of the pixmap exactly equal
> in size to the position of the origin of the window from the
> upper-left hand corner of the screen.

[diagram making clear the above should be "top and left side".]

> The rest of the Pixmap seems to copy correctly.

Does this mean that the area that's not the black band is the corner of
the window, or that part of the window that's inset from the corner by
the size of the black band?  If the former, I suspect one problem; if
the latter, I'm not as sure, but another possibility comes to mind.

In any case, I'd need to see the code, in particular the XCopyArea
calls being used to copy in each direction.  I suspect you simply have
some of the coordinates wrong....

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu