Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
Fixes #311 (Ensure icons are always 16px*16px even when DPI is higher…
Browse files Browse the repository at this point in the history
… than normal);

1.4.4b1
  • Loading branch information
luckyrat committed Oct 5, 2014
1 parent 0e84907 commit e7db7a2
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 15 deletions.
16 changes: 8 additions & 8 deletions Firefox addon/KeeFox/chrome.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ locale keefox es-AR chrome/locale/es-AR/
locale keefox fi chrome/locale/fi/
locale keefox fr chrome/locale/fr/
locale keefox hu chrome/locale/hu/
#locale keefox it chrome/locale/it/
locale keefox it chrome/locale/it/
#locale keefox ja chrome/locale/ja/
#locale keefox ko-KR chrome/locale/ko-KR/
#locale keefox nb-NO chrome/locale/nb-NO/
locale keefox ko-KR chrome/locale/ko-KR/
locale keefox nb-NO chrome/locale/nb-NO/
locale keefox nl chrome/locale/nl/
#locale keefox pl chrome/locale/pl/
#locale keefox pt-BR chrome/locale/pt-BR/
#locale keefox pt-PT chrome/locale/pt-PT/
#locale keefox ro chrome/locale/ro/
locale keefox pl chrome/locale/pl/
locale keefox pt-BR chrome/locale/pt-BR/
locale keefox pt-PT chrome/locale/pt-PT/
locale keefox ro chrome/locale/ro/
locale keefox ru chrome/locale/ru/
locale keefox sv-SE chrome/locale/sv-SE/
#locale keefox tr chrome/locale/tr/
locale keefox tr chrome/locale/tr/
#locale keefox vi-VN chrome/locale/vi-VN/
locale keefox zh-CN chrome/locale/zh-CN/
#locale keefox zh-TW chrome/locale/zh-TW/
6 changes: 3 additions & 3 deletions Firefox addon/KeeFox/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<Description about="urn:mozilla:install-manifest">
<em:id>[email protected]</em:id>
<em:version>1.4.3</em:version>
<em:version>1.4.4b1</em:version>
<em:type>2</em:type>
<em:unpack>true</em:unpack>

Expand All @@ -19,7 +19,7 @@
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>17.0</em:minVersion>
<em:maxVersion>33.*</em:maxVersion>
<em:maxVersion>35.*</em:maxVersion>
</Description>
</em:targetApplication>

Expand All @@ -28,7 +28,7 @@
<!-- Thunderbird -->
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>17.0</em:minVersion>
<em:maxVersion>33.*</em:maxVersion>
<em:maxVersion>35.*</em:maxVersion>
</Description>
</em:targetApplication>

Expand Down
2 changes: 1 addition & 1 deletion Firefox addon/KeeFox/modules/kprpcClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function kprpcClient() {
this.requestId = 1;
this.callbacks = {};
this.callbacksData = {};
this.clientVersion = [1,4,3];
this.clientVersion = [1,4,4];
this.authPromptAborted = false;

// We manually create HMACs to protect the integrity of our AES encrypted messages
Expand Down
49 changes: 49 additions & 0 deletions KeePassRPC/DpiFix.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;

namespace KeePassRPC
{
public static class DpiFix
{

public static Image ScaleImageTo16x16(Image img, bool bForceNewObject)
{
if (img == null) { Debug.Assert(false); return null; }

int w = img.Width;
int h = img.Height;
int sw = 16;
int sh = 16;

if ((w == sw) && (h == sh) && !bForceNewObject)
return img;

Bitmap bmp = new Bitmap(sw, sh, img.PixelFormat);
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;

RectangleF rSource = new RectangleF(0, 0, w, h);
RectangleF rDest = new RectangleF(0, 0, sw, sh);

// Prevent border drawing bug
rSource.Offset(-0.5f, -0.5f);

g.DrawImage(img, rDest, rSource, GraphicsUnit.Pixel);
}

return bmp;
}
}


}
1 change: 1 addition & 0 deletions KeePassRPC/KeePassRPC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
<ItemGroup>
<Compile Include="BigInteger.cs" />
<Compile Include="DataExchangeModel.cs" />
<Compile Include="DpiFix.cs" />
<Compile Include="Forms\AuthForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
7 changes: 5 additions & 2 deletions KeePassRPC/KeePassRPCExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public sealed class KeePassRPCExt : Plugin
//private static LifetimeServices fakeHack = new LifetimeServices();

// version information
public static readonly Version PluginVersion = new Version(1,4,3);
public static readonly Version PluginVersion = new Version(1,4,4);

private BackgroundWorker _BackgroundWorker; // used to invoke main thread from other threads
private AutoResetEvent _BackgroundWorkerAutoResetEvent;
Expand Down Expand Up @@ -516,7 +516,10 @@ public object WelcomeKeeFoxUser()

public Image GetIcon(int iconIndex)
{
return _host.MainWindow.ClientIcons.Images[(int)iconIndex];
Image im = _host.MainWindow.ClientIcons.Images[(int)iconIndex];
if (DpiUtil.ScalingRequired)
im = DpiFix.ScaleImageTo16x16(im, false);
return im;
}


Expand Down
2 changes: 1 addition & 1 deletion KeePassRPC/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ You should have received a copy of the GNU General Public License

// Assembly version information
[assembly: AssemblyVersion("2.0.15.*")]
[assembly: AssemblyFileVersion("1.4.3.0")] // also change PluginVersion in KeePassRPCExt.cs!
[assembly: AssemblyFileVersion("1.4.4.0")] // also change PluginVersion in KeePassRPCExt.cs!

0 comments on commit e7db7a2

Please sign in to comment.