--- a/KeePass/KeePass.csproj
+++ b/KeePass/KeePass.csproj
@@ -181,6 +181,9 @@
KeePassLib\Native\NativeMethods.cs
+
+ KeePassLib\Native\NativeMethods.Unix.cs
+
KeePassLib\PwCustomIcon.cs
@@ -1006,7 +1009,9 @@
-
+
+ KeePassLib\Utility\MonoWorkarounds.cs
+
--- a/KeePass/UI/CustomListViewEx.cs
+++ b/KeePass/UI/CustomListViewEx.cs
@@ -26,6 +26,7 @@
using KeePass.Native;
using KeePass.Util;
+using KeePassLib.Utility;
namespace KeePass.UI
{
--- a/KeePass/Util/MonoWorkarounds.cs
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- KeePass Password Safe - The Open-Source Password Manager
- Copyright (C) 2003-2014 Dominik Reichl
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Windows.Forms;
-using System.ComponentModel;
-using System.Reflection;
-using System.Diagnostics;
-
-using KeePassLib;
-using KeePassLib.Native;
-
-namespace KeePass.Util
-{
- public static class MonoWorkarounds
- {
- private static bool? m_bReq = null;
- public static bool IsRequired()
- {
- if(!m_bReq.HasValue) m_bReq = NativeLib.IsUnix();
- return m_bReq.Value;
- }
-
- // 5795:
- // https://bugzilla.xamarin.com/show_bug.cgi?id=5795
- // https://sourceforge.net/p/keepass/discussion/329220/thread/d23dc88b/
- // 12525:
- // https://bugzilla.xamarin.com/show_bug.cgi?id=12525
- // https://sourceforge.net/p/keepass/discussion/329220/thread/54f61e9a/
- // 586901:
- // https://bugzilla.novell.com/show_bug.cgi?id=586901
- // 620618:
- // https://bugzilla.novell.com/show_bug.cgi?id=620618
- // 649266:
- // https://bugzilla.novell.com/show_bug.cgi?id=649266
- // 686017:
- // http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686017
- // 801414:
- // https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/801414
- // 891029:
- // https://sourceforge.net/projects/keepass/forums/forum/329221/topic/4519750
- // https://bugs.launchpad.net/ubuntu/+source/keepass2/+bug/891029
- // 836428016:
- // https://sourceforge.net/p/keepass/discussion/329221/thread/31dae0f0/
- // 3574233558:
- // https://sourceforge.net/p/keepass/discussion/329220/thread/d50a79d6/
- public static bool IsRequired(uint uBugID)
- {
- return MonoWorkarounds.IsRequired();
- }
-
- public static void ApplyTo(Form f)
- {
- if(!MonoWorkarounds.IsRequired()) return;
- if(f == null) { Debug.Assert(false); return; }
-
- f.HandleCreated += MonoWorkarounds.OnFormHandleCreated;
- SetWmClass(f);
-
- ApplyToControlsRec(f.Controls, f, MonoWorkarounds.ApplyToControl);
- }
-
- public static void Release(Form f)
- {
- if(!MonoWorkarounds.IsRequired()) return;
- if(f == null) { Debug.Assert(false); return; }
-
- f.HandleCreated -= MonoWorkarounds.OnFormHandleCreated;
-
- ApplyToControlsRec(f.Controls, f, MonoWorkarounds.ReleaseControl);
- }
-
- private delegate void MwaControlHandler(Control c, Form fContext);
-
- private static void ApplyToControlsRec(Control.ControlCollection cc,
- Form fContext, MwaControlHandler fn)
- {
- if(cc == null) { Debug.Assert(false); return; }
-
- foreach(Control c in cc)
- {
- fn(c, fContext);
- ApplyToControlsRec(c.Controls, fContext, fn);
- }
- }
-
- private sealed class MwaHandlerInfo
- {
- private readonly Delegate m_fnOrg; // May be null
- public Delegate FunctionOriginal
- {
- get { return m_fnOrg; }
- }
-
- private readonly Delegate m_fnOvr;
- public Delegate FunctionOverride
- {
- get { return m_fnOvr; }
- }
-
- private readonly DialogResult m_dr;
- public DialogResult Result
- {
- get { return m_dr; }
- }
-
- private readonly Form m_fContext;
- public Form FormContext
- {
- get { return m_fContext; }
- }
-
- public MwaHandlerInfo(Delegate fnOrg, Delegate fnOvr, DialogResult dr,
- Form fContext)
- {
- m_fnOrg = fnOrg;
- m_fnOvr = fnOvr;
- m_dr = dr;
- m_fContext = fContext;
- }
- }
-
- private static void ApplyToControl(Control c, Form fContext)
- {
- Button btn = (c as Button);
- if(btn != null) ApplyToButton(btn, fContext);
- }
-
- private static EventHandlerList GetEventHandlers(Component c,
- out object objClickEvent)
- {
- FieldInfo fi = typeof(Control).GetField("ClickEvent", // Mono
- BindingFlags.Static | BindingFlags.NonPublic);
- if(fi == null)
- fi = typeof(Control).GetField("EventClick", // .NET
- BindingFlags.Static | BindingFlags.NonPublic);
- if(fi == null) { Debug.Assert(false); objClickEvent = null; return null; }
-
- objClickEvent = fi.GetValue(null);
- if(objClickEvent == null) { Debug.Assert(false); return null; }
-
- PropertyInfo pi = typeof(Component).GetProperty("Events",
- BindingFlags.Instance | BindingFlags.NonPublic);
- return (pi.GetValue(c, null) as EventHandlerList);
- }
-
- private static Dictionary