X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=c52196f65b3e2fdba460439f129fee0ee2542b7e;hb=12d4e343f31707c899e6e4daa10c68b172433cff;hp=a12d71f66fa61ee900eaceb936753b41c2f11c4b;hpb=32a609a6bd1181993569399ab51f314dc7cb4fba;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index a12d71f6..c52196f6 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -57,7 +57,9 @@ #include #include +#ifdef HAVE_XV #include +#endif #include #include #include @@ -205,9 +207,10 @@ BC_WindowBase::~BC_WindowBase() XFree(xinerama_info); xinerama_screens = 0; xinerama_info = 0; +#ifdef HAVE_XV if( xvideo_port_id >= 0 ) XvUngrabPort(display, xvideo_port_id, CurrentTime); - +#endif unlock_window(); // Must be last reference to display. // _XftDisplayInfo needs a lock. @@ -869,8 +872,11 @@ int BC_WindowBase::keysym_lookup(XEvent *event) wkey_string_length = 0; if( input_context ) { + wchar_t wkey[4]; wkey_string_length = XwcLookupString(input_context, - (XKeyEvent*)event, wkey_string, 4, &keysym, 0); + (XKeyEvent*)event, wkey, 4, &keysym, 0); + for( int i=0; iuse_xvideo || // disabled !get_resources()->use_shm ) // Only local server is fast enough. return -1; @@ -3160,8 +3167,10 @@ int BC_WindowBase::grab_port_id(int color_model) } XvFreeAdaptorInfo(info); - return xvideo_port_id; +#else + return -1; +#endif } @@ -3901,9 +3910,9 @@ void BC_WindowBase::get_pop_cursor(int &px, int &py, int lock_window) get_abs_cursor(px, py, lock_window); if( px < xmargin ) px = xmargin; if( py < ymargin ) py = ymargin; - int wd = get_screen_w(lock_window,-1) - xmargin; + int wd = get_screen_x(lock_window,-1) + get_screen_w(lock_window,-1) - xmargin; if( px > wd ) px = wd; - int ht = get_screen_h(lock_window,-1) - ymargin; + int ht = get_screen_y(lock_window,-1) + get_screen_h(lock_window,-1) - ymargin; if( py > ht ) py = ht; } int BC_WindowBase::get_pop_cursor_x(int lock_window) @@ -4039,7 +4048,7 @@ int BC_WindowBase::ctrl_down() return top_level->ctrl_mask; } -wchar_t* BC_WindowBase::get_wkeystring(int *length) +wchr_t* BC_WindowBase::get_wkeystring(int *length) { if(length) *length = top_level->wkey_string_length; @@ -4214,6 +4223,8 @@ void BC_WindowBase::set_force_tooltip(int v) int BC_WindowBase::raise_window(int do_flush) { + if( hidden ) return 1; + if( wait_viewable(500) ) return 1; XRaiseWindow(top_level->display, win); if(do_flush) XFlush(top_level->display); return 0; @@ -4630,3 +4641,15 @@ void BC_WindowBase::focus() XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime); } +int BC_WindowBase::wait_viewable(int ms) +{ + Timer timer; + XWindowAttributes xwa; + do { + XGetWindowAttributes(top_level->display, top_level->win, &xwa); + if( xwa.map_state == IsViewable ) return 0; + usleep(10000); + } while( timer.get_difference() < ms ); + return 1; +} +