diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2014-02-05 15:07:27 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2014-02-05 15:08:02 +0400 |
commit | 5b8bf1b2ac12f1ecdd945c0708577dea72bad009 (patch) | |
tree | d069e25bfe70d4dd6c748964cd330ca8b5e459a5 | |
parent | 64143d1dc54d7a3b7b11959c69575b14d278905e (diff) |
Toolkit.WrapContext now requires a reference to a widget
This widget is used to determine the scale factor
-rwxr-xr-x | Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs | 5 | ||||
-rwxr-xr-x | Xwt/Xwt.Backends/ToolkitEngineBackend.cs | 2 | ||||
-rw-r--r-- | Xwt/Xwt/Toolkit.cs | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs b/Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs index b059b0a4..d46ad495 100755 --- a/Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs @@ -274,9 +274,10 @@ namespace Xwt.GtkBackend throw new NotSupportedException (); } - public override object GetBackendForContext (object nativeContext) + public override object GetBackendForContext (object nativeWidget, object nativeContext) { - return new CairoContextBackend (1) { Context = (Cairo.Context)nativeContext }; + Gtk.Widget w = (Gtk.Widget)nativeWidget; + return new CairoContextBackend (Util.GetScaleFactor (w)) { Context = (Cairo.Context)nativeContext }; } public override object GetNativeParentWindow (Widget w) diff --git a/Xwt/Xwt.Backends/ToolkitEngineBackend.cs b/Xwt/Xwt.Backends/ToolkitEngineBackend.cs index 21289dbe..6d87e08a 100755 --- a/Xwt/Xwt.Backends/ToolkitEngineBackend.cs +++ b/Xwt/Xwt.Backends/ToolkitEngineBackend.cs @@ -195,7 +195,7 @@ namespace Xwt.Backends /// </summary> /// <returns>The backend for context.</returns> /// <param name="nativeContext">The native context.</param> - public virtual object GetBackendForContext (object nativeContext) + public virtual object GetBackendForContext (object nativeWidget, object nativeContext) { return nativeContext; } diff --git a/Xwt/Xwt/Toolkit.cs b/Xwt/Xwt/Toolkit.cs index 4471e51b..113f0610 100644 --- a/Xwt/Xwt/Toolkit.cs +++ b/Xwt/Xwt/Toolkit.cs @@ -358,9 +358,9 @@ namespace Xwt return new Image (backend.GetBackendForImage (nativeImage)); } - public Context WrapContext (object nativeContext) + public Context WrapContext (object nativeWidget, object nativeContext) { - return new Context (backend.GetBackendForContext (nativeContext), this); + return new Context (backend.GetBackendForContext (nativeWidget, nativeContext), this); } public object ValidateObject (object obj) |