[go: up one dir, main page]

Menu

[r1]: / visocor.h  Maximize  Restore  History

Download this file

175 lines (117 with data), 5.2 kB

  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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*----------------------------------------------------------------------------*\
| Copyright (C) 2009 - Rafael de O. Lopes Gonçalves and André Shoji Asato |
| 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. |
| |
| 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.|
\*----------------------------------------------------------------------------*/
#ifndef VISOCOR_H
#define VISOCOR_H
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <compiz-core.h>
#include <compiz-mousepoll.h>
#include "visocor_options.h"
#define PLUGIN_NAME "VISOCOR"
extern int visocorDisplayPrivateIndex;
extern int visocorCorePrivateIndex;
#define GET_VISOCOR_CORE(c) \
((VISOCORCore *) (c)->base.privates[visocorCorePrivateIndex].ptr)
#define VISOCOR_CORE(c) \
VISOCORCore *vc = GET_VISOCOR_CORE (c)
#define GET_VISOCOR_DISPLAY(d) \
((VISOCORDisplay *) (d)->base.privates[visocorDisplayPrivateIndex].ptr)
#define VISOCOR_DISPLAY(d) \
VISOCORDisplay *vd = GET_VISOCOR_DISPLAY (d)
#define GET_VISOCOR_SCREEN(s, vd) \
((VISOCORScreen *) (s)->base.privates[(vd)->screenPrivateIndex].ptr)
#define VISOCOR_SCREEN(s) \
VISOCORScreen *vs = GET_VISOCOR_SCREEN (s, GET_VISOCOR_DISPLAY (s->display))
#define GET_VISOCOR_WINDOW(w, vs) \
((VISOCORWindow *) (w)->base.privates[(vs)->windowPrivateIndex].ptr)
#define VISOCOR_WINDOW(w) \
VISOCORWindow *vw = GET_VISOCOR_WINDOW (w, \
GET_VISOCOR_SCREEN (w->screen, \
GET_VISOCOR_DISPLAY (w->screen->display)))
typedef struct _VISOCORCore {
ObjectAddProc objectAdd;
} VISOCORCore;
typedef struct _VISOCORDisplay {
int screenPrivateIndex;
MousePollFunc *mousepollFunc;
} VISOCORDisplay;
typedef struct _VISOCORSCreen {
int windowPrivateIndex;
PreparePaintScreenProc preparePaintScreen;
DonePaintScreenProc donePaintScreen;
DrawWindowTextureProc drawWindowTexture;
int filterIntensity;
float ir;
float ig;
float ib;
int visocorFunctions[2][MAX_FRAGMENT_FUNCTIONS];
Bool isMousepollActive;
int mousePosX;
int mousePosY;
float mouse_pixel[3];
PositionPollingHandle pollHandle;
} VISOCORScreen;
typedef enum _VisocorWindowState{
FILTER = 0,
SLICE = 1 ,
OFF
}VisocorWindowState;
typedef struct _VISOCORWindow {
VisocorWindowState lastState;
VisocorWindowState currentState;
} VISOCORWindow;
/* ********************************************************************************************** */
/*visocor.c*/
void visocorPrintf(CompLogLevel level,const char *fmt, ...);
/**
* Muda o estado da janela.
*/
void visocorToggleWindowToState(CompWindow * w, VisocorWindowState state);
void visocorDamageAllWindows(CompScreen * s);
CompScreen * visocorFindScreen(CompDisplay * d, CompOption * option, int nOption);
CompWindow * visocorFindWindow(CompDisplay * d, CompOption * option, int nOption);
/* ********************************************************************************************** */
/*filter.c*/
#define N_FILTER_VARIATIONS 32
Bool visocorToggleFilter(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption);
Bool visocorDecreaseFilter(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption);
Bool visocorIncreaseFilter(CompDisplay * d, CompAction * action,
CompActionState state, CompOption * option, int nOption);
int getVisocorFilterFragmentFunction( CompScreen * s, CompTexture * texture,
int param);
void visocorResetFilter(VISOCORScreen * vs);
/* ********************************************************************************************** */
/*slicer.c*/
#define MAX_DISTANCE_R 6.666
#define MAX_DISTANCE_G 6.666
#define MAX_DISTANCE_B 2
void visocorMousepollPositionUpdate(CompScreen *s, int x, int y);
Bool visocorMousepollClickKeyInitiateSlice(CompDisplay *d,
CompAction *action, CompActionState state, CompOption *option,
int nOption);
Bool visocorMousepollClickKeyTerminateSlice(CompDisplay *d,
CompAction *action, CompActionState state, CompOption *option,
int nOption);
int getVisocorSlicerFragmentFunction(CompScreen * s, CompTexture * texture,
int param);
/* ********************************************************************************************** */
#endif