Skip to content

Commit

Permalink
refs #18
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyCorbett committed Jan 17, 2021
1 parent 872c43c commit bd73ea7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
23 changes: 20 additions & 3 deletions JwlMediaWin.Core/Fixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,21 @@ private FixerStatus ExecuteInternal(
const uint NoCopyBitsFlag = 0x0100;
const uint NoSendChangingFlag = 0x0400;

const int adjustment = 34;
const int border = 8;
// the window used to have a non-transparent titlebar so we could
// just remove it by trimming the top margin...
// const int adjustment = 34; // adjustment for titlebar
// const int border = 8; // adjustment for borders

// ... but in Jan 2021 the title bar became transparent and so
// it needed to be retained. However, the command buttons top right
// can be 'removed' (see below)
const int adjustment = 1; // adjustment for titlebar
const int border = 8; // adjustment for borders

// this Sleep is definitely required. Without it, the media window may remain
// on the primary display (i.e. the SetWindowPos call is ineffective). See #5
Thread.Sleep(500);

NativeMethods.SetWindowPos(
mainHandle,
insertAfterValue,
Expand All @@ -215,6 +223,15 @@ private FixerStatus ExecuteInternal(

EnsureWindowIsNonSizeable(mainHandle);

// to 'remove' the command buttons from the transparent title bar
// we move focus to the main JWL window and then disable the media
// window meaning it can no longer gain focus via mouse click. This
// doesn't prevent the button being displayed if you alt-tab to the
// media window but it is a small change that is generally helpful.

NativeMethods.SetForegroundWindow(coreHandle);
NativeMethods.EnableWindow(mainHandle, false);

return result;
}

Expand Down
4 changes: 4 additions & 0 deletions JwlMediaWin.Core/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ internal static class NativeMethods
[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EnableWindow(IntPtr hWnd, bool bEnable);

[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
internal static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);

Expand Down
5 changes: 2 additions & 3 deletions JwlMediaWin/ViewModel/NotifyIconViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;

namespace JwlMediaWin.ViewModel
namespace JwlMediaWin.ViewModel
{
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
Expand Down
4 changes: 2 additions & 2 deletions SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("JwlMediaWin")]
[assembly: AssemblyCopyright("Copyright © 2019 Antony Corbett")]
[assembly: AssemblyCopyright("Copyright © 2021 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.0.9")]
[assembly: AssemblyVersion("1.1.0.1")]

0 comments on commit bd73ea7

Please sign in to comment.