🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Alex Pakter Fri, 11 Feb 1994 04:14
sending events while grabbing pointer
#38163
Author: Alex Pakter
Date: Fri, 11 Feb 1994 04:14
35 lines
2387 bytes
Hey'all-

	I'm trying to do the following:

	I need to have my application pop up a shell, which the user
can interact with.  If the user clicks in this shell (which has other
widgets in it), I want these events to be processed normally.
	If the user clicks anywhere outside this shell, I need to catch this,
so that my application can hide the popup shell.  Clicks outside the
popup shell should not be processed except by my application.

	I need keyboard input to be enabled so that the user can type into
a text field on my application which is NOT on the popup shell.

	So far I have attempted the following: 	
	I do an XtGrabPointer, and I add event handlers on my application
to catch all relevant events (ButtonPress, ButtonRelease, ButtonMotion).
In the event handler, I do an XQueryPointer, and find out where the
pointer is.  If it is in the shell, I use XSendEvent to forward the event
to the appropriate subwindow of the shell.
  If the click occurs outside the shell, I hide the shell, and do an
XUngrabPointer.

My problem?  It doesn't work.  The events that I send with XSendEvent
aren't getting to their appropriate widgets.  Note that I am calling
XSendEvent while I have the pointer grab. I am sending them to the
window returned in the "child_return" argument to XQueryPointer.

Can anyone help?  

Thanks very much-

Alex   | Alex Pakter
----   | alex@brt.com
  
Re: sending events while grabbing pointer
#38164
Author: Oliver Jones
Date: Sat, 12 Feb 1994 00:46
38 lines
2457 bytes
In article <2jf0nf$ouk@brt.brt.com>, Alex Pakter <alex@brt.com> wrote:
>	If the user clicks anywhere outside this shell, I need to catch this,
>so that my application can hide the popup shell.  Clicks outside the
>popup shell should not be processed except by my application.
>
>	I need keyboard input to be enabled so that the user can type into
>a text field on my application which is NOT on the popup shell.
>
>	So far I have attempted the following: 	
>	I do an XtGrabPointer, and I add event handlers on my application
>to catch all relevant events (ButtonPress, ButtonRelease, ButtonMotion).
>In the event handler, I do an XQueryPointer, and find out where the
>pointer is.  If it is in the shell, I use XSendEvent to forward the event
>to the appropriate subwindow of the shell.
>  If the click occurs outside the shell, I hide the shell, and do an
>XUngrabPointer.
>
>My problem?  It doesn't work. 

The grab feature in X provides for this sort of behavior
without recourse to XSendEvent.

When you grab the pointer, use a pointer_mode of GrabModeSync.

When you get an event which you decide is one of the ones
you want to handle by sending along to the ungrabbed destination,
call XAllowEvents (dpy, ReplayPointer, time);

This will end the grab and redispatch the event *from the server* normally.

When you get an event bound for your dialog box, call
XAllowEvents (dpy, SyncPointer, time);
and process the event.

For more information see p 426-429 of Introduction to the X Window System.

Oliver Jones
(sorry for the book plug)
Re: sending events while grabbing pointer
#38165
Author: Vladimir T. Romanovski
Date: Sun, 13 Feb 1994 20:58
19 lines
1896 bytes
Alex Pakter (alex@brt.com) wrote:
: Hey'all-

: 	I'm trying to do the following:

: 	I need to have my application pop up a shell, which the user
: can interact with.  If the user clicks in this shell (which has other
: widgets in it), I want these events to be processed normally.
: 	If the user clicks anywhere outside this shell, I need to catch this,
: so that my application can hide the popup shell.  Clicks outside the
: popup shell should not be processed except by my application.

: 	I need keyboard input to be enabled so that the user can type into
: a text field on my application which is NOT on the popup shell.

Why did you forget passive grab for pointer?
I think this is just for your problem.

Vladimir
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads