X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;ds=sidebyside;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=621c560acb4b5363df11985e77aca1a13a934847;hb=7e5a0760f40ff787cc3d93cb7768a901ebe52809;hp=f5759dd853d31b196d46040781b359f57c766ad8;hpb=a21c48689604ad7142a02d6f0a8dd4776e8d4422;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index f5759dd8..621c560a 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -1339,20 +1339,25 @@ locking_message = event->xclient.message_type; case LeaveNotify: if( event->xcrossing.mode != NotifyNormal ) break; - if( cursor_entered && event->xcrossing.window == win ) { - cursor_entered = 0; - } + cursor_entered = 0; event_win = event->xany.window; dispatch_cursor_leave(); break; case EnterNotify: if( event->xcrossing.mode != NotifyNormal ) break; - if( !cursor_entered && event->xcrossing.window == win ) { - if( !event->xcrossing.focus && get_resources()->grab_input_focus ) { - XSetInputFocus(display, win, RevertToParent, CurrentTime); + + if( !cursor_entered ) { + for( int i=0; iwin == event->xcrossing.window ) + cursor_entered = 1; + } + if( !cursor_entered && get_resources()->grab_input_focus && + !event->xcrossing.focus && event->xcrossing.window == win ) { + cursor_entered = 1; } - cursor_entered = 1; + if( cursor_entered ) + focus(); } event_win = event->xany.window; cursor_x = event->xcrossing.x; @@ -4572,3 +4577,11 @@ void BC_WindowBase::flicker(int n, int ms) set_opaque(); } +void BC_WindowBase::focus() +{ + XWindowAttributes xwa; + XGetWindowAttributes(top_level->display, top_level->win, &xwa); + if( xwa.map_state == IsViewable ) + XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime); +} +