2
* Compiz vpswitch plugin
6
* Copyright (c) 2007 Dennis Kasprzyk <onestone@opencompositing.org>
8
* Go-to-numbered-viewport functionality by
10
* Copyright (c) 2007 Robert Carr <racarr@opencompositing.org>
11
* (c) 2007 Danny Baumann <maniac@opencompositing.org>
13
* Go-to-specific-viewport functionality by
15
* Copyright (c) 2007 Michael Vogt <mvo@ubuntu.com>
17
* This program is free software; you can redistribute it and/or
18
* modify it under the terms of the GNU General Public License
19
* as published by the Free Software Foundation; either version 2
20
* of the License, or (at your option) any later version.
22
* This program is distributed in the hope that it will be useful,
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
* GNU General Public License for more details.
29
#include <core/core.h>
30
#include <core/pluginclasshandler.h>
31
#include <core/atoms.h>
33
#include "vpswitch_options.h"
35
/* Helper macro to obtain necesary action data */
37
/* ??? xid = screen->grabWindow () else xid = screen->below () */
42
if (screen->otherGrabExist ("rotate", "wall", "plane", 0)) \
44
xid = CompOption::getIntOptionNamed (options, "window"); \
45
w = screen->findWindow (xid); \
46
if ((!w || (w->type () & CompWindowTypeDesktopMask) == 0) && \
47
xid != screen->root ()) \
50
/* number-to-keysym mapping */
51
static const KeySym numberKeySyms[3][10] = {
53
{ XK_0, XK_1, XK_2, XK_3, XK_4, XK_5, XK_6, XK_7, XK_8, XK_9 },
54
/* number keypad with activated NumLock */
55
{ XK_KP_0, XK_KP_1, XK_KP_2, XK_KP_3, XK_KP_4,
56
XK_KP_5, XK_KP_6, XK_KP_7, XK_KP_8, XK_KP_9 },
57
/* number keypad without NumLock */
58
{ XK_KP_Insert, XK_KP_End, XK_KP_Down, XK_KP_Next, XK_KP_Left,
59
XK_KP_Begin, XK_KP_Right, XK_KP_Home, XK_KP_Up, XK_KP_Prior }
62
class VPSwitchScreen :
63
public PluginClassHandler <VPSwitchScreen, CompScreen>,
64
public VpswitchOptions,
65
public ScreenInterface
69
VPSwitchScreen (CompScreen *);
74
/* Wrappable functions */
76
handleEvent (XEvent *);
80
movevp (CompAction *action,
81
CompAction::State state,
82
CompOption::Vector &options,
83
unsigned int dx, unsigned int dy);
86
switchto (CompAction *action,
87
CompAction::State state,
88
CompOption::Vector &options,
92
initiateNumbered (CompAction *action,
93
CompAction::State state,
94
CompOption::Vector &options);
97
terminateNumbered (CompAction *action,
98
CompAction::State state,
99
CompOption::Vector &options);
102
prev (CompAction *action,
103
CompAction::State state,
104
CompOption::Vector &options);
107
next (CompAction *action,
108
CompAction::State state,
109
CompOption::Vector &options);
112
initPluginAction (CompAction *action,
113
CompAction::State state,
114
CompOption::Vector &options);
117
termPluginAction (CompAction *action,
118
CompAction::State state,
119
CompOption::Vector &options);
121
/* General Functions */
124
gotovp (int x, int y);
127
#define VPSWITCH_SCREEN(s) \
128
VPSwitchScreen *vs = VPSwitchScreen::get (s);
130
class VPSwitchPluginVTable :
131
public CompPlugin::VTableForScreen <VPSwitchScreen>