summaryrefslogtreecommitdiff
path: root/src/hoverfx.h
blob: a2ac065d2f8affd970bc59861a0b5ed86ef09c3e (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*copyright*/

#include <core/core.h>
#include <composite/composite.h>
#include <opengl/opengl.h>

#include "hoverfx_options.h"

class HoverScreen :
    public PluginClassHandler <HoverScreen, CompScreen>,
    public ScreenInterface,
    public CompositeScreenInterface,
    public GLScreenInterface,
    public HoverfxOptions
{
    public:
	
	HoverScreen (CompScreen *);
	
	CompositeScreen *cScreen;
	GLScreen	*gScreen;

	CompWindowList  mHoveredWindows;
	
	void
	toggleFunctions (bool);
	
	void
	preparePaint (int);

	void
	handleEvent (XEvent *);
	
	void
	donePaint ();
	
	bool
	glPaintOutput (const GLScreenPaintAttrib &attrib,
		       const GLMatrix	      &transform,
		       const CompRegion	      &region,
		       CompOutput	      *output,
		       unsigned int	      mask);
};

#define HOVER_SCREEN(s)							      \
    HoverScreen *hs = HoverScreen::get(s)


class HoverWindow :
    public PluginClassHandler <HoverWindow, CompWindow>,
    public CompositeWindowInterface,
    public GLWindowInterface
{
    public:
	
	HoverWindow (CompWindow *);

	CompWindow *window;
	CompositeWindow *cWindow;
	GLWindow 	*gWindow;

	bool		mIsHovered;
	bool		mAnimate;

	float		mDefault;
	float		mOld;
	float		mCurrent;
	float		mTarget;
	
	void		toggleFunctions (bool);
	
	bool		shouldAnimate ();

	bool
	glPaint (const GLWindowPaintAttrib &,
		 const GLMatrix		   &,
		 const CompRegion	   &,
		 unsigned int);
	
	bool
	damageRect (bool, const CompRect &);
};

#define HOVER_WINDOW(w)							      \
    HoverWindow *hw = HoverWindow::get (w);

class HoverPluginVTable :
    public CompPlugin::VTableForScreenAndWindow <HoverScreen, HoverWindow>
{
    public:
	bool init ();
};