X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcwindowbase.C;h=583caac6d890e62de81dc16def9db3201a74e6a1;hp=f9e49e22aa897e2059dd1973cbf04885298a68b5;hb=6c5258a9791775f706e55c280da75ed6f6ef1720;hpb=2778975bea06a53d8165a5e37bdacde1ae5f3320 diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index f9e49e22..583caac6 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -566,9 +566,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(); @@ -893,7 +892,7 @@ int BC_WindowBase::dispatch_event(XEvent *event) int result; XClientMessageEvent *ptr; int cancel_resize, cancel_translation; - const int debug = 0; + volatile static int debug = 0; key_pressed = 0; @@ -930,23 +929,22 @@ locking_message = event->xclient.message_type; -//static const char *event_names[] = { -// "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", -// "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", -// "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", -// "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", -// "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", -// "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", -// "GenericEvent", "LASTEvent", -//}; -// -//if(debug) -//if(event->type != ClientMessage) { -// printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n", -//__LINE__, title, event, event->type, -// event->type>=0 && event->typetype] : "Unknown"); -//} +if( debug && event->type != ClientMessage ) { + static const char *event_names[] = { + "Reply", "Error", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", + "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", + "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", + "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", + "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", + "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify", + "GenericEvent", "LASTEvent", + }; + const int nevents = sizeof(event_names)/sizeof(event_names[0]); + + printf("BC_WindowBase::dispatch_event %d %s %p %d (%s)\n", __LINE__, + title, event, event->type, event->type>=0 && event->typetype] : "Unknown"); +} if( active_grab ) { unlock_window(); @@ -960,42 +958,25 @@ locking_message = event->xclient.message_type; switch(event->type) { case ClientMessage: // Clear the resize buffer - if(resize_events) dispatch_resize_event(last_resize_w, last_resize_h); + if( resize_events ) + dispatch_resize_event(last_resize_w, last_resize_h); // Clear the motion buffer since this can clear the window - if(motion_events) - { + if( motion_events ) dispatch_motion_event(); - } ptr = (XClientMessageEvent*)event; - - - if(ptr->message_type == ProtoXAtom && - (Atom)ptr->data.l[0] == DelWinXAtom) - { + if( ptr->message_type == ProtoXAtom && + (Atom)ptr->data.l[0] == DelWinXAtom ) { close_event(); } - else - if(ptr->message_type == RepeaterXAtom) - { + else if( ptr->message_type == RepeaterXAtom ) { dispatch_repeat_event(ptr->data.l[0]); -// Make sure the repeater still exists. -// for(int i = 0; i < repeaters.total; i++) -// { -// if(repeaters.values[i]->repeat_id == ptr->data.l[0]) -// { -// dispatch_repeat_event_master(ptr->data.l[0]); -// break; -// } -// } } - else - if(ptr->message_type == SetDoneXAtom) - { + else if( ptr->message_type == SetDoneXAtom ) { done = 1; - } else - { // We currently use X marshalling for xatom events, we can switch to something else later - receive_custom_xatoms((xatom_event *)ptr); + } + else { + receive_custom_xatoms((xatom_event *)ptr); } break; @@ -1084,7 +1065,13 @@ locking_message = event->xclient.message_type; 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: @@ -3334,6 +3321,23 @@ int BC_WindowBase::unlock_window() return 0; } +int BC_WindowBase::break_lock() +{ + if( !top_level ) return 0; + if( top_level != this ) return top_level->break_lock(); + if( top_level->display_lock_owner != pthread_self() ) return 0; + if( top_level->window_lock != 1 ) return 0; + UNSET_LOCK(this); + window_lock = 0; + display_lock_owner = 0; +#ifdef SINGLE_THREAD + BC_Display::unlock_display(); +#else + XUnlockDisplay(display); +#endif + return 1; +} + void BC_WindowBase::set_done(int return_value) { if(done_set) return;