Skip to content

Commit dbb9168

Browse files
committed
FlightData: add GimbalVideoControl to map
1 parent 3e3969b commit dbb9168

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();
@@ -273,7 +277,7 @@ private void videoStreamToolStripMenuItem_Click(object sender, EventArgs e)
273277
public bool PreFilterMessage(ref Message m)
274278
{
275279
// Don't hog the keyboard when this control doesn't have focus
276-
if (!ContainsFocus)
280+
if (!(Parent?.ContainsFocus ?? false))
277281
{
278282
if(heldKeys.Count > 0)
279283
{
@@ -546,6 +550,9 @@ private void VideoBox_MouseLeave(object sender, EventArgs e)
546550

547551
private void VideoBox_Click(object sender, EventArgs e)
548552
{
553+
// Focus the control when clicked
554+
VideoBox.Focus();
555+
549556
MouseEventArgs me = (MouseEventArgs)e;
550557
var point = getMousePosition(me.X, me.Y);
551558
if (!point.HasValue)

0 commit comments

Comments
 (0)