preview mode mods, powerpc signal handler tweak, default wdws for 3 or more screens
authorGood Guy <[email protected]>
Sun, 10 Mar 2019 04:07:08 +0000 (21:07 -0700)
committerGood Guy <[email protected]>
Sun, 10 Mar 2019 04:07:08 +0000 (21:07 -0700)
cinelerra-5.1/cinelerra/awindowgui.C
cinelerra-5.1/cinelerra/awindowgui.h
cinelerra-5.1/cinelerra/mainsession.C
cinelerra-5.1/guicast/bcdisplayinfo.C
cinelerra-5.1/guicast/bcdisplayinfo.h
cinelerra-5.1/guicast/bcsignals.C
cinelerra-5.1/guicast/bcwindowbase.C

index 13e802a8f0f7430fe6c3121acb97bb3be6cded17..b949e9cda10bc4a02f0d625b4b9db3e03157ca21 100644 (file)
@@ -1609,8 +1609,10 @@ void AWindowGUI::start_vicon_drawing()
        if( !vicon_thread->interrupted ) return;
        switch( vicon_drawing ) {
        case AVICON_FULL_PLAY:  // all vicons, viewing, target
-       case AVICON_MOUSE_OVER: // one vicon, viewing, target
                break;
+       case AVICON_MOUSE_OVER: // one vicon, viewing, target
+               if( vicon_thread->solo ) break;
+       // fall thru
        case AVICON_SRC_TARGET: // no vicons, no view, target
        case AVICON_NO_PLAY:    // no vicons, no view, no target
                return;
@@ -2775,7 +2777,8 @@ int AWindowAssets::selection_changed()
 
                deactivate_selection();
        }
-       else if( get_button_down() ) {
+       else if( get_button_down() &&
+                 mwindow->edl->session->assetlist_format != ASSETS_TEXT ) {
                if( (item = (AssetPicon*)get_selection(0, 0)) != 0 ) {
                        switch( folder ) {
                        case AW_MEDIA_FOLDER:
@@ -2978,9 +2981,9 @@ int AWindowAssets::column_resize_event()
        return 1;
 }
 
-int AWindowAssets::focus_in_event()
+int AWindowAssets::cursor_enter_event()
 {
-       int ret = BC_ListBox::focus_in_event();
+       int ret = BC_ListBox::cursor_enter_event();
        switch( gui->vicon_drawing ) {
        case AVICON_FULL_PLAY:
                gui->start_vicon_drawing();
@@ -2994,6 +2997,13 @@ int AWindowAssets::focus_in_event()
        return ret;
 }
 
+int AWindowAssets::cursor_leave_event()
+{
+       if( !gui->vicon_thread->viewing )
+               gui->stop_vicon_drawing();
+       return BC_ListBox::cursor_leave_event();
+}
+
 int AWindowAssets::focus_out_event()
 {
        gui->stop_vicon_drawing();
@@ -3027,10 +3037,13 @@ int AWindowAssets::mouse_over_event(int no)
        case AVICON_MOUSE_OVER:
                if( !vicon ) break;
                gui->vicon_thread->solo = vicon;
+               gui->start_vicon_drawing();
+       // fall thru
+       case AVICON_SRC_TARGET:
+               if( !vicon ) break;
                if( gui->vicon_thread->viewing )
                        gui->vicon_thread->set_view_popup(vicon);
                break;
-       case AVICON_SRC_TARGET:
        case AVICON_NO_PLAY:
        default:
                break;
@@ -3284,6 +3297,7 @@ int AVIconDrawingItem::handle_event()
        AWindowGUI *agui = avicon->agui;
        agui->stop_vicon_drawing();
        agui->vicon_thread->set_view_popup(0);
+       agui->vicon_thread->solo = 0;
        agui->vicon_drawing = id;
        agui->start_vicon_drawing();
        return 1;
index 35fdb9231c796a80ea5b5fd9e0e62d3fd41dc21f..878aa4559e06442adc3590cb9d6571766204cb5a 100644 (file)
@@ -402,7 +402,8 @@ public:
        int drag_stop_event();
        int button_press_event();
        int column_resize_event();
-       int focus_in_event();
+       int cursor_enter_event();
+       int cursor_leave_event();
        int focus_out_event();
        void update_vicon_area();
        int mouse_over_event(int no);
index f1b1974e05f2537fb3bc00d7799e0c29b3df968b..e40f343efbc16adc8a414a8c559a971442186c82 100644 (file)
@@ -201,9 +201,42 @@ void MainSession::default_window_positions(int window_config)
        int border_bottom = display_info.get_bottom_border();
 
        int dual_head = screens > 1 ? 1 : 0;
-       int right_w = root_w;
+       int left_w = 0, right_w = root_w;
+       int xin_screens = display_info.get_xinerama_screens();
+       if( xin_screens > 1 ) {
+               dual_head = 1;
+               int x, y, w, h;
+               for( int s=0; s<xin_screens; ++s ) {
+                       if( display_info.xinerama_geometry(s, x, y, w, h) )
+                               continue;
+                       if( !y && !x ) {
+                               left_w = w;
+                               break;
+                       }
+               }
+               if( left_w > 0 ) {
+                       for( int s=0; s<xin_screens; ++s ) {
+                               if( display_info.xinerama_geometry(s, x, y, w, h) )
+                                       continue;
+                               if( !y && x == left_w ) {
+                                       right_w = w;
+                                       screens = 2;
+                                       break;
+                               }
+                       }
+                       if( window_config == 1 ) {
+                               root_x = left_w;
+                               root_w = right_w;
+                       }
+                       else {
+                       // use same aspect ratio to compute left height
+                               root_w = left_w;
+                               root_h = (root_w*root_h) / right_w;
+                       }
+               }
+       }
 // Wider than 16:9, narrower than dual head
-       if( screens < 2 && (float)root_w / root_h > 1.8) {
+       if( screens < 2 && (float)root_w / root_h > 1.8 ) {
                dual_head = 1;
                switch( root_h ) {
                case 600:  right_w = 800;   break;
index 5bbe991ce925492b454fbc2fc58c0d59e9ac34ef..e94ee7502b488ff4c7bab7cde502cf6edd8600da 100644 (file)
@@ -46,11 +46,14 @@ int BC_DisplayInfo::auto_reposition_y = -1;
 BC_DisplayInfo::BC_DisplayInfo(const char *display_name, int show_error)
 {
        screen = -1;
+       xinerama_screens = -1;
+       xinerama_info = 0;
        init_window(display_name, show_error);
 }
 
 BC_DisplayInfo::~BC_DisplayInfo()
 {
+       if( xinerama_info ) XFree(xinerama_info);
 #ifndef SINGLE_THREAD
        XCloseDisplay(display);
 #endif
@@ -62,6 +65,47 @@ void BC_DisplayInfo::parse_geometry(char *geom, int *x, int *y, int *width, int
        XParseGeometry(geom, x, y, (unsigned int*)width, (unsigned int*)height);
 }
 
+
+int BC_DisplayInfo::get_xinerama_screens()
+{
+       if( xinerama_screens < 0 ) {
+               xinerama_screens = 0;
+               if( XineramaIsActive(display) )
+                       xinerama_info = XineramaQueryScreens(display, &xinerama_screens);
+       }
+       return xinerama_screens;
+}
+
+int BC_DisplayInfo::xinerama_geometry(int screen, int &x, int &y, int &w, int &h)
+{
+       int screens = get_xinerama_screens();
+       if( !screens ) return 1;
+       if( screen >= 0 ) {
+               int k = screens;
+               while( --k >= 0 && xinerama_info[k].screen_number != screen );
+               if( k < 0 ) return 1;
+               x = xinerama_info[k].x_org;  w = xinerama_info[k].width;
+               y = xinerama_info[k].y_org;  h = xinerama_info[k].height;
+       }
+       else {
+               int sx0 = INT_MAX, sx1 = INT_MIN;
+               int sy0 = INT_MAX, sy1 = INT_MIN;
+               for( int i=0; i<screens; ++i ) {
+                       int x0 = xinerama_info[i].x_org;
+                       int x1 = x0 + xinerama_info[i].width;
+                       if( sx0 > x0 ) sx0 = x0;
+                       if( sx1 < x1 ) sx1 = x1;
+                       int y0 = xinerama_info[i].y_org;
+                       int y1 = y0 + xinerama_info[i].height;
+                       if( sy0 > y0 ) sy0 = y0;
+                       if( sy1 < y1 ) sy1 = y1;
+               }
+               x = sx0;  w = sx1 - sx0;
+               y = sy0;  h = sy1 - sy0;
+       }
+       return 0;
+}
+
 static void get_top_coords(Display *display, Window win, int &px,int &py, int &tx,int &ty)
 {
        Window *pcwin = 0;  unsigned int ncwin = 0;
index 54f74660a73d72f5686df5844e8a630d42bd8c2b..9e4b651c06d7c7c608d19a250c2e2a2f349f5661 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <X11/Xlib.h>
+#include <X11/extensions/Xinerama.h>
 
 class BC_DisplayInfo
 {
@@ -50,6 +51,8 @@ public:
        static const char *host_display_name(const char *name);
        void init_window(const char *display_name, int show_error=0);
        int get_screen() { return screen; }
+       int get_xinerama_screens();
+       int xinerama_geometry(int screen, int &x, int &y, int &w, int &h);
 
 private:
        static void init_borders();
@@ -65,6 +68,8 @@ private:
        static int auto_reposition_y;
        int default_depth;
        char *display_name;
+       XineramaScreenInfo *xinerama_info;
+       int xinerama_screens;
 };
 
 #endif
index ed50cfb15d9e8ac38c630c3096c9ab2b77fce477..59597ffa80161cd8a174d98ad3db5e54ceb6a249 100644 (file)
@@ -385,10 +385,20 @@ const char* BC_Signals::sig_to_str(int number)
 
 #if __i386__
 #define IP eip
+#define sigregs_t sigcontext
 #endif
+
 #if __x86_64__
 #define IP rip
+#define sigregs_t sigcontext
+#endif
+
+#if __powerpc__ || __powerpc64__ || __powerpc64le__
+#include <asm/ptrace.h>
+#define IP nip
+#define sigregs_t pt_regs
 #endif
+
 #ifndef IP
 #error gotta have IP
 #endif
@@ -406,7 +416,7 @@ static void handle_dump(int n, siginfo_t * info, void *sc)
 //     if( uid != 0 ) return;
        ucontext_t *uc = (ucontext_t *)sc;
        int pid = getpid(), tid = gettid();
-       struct sigcontext *c = (struct sigcontext *)&uc->uc_mcontext;
+       struct sigregs_t *c = (struct sigregs_t *)&uc->uc_mcontext;
        uint8_t *ip = (uint8_t *)c->IP;
        fprintf(stderr,"** %s at %p in pid %d, tid %d\n",
                n==SIGSEGV? "segv" : n==SIGINT? "intr" : "trap",
index 1810abc3f6fd943076cbdb6ab20edc1a16a5ba83..23e5bec4a7918345c1ca7bbb7384df62a4be56a1 100644 (file)
@@ -959,42 +959,25 @@ if( debug && event->type != ClientMessage ) {
        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;