summaryrefslogtreecommitdiff
path: root/src/TestPlugin.cs
blob: feb6f01687037320e038d5d4469bce1d2a989720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using Compiz;

public class MtestPlugin : Plugin
{
	Screen s;

	public override bool InitScreen (IntPtr plugin, IntPtr screen)
	{
		Console.WriteLine ("initScreen");

		s = new Screen (screen);
		s.PreparePaint += OnPreparePaintScreen;
		s.Paint += OnPaintScreen;

		return true;
	}

	public void OnPreparePaintScreen (PreparePaintScreenHandler inner, IntPtr s, int msSinceLastPaint)
	{
		Console.Error.WriteLine ("PreparePaintScreen (managed) " + msSinceLastPaint);
		inner (s, msSinceLastPaint);
	}

	public bool OnPaintScreen (PaintScreenHandler inner, IntPtr s, ref ScreenPaintAttrib sa, IntPtr region, ScreenPaint mask)
	{
		Console.Error.WriteLine ("PaintScreen (managed) " + " " +  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 = inner (s, ref sa, region, mask);

		return ret;
	}

	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;
	}

	public override void FiniWindow (IntPtr plugin, IntPtr window)
	{
		Console.WriteLine ("finiWindow");
	}
}