X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=93b3d4554077c45aeb721636fe574ed77a09a73a;hb=72a88d4704507f72e05b380d9604d9eb3e7d5a89;hp=23e5bec4a7918345c1ca7bbb7384df62a4be56a1;hpb=3932d2c16e903573db3cacdb3102dea9639c6ca4;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 23e5bec4..93b3d455 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -149,7 +149,11 @@ BC_WindowBase::~BC_WindowBase() //printf("delete glx=%08x, win=%08x %s\n", (unsigned)glx_win, (unsigned)win, title); #ifdef HAVE_GL if( get_resources()->get_synchronous() && glx_win != 0 ) { + if( window_type == MAIN_WINDOW ) + unlock_window(); get_resources()->get_synchronous()->delete_window(this); + if( window_type == MAIN_WINDOW ) + lock_window("BC_WindowBase::delete_window"); } #endif XDestroyWindow(top_level->display, win); @@ -456,8 +460,19 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title vis = get_glx_visual(display); if( !vis ) #endif + { + int mask = VisualDepthMask | VisualClassMask; + static XVisualInfo vinfo; + memset(&vinfo, 0, sizeof(vinfo)); + vinfo.depth = 24; + vinfo.c_class = TrueColor; + int nitems = 0; + XVisualInfo *vis_info = XGetVisualInfo(display, mask, &vinfo, &nitems); + vis = vis_info && nitems>0 ? vis_info[0].visual : 0; + if( vis_info ) XFree(vis_info); + } + if( !vis ) vis = DefaultVisual(display, screen); - default_depth = DefaultDepth(display, screen); client_byte_order = (*(const u_int32_t*)"a ") & 0x00000001; @@ -566,9 +581,8 @@ int BC_WindowBase::create_window(BC_WindowBase *parent_window, const char *title mask = CWEventMask | CWBackPixel | CWColormap | CWOverrideRedirect | CWSaveUnder | CWCursor; - attr.event_mask = DEFAULT_EVENT_MASKS | - KeyPressMask | - KeyReleaseMask; + attr.event_mask = DEFAULT_EVENT_MASKS | ExposureMask | + KeyPressMask | KeyReleaseMask; if(this->bg_color == -1) this->bg_color = resources.get_bg_color(); @@ -729,9 +743,8 @@ int BC_WindowBase::run_window() init_lock->unlock(); // Handle common events - while(!done) - { - dispatch_event(0); + while( !done ) { + dispatch_event(); } unset_all_repeaters(); @@ -887,13 +900,14 @@ pthread_t locking_task = (pthread_t)-1L; int locking_event = -1; int locking_message = -1; -int BC_WindowBase::dispatch_event(XEvent *event) +int BC_WindowBase::dispatch_event() { Window tempwin; int result; XClientMessageEvent *ptr; int cancel_resize, cancel_translation; volatile static int debug = 0; + XEvent *event; key_pressed = 0; @@ -1066,7 +1080,13 @@ if( debug && event->type != ClientMessage ) { case Expose: event_win = event->xany.window; - dispatch_expose_event(); + result = 0; + for( int i=0; !result && iwin == event_win ) + result = popups[i]->dispatch_expose_event(); + } + if( !result ) + result = dispatch_expose_event(); break; case MotionNotify: @@ -4051,6 +4071,11 @@ int BC_WindowBase::resize_window(int w, int h) size_hints.max_width = w; size_hints.min_height = h; size_hints.max_height = h; + if( this->x > -BC_INFINITY && this->x < BC_INFINITY ) { + size_hints.flags |= PPosition; + size_hints.x = this->x; + size_hints.y = this->y; + } XSetNormalHints(top_level->display, win, &size_hints); } XResizeWindow(top_level->display, win, w, h);