From: Good Guy <good1.2guy@gmail.com>
Date: Sat, 8 Sep 2018 21:17:28 +0000 (-0600)
Subject: fullscreen tweaks, vwdw refresh frame scale, cleanup
X-Git-Url: http://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=a4387a272874bd4ed9f010684976f336fa3d0190;p=goodguy%2Fhistory.git

fullscreen tweaks, vwdw refresh frame scale, cleanup
---

diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C
index 4f9d9234..3e7ee0be 100644
--- a/cinelerra-5.1/cinelerra/canvas.C
+++ b/cinelerra-5.1/cinelerra/canvas.C
@@ -808,7 +808,6 @@ int Canvas::button_press_event_base(BC_WindowBase *caller)
 
 int Canvas::keypress_event(BC_WindowBase *caller)
 {
-	int caller_is_canvas = (caller == get_canvas());
 	int key = caller->get_keypress();
 	switch( key ) {
 	case 'f':
@@ -817,13 +816,13 @@ int Canvas::keypress_event(BC_WindowBase *caller)
 			stop_fullscreen();
 		else
 			start_fullscreen();
-		if(!caller_is_canvas) caller->lock_window("Canvas::keypress_event 1");
+		caller->lock_window("Canvas::keypress_event 1");
 		break;
 	case ESC:
 		caller->unlock_window();
 		if(get_fullscreen())
 			stop_fullscreen();
-		if(!caller_is_canvas) caller->lock_window("Canvas::keypress_event 2");
+		caller->lock_window("Canvas::keypress_event 2");
 		break;
 	default:
 		return 0;
@@ -899,17 +898,17 @@ CanvasOutput::~CanvasOutput()
 
 int CanvasOutput::cursor_leave_event()
 {
-	return canvas->cursor_leave_event_base(this);
+	return canvas->cursor_leave_event_base(canvas->get_canvas());
 }
 
 int CanvasOutput::cursor_enter_event()
 {
-	return canvas->cursor_enter_event_base(this);
+	return canvas->cursor_enter_event_base(canvas->get_canvas());
 }
 
 int CanvasOutput::button_press_event()
 {
-	return canvas->button_press_event_base(this);
+	return canvas->button_press_event_base(canvas->get_canvas());
 }
 
 int CanvasOutput::button_release_event()
@@ -924,7 +923,7 @@ int CanvasOutput::cursor_motion_event()
 
 int CanvasOutput::keypress_event()
 {
-	return canvas->keypress_event(this);
+	return canvas->keypress_event(canvas->get_canvas());
 }
 
 
diff --git a/cinelerra-5.1/cinelerra/canvas.h b/cinelerra-5.1/cinelerra/canvas.h
index aa4879a1..9a78095e 100644
--- a/cinelerra-5.1/cinelerra/canvas.h
+++ b/cinelerra-5.1/cinelerra/canvas.h
@@ -226,10 +226,7 @@ public:
 
 private:
 	void get_scrollbars(EDL *edl,
-		int &canvas_x,
-		int &canvas_y,
-		int &canvas_w,
-		int &canvas_h);
+		int &canvas_x, int &canvas_y, int &canvas_w, int &canvas_h);
 	Mutex *canvas_lock;
 };
 
@@ -238,10 +235,7 @@ class CanvasOutput : public BC_SubWindow
 {
 public:
 	CanvasOutput(Canvas *canvas,
-        int x,
-        int y,
-        int w,
-        int h);
+	        int x, int y, int w, int h);
 	~CanvasOutput();
 
 	int cursor_leave_event();
@@ -260,9 +254,7 @@ public:
 class CanvasFullScreen : public BC_FullScreen
 {
 public:
-	CanvasFullScreen(Canvas *canvas,
-        int w,
-        int h);
+	CanvasFullScreen(Canvas *canvas, int w, int h);
 	~CanvasFullScreen();
 
 	Canvas *canvas;
diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C
index bc423328..dfbffff0 100644
--- a/cinelerra-5.1/cinelerra/vwindowgui.C
+++ b/cinelerra-5.1/cinelerra/vwindowgui.C
@@ -830,14 +830,17 @@ void VWindowCanvas::draw_refresh(int flush)
 		float in_x1, in_y1, in_x2, in_y2;
 		float out_x1, out_y1, out_x2, out_y2;
 		get_transfers(edl,
-			in_x1,
-			in_y1,
-			in_x2,
-			in_y2,
-			out_x1,
-			out_y1,
-			out_x2,
-			out_y2);
+			in_x1, in_y1, in_x2, in_y2,
+			out_x1, out_y1, out_x2, out_y2);
+// input scaled from session to refresh frame coordinates
+		int ow = get_output_w(edl);
+		int oh = get_output_h(edl);
+		int rw = refresh_frame->get_w();
+		int rh = refresh_frame->get_h();
+		float xs = (float)rw / ow;
+		float ys = (float)rh / oh;
+		in_x1 *= xs;  in_x2 *= xs;
+		in_y1 *= ys;  in_y2 *= ys;
 		get_canvas()->draw_vframe(refresh_frame,
 				(int)out_x1,
 				(int)out_y1,
diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C
index f5759dd8..7de7c15d 100644
--- a/cinelerra-5.1/guicast/bcwindowbase.C
+++ b/cinelerra-5.1/guicast/bcwindowbase.C
@@ -1339,20 +1339,25 @@ locking_message = event->xclient.message_type;
 
 	case LeaveNotify:
 		if( event->xcrossing.mode != NotifyNormal ) break;
-		if( cursor_entered && event->xcrossing.window == win ) {
-			cursor_entered = 0;
-		}
+		cursor_entered = 0;
 		event_win = event->xany.window;
 		dispatch_cursor_leave();
 		break;
 
 	case EnterNotify:
 		if( event->xcrossing.mode != NotifyNormal ) break;
-		if( !cursor_entered && event->xcrossing.window == win ) {
-			if( !event->xcrossing.focus && get_resources()->grab_input_focus ) {
-				XSetInputFocus(display, win, RevertToParent, CurrentTime);
+
+		if( !cursor_entered ) {
+			for( int i=0; i<popups.size(); ++i ) {  // popups always take focus
+				if( popups[i]->win == event->xcrossing.window )
+				cursor_entered = 1;
 			}
-			cursor_entered = 1;
+			if( !cursor_entered && get_resources()->grab_input_focus &&
+			    !event->xcrossing.focus && event->xcrossing.window == win ) {
+				cursor_entered = 1;
+			}
+			if( cursor_entered )
+				XSetInputFocus(display, win, RevertToParent, CurrentTime);
 		}
 		event_win = event->xany.window;
 		cursor_x = event->xcrossing.x;