X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=a14c2eef960b4582b9e3836681c9f0b4e2020965;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hp=d8c60421006f0b87eecc6521ab8b2fd703d3895d;hpb=0a0a29dd9e484b5622b46173d51bb6cefc0a5da4;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index d8c60421..a14c2eef 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -85,9 +85,8 @@ Window XGroupLeader = 0; Mutex BC_KeyboardHandlerLock::keyboard_listener_mutex("keyboard_listener",0); ArrayList BC_KeyboardHandler::listeners; -BC_WindowBase::BC_WindowBase(int opts) +BC_WindowBase::BC_WindowBase() { - this->options = opts; //printf("BC_WindowBase::BC_WindowBase 1\n"); BC_WindowBase::initialize(); } @@ -147,13 +146,13 @@ BC_WindowBase::~BC_WindowBase() delete pixmap; +//printf("delete glx=%08x, win=%08x %s\n", (unsigned)glx_win, (unsigned)win, title); #ifdef HAVE_GL - if( get_resources()->get_synchronous() && - (top_level->options & GLX_WINDOW) && glx_win != 0 ) + if( get_resources()->get_synchronous() && glx_win != 0 ) { get_resources()->get_synchronous()->delete_window(this); - else + } #endif - XDestroyWindow(top_level->display, win); + XDestroyWindow(top_level->display, win); if(bg_pixmap && !shared_bg_pixmap) delete bg_pixmap; if(icon_pixmap) delete icon_pixmap; @@ -213,28 +212,15 @@ BC_WindowBase::~BC_WindowBase() XvUngrabPort(display, xvideo_port_id, CurrentTime); unlock_window(); -// Can't close display if another thread is waiting for events. -// Synchronous thread must delete display it owns a GLX_WINDOW // Must be last reference to display. -#ifndef SINGLE_THREAD -#ifdef HAVE_GL - if( (options & GLX_DISPLAY) != 0 && get_resources()->get_synchronous() ) { - printf(_("BC_WindowBase::~BC_WindowBase window deleted but opengl deletion is not\n" - "implemented for BC_Pixmap.\n")); - get_resources()->get_synchronous()->delete_display(this); - } - else -#endif - { // _XftDisplayInfo needs a lock. - get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase"); - XCloseDisplay(display); - get_resources()->create_window_lock->unlock(); - } + get_resources()->create_window_lock->lock("BC_WindowBase::~BC_WindowBase"); + XCloseDisplay(display); + get_resources()->create_window_lock->unlock(); + // clipboard uses a different display connection clipboard->stop_clipboard(); delete clipboard; -#endif // SINGLE_THREAD } resize_history.remove_all_objects(); @@ -269,6 +255,7 @@ int BC_WindowBase::initialize() keys_return[0] = 0; is_deleting = 0; window_lock = 0; + resend_event_window = 0; x = 0; y = 0; w = 0; @@ -431,7 +418,7 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title else this->display_name[0] = 0; - put_title(_(title)); + put_title(title); if(bg_pixmap) shared_bg_pixmap = 1; subwindows = new BC_SubWindowList; @@ -1268,6 +1255,20 @@ locking_message = event->xclient.message_type; case XK_KP_Insert: key_pressed = KPINS; break; case XK_KP_Decimal: case XK_KP_Delete: key_pressed = KPDEL; break; + + case XK_F1: key_pressed = KEY_F1; break; + case XK_F2: key_pressed = KEY_F2; break; + case XK_F3: key_pressed = KEY_F3; break; + case XK_F4: key_pressed = KEY_F4; break; + case XK_F5: key_pressed = KEY_F5; break; + case XK_F6: key_pressed = KEY_F6; break; + case XK_F7: key_pressed = KEY_F7; break; + case XK_F8: key_pressed = KEY_F8; break; + case XK_F9: key_pressed = KEY_F9; break; + case XK_F10: key_pressed = KEY_F10; break; + case XK_F11: key_pressed = KEY_F11; break; + case XK_F12: key_pressed = KEY_F12; break; + case XK_Menu: key_pressed = KPMENU; break; /* menu */ // remote control // above case XK_KP_Enter: key_pressed = KPENTER; break; /* check */ @@ -1365,7 +1366,14 @@ locking_message = event->xclient.message_type; #ifndef SINGLE_THREAD unlock_window(); - if(event) delete event; + if(event) { + if( resend_event_window ) { + resend_event_window->put_event(event); + resend_event_window = 0; + } + else + delete event; + } #else // if(done) completion_lock->unlock(); #endif @@ -2352,6 +2360,9 @@ void BC_WindowBase::init_xft() { #ifdef HAVE_XFT if( !get_resources()->use_xft ) return; +// apparently, xft is not reentrant, more than this is needed +static Mutex xft_init_lock("BC_WindowBase::xft_init_lock", 0); +xft_init_lock.lock("BC_WindowBase::init_xft"); if(!(smallfont_xft = (resources.small_font_xft[0] == '-' ? XftFontOpenXlfd(display, screen, resources.small_font_xft) : @@ -2421,6 +2432,7 @@ void BC_WindowBase::init_xft() } // _XftDisplayInfo needs a lock. XftDefaultHasRender(display); +xft_init_lock.unlock(); #endif // HAVE_XFT } @@ -3371,6 +3383,14 @@ int BC_WindowBase::ungrab(BC_WindowBase *window) this->grab_active = 0; return 1; } +int BC_WindowBase::grab_event_count() +{ + int result = 0; +#ifndef SINGLE_THREAD + result = grab_active->get_event_count(); +#endif + return result; +} int BC_WindowBase::grab_buttons() { XSync(top_level->display, False); @@ -3433,6 +3453,8 @@ BC_WindowBase::get_xinerama_info(int screen) return 0; } int top_x = get_x(), top_y = get_y(); + if( BC_DisplayInfo::left_border >= 0 ) top_x += BC_DisplayInfo::left_border; + if( BC_DisplayInfo::top_border >= 0 ) top_y += BC_DisplayInfo::top_border; for( int i=0; i= xinerama_info[i].height ) continue; @@ -3841,21 +3863,28 @@ int BC_WindowBase::match_window(Window win) int BC_WindowBase::get_cursor_over_window() { - if(top_level != this) return top_level->get_cursor_over_window(); - int abs_x, abs_y, win_x, win_y; - unsigned int temp_mask; + unsigned int mask_return; Window root_return, child_return; - int ret = XQueryPointer(display, win, + int ret = XQueryPointer(top_level->display, top_level->rootwin, &root_return, &child_return, &abs_x, &abs_y, - &win_x, &win_y, &temp_mask); -//printf("BC_WindowBase::get_cursor_over_window %d %s 0x%x %d 0x%x\n", -// __LINE__, title, win, ret, child_return); - - int result = !ret || child_return == None ? 0 : - match_window(child_return); - return result; + &win_x, &win_y, &mask_return); + if( ret && child_return == None ) ret = 0; + if( ret && win != child_return ) + ret = top_level->match_window(child_return); +// query pointer can return a window manager window with this top_level as a child +// for kde this can be two levels deep + unsigned int nchildren_return = 0; + Window parent_return, *children_return = 0; + Window top_win = top_level->win; + while( !ret && top_win != top_level->rootwin && top_win != root_return && + XQueryTree(top_level->display, top_win, &root_return, + &parent_return, &children_return, &nchildren_return) ) { + if( children_return ) XFree(children_return); + if( (top_win=parent_return) == child_return ) ret = 1; + } + return ret; } int BC_WindowBase::cursor_above() @@ -4148,7 +4177,7 @@ void BC_WindowBase::put_title(const char *text) void BC_WindowBase::set_title(const char *text, int utf8) { // utf8>0: wm + net_wm, utf8=0: wm only, utf<0: net_wm only - put_title(_(text)); + put_title(text); const unsigned char *wm_title = (const unsigned char *)title; int title_len = strlen((const char *)title); if( utf8 >= 0 ) { @@ -4258,6 +4287,7 @@ int BC_WindowBase::load_defaults(BC_Hash *defaults) resources->filebox_columnwidth[1] = defaults->get("FILEBOX_WIDTH1", resources->filebox_columnwidth[1]); resources->filebox_columnwidth[2] = defaults->get("FILEBOX_WIDTH2", resources->filebox_columnwidth[2]); resources->filebox_columnwidth[3] = defaults->get("FILEBOX_WIDTH3", resources->filebox_columnwidth[3]); + resources->filebox_size_format = defaults->get("FILEBOX_SIZE_FORMAT", get_resources()->filebox_size_format); defaults->get("FILEBOX_FILTER", resources->filebox_filter); return 0; } @@ -4285,6 +4315,7 @@ int BC_WindowBase::save_defaults(BC_Hash *defaults) defaults->update("FILEBOX_WIDTH2", resources->filebox_columnwidth[2]); defaults->update("FILEBOX_WIDTH3", resources->filebox_columnwidth[3]); defaults->update("FILEBOX_FILTER", resources->filebox_filter); + defaults->update("FILEBOX_SIZE_FORMAT", get_resources()->filebox_size_format); return 0; } @@ -4464,6 +4495,20 @@ void BC_WindowBase::dequeue_events(Window win) event_lock->unlock(); } +int BC_WindowBase::resend_event(BC_WindowBase *window) +{ + if( resend_event_window ) return 1; + resend_event_window = window; + return 0; +} + +#else + +int BC_WindowBase::resend_event(BC_WindowBase *window) +{ + return 1; +} + #endif // SINGLE_THREAD int BC_WindowBase::get_id()