From 8429c33b548c1493b81793e5568b53dcd29ecb7c Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sun, 9 Sep 2018 13:53:03 -0600 Subject: [PATCH] add input focus, negate dx,dy for camera drag motion --- cinelerra-5.1/cinelerra/canvas.C | 87 ++++------------------------ cinelerra-5.1/cinelerra/cwindowgui.C | 9 ++- cinelerra-5.1/guicast/bcwindowbase.C | 7 ++- cinelerra-5.1/guicast/bcwindowbase.h | 1 + 4 files changed, 26 insertions(+), 78 deletions(-) diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index 3e7ee0be..2a478d41 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -773,6 +773,10 @@ void Canvas::create_canvas() if(video_on) get_canvas()->start_video(); + get_canvas()->lock_window("Canvas::create_canvas 2"); + get_canvas()->focus(); + get_canvas()->unlock_window(); + unlock_canvas(); } @@ -928,26 +932,8 @@ int CanvasOutput::keypress_event() - - - - - - - - - - -CanvasFullScreen::CanvasFullScreen(Canvas *canvas, - int w, - int h) - : BC_FullScreen(canvas->subwindow, - w, - h, - BLACK, - 0, - 0, - 0) +CanvasFullScreen::CanvasFullScreen(Canvas *canvas, int w, int h) + : BC_FullScreen(canvas->subwindow, w, h, BLACK, 0, 0, 0) { this->canvas = canvas; } @@ -957,32 +943,9 @@ CanvasFullScreen::~CanvasFullScreen() } - - - - - - - - - - - -CanvasXScroll::CanvasXScroll(EDL *edl, - Canvas *canvas, - int x, - int y, - int length, - int position, - int handle_length, - int pixels) - : BC_ScrollBar(x, - y, - SCROLL_HORIZ, - pixels, - length, - position, - handle_length) +CanvasXScroll::CanvasXScroll(EDL *edl, Canvas *canvas, int x, int y, + int length, int position, int handle_length, int pixels) + : BC_ScrollBar(x, y, SCROLL_HORIZ, pixels, length, position, handle_length) { this->canvas = canvas; } @@ -1000,25 +963,9 @@ int CanvasXScroll::handle_event() } - - - - -CanvasYScroll::CanvasYScroll(EDL *edl, - Canvas *canvas, - int x, - int y, - int length, - int position, - int handle_length, - int pixels) - : BC_ScrollBar(x, - y, - SCROLL_VERT, - pixels, - length, - position, - handle_length) +CanvasYScroll::CanvasYScroll(EDL *edl, Canvas *canvas, int x, int y, + int length, int position, int handle_length, int pixels) + : BC_ScrollBar(x, y, SCROLL_VERT, pixels, length, position, handle_length) { this->canvas = canvas; } @@ -1036,10 +983,6 @@ int CanvasYScroll::handle_event() } - - - - CanvasFullScreenPopup::CanvasFullScreenPopup(Canvas *canvas) : BC_PopupMenu(0, 0, 0, "", 0) { @@ -1074,12 +1017,6 @@ int CanvasSubWindowItem::handle_event() } - - - - - - CanvasPopup::CanvasPopup(Canvas *canvas) : BC_PopupMenu(0, 0, 0, "", 0) { diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 3b1d0ac8..3e980b8b 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -2987,8 +2987,13 @@ int CWindowCanvas::test_bezier(int button_press, { last_center_x = gui->affected_x->get_value(); last_center_y = gui->affected_y->get_value(); - float x = gui->center_x + cursor_x - gui->x_origin; - float y = gui->center_y + cursor_y - gui->y_origin; + float dx = cursor_x - gui->x_origin; + float dy = cursor_y - gui->y_origin; + if(gui->current_operation == CWINDOW_CAMERA ) { + dx = -dx; dy = -dy; + } + float x = gui->center_x + dx; + float y = gui->center_y + dy; gui->affected_x->set_value(x); gui->affected_y->set_value(y); if( !EQUIV(last_center_x, x) || !EQUIV(last_center_y, y) ) diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 7de7c15d..724a44f7 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -1357,7 +1357,7 @@ locking_message = event->xclient.message_type; cursor_entered = 1; } if( cursor_entered ) - XSetInputFocus(display, win, RevertToParent, CurrentTime); + focus(); } event_win = event->xany.window; cursor_x = event->xcrossing.x; @@ -4577,3 +4577,8 @@ void BC_WindowBase::flicker(int n, int ms) set_opaque(); } +void BC_WindowBase::focus() +{ + XSetInputFocus(top_level->display, top_level->win, RevertToParent, CurrentTime); +} + diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index 336b9693..ca73b39e 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -497,6 +497,7 @@ public: void slide_up(int distance); void slide_down(int distance); void flicker(int n=3, int ms=66); + void focus(); int cycle_textboxes(int amount); -- 2.26.2