1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2010 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Authored by: Jason Smith <jason.smith@canonical.com>
20
1
#ifndef PLUGINADAPTER_H
21
2
#define PLUGINADAPTER_H
24
5
#include <core/core.h>
25
#include <core/atoms.h>
27
7
#include <sigc++/sigc++.h>
29
#include "WindowManager.h"
34
unsigned long functions;
35
unsigned long decorations;
38
} MotifWmHints, MwmHints;
44
MultiActionList(int n) :
46
_primary_action(NULL) {};
48
void InitiateAll(CompOption::Vector& extraArgs, int state);
49
void TerminateAll(CompOption::Vector& extraArgs);
51
void AddNewAction(CompAction*, bool primary);
52
void RemoveAction(CompAction*);
55
std::list <CompAction*> m_ActionList;
56
CompAction* _primary_action;
60
class PluginAdapter : public sigc::trackable, public WindowManager
63
static PluginAdapter* Default();
65
static void Initialize(CompScreen* screen);
67
nux::Property<bool> bias_active_to_viewport;
71
void SetScaleAction(MultiActionList& scale);
72
void SetExpoAction(MultiActionList& expo);
74
void SetShowHandlesAction(CompAction* action)
76
_grab_show_action = action;
78
void SetHideHandlesAction(CompAction* action)
80
_grab_hide_action = action;
82
void SetToggleHandlesAction(CompAction* action)
84
_grab_toggle_action = action;
87
void OnWindowClosed (CompWindow *);
88
void OnScreenGrabbed();
89
void OnScreenUngrabbed();
91
void OnShowDesktop ();
92
void OnLeaveDesktop ();
94
void TerminateScale();
100
void ShowGrabHandles(CompWindow* window, bool use_timer);
101
void HideGrabHandles(CompWindow* window);
102
void ToggleGrabHandles(CompWindow* window);
104
void Notify(CompWindow* window, CompWindowNotify notify);
105
void NotifyMoved(CompWindow* window, int x, int y);
106
void NotifyResized(CompWindow* window, int x, int y, int w, int h);
107
void NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state);
108
void NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option);
109
void NotifyNewDecorationState(guint32 xid);
111
void Decorate(guint32 xid);
112
void Undecorate(guint32 xid);
114
// WindowManager implementation
115
bool IsWindowMaximized(guint xid);
116
bool IsWindowDecorated(guint xid);
117
bool IsWindowOnCurrentDesktop(guint xid);
118
bool IsWindowObscured(guint xid);
119
bool IsWindowMapped(guint xid);
120
bool IsWindowVisible(guint32 xid);
121
void Restore(guint32 xid);
122
void Minimize(guint32 xid);
123
void Close(guint32 xid);
124
void Activate(guint32 xid);
125
void Raise(guint32 xid);
126
void Lower(guint32 xid);
129
void SetWindowIconGeometry(Window window, nux::Geometry const& geo);
131
void FocusWindowGroup(std::vector<Window> windows, FocusVisibility);
132
bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);
134
bool IsScreenGrabbed();
135
bool IsViewPortSwitchStarted();
137
unsigned long long GetWindowActiveNumber (guint32 xid);
139
bool MaximizeIfBigEnough(CompWindow* window);
141
nux::Geometry GetWindowGeometry(guint32 xid);
142
nux::Geometry GetScreenGeometry();
144
void CheckWindowIntersections(nux::Geometry const& region, bool &active, bool &any);
146
int WorkspaceCount();
148
void SetCoverageAreaBeforeAutomaximize(float area);
150
bool saveInputFocus ();
151
bool restoreInputFocus ();
9
class PluginAdapter : public sigc::trackable
12
static PluginAdapter * Default ();
14
static void Initialize (CompScreen *screen);
18
std::string * MatchStringForXids (std::list<Window> *windows);
20
void SetScaleAction (CompAction *scale);
22
void SetExpoAction (CompAction *expo);
24
void InitiateScale (std::string *match);
154
PluginAdapter(CompScreen* screen);
29
PluginAdapter(CompScreen *screen);
157
std::string MatchStringForXids(std::vector<Window> *windows);
158
void InitiateScale(std::string const& match, int state = 0);
160
bool CheckWindowIntersection(nux::Geometry const& region, CompWindow* window);
161
void SetMwmWindowHints(Window xid, MotifWmHints* new_hints);
163
CompScreen* m_Screen;
164
MultiActionList m_ExpoActionList;
165
MultiActionList m_ScaleActionList;
169
bool _vp_switch_started;
171
CompAction* _grab_show_action;
172
CompAction* _grab_hide_action;
173
CompAction* _grab_toggle_action;
175
float _coverage_area_before_automaximize;
177
bool _in_show_desktop;
178
CompWindow* _last_focused_window;
180
std::map<guint32, unsigned int> _window_decoration_state;
182
static PluginAdapter* _default;
33
CompAction *m_ExpoAction;
34
CompAction *m_ScaleAction;
36
static PluginAdapter *_default;