/*----------------------------------------------------------------------------*\
| 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