X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=1ef0d5939cc8e697ae71ffe3a94b2bbcdc894b3b;hp=24dc5872e0e3ee426b504bffd009a9c305ede949;hb=04031cc2a664d2a6d9d2a37954c55cc68742d78c;hpb=6853a2c0b04cc5ff4e87a2022c914227f925cb7f diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 24dc5872..1ef0d593 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -62,7 +62,6 @@ #include #include - BC_ResizeCall::BC_ResizeCall(int w, int h) { this->w = w; @@ -182,10 +181,12 @@ BC_WindowBase::~BC_WindowBase() for( int i=sizeof(xfont)/sizeof(xfont[0]); --i>=0; ) XFreeFont(display, this->*xfont[i]); -// past bug in X caused XRenderExtensionInfo to be damaged -// if this is done here. left to be done in XCloseDisplay by Xlib. -// works in more modern systems, and needed for leak testing. -#if defined(HAVE_XFT) && defined(VALGRIND) +#ifdef HAVE_XFT +// prevents a bug when Xft closes with unrefd fonts + FcPattern *defaults = FcPatternCreate(); + FcPatternAddInteger(defaults, "maxunreffonts", 0); + XftDefaultSet(display, defaults); + static void *BC_WindowBase::*xft_font[] = { &BC_WindowBase::smallfont_xft, &BC_WindowBase::mediumfont_xft, @@ -390,12 +391,8 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title #endif id = get_resources()->get_id(); - int need_lock = 0; if(parent_window) top_level = parent_window->top_level; - if( top_level ) { // need this to avoid deadlock with Xlib's locks - need_lock = 1; - lock_window("BC_WindowBase::create_window"); - } + if( top_level ) lock_window("BC_WindowBase::create_window"); get_resources()->create_window_lock->lock("BC_WindowBase::create_window"); #ifdef HAVE_LIBXXF86VM @@ -445,6 +442,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title if( shm_completion_event < 0 ) shm_completion_event = ShmCompletion + XShmGetEventBase(display); #endif + lock_window("BC_WindowBase::create_window 1"); screen = DefaultScreen(display); rootwin = RootWindow(display, screen); @@ -548,6 +546,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title PropModeReplace, (unsigned char *)&XGroupLeader, true); } init_im(); + set_icon(get_resources()->default_icon); } #ifdef HAVE_LIBXXF86VM @@ -638,7 +637,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title if(!hidden) show_window(); } get_resources()->create_window_lock->unlock(); - if(need_lock) unlock_window(); + unlock_window(); return 0; } @@ -998,7 +997,7 @@ locking_message = event->xclient.message_type; done = 1; } else { // We currently use X marshalling for xatom events, we can switch to something else later - recieve_custom_xatoms((xatom_event *)ptr); + receive_custom_xatoms((xatom_event *)ptr); } break; @@ -1339,19 +1338,26 @@ locking_message = event->xclient.message_type; break; case LeaveNotify: - if( cursor_entered && event->xcrossing.window == win ) { - cursor_entered = 0; - } + if( event->xcrossing.mode != NotifyNormal ) break; + cursor_entered = 0; event_win = event->xany.window; dispatch_cursor_leave(); break; case EnterNotify: - if( !cursor_entered && event->xcrossing.window == win ) { - if( !event->xcrossing.focus && get_resources()->grab_input_focus ) { - XSetInputFocus(display, win, RevertToParent, CurrentTime); + if( event->xcrossing.mode != NotifyNormal ) break; + + 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; @@ -1979,7 +1985,7 @@ int BC_WindowBase::arm_repeat(int64_t duration) } #endif -int BC_WindowBase::recieve_custom_xatoms(xatom_event *event) +int BC_WindowBase::receive_custom_xatoms(xatom_event *event) { return 0; } @@ -3466,6 +3472,38 @@ BC_WindowBase::get_xinerama_info(int screen) return 0; } +void BC_WindowBase::get_fullscreen_geometry(int &wx, int &wy, int &ww, int &wh) +{ + XineramaScreenInfo *info = top_level->get_xinerama_info(-1); + if( info ) { + wx = info->x_org; wy = info->y_org; + ww = info->width; wh = info->height; + } + else { + wx = get_screen_x(0, -1); + wy = get_screen_y(0, -1); + int scr_w0 = get_screen_w(0, 0); + int root_w = get_root_w(0); + int root_h = get_root_h(0); + if( root_w > scr_w0 ) { // multi-headed + if( wx >= scr_w0 ) { + // assumes right side is the big one + ww = root_w - scr_w0; + wh = root_h; + } + else { + // use same aspect ratio to compute left height + ww = scr_w0; + wh = (w*root_h) / (root_w-scr_w0); + } + } + else { + ww = root_w; + wh = root_h; + } + } +} + int BC_WindowBase::get_screen_x(int lock_display, int screen) { int result = -1; @@ -4539,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); +} +