🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #37653

Re: proper way to get keypress events within override-redirect windows

#37653
From: Barr3y Jaspan
Date: Sun, 04 Mar 1990 19:56
27 lines
1778 bytes
>> I have an Xt application which wants an XtPopup window to be
>> override-redirect (XtNoverrideRedirect True) but still wants
>> KeyPress events.

I solved this problem a couple months ago when I wrote a "synchronous
GetString"
Xt.  (ie: a function that you call that pops up a dialog box, gets a string
from the user, and returns it to the caller w/o mucking around with callbacks,
etc.)

My solution is sorta kludgy but it "does the right thing."  I pop up the
dialog as an override-redirect window.  The dialog has a translation table
that maps "EnterWindow" events to an action procedure called Focus that
does an XSetInputFocus to the text widget inside the dialog.  Thus, when
the mouse enters the dialog I can type into it, and when it leaves the dialog
and enters another window, and ICCCM window manager reassigns keyboard
focus, thus undoing the effect of the XSetInputFocus by GetString.

Note that this will NOT work with a non-ICCCM wm that does not actively
set keyboard focus.. an application that uses this method must have an option
to not do the SetInputFocus.

I'll send a copy of the code, but your mileage may vary.


Barry Jaspan, MIT-Project Athena
bjaspan@athena.mit.edu
Technical Details
Message-ID: <1990Mar4.195647.5761@athena.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!athena.mit.edu!bjaspan
References: <9003022203.AA18830@armory>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!athena.mit.edu!bjaspan
From: bjaspan@athena.mit.edu (Barr3y Jaspan)
Newsgroups: comp.windows.x
Subject: Re: proper way to get keypress events within override-redirect windows
Message-ID: <1990Mar4.195647.5761@athena.mit.edu>
Date: 4 Mar 90 19:56:47 GMT
References: <9003022203.AA18830@armory>
Sender: news@athena.mit.edu (News system)
Reply-To: bjaspan@athena.mit.edu (Barr3y Jaspan)
Organization: Massachusetts Institute of Technology
Lines: 27