Skip to content

Commit b7075f7

Browse files
committed
FlightData: add GimbalVideoControl to map
1 parent 174bec3 commit b7075f7

File tree

5 files changed

+623
-324
lines changed

5 files changed

+623
-324
lines changed

Controls/GimbalVideoControl.Designer.cs

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Controls/GimbalVideoControl.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ protected override void Dispose(bool disposing)
238238
{
239239
if (disposing)
240240
{
241-
_stream.OnNewImage -= RenderFrame;
242-
_stream.Stop();
243-
241+
Stop();
244242
if (components != null)
245243
{
246244
components.Dispose();
@@ -249,6 +247,12 @@ protected override void Dispose(bool disposing)
249247
base.Dispose(disposing);
250248
}
251249

250+
public void Stop()
251+
{
252+
_stream.OnNewImage -= RenderFrame;
253+
_stream.Stop();
254+
}
255+
252256
private void videoStreamToolStripMenuItem_Click(object sender, EventArgs e)
253257
{
254258
GStreamer.GstLaunch = GStreamer.LookForGstreamer();
@@ -276,7 +280,7 @@ private void videoStreamToolStripMenuItem_Click(object sender, EventArgs e)
276280
public bool PreFilterMessage(ref Message m)
277281
{
278282
// Don't hog the keyboard when this control doesn't have focus
279-
if (!ContainsFocus)
283+
if (!(Parent?.ContainsFocus ?? false))
280284
{
281285
if(heldKeys.Count > 0)
282286
{
@@ -549,6 +553,9 @@ private void VideoBox_MouseLeave(object sender, EventArgs e)
549553

550554
private void VideoBox_Click(object sender, EventArgs e)
551555
{
556+
// Focus the control when clicked
557+
VideoBox.Focus();
558+
552559
MouseEventArgs me = (MouseEventArgs)e;
553560
var point = getMousePosition(me.X, me.Y);
554561
if (!point.HasValue)

0 commit comments

Comments
 (0)