qt - Linux, execl(), Why do I lose keyboard input to the application? -


my linux program has name myprogram_0001 , newer versions higher numbers. when started app looks newer version in same directory , if finds 1 calls via execl(). works great, while mouse continues work new version not keyboard input, if click in window beforehand. calling app gone, other running programs continue keyboard input ... ideas ? program written c++ qt designer 4.7 application, shouldn't important, or maybe :-) ?

ok, more information ... here's code catches keys , calls slots ...

// define own event handler // capture key presses ... bool layout10::eventfilter(qobject *obj, qevent *event) {     if (event->type() == qevent::keypress)     {         qkeyevent *keyevent = static_cast<qkeyevent*>(event);          // directly exit on alt-keys         if (keyevent->modifiers()&qt::altmodifier) return true;          // normal keyboard         if ((!(keyevent->modifiers()&qt::keypadmodifier))&&(keyboard_on)) switch (keyevent->key())         {             case qt::key_0:         c->num0buttonclicked_kp(); return true;             case qt::key_1:         c->num1buttonclicked_kp(); return true;             case qt::key_2:         c->num2buttonclicked_kp(); return true;             case qt::key_3:         c->num3buttonclicked_kp(); return true;             case qt::key_4:         c->num4buttonclicked_kp(); return true;             case qt::key_5:         c->num5buttonclicked_kp(); return true;             case qt::key_6:         c->num6buttonclicked_kp(); return true;             case qt::key_7:         c->num7buttonclicked_kp(); return true;             case qt::key_8:         c->num8buttonclicked_kp(); return true;             case qt::key_9:         c->num9buttonclicked_kp(); return true;             case qt::key_x:         c->xbuttonclicked_kp();    return true;             case qt::key_backspace: c->ebuttonclicked_kp();    return true;             case qt::key_f1:        c->f1buttonclicked_kp();   return true;             case qt::key_f2:        c->f2buttonclicked_kp();   return true;             case qt::key_f3:        c->f3buttonclicked_kp();   return true;         }          // keypad         if ((keyevent->modifiers()&qt::keypadmodifier)&&(keypad_on)) switch (keyevent->key())         {             case qt::key_0:         c->num0buttonclicked_kp(); return true;             case qt::key_insert:    c->num0buttonclicked_kp(); return true;             case qt::key_1:         c->num1buttonclicked_kp(); return true;             case qt::key_end:       c->num1buttonclicked_kp(); return true;             case qt::key_2:         c->num2buttonclicked_kp(); return true;             case qt::key_down:      c->num2buttonclicked_kp(); return true;             case qt::key_3:         c->num3buttonclicked_kp(); return true;             case qt::key_pagedown:  c->num3buttonclicked_kp(); return true;             case qt::key_4:         c->num4buttonclicked_kp(); return true;             case qt::key_left:      c->num4buttonclicked_kp(); return true;             case qt::key_5:         c->num5buttonclicked_kp(); return true;             case qt::key_clear:     c->num5buttonclicked_kp(); return true;             case qt::key_6:         c->num6buttonclicked_kp(); return true;             case qt::key_right:     c->num6buttonclicked_kp(); return true;             case qt::key_7:         c->num7buttonclicked_kp(); return true;             case qt::key_home:      c->num7buttonclicked_kp(); return true;             case qt::key_8:         c->num8buttonclicked_kp(); return true;             case qt::key_up:        c->num8buttonclicked_kp(); return true;             case qt::key_9:         c->num9buttonclicked_kp(); return true;             case qt::key_pageup:    c->num9buttonclicked_kp(); return true;             case qt::key_back:      c->xbuttonclicked_kp();    return true; // maybe should have been backslash ?             case qt::key_delete:    c->ebuttonclicked_kp();    return true;             case qt::key_division:  c->f1buttonclicked_kp();   return true;             case qt::key_multiply:  c->f2buttonclicked_kp();   return true;             case qt::key_minus:     c->f3buttonclicked_kp();   return true;         }         return true; // event not given on further processing     }     else     {         return false; // other events may processed further     } } 

the keyboard_on public boolean member of class use disable keyboard if touchscreen presented user. message handler above installed ...

this->installeventfilter(this); 

... in constructor of widget class ... have 1 such handler widget classes make dialogs ... well, works unless start app through execl or startdetached() ...

one thing caught eye in description of startdetached() ... write new process running in own environment , behaves deamon under linux. wonder if that's why loose keys ...

really puzzles me. there chain of layers keystrokes have pass , way debug , see @ level loose them ? !

more info ... found don't loose keyboard if call same binary through execl. if copy binary different name , call ... keyboard gone. comes down a single letter change in execl call, in second parameter, else being same bug still occurs ... seems there's context remains same if path+binary same, otherwise keys sent old context , file called through execl started within different context ...

many applications deal issues starting shell script runs binary, instead of binary itself. firefox this. can "most recent version" check in script.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

c# - how to write client side events functions for the combobox items -

ssh client with paramiko (python) -