2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
#include "applet-struct.h"
24
#include "applet-notifications.h"
26
#define CD_DOCK_IN_MOVMENT(pDock) ((myConfig.bAlways && cairo_dock_container_is_animating (CAIRO_CONTAINER(pDock))) || pDock->bIsShrinkingDown || pDock->bIsGrowingUp)
29
gboolean cd_motion_blur_pre_render (gpointer pUserData, CairoDock *pDock, cairo_t *pCairoContext)
31
if (pCairoContext != NULL)
32
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
33
CDMotionBlurData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);
35
if ((pData != NULL && pData->iBlurCount != 0) || CD_DOCK_IN_MOVMENT (pDock))
36
glAccum(GL_MULT, myConfig.fBlurFactor);
38
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
41
gboolean cd_motion_blur_post_render (gpointer pUserData, CairoDock *pDock, cairo_t *pCairoContext)
43
if (pCairoContext != NULL)
44
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
45
CDMotionBlurData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);
47
if ((pData != NULL && pData->iBlurCount != 0) || CD_DOCK_IN_MOVMENT (pDock))
49
glAccum (GL_ACCUM, 1 - myConfig.fBlurFactor);
50
glAccum (GL_RETURN, 1.0);
54
glClearAccum (0., 0., 0., 0.);
55
glClear (GL_ACCUM_BUFFER_BIT);
56
glAccum (GL_ACCUM, 1.);
59
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
63
gboolean cd_motion_blur_mouse_moved (gpointer pUserData, CairoDock *pDock, gboolean *bStartAnimation)
65
if (! CAIRO_DOCK_CONTAINER_IS_OPENGL (CAIRO_CONTAINER (pDock)))
66
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
67
CDMotionBlurData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);
69
pData = g_new0 (CDMotionBlurData, 1);
71
pData->iBlurCount = 20;
72
*bStartAnimation = TRUE;
74
CD_APPLET_SET_MY_DOCK_DATA (pDock, pData);
75
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
79
gboolean cd_motion_blur_update_dock (gpointer pUserData, CairoDock *pDock, gboolean *bContinueAnimation)
81
CDMotionBlurData *pData = CD_APPLET_GET_MY_DOCK_DATA (pDock);
83
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
85
if (! pDock->bIsShrinkingDown && ! pDock->bIsGrowingUp)
87
cd_message ("blur <- %d", pData->iBlurCount);
89
cairo_dock_redraw_container (CAIRO_CONTAINER (pDock));
90
if (pData->iBlurCount <= 0)
93
CD_APPLET_SET_MY_DOCK_DATA (pDock, NULL);
94
return CAIRO_DOCK_LET_PASS_NOTIFICATION;
97
*bContinueAnimation = TRUE;
98
return CAIRO_DOCK_LET_PASS_NOTIFICATION;