[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2166.0. "XSetInputFocus Problem" by VNASWS::HAUSB (Its a hard life in the mountains) Tue Jan 30 1990 08:25

    
    
    I have a problem with XSetInputFocus. I am running UWS 2.1.
    
    The following lines have been extracted from my program.
    XSetInputFocus works if I have the "sleep" in place. It doesn't if I
    remove it or replace it by XFlush or XSync. I get the error:
    
X Protocol error detected by server: parameter mismatch
  Failed request major op code 42 X_SetInputFocus
  Failed request minor op code 0 (if applicable)
  ResourceID 0x200002 in failed request (if applicable)
  Serial number of failed request 13
  Current serialnumber in output stream 14

    ---------------------------------------------------------------------
    Any idea ?????
    ---------------------------------------------------------------------
    
     w = XCreateSimpleWindow (display, RootWindow (display, screen),
                              hints.x, hints.y, hints.width, hints.height, 2,
                              border, back);
     XMapWindow   (display, w);
     XSync (display, False);
     XGetInputFocus (display, &wtext, &irevert);
/*                  Setze Focus auf kleines Window */
    
     XSetInputFocus (display, w, RevertToNone, CurrentTime);
    
     sleep(5); /* <----------- THIS HELPS */
    
     XSelectInput (display, w,
         (KeyPressMask | ExposureMask | ButtonPressMask));

--------------------------------------------------------------------

    
T.RTitleUserPersonal
Name
DateLines
2166.1VIA::FINNEGANAll of the best intentions are less than one good act.Tue Jan 30 1990 09:399
The problem is that you don't really have a window created on the screen when
do try your set input focus call.  The sleep works because the window is created
during the sleep but is not teh correct solution.

You should add an expose callback on your window.  In the expose call back you
know you window is created and ready.  Then you do things like set input focus,
create GC's and any other operation that requires a valid window or widget id.

Neal
2166.2VNASWS::HAUSBIts a hard life in the mountainsWed Jan 31 1990 07:046
    Thanx,
    that may help.
    
    But why does "XFlush" or "XSync" not help ??
    
    G.H
2166.3FLUME::dikeWed Jan 31 1990 07:504
XFlush and XSync only make sure that your request gets to the server.  The map
request also has to go through a window manager so that the wm can wrap 
decorations around the window if it needs to before mapping it.
				Jeff