From: Hans-Dieter K. <hd...@t-...> - 2005-05-11 01:06:06
|
Hi all, resulting of the extensive exchange of ideas, here I propose a patch for testing and discussing. It uses alternating locking keys and filters the keys so that they don't kill tooltips and menus and it doesn't interfere typing into an xterm as far as I could test. I hope that I've covered (nearly) all issues now... Cheers, Hans-Dieter Index: src/xitk/videowin.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/videowin.c,v retrieving revision 1.213 diff -u -r1.213 videowin.c --- src/xitk/videowin.c 15 Feb 2005 20:39:20 -0000 1.213 +++ src/xitk/videowin.c 11 May 2005 00:00:27 -0000 @@ -1449,8 +1449,8 @@ gVw->desktopHeight = DisplayHeight(gGui->video_display, gGui->video_screen); #ifdef HAVE_XTESTEXTENSION - gVw->fake_keys[0] = XKeysymToKeycode(gGui->video_display, XK_Shift_L); - gVw->fake_keys[1] = XKeysymToKeycode(gGui->video_display, XK_Control_L); + gVw->fake_keys[0] = XKeysymToKeycode(gGui->video_display, XK_Scroll_Lock); + gVw->fake_keys[1] = XKeysymToKeycode(gGui->video_display, XK_Num_Lock); gVw->fake_key_cur = 0; #endif @@ -2151,6 +2151,8 @@ XLockDisplay(gGui->video_display); XTestFakeKeyEvent(gGui->video_display, gVw->fake_keys[gVw->fake_key_cur], True, CurrentTime); XTestFakeKeyEvent(gGui->video_display, gVw->fake_keys[gVw->fake_key_cur], False, CurrentTime); + XTestFakeKeyEvent(gGui->video_display, gVw->fake_keys[gVw->fake_key_cur], True, CurrentTime); + XTestFakeKeyEvent(gGui->video_display, gVw->fake_keys[gVw->fake_key_cur], False, CurrentTime); XSync(gGui->video_display, False); XUnlockDisplay(gGui->video_display); } Index: src/xitk/xine-toolkit/xitk.c =================================================================== RCS file: /cvsroot/xine/xine-ui/src/xitk/xine-toolkit/xitk.c,v retrieving revision 1.136 diff -u -r1.136 xitk.c --- src/xitk/xine-toolkit/xitk.c 29 Apr 2005 00:42:47 -0000 1.136 +++ src/xitk/xine-toolkit/xitk.c 11 May 2005 00:00:29 -0000 @@ -147,6 +147,8 @@ struct timeval keypress; + KeyCode ignore_keys[3]; + pthread_t *tips_thread; unsigned long tips_timeout; @@ -1269,6 +1271,19 @@ if(!(fx = (__gfx_t *) xitk_list_first_content(gXitk->gfx))) return; + + if(event->type == KeyPress || event->type == KeyRelease) { + + /* Filter keys that dont't need to be handled by xine */ + /* and could be used by our screen saver reset "ping". */ + /* So they will not kill tips and menus. */ + + int i; + + for(i = 0; i < sizeof(gXitk->ignore_keys)/sizeof(gXitk->ignore_keys[0]); ++i) + if(event->xkey.keycode == gXitk->ignore_keys[i]) + return; + } FXLOCK(fx); @@ -1790,6 +1805,9 @@ xitk_x_error = 0; gXitk->x_error_handler = NULL; gXitk->modalw = None; + gXitk->ignore_keys[0] = XKeysymToKeycode(display, XK_Scroll_Lock); + gXitk->ignore_keys[1] = XKeysymToKeycode(display, XK_Num_Lock); + gXitk->ignore_keys[2] = XKeysymToKeycode(display, XK_Caps_Lock); gXitk->tips_timeout = TIPS_TIMEOUT; XGetInputFocus(display, &(gXitk->parent.window), &(gXitk->parent.focus)); |