Skip to content

Commit

Permalink
FlightData: add GimbalVideoControl to map
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlong13 committed Nov 16, 2024
1 parent 56dcb35 commit f133b6f
Show file tree
Hide file tree
Showing 5 changed files with 623 additions and 324 deletions.
7 changes: 3 additions & 4 deletions Controls/GimbalVideoControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions Controls/GimbalVideoControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ protected override void Dispose(bool disposing)
{
if (disposing)
{
_stream.OnNewImage -= RenderFrame;
_stream.Stop();

Stop();
if (components != null)
{
components.Dispose();
Expand All @@ -249,6 +247,12 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

public void Stop()
{
_stream.OnNewImage -= RenderFrame;
_stream.Stop();
}

private void videoStreamToolStripMenuItem_Click(object sender, EventArgs e)
{
GStreamer.GstLaunch = GStreamer.LookForGstreamer();
Expand All @@ -273,7 +277,7 @@ private void videoStreamToolStripMenuItem_Click(object sender, EventArgs e)
public bool PreFilterMessage(ref Message m)
{
// Don't hog the keyboard when this control doesn't have focus
if (!ContainsFocus)
if (!(Parent?.ContainsFocus ?? false))
{
if(heldKeys.Count > 0)
{
Expand Down Expand Up @@ -546,6 +550,9 @@ private void VideoBox_MouseLeave(object sender, EventArgs e)

private void VideoBox_Click(object sender, EventArgs e)
{
// Focus the control when clicked
VideoBox.Focus();

MouseEventArgs me = (MouseEventArgs)e;
var point = getMousePosition(me.X, me.Y);
if (!point.HasValue)
Expand Down
Loading

0 comments on commit f133b6f

Please sign in to comment.