summaryrefslogtreecommitdiff
path: root/src/TestPlugin.cs
diff options
context:
space:
mode:
authorAlp Toker <alp@atoker.com>2006-08-08 21:17:14 +0100
committerAlp Toker <alp@atoker.com>2006-08-08 21:17:14 +0100
commit33e712821ac5c35ec345e6e547a7702333bb2500 (patch)
tree97692a9eba79c99a1e74cc44387f8b4d9eb7ef8d /src/TestPlugin.cs
parent8dbbad8330a7ee438e09865fe2d0d196f43ad459 (diff)
downloadcompiz-cil-33e712821ac5c35ec345e6e547a7702333bb2500.tar.gz
compiz-cil-33e712821ac5c35ec345e6e547a7702333bb2500.tar.bz2
Start work on assembly loading
The plugin interfaces are clearly not final yet.
Diffstat (limited to 'src/TestPlugin.cs')
-rw-r--r--src/TestPlugin.cs73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/TestPlugin.cs b/src/TestPlugin.cs
new file mode 100644
index 0000000..dc40a58
--- /dev/null
+++ b/src/TestPlugin.cs
@@ -0,0 +1,73 @@
+using System;
+using Compiz;
+
+public class MtestPlugin : Plugin
+{
+ public override bool InitScreen (IntPtr plugin, IntPtr screen)
+ {
+ Console.WriteLine ("initScreen");
+
+ Screen s = new Screen (screen);
+ s.PreparePaint += OnPreparePaintScreen;
+
+ return true;
+ }
+
+ public void OnPreparePaintScreen (PreparePaintScreenHandler inner, IntPtr s, int msSinceLastPaint)
+ {
+ Console.Error.WriteLine ("PreparePaintScreen (managed)");
+ inner (s, msSinceLastPaint);
+ }
+
+ public bool PaintScreen (IntPtr s, ref ScreenPaintAttrib sa, IntPtr region, ScreenPaint mask)
+ {
+ Console.Error.WriteLine ("PaintScreen (managed) " + " " + my_screen.Handle + " " + s + " " + mask);
+
+ Console.Error.WriteLine ("xRotate: " + sa.xRotate);
+ Console.Error.WriteLine ("yRotate: " + sa.yRotate);
+ Console.Error.WriteLine ("vRotate: " + sa.vRotate);
+ //Console.Error.WriteLine (": " + my_screen.);
+
+ //restrict rotation on x
+ if (sa.xRotate > 6)
+ sa.xRotate = 6f;
+ else if (sa.xRotate < -6)
+ sa.xRotate = -6f;
+
+ //restrict rotation on v
+ if (sa.vRotate > 6)
+ sa.vRotate = 6f;
+ else if (sa.vRotate < -6)
+ sa.vRotate = -6f;
+
+ //zoom out
+ //sa.zCamera = -1f;
+
+ //mask &= ScreenPaint.Region;
+ //mask |= ScreenPaint.Transformed;
+
+ bool ret = my_screen.PaintScreenOrig (s, ref sa, region, mask);
+ //Screen.PaintScreen_Add (my_screen.Handle, ref PaintScreen);
+ Screen.PaintScreen_Add (my_screen.Handle, pt);
+ return ret;
+ }
+
+ Screen my_screen = null;
+
+ PaintScreenHandler pt;
+
+ public override bool InitWindow (IntPtr plugin, IntPtr window)
+ {
+ Console.WriteLine ("initWindow");
+
+ //Console.WriteLine (window.Id);
+ //Console.WriteLine (window.Frame);
+
+ Window win = new Window (window);
+ Console.WriteLine (win.UserTime);
+ //Console.WriteLine (win.State);
+ //win.Maximize ();
+
+ return true;
+ }
+}