summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/BackgroundEffectHelper.cpp1
-rw-r--r--unity-shared/CMakeLists.txt5
-rw-r--r--unity-shared/PluginAdapter.cpp (renamed from unity-shared/PluginAdapterCompiz.cpp)421
-rw-r--r--unity-shared/PluginAdapter.h98
-rw-r--r--unity-shared/PluginAdapterStandalone.cpp491
-rw-r--r--unity-shared/StandaloneWindowManager.cpp274
-rw-r--r--unity-shared/StandaloneWindowManager.h108
-rw-r--r--unity-shared/StaticCairoText.cpp4
-rw-r--r--unity-shared/WindowManager.cpp271
-rw-r--r--unity-shared/WindowManager.h137
10 files changed, 611 insertions, 1199 deletions
diff --git a/unity-shared/BackgroundEffectHelper.cpp b/unity-shared/BackgroundEffectHelper.cpp
index 2d3be7ef4..f9078b801 100644
--- a/unity-shared/BackgroundEffectHelper.cpp
+++ b/unity-shared/BackgroundEffectHelper.cpp
@@ -29,7 +29,6 @@
#undef FALSE
#endif
-#include <X11/Xregion.h>
#include <boost/utility.hpp>
#include "UnitySettings.h"
diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt
index c2c5b9562..dbb4b28a8 100644
--- a/unity-shared/CMakeLists.txt
+++ b/unity-shared/CMakeLists.txt
@@ -64,6 +64,7 @@ set (UNITY_SHARED_SOURCES
UnityWindowView.cpp
UserThumbnailProvider.cpp
WindowManager.cpp
+ XWindowManager.cpp
ubus-server.cpp
)
@@ -77,7 +78,7 @@ add_dependencies (unity-shared unity-core-${UNITY_API_VERSION})
# compiz
set (UNITY_SHARED_COMPIZ_SOURCES
- PluginAdapterCompiz.cpp
+ PluginAdapter.cpp
)
add_library (unity-shared-compiz STATIC ${UNITY_SHARED_COMPIZ_SOURCES})
target_link_libraries (unity-shared-compiz ${LIBS})
@@ -86,7 +87,7 @@ add_dependencies (unity-shared-compiz unity-shared)
# standalone
set (UNITY_SHARED_STANDALONE_SOURCES
- PluginAdapterStandalone.cpp
+ StandaloneWindowManager.cpp
)
add_library (unity-shared-standalone STATIC ${UNITY_SHARED_STANDALONE_SOURCES})
target_link_libraries (unity-shared-standalone ${LIBS})
diff --git a/unity-shared/PluginAdapterCompiz.cpp b/unity-shared/PluginAdapter.cpp
index 23702bf7f..8aa4c3723 100644
--- a/unity-shared/PluginAdapterCompiz.cpp
+++ b/unity-shared/PluginAdapter.cpp
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -25,6 +25,8 @@
#include <NuxCore/Logger.h>
#include <UnityCore/Variant.h>
+namespace unity
+{
namespace
{
@@ -33,10 +35,9 @@ nux::logging::Logger logger("unity.plugin");
const int THRESHOLD_HEIGHT = 600;
const int THRESHOLD_WIDTH = 1024;
+std::shared_ptr<PluginAdapter> global_instance;
}
-PluginAdapter* PluginAdapter::_default = 0;
-
#define MAXIMIZABLE (CompWindowActionMaximizeHorzMask & CompWindowActionMaximizeVertMask & CompWindowActionResizeMask)
#define MWM_HINTS_FUNCTIONS (1L << 0)
@@ -44,20 +45,23 @@ PluginAdapter* PluginAdapter::_default = 0;
#define MWM_HINTS_UNDECORATED_UNITY 0x80
#define _XA_MOTIF_WM_HINTS "_MOTIF_WM_HINTS"
+
+WindowManagerPtr create_window_manager()
+{
+ return global_instance;
+}
+
/* static */
-PluginAdapter*
-PluginAdapter::Default()
+PluginAdapter& PluginAdapter::Default()
{
- if (!_default)
- return 0;
- return _default;
+ // Better hope that initialize has been called first.
+ return *global_instance;
}
/* static */
-void
-PluginAdapter::Initialize(CompScreen* screen)
+void PluginAdapter::Initialize(CompScreen* screen)
{
- _default = new PluginAdapter(screen);
+ global_instance.reset(new PluginAdapter(screen));
}
PluginAdapter::PluginAdapter(CompScreen* screen) :
@@ -82,10 +86,9 @@ PluginAdapter::~PluginAdapter()
}
/* A No-op for now, but could be useful later */
-void
-PluginAdapter::OnScreenGrabbed()
+void PluginAdapter::OnScreenGrabbed()
{
- compiz_screen_grabbed.emit();
+ screen_grabbed.emit();
if (!_spread_state && screen->grabExist("scale"))
{
@@ -100,8 +103,7 @@ PluginAdapter::OnScreenGrabbed()
}
}
-void
-PluginAdapter::OnScreenUngrabbed()
+void PluginAdapter::OnScreenUngrabbed()
{
if (_spread_state && !screen->grabExist("scale"))
{
@@ -116,58 +118,53 @@ PluginAdapter::OnScreenUngrabbed()
terminate_expo.emit();
}
- compiz_screen_ungrabbed.emit();
+ screen_ungrabbed.emit();
}
-void
-PluginAdapter::NotifyResized(CompWindow* window, int x, int y, int w, int h)
+void PluginAdapter::NotifyResized(CompWindow* window, int x, int y, int w, int h)
{
window_resized.emit(window->id());
}
-void
-PluginAdapter::NotifyMoved(CompWindow* window, int x, int y)
+void PluginAdapter::NotifyMoved(CompWindow* window, int x, int y)
{
window_moved.emit(window->id());
}
-void
-PluginAdapter::NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state)
+void PluginAdapter::NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state)
{
if (!((last_state & MAXIMIZE_STATE) == MAXIMIZE_STATE)
&& ((state & MAXIMIZE_STATE) == MAXIMIZE_STATE))
{
- WindowManager::window_maximized.emit(window->id());
+ window_maximized.emit(window->id());
}
else if (((last_state & MAXIMIZE_STATE) == MAXIMIZE_STATE)
&& !((state & MAXIMIZE_STATE) == MAXIMIZE_STATE))
{
- WindowManager::window_restored.emit(window->id());
+ window_restored.emit(window->id());
}
}
-void
-PluginAdapter::NotifyNewDecorationState(guint32 xid)
+void PluginAdapter::NotifyNewDecorationState(Window xid)
{
- bool wasTracked = (_window_decoration_state.find (xid) != _window_decoration_state.end ());
+ bool wasTracked = (_window_decoration_state.find(xid) != _window_decoration_state.end());
bool wasDecorated = false;
if (wasTracked)
wasDecorated = _window_decoration_state[xid];
- bool decorated = IsWindowDecorated (xid);
+ bool decorated = IsWindowDecorated(xid);
if (decorated == wasDecorated)
return;
if (decorated && (!wasDecorated || !wasTracked))
- WindowManager::window_decorated.emit(xid);
+ window_decorated.emit(xid);
else if (wasDecorated || !wasTracked)
- WindowManager::window_undecorated.emit(xid);
+ window_undecorated.emit(xid);
}
-void
-PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
+void PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
{
switch (notify)
{
@@ -190,38 +187,36 @@ PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
window_shown.emit(window->id());
break;
case CompWindowNotifyMap:
- WindowManager::window_mapped.emit(window->id());
+ window_mapped.emit(window->id());
break;
case CompWindowNotifyUnmap:
- WindowManager::window_unmapped.emit(window->id());
+ window_unmapped.emit(window->id());
break;
case CompWindowNotifyFocusChange:
- WindowManager::window_focus_changed.emit(window->id());
+ window_focus_changed.emit(window->id());
break;
default:
break;
}
}
-void
-PluginAdapter::NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option)
+void PluginAdapter::NotifyCompizEvent(const char* plugin,
+ const char* event,
+ CompOption::Vector& option)
{
if (g_strcmp0(event, "start_viewport_switch") == 0)
{
_vp_switch_started = true;
- compiz_screen_viewport_switch_started.emit();
+ screen_viewport_switch_started.emit();
}
else if (g_strcmp0(event, "end_viewport_switch") == 0)
{
_vp_switch_started = false;
- compiz_screen_viewport_switch_ended.emit();
+ screen_viewport_switch_ended.emit();
}
-
- compiz_event.emit(plugin, event, option);
}
-void
-MultiActionList::AddNewAction(std::string const& name, CompAction* a, bool primary)
+void MultiActionList::AddNewAction(std::string const& name, CompAction* a, bool primary)
{
actions_[name] = a;
@@ -328,13 +323,9 @@ void MultiActionList::TerminateAll(CompOption::Vector const& extra_args) const
}
}
-unsigned long long
-PluginAdapter::GetWindowActiveNumber (guint32 xid) const
+unsigned long long PluginAdapter::GetWindowActiveNumber(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
@@ -349,33 +340,32 @@ PluginAdapter::GetWindowActiveNumber (guint32 xid) const
return 0;
}
-void
-PluginAdapter::SetExpoAction(MultiActionList& expo)
+void PluginAdapter::SetExpoAction(MultiActionList& expo)
{
m_ExpoActionList = expo;
}
-void
-PluginAdapter::SetScaleAction(MultiActionList& scale)
+void PluginAdapter::SetScaleAction(MultiActionList& scale)
{
m_ScaleActionList = scale;
}
-std::string
-PluginAdapter::MatchStringForXids(std::vector<Window> const& windows)
+std::string PluginAdapter::MatchStringForXids(std::vector<Window> const& windows)
{
- std::string out_string = "any & (";
+ std::ostringstream sout;
- for (auto const& xid : windows)
- out_string += "| xid=" + std::to_string(xid) + " ";
+ sout << "any & (";
- out_string += ")";
+ for (auto const& window : windows)
+ {
+ sout << "| xid=" << window << " ";
+ }
+ sout << ")";
- return out_string;
+ return sout.str();
}
-void
-PluginAdapter::InitiateScale(std::string const& match, int state)
+void PluginAdapter::InitiateScale(std::string const& match, int state)
{
CompOption::Vector argument(1);
argument[0].setName("match", CompOption::TypeMatch);
@@ -384,32 +374,27 @@ PluginAdapter::InitiateScale(std::string const& match, int state)
m_ScaleActionList.InitiateAll(argument, state);
}
-void
-PluginAdapter::TerminateScale()
+void PluginAdapter::TerminateScale()
{
m_ScaleActionList.TerminateAll();
}
-bool
-PluginAdapter::IsScaleActive() const
+bool PluginAdapter::IsScaleActive() const
{
return m_Screen->grabExist("scale");
}
-bool
-PluginAdapter::IsScaleActiveForGroup() const
+bool PluginAdapter::IsScaleActiveForGroup() const
{
return _spread_windows_state && m_Screen->grabExist("scale");
}
-bool
-PluginAdapter::IsExpoActive() const
+bool PluginAdapter::IsExpoActive() const
{
return m_Screen->grabExist("expo");
}
-bool
-PluginAdapter::IsWallActive() const
+bool PluginAdapter::IsWallActive() const
{
return m_Screen->grabExist("wall");
}
@@ -425,19 +410,14 @@ void PluginAdapter::TerminateExpo()
}
// WindowManager implementation
-guint32
-PluginAdapter::GetActiveWindow() const
+Window PluginAdapter::GetActiveWindow() const
{
return m_Screen->activeWindow();
}
-bool
-PluginAdapter::IsWindowMaximized(guint xid) const
+bool PluginAdapter::IsWindowMaximized(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
return ((window->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE);
@@ -446,12 +426,9 @@ PluginAdapter::IsWindowMaximized(guint xid) const
return false;
}
-bool
-PluginAdapter::IsWindowDecorated(guint32 xid)
+bool PluginAdapter::IsWindowDecorated(Window window_id) const
{
Display* display = m_Screen->dpy();
- Window win = xid;
- Atom hints_atom = None;
MotifWmHints* hints = NULL;
Atom type = None;
gint format;
@@ -459,9 +436,9 @@ PluginAdapter::IsWindowDecorated(guint32 xid)
gulong bytes_after;
bool ret = true;
- hints_atom = XInternAtom(display, _XA_MOTIF_WM_HINTS, false);
+ Atom hints_atom = XInternAtom(display, _XA_MOTIF_WM_HINTS, false);
- if (XGetWindowProperty(display, win, hints_atom, 0,
+ if (XGetWindowProperty(display, window_id, hints_atom, 0,
sizeof(MotifWmHints) / sizeof(long), False,
hints_atom, &type, &format, &nitems, &bytes_after,
(guchar**)&hints) != Success)
@@ -477,22 +454,20 @@ PluginAdapter::IsWindowDecorated(guint32 xid)
hints->flags & MWM_HINTS_DECORATIONS)
{
/* Must have both bits set */
- _window_decoration_state[xid] = ret =
- (hints->decorations & (MwmDecorAll | MwmDecorTitle)) ||
+ ret = (hints->decorations & (MwmDecorAll | MwmDecorTitle)) ||
(hints->decorations & MWM_HINTS_UNDECORATED_UNITY);
+ // This is mildly evil and we should look for another solution.
+ PluginAdapter* non_const_this = const_cast<PluginAdapter*>(this);
+ non_const_this->_window_decoration_state[window_id] = ret;
}
XFree(hints);
return ret;
}
-bool
-PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) const
+bool PluginAdapter::IsWindowOnCurrentDesktop(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
// we aren't checking window->onCurrentDesktop (), as the name implies, because that is broken
@@ -502,13 +477,9 @@ PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) const
return false;
}
-bool
-PluginAdapter::IsWindowObscured(guint32 xid) const
+bool PluginAdapter::IsWindowObscured(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
@@ -535,35 +506,26 @@ PluginAdapter::IsWindowObscured(guint32 xid) const
return false;
}
-bool
-PluginAdapter::IsWindowMapped(guint32 xid) const
+bool PluginAdapter::IsWindowMapped(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
return window->mapNum () > 0;
return true;
}
-bool
-PluginAdapter::IsWindowVisible(guint32 xid) const
+bool PluginAdapter::IsWindowVisible(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
return !(window->state() & CompWindowStateHiddenMask) && !window->inShowDesktopMode();
return false;
}
-bool
-PluginAdapter::IsWindowOnTop(guint32 xid) const
+bool PluginAdapter::IsWindowOnTop(Window window_id) const
{
- if (xid == GetTopMostValidWindowInViewport())
+ if (window_id == GetTopMostValidWindowInViewport())
return true;
return false;
@@ -594,130 +556,91 @@ Window PluginAdapter::GetTopMostValidWindowInViewport() const
return 0;
}
-bool
-PluginAdapter::IsWindowClosable(guint32 xid) const
+bool PluginAdapter::IsWindowClosable(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
return (window->actions() & CompWindowActionCloseMask);
return false;
}
-bool
-PluginAdapter::IsWindowMinimizable(guint32 xid) const
+bool PluginAdapter::IsWindowMinimizable(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
return (window->actions() & CompWindowActionMinimizeMask);
return false;
}
-bool
-PluginAdapter::IsWindowMaximizable(guint32 xid) const
+bool PluginAdapter::IsWindowMaximizable(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
return (window->actions() & MAXIMIZABLE);
return false;
}
-void
-PluginAdapter::Restore(guint32 xid)
+void PluginAdapter::Restore(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
window->maximize(0);
}
-void
-PluginAdapter::RestoreAt(guint32 xid, int x, int y)
+void PluginAdapter::RestoreAt(Window window_id, int x, int y)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window && (window->state() & MAXIMIZE_STATE))
{
- nux::Geometry new_geo(GetWindowSavedGeometry(xid));
+ nux::Geometry new_geo(GetWindowSavedGeometry(window_id));
new_geo.x = x;
new_geo.y = y;
window->maximize(0);
- MoveResizeWindow(xid, new_geo);
+ MoveResizeWindow(window_id, new_geo);
}
}
-void
-PluginAdapter::Minimize(guint32 xid)
+void PluginAdapter::Minimize(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window && (window->actions() & CompWindowActionMinimizeMask))
window->minimize();
}
-void
-PluginAdapter::Close(guint32 xid)
+void PluginAdapter::Close(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
window->close(CurrentTime);
}
-void
-PluginAdapter::Activate(guint32 xid)
+void PluginAdapter::Activate(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
window->activate();
}
-void
-PluginAdapter::Raise(guint32 xid)
+void PluginAdapter::Raise(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
window->raise();
}
-void
-PluginAdapter::Lower(guint32 xid)
+void PluginAdapter::Lower(Window window_id)
{
- Window win = xid;
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
window->lower();
}
-void
-PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor, bool only_top_win)
+void PluginAdapter::FocusWindowGroup(std::vector<Window> const& window_ids,
+ FocusVisibility focus_visibility,
+ int monitor, bool only_top_win)
{
CompPoint target_vp = m_Screen->vp();
CompWindow* top_window = nullptr;
@@ -838,8 +761,7 @@ PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility
}
}
-bool
-PluginAdapter::ScaleWindowGroup(std::vector<Window> windows, int state, bool force)
+bool PluginAdapter::ScaleWindowGroup(std::vector<Window> const& windows, int state, bool force)
{
std::size_t num_windows = windows.size();
if (num_windows > 1 || (force && num_windows))
@@ -852,8 +774,7 @@ PluginAdapter::ScaleWindowGroup(std::vector<Window> windows, int state, bool for
return false;
}
-void
-PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
+void PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
{
long data[4];
@@ -867,8 +788,7 @@ PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
(unsigned char*) data, 4);
}
-void
-PluginAdapter::ShowDesktop()
+void PluginAdapter::ShowDesktop()
{
if (_in_show_desktop)
{
@@ -887,25 +807,22 @@ bool PluginAdapter::InShowDesktop() const
return _in_show_desktop;
}
-void
-PluginAdapter::OnShowDesktop()
+void PluginAdapter::OnShowDesktop()
{
LOG_DEBUG(logger) << "Now in show desktop mode.";
_in_show_desktop = true;
}
-void
-PluginAdapter::OnLeaveDesktop()
+void PluginAdapter::OnLeaveDesktop()
{
LOG_DEBUG(logger) << "No longer in show desktop mode.";
_in_show_desktop = false;
}
-int
-PluginAdapter::GetWindowMonitor(guint32 xid) const
+int PluginAdapter::GetWindowMonitor(Window window_id) const
{
// FIXME, we should use window->outputDevice() but this is not UScreen friendly
- nux::Geometry const& geo = GetWindowGeometry(xid);
+ nux::Geometry const& geo = GetWindowGeometry(window_id);
if (!geo.IsNull())
{
@@ -918,14 +835,10 @@ PluginAdapter::GetWindowMonitor(guint32 xid) const
return -1;
}
-nux::Geometry
-PluginAdapter::GetWindowGeometry(guint32 xid) const
+nux::Geometry PluginAdapter::GetWindowGeometry(Window window_id) const
{
- Window win = xid;
- CompWindow* window;
nux::Geometry geo;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
geo.x = window->borderRect().x();
@@ -936,14 +849,10 @@ PluginAdapter::GetWindowGeometry(guint32 xid) const
return geo;
}
-nux::Geometry
-PluginAdapter::GetWindowSavedGeometry(guint32 xid) const
+nux::Geometry PluginAdapter::GetWindowSavedGeometry(Window window_id) const
{
- Window win = xid;
nux::Geometry geo(0, 0, 1, 1);
- CompWindow* window;
-
- window = m_Screen->findWindow(win);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (window)
{
XWindowChanges &wc = window->saveWc();
@@ -956,37 +865,27 @@ PluginAdapter::GetWindowSavedGeometry(guint32 xid) const
return geo;
}
-nux::Geometry
-PluginAdapter::GetScreenGeometry() const
+nux::Geometry PluginAdapter::GetScreenGeometry() const
{
- nux::Geometry geo;
-
- geo.x = 0;
- geo.y = 0;
- geo.width = m_Screen->width();
- geo.height = m_Screen->height();
-
+ nux::Geometry geo(0, 0, m_Screen->width(), m_Screen->height());
return geo;
}
-nux::Geometry
-PluginAdapter::GetWorkAreaGeometry(guint32 xid) const
+nux::Geometry PluginAdapter::GetWorkAreaGeometry(Window window_id) const
{
CompWindow* window = nullptr;
unsigned int output = 0;
- if (xid != 0)
+ if (window_id)
{
- Window win = xid;
-
- window = m_Screen->findWindow(win);
+ window = m_Screen->findWindow(window_id);
if (window)
{
output = window->outputDevice();
}
}
- if (xid == 0 || !window)
+ if (window_id == 0 || !window)
{
output = m_Screen->currentOutputDev().id();
}
@@ -996,8 +895,7 @@ PluginAdapter::GetWorkAreaGeometry(guint32 xid) const
return nux::Geometry(workarea.x(), workarea.y(), workarea.width(), workarea.height());
}
-bool
-PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const
+bool PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const
{
int intersect_types = CompWindowTypeNormalMask | CompWindowTypeDialogMask |
CompWindowTypeModalDialogMask | CompWindowTypeUtilMask;
@@ -1015,8 +913,7 @@ PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow*
return false;
}
-void
-PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any)
+void PluginAdapter::CheckWindowIntersections(nux::Geometry const& region, bool &active, bool &any)
{
// prime to false so we can assume values later one
active = false;
@@ -1053,14 +950,12 @@ PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &acti
}
}
-int
-PluginAdapter::WorkspaceCount() const
+int PluginAdapter::WorkspaceCount() const
{
return m_Screen->vpSize().width() * m_Screen->vpSize().height();
}
-void
-PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
+void PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
{
Display* display = m_Screen->dpy();
Atom hints_atom = None;
@@ -1111,19 +1006,17 @@ PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
XFree(data);
}
-void
-PluginAdapter::Decorate(guint32 xid)
+void PluginAdapter::Decorate(Window window_id)
{
MotifWmHints hints = { 0 };
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = GDK_DECOR_ALL & ~(MWM_HINTS_UNDECORATED_UNITY);
- SetMwmWindowHints(xid, &hints);
+ SetMwmWindowHints(window_id, &hints);
}
-void
-PluginAdapter::Undecorate(guint32 xid)
+void PluginAdapter::Undecorate(Window window_id)
{
MotifWmHints hints = { 0 };
@@ -1133,17 +1026,15 @@ PluginAdapter::Undecorate(guint32 xid)
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = MWM_HINTS_UNDECORATED_UNITY;
- SetMwmWindowHints(xid, &hints);
+ SetMwmWindowHints(window_id, &hints);
}
-bool
-PluginAdapter::IsScreenGrabbed() const
+bool PluginAdapter::IsScreenGrabbed() const
{
return m_Screen->grabbed();
}
-bool
-PluginAdapter::IsViewPortSwitchStarted() const
+bool PluginAdapter::IsViewPortSwitchStarted() const
{
return _vp_switch_started;
}
@@ -1208,8 +1099,7 @@ bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) const
return true;
}
-void
-PluginAdapter::ShowGrabHandles(CompWindow* window, bool use_timer)
+void PluginAdapter::ShowGrabHandles(CompWindow* window, bool use_timer)
{
if (!_grab_show_action || !window)
return;
@@ -1226,8 +1116,7 @@ PluginAdapter::ShowGrabHandles(CompWindow* window, bool use_timer)
_grab_show_action->initiate()(_grab_show_action, 0, argument);
}
-void
-PluginAdapter::HideGrabHandles(CompWindow* window)
+void PluginAdapter::HideGrabHandles(CompWindow* window)
{
if (!_grab_hide_action || !window)
return;
@@ -1242,8 +1131,7 @@ PluginAdapter::HideGrabHandles(CompWindow* window)
_grab_hide_action->initiate()(_grab_hide_action, 0, argument);
}
-void
-PluginAdapter::ToggleGrabHandles(CompWindow* window)
+void PluginAdapter::ToggleGrabHandles(CompWindow* window)
{
if (!_grab_toggle_action || !window)
return;
@@ -1258,14 +1146,12 @@ PluginAdapter::ToggleGrabHandles(CompWindow* window)
_grab_toggle_action->initiate()(_grab_toggle_action, 0, argument);
}
-void
-PluginAdapter::SetCoverageAreaBeforeAutomaximize(float area)
+void PluginAdapter::SetCoverageAreaBeforeAutomaximize(float area)
{
_coverage_area_before_automaximize = area;
}
-bool
-PluginAdapter::saveInputFocus()
+bool PluginAdapter::SaveInputFocus()
{
Window active = m_Screen->activeWindow ();
CompWindow* cw = m_Screen->findWindow (active);
@@ -1279,8 +1165,7 @@ PluginAdapter::saveInputFocus()
return false;
}
-bool
-PluginAdapter::restoreInputFocus()
+bool PluginAdapter::RestoreInputFocus()
{
if (_last_focused_window)
{
@@ -1297,11 +1182,10 @@ PluginAdapter::restoreInputFocus()
return false;
}
-void
-PluginAdapter::MoveResizeWindow(guint32 xid, nux::Geometry geometry)
+void PluginAdapter::MoveResizeWindow(Window window_id, nux::Geometry geometry)
{
int w, h;
- CompWindow* window = m_Screen->findWindow(xid);
+ CompWindow* window = m_Screen->findWindow(window_id);
if (!window)
return;
@@ -1333,15 +1217,13 @@ PluginAdapter::MoveResizeWindow(guint32 xid, nux::Geometry geometry)
window->configureXWindow(CWX | CWY | CWWidth | CWHeight, &xwc);
}
-void
-PluginAdapter::OnWindowClosed(CompWindow *w)
+void PluginAdapter::OnWindowClosed(CompWindow *w)
{
if (_last_focused_window == w)
_last_focused_window = NULL;
}
-void
-PluginAdapter::AddProperties(GVariantBuilder* builder)
+void PluginAdapter::AddProperties(GVariantBuilder* builder)
{
unity::variant::BuilderWrapper wrapper(builder);
wrapper.add(GetScreenGeometry())
@@ -1355,28 +1237,26 @@ PluginAdapter::AddProperties(GVariantBuilder* builder)
.add("showdesktop_active", _in_show_desktop);
}
-std::string
-PluginAdapter::GetWindowName(guint32 xid) const
+std::string PluginAdapter::GetWindowName(Window window_id) const
{
std::string name;
Atom visibleNameAtom;
visibleNameAtom = XInternAtom(m_Screen->dpy(), "_NET_WM_VISIBLE_NAME", 0);
- name = GetUtf8Property(xid, visibleNameAtom);
+ name = GetUtf8Property(window_id, visibleNameAtom);
if (name.empty())
{
Atom wmNameAtom = XInternAtom(m_Screen->dpy(), "_NET_WM_NAME", 0);
- name = GetUtf8Property(xid, wmNameAtom);
+ name = GetUtf8Property(window_id, wmNameAtom);
}
if (name.empty())
- name = GetTextProperty(xid, XA_WM_NAME);
+ name = GetTextProperty(window_id, XA_WM_NAME);
return name;
}
-std::string
-PluginAdapter::GetUtf8Property(guint32 xid, Atom atom) const
+std::string PluginAdapter::GetUtf8Property(Window window_id, Atom atom) const
{
Atom type;
int result, format;
@@ -1386,7 +1266,7 @@ PluginAdapter::GetUtf8Property(guint32 xid, Atom atom) const
Atom utf8StringAtom;
utf8StringAtom = XInternAtom(m_Screen->dpy(), "UTF8_STRING", 0);
- result = XGetWindowProperty(m_Screen->dpy(), xid, atom, 0L, 65536, False,
+ result = XGetWindowProperty(m_Screen->dpy(), window_id, atom, 0L, 65536, False,
utf8StringAtom, &type, &format, &nItems,
&bytesAfter, reinterpret_cast<unsigned char **>(&val));
@@ -1403,21 +1283,22 @@ PluginAdapter::GetUtf8Property(guint32 xid, Atom atom) const
return retval;
}
-std::string
-PluginAdapter::GetTextProperty(guint32 id, Atom atom) const
+std::string PluginAdapter::GetTextProperty(Window window_id, Atom atom) const
{
XTextProperty text;
std::string retval;
text.nitems = 0;
- if (XGetTextProperty(m_Screen->dpy(), id, &text, atom))
+ if (XGetTextProperty(m_Screen->dpy(), window_id, &text, atom))
{
if (text.value)
{
retval = std::string(reinterpret_cast<char*>(text.value), text.nitems);
- XFree (text.value);
+ XFree(text.value);
}
}
return retval;
}
+
+}
diff --git a/unity-shared/PluginAdapter.h b/unity-shared/PluginAdapter.h
index 06ce7ef33..8f09bf3f7 100644
--- a/unity-shared/PluginAdapter.h
+++ b/unity-shared/PluginAdapter.h
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -17,16 +17,19 @@
* Authored by: Jason Smith <jason.smith@canonical.com>
*/
-#ifndef PLUGINADAPTER_H
-#define PLUGINADAPTER_H
+#ifndef UNITYSHARED_PLUGINADAPTER_H
+#define UNITYSHARED_PLUGINADAPTER_H
/* Compiz */
#include <core/core.h>
#include <core/atoms.h>
-#include <sigc++/sigc++.h>
+#include <NuxCore/Property.h>
-#include "WindowManager.h"
+#include "XWindowManager.h"
+
+namespace unity
+{
typedef struct
{
@@ -60,11 +63,12 @@ private:
};
-class PluginAdapter : public sigc::trackable, public WindowManager
+class PluginAdapter : public sigc::trackable, public XWindowManager
{
public:
- static PluginAdapter* Default();
-
+ // You shouldn't get the PluginAdapter if you really want a WindowManager.
+ // The PluginAdapter::Default should really only be called from within unityshell plugin.
+ static PluginAdapter& Default();
static void Initialize(CompScreen* screen);
nux::Property<bool> bias_active_to_viewport;
@@ -113,54 +117,56 @@ public:
void NotifyResized(CompWindow* window, int x, int y, int w, int h);
void NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state);
void NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option);
- void NotifyNewDecorationState(guint32 xid);
+ void NotifyNewDecorationState(Window xid);
- guint32 GetActiveWindow() const;
+ Window GetActiveWindow() const;
- void Decorate(guint32 xid);
- void Undecorate(guint32 xid);
+ void Decorate(Window xid);
+ void Undecorate(Window xid);
// WindowManager implementation
- bool IsWindowMaximized(guint xid) const;
- bool IsWindowDecorated(guint xid);
- bool IsWindowOnCurrentDesktop(guint xid) const;
- bool IsWindowObscured(guint xid) const;
- bool IsWindowMapped(guint xid) const;
- bool IsWindowVisible(guint32 xid) const;
- bool IsWindowOnTop(guint32 xid) const;
- bool IsWindowClosable(guint32 xid) const;
- bool IsWindowMinimizable(guint32 xid) const;
- bool IsWindowMaximizable(guint32 xid) const;
-
- void Restore(guint32 xid);
- void RestoreAt(guint32 xid, int x, int y);
- void Minimize(guint32 xid);
- void Close(guint32 xid);
- void Activate(guint32 xid);
- void Raise(guint32 xid);
- void Lower(guint32 xid);
+ bool IsWindowMaximized(Window window_id) const;
+ bool IsWindowDecorated(Window window_id) const;
+ bool IsWindowOnCurrentDesktop(Window window_id) const;
+ bool IsWindowObscured(Window window_id) const;
+ bool IsWindowMapped(Window window_id) const;
+ bool IsWindowVisible(Window window_id) const;
+ bool IsWindowOnTop(Window window_id) const;
+ bool IsWindowClosable(Window window_id) const;
+ bool IsWindowMinimizable(Window window_id) const;
+ bool IsWindowMaximizable(Window window_id) const;
+
+ void Restore(Window window_id);
+ void RestoreAt(Window window_id, int x, int y);
+ void Minimize(Window window_id);
+ void Close(Window window_id);
+ void Activate(Window window_id);
+ void Raise(Window window_id);
+ void Lower(Window window_id);
void ShowDesktop();
bool InShowDesktop() const;
void SetWindowIconGeometry(Window window, nux::Geometry const& geo);
- void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1, bool only_top_win = true);
- bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);
+ void FocusWindowGroup(std::vector<Window> const& windows,
+ FocusVisibility, int monitor = -1, bool only_top_win = true);
+ bool ScaleWindowGroup(std::vector<Window> const& windows,
+ int state, bool force);
bool IsScreenGrabbed() const;
bool IsViewPortSwitchStarted() const;
- unsigned long long GetWindowActiveNumber (guint32 xid) const;
+ unsigned long long GetWindowActiveNumber(Window window_id) const;
bool MaximizeIfBigEnough(CompWindow* window) const;
- int GetWindowMonitor(guint32 xid) const;
- nux::Geometry GetWindowGeometry(guint32 xid) const;
- nux::Geometry GetWindowSavedGeometry(guint32 xid) const;
+ int GetWindowMonitor(Window window_id) const;
+ nux::Geometry GetWindowGeometry(Window window_id) const;
+ nux::Geometry GetWindowSavedGeometry(Window window_id) const;
nux::Geometry GetScreenGeometry() const;
- nux::Geometry GetWorkAreaGeometry(guint32 xid = 0) const;
- std::string GetWindowName(guint32 xid) const;
+ nux::Geometry GetWorkAreaGeometry(Window window_id = 0) const;
+ std::string GetWindowName(Window window_id) const;
void CheckWindowIntersections(nux::Geometry const& region, bool &active, bool &any);
@@ -168,10 +174,10 @@ public:
void SetCoverageAreaBeforeAutomaximize(float area);
- bool saveInputFocus ();
- bool restoreInputFocus ();
+ bool SaveInputFocus();
+ bool RestoreInputFocus();
- void MoveResizeWindow(guint32 xid, nux::Geometry geometry);
+ void MoveResizeWindow(Window window_id, nux::Geometry geometry);
protected:
PluginAdapter(CompScreen* screen);
@@ -186,8 +192,8 @@ private:
Window GetTopMostValidWindowInViewport() const;
- std::string GetTextProperty(guint32 xid, Atom atom) const;
- std::string GetUtf8Property(guint32 xid, Atom atom) const;
+ std::string GetTextProperty(Window xid, Atom atom) const;
+ std::string GetUtf8Property(Window xid, Atom atom) const;
CompScreen* m_Screen;
MultiActionList m_ExpoActionList;
@@ -207,9 +213,9 @@ private:
bool _in_show_desktop;
CompWindow* _last_focused_window;
- std::map<guint32, unsigned int> _window_decoration_state;
-
- static PluginAdapter* _default;
+ std::map<Window, unsigned int> _window_decoration_state;
};
+}
+
#endif
diff --git a/unity-shared/PluginAdapterStandalone.cpp b/unity-shared/PluginAdapterStandalone.cpp
deleted file mode 100644
index b457c57d6..000000000
--- a/unity-shared/PluginAdapterStandalone.cpp
+++ /dev/null
@@ -1,491 +0,0 @@
-// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
-/*
- * Copyright (C) 2010 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by: Jason Smith <jason.smith@canonical.com>
- */
-
-#include <glib.h>
-#include <sstream>
-#include "PluginAdapter.h"
-#include "UScreen.h"
-
-#include <NuxCore/Logger.h>
-#include <UnityCore/Variant.h>
-
-//FIXME!! Entirely stubs for now, unless we need this functionality at some point
-
-namespace
-{
-nux::logging::Logger logger("unity.plugin");
-}
-
-PluginAdapter* PluginAdapter::_default = 0;
-
-/* static */
-PluginAdapter*
-PluginAdapter::Default()
-{
- if (!_default)
- return 0;
- return _default;
-}
-
-/* static */
-void
-PluginAdapter::Initialize(CompScreen* screen)
-{
- _default = new PluginAdapter(screen);
-}
-
-PluginAdapter::PluginAdapter(CompScreen* screen)
- : m_Screen(screen)
- , _expo_state(false)
- , _in_show_desktop(false)
- , _last_focused_window(nullptr)
-{
-}
-
-PluginAdapter::~PluginAdapter()
-{
-}
-
-/* A No-op for now, but could be useful later */
-void
-PluginAdapter::OnScreenGrabbed()
-{
-}
-
-void
-PluginAdapter::OnScreenUngrabbed()
-{
-}
-
-void
-PluginAdapter::NotifyResized(CompWindow* window, int x, int y, int w, int h)
-{
-}
-
-void
-PluginAdapter::NotifyMoved(CompWindow* window, int x, int y)
-{
-}
-
-void
-PluginAdapter::NotifyStateChange(CompWindow* window, unsigned int state, unsigned int last_state)
-{
-}
-
-void
-PluginAdapter::NotifyNewDecorationState(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
-{
-}
-
-void
-PluginAdapter::NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option)
-{
-}
-
-void
-MultiActionList::AddNewAction(std::string const& n, CompAction* a, bool primary)
-{
-}
-
-void
-MultiActionList::RemoveAction(std::string const& n)
-{
-}
-
-void
-MultiActionList::InitiateAll(CompOption::Vector const& extraArgs, int state) const
-{
-}
-
-void
-MultiActionList::TerminateAll(CompOption::Vector const& extraArgs) const
-{
-}
-
-bool
-MultiActionList::HasPrimary() const
-{
- return false;
-}
-
-CompAction*
-MultiActionList::GetAction(std::string const& name) const
-{
- return nullptr;
-}
-
-
-unsigned long long
-PluginAdapter::GetWindowActiveNumber (guint32 xid) const
-{
- return 0;
-}
-
-void
-PluginAdapter::SetExpoAction(MultiActionList& expo)
-{
-}
-
-void
-PluginAdapter::SetScaleAction(MultiActionList& scale)
-{
-}
-
-std::string
-PluginAdapter::MatchStringForXids(std::vector<Window> const& windows)
-{
- return "";
-}
-
-void
-PluginAdapter::InitiateScale(std::string const& match, int state)
-{
-}
-
-void
-PluginAdapter::TerminateScale()
-{
-}
-
-bool
-PluginAdapter::IsScaleActive() const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsScaleActiveForGroup() const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsExpoActive() const
-{
- return _expo_state;
-}
-
-void
-PluginAdapter::InitiateExpo()
-{
- _expo_state = true;
-}
-
-void
-PluginAdapter::TerminateExpo()
-{
- _expo_state = false;
-}
-
-bool
-PluginAdapter::IsWallActive() const
-{
- return false;
-}
-
-// WindowManager implementation
-guint32
-PluginAdapter::GetActiveWindow() const
-{
- return 0;
-}
-
-bool
-PluginAdapter::IsWindowMaximized(guint xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowDecorated(guint32 xid)
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowObscured(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowMapped(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowVisible(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowOnTop(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowClosable(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowMinimizable(guint32 xid) const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsWindowMaximizable(guint32 xid) const
-{
- return false;
-}
-
-void
-PluginAdapter::Restore(guint32 xid)
-{
-}
-
-void
-PluginAdapter::RestoreAt(guint32 xid, int x, int y)
-{
-}
-
-void
-PluginAdapter::Minimize(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Close(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Activate(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Raise(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Lower(guint32 xid)
-{
-}
-
-void
-PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor, bool only_top_win)
-{
-}
-
-bool
-PluginAdapter::ScaleWindowGroup(std::vector<Window> windows, int state, bool force)
-{
- return false;
-}
-
-void
-PluginAdapter::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
-{
-}
-
-void
-PluginAdapter::ShowDesktop()
-{
- _in_show_desktop = !_in_show_desktop;
-}
-
-bool PluginAdapter::InShowDesktop() const
-{
- return _in_show_desktop;
-}
-
-void
-PluginAdapter::OnShowDesktop()
-{
-}
-
-void
-PluginAdapter::OnLeaveDesktop()
-{
-}
-
-int
-PluginAdapter::GetWindowMonitor(guint32 xid) const
-{
- return -1;
-}
-
-nux::Geometry
-PluginAdapter::GetWindowGeometry(guint32 xid) const
-{
- nux::Geometry geo(0, 0, 1, 1);
- return geo;
-}
-
-nux::Geometry
-PluginAdapter::GetWindowSavedGeometry(guint32 xid) const
-{
- nux::Geometry geo(0, 0, 1, 1);
- return geo;
-}
-
-nux::Geometry
-PluginAdapter::GetScreenGeometry() const
-{
- nux::Geometry geo(0, 0, 1, 1);
- return geo;
-}
-
-nux::Geometry
-PluginAdapter::GetWorkAreaGeometry(guint32 xid) const
-{
- nux::Geometry geo(0, 0, 1, 1);
- return geo;
-}
-
-bool
-PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const
-{
- return false;
-}
-
-void
-PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any)
-{
-}
-
-int
-PluginAdapter::WorkspaceCount() const
-{
- return 4;
-}
-
-void
-PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
-{
-}
-
-void
-PluginAdapter::Decorate(guint32 xid)
-{
-}
-
-void
-PluginAdapter::Undecorate(guint32 xid)
-{
-}
-
-bool
-PluginAdapter::IsScreenGrabbed() const
-{
- return false;
-}
-
-bool
-PluginAdapter::IsViewPortSwitchStarted() const
-{
- return false;
-}
-
-/* Returns true if the window was maximized */
-bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) const
-{
- return true;
-}
-
-void
-PluginAdapter::ShowGrabHandles(CompWindow* window, bool use_timer)
-{
-}
-
-void
-PluginAdapter::HideGrabHandles(CompWindow* window)
-{
-}
-
-void
-PluginAdapter::ToggleGrabHandles(CompWindow* window)
-{
-}
-
-void
-PluginAdapter::SetCoverageAreaBeforeAutomaximize(float area)
-{
-}
-
-bool
-PluginAdapter::saveInputFocus()
-{
- return false;
-}
-
-bool
-PluginAdapter::restoreInputFocus()
-{
- return false;
-}
-
-void
-PluginAdapter::MoveResizeWindow(guint32 xid, nux::Geometry geometry)
-{
-}
-
-void
-PluginAdapter::OnWindowClosed(CompWindow *w)
-{
-}
-
-void
-PluginAdapter::AddProperties(GVariantBuilder* builder)
-{
- unity::variant::BuilderWrapper wrapper(builder);
- wrapper.add(GetScreenGeometry())
- .add("workspace_count", WorkspaceCount())
- .add("active_window", GetActiveWindow())
- .add("screen_grabbed", IsScreenGrabbed())
- .add("scale_active", IsScaleActive())
- .add("scale_active_for_group", IsScaleActiveForGroup())
- .add("expo_active", IsExpoActive())
- .add("viewport_switch_running", IsViewPortSwitchStarted())
- .add("showdesktop_active", _in_show_desktop);
-}
-
-std::string
-PluginAdapter::GetWindowName(guint32 xid) const
-{
- return "";
-}
diff --git a/unity-shared/StandaloneWindowManager.cpp b/unity-shared/StandaloneWindowManager.cpp
new file mode 100644
index 000000000..bc3902c25
--- /dev/null
+++ b/unity-shared/StandaloneWindowManager.cpp
@@ -0,0 +1,274 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010-2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ * Tim Penhey <tim.penhey@canonical.com>
+ */
+
+#include <glib.h>
+#include <sstream>
+#include "StandaloneWindowManager.h"
+#include "UScreen.h"
+
+#include <NuxCore/Logger.h>
+#include <UnityCore/Variant.h>
+
+// Entirely stubs for now, unless we need this functionality at some point
+
+namespace unity
+{
+
+namespace
+{
+nux::logging::Logger logger("unity.wm");
+}
+
+WindowManagerPtr create_window_manager()
+{
+ return WindowManagerPtr(new StandaloneWindowManager);
+}
+
+StandaloneWindowManager::StandaloneWindowManager()
+ : expo_state_(false)
+ , in_show_desktop_(false)
+{
+}
+
+Window StandaloneWindowManager::GetActiveWindow() const
+{
+ return 0;
+}
+
+bool StandaloneWindowManager::IsWindowMaximized(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowDecorated(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowOnCurrentDesktop(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowObscured(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowMapped(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowVisible(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowOnTop(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowClosable(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowMinimizable(Window window_id) const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsWindowMaximizable(Window window_id) const
+{
+ return false;
+}
+
+void StandaloneWindowManager::ShowDesktop()
+{
+ in_show_desktop_ = !in_show_desktop_;
+}
+
+bool StandaloneWindowManager::InShowDesktop() const
+{
+ return in_show_desktop_;
+}
+
+void StandaloneWindowManager::Restore(Window window_id)
+{}
+
+void StandaloneWindowManager::RestoreAt(Window window_id, int x, int y)
+{}
+
+void StandaloneWindowManager::Minimize(Window window_id)
+{}
+
+void StandaloneWindowManager::Close(Window window_id)
+{}
+
+void StandaloneWindowManager::Activate(Window window_id)
+{}
+
+void StandaloneWindowManager::Raise(Window window_id)
+{}
+
+void StandaloneWindowManager::Lower(Window window_id)
+{}
+
+void StandaloneWindowManager::TerminateScale()
+{}
+
+bool StandaloneWindowManager::IsScaleActive() const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsScaleActiveForGroup() const
+{
+ return false;
+}
+
+void StandaloneWindowManager::InitiateExpo()
+{
+ expo_state_ = !expo_state_;
+}
+
+void StandaloneWindowManager::TerminateExpo()
+{
+ expo_state_ = false;
+}
+
+bool StandaloneWindowManager::IsExpoActive() const
+{
+ return expo_state_;
+}
+
+bool StandaloneWindowManager::IsWallActive() const
+{
+ return false;
+}
+
+void StandaloneWindowManager::FocusWindowGroup(std::vector<Window> const& windows,
+ FocusVisibility,
+ int monitor,
+ bool only_top_win)
+{}
+
+bool StandaloneWindowManager::ScaleWindowGroup(std::vector<Window> const& windows,
+ int state, bool force)
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsScreenGrabbed() const
+{
+ return false;
+}
+
+bool StandaloneWindowManager::IsViewPortSwitchStarted() const
+{
+ return false;
+}
+
+void StandaloneWindowManager::MoveResizeWindow(Window window_id, nux::Geometry geometry)
+{}
+
+void StandaloneWindowManager::StartMove(Window window_id, int x, int y)
+{}
+
+int StandaloneWindowManager::GetWindowMonitor(Window window_id) const
+{
+ return -1;
+}
+
+nux::Geometry StandaloneWindowManager::GetWindowGeometry(Window window_id) const
+{
+ nux::Geometry geo(0, 0, 1, 1);
+ return geo;
+}
+
+nux::Geometry StandaloneWindowManager::GetWindowSavedGeometry(Window window_id) const
+{
+ nux::Geometry geo(0, 0, 1, 1);
+ return geo;
+}
+
+nux::Geometry StandaloneWindowManager::GetScreenGeometry() const
+{
+ nux::Geometry geo(0, 0, 1, 1);
+ return geo;
+}
+
+nux::Geometry StandaloneWindowManager::GetWorkAreaGeometry(Window window_id) const
+{
+ nux::Geometry geo(0, 0, 1, 1);
+ return geo;
+}
+
+unsigned long long StandaloneWindowManager::GetWindowActiveNumber(Window window_id) const
+{
+ return 0;
+}
+
+void StandaloneWindowManager::SetWindowIconGeometry(Window window, nux::Geometry const& geo)
+{
+}
+
+void StandaloneWindowManager::CheckWindowIntersections(nux::Geometry const& region,
+ bool &active, bool &any)
+{
+}
+
+int StandaloneWindowManager::WorkspaceCount() const
+{
+ return 4;
+}
+
+bool StandaloneWindowManager::SaveInputFocus()
+{
+ return false;
+}
+
+bool StandaloneWindowManager::RestoreInputFocus()
+{
+ return false;
+}
+
+std::string StandaloneWindowManager::GetWindowName(Window window_id) const
+{
+ return "";
+}
+
+void StandaloneWindowManager::AddProperties(GVariantBuilder* builder)
+{
+ unity::variant::BuilderWrapper wrapper(builder);
+ wrapper.add(GetScreenGeometry())
+ .add("workspace_count", WorkspaceCount())
+ .add("active_window", GetActiveWindow())
+ .add("screen_grabbed", IsScreenGrabbed())
+ .add("scale_active", IsScaleActive())
+ .add("scale_active_for_group", IsScaleActiveForGroup())
+ .add("expo_active", IsExpoActive())
+ .add("viewport_switch_running", IsViewPortSwitchStarted())
+ .add("showdesktop_active", in_show_desktop_);
+}
+
+} // namespace unity
diff --git a/unity-shared/StandaloneWindowManager.h b/unity-shared/StandaloneWindowManager.h
new file mode 100644
index 000000000..636e3c580
--- /dev/null
+++ b/unity-shared/StandaloneWindowManager.h
@@ -0,0 +1,108 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Tim Penhey <tim.penhey@canonical.com>
+ */
+
+#ifndef UNITYSHARED_STANDALONE_WINDOW_MANAGER_H
+#define UNITYSHARED_STANDALONE_WINDOW_MANAGER_H
+
+#include "unity-shared/WindowManager.h"
+
+namespace unity
+{
+
+class StandaloneWindowManager : public WindowManager
+{
+public:
+ StandaloneWindowManager();
+
+ virtual Window GetActiveWindow() const;
+
+ virtual bool IsWindowMaximized(Window window_id) const;
+ virtual bool IsWindowDecorated(Window window_id) const;
+ virtual bool IsWindowOnCurrentDesktop(Window window_id) const;
+ virtual bool IsWindowObscured(Window window_id) const;
+ virtual bool IsWindowMapped(Window window_id) const;
+ virtual bool IsWindowVisible(Window window_id) const;
+ virtual bool IsWindowOnTop(Window window_id) const;
+ virtual bool IsWindowClosable(Window window_id) const;
+ virtual bool IsWindowMinimizable(Window window_id) const;
+ virtual bool IsWindowMaximizable(Window window_id) const;
+
+ virtual void ShowDesktop();
+ virtual bool InShowDesktop() const;
+
+ virtual void Restore(Window window_id);
+ virtual void RestoreAt(Window window_id, int x, int y);
+ virtual void Minimize(Window window_id);
+ virtual void Close(Window window_id);
+
+ virtual void Activate(Window window_id);
+ virtual void Raise(Window window_id);
+ virtual void Lower(Window window_id);
+
+ virtual void TerminateScale();
+ virtual bool IsScaleActive() const;
+ virtual bool IsScaleActiveForGroup() const;
+
+ virtual void InitiateExpo();
+ virtual void TerminateExpo();
+ virtual bool IsExpoActive() const;
+
+ virtual bool IsWallActive() const;
+
+ virtual void FocusWindowGroup(std::vector<Window> const& windows,
+ FocusVisibility, int monitor = -1, bool only_top_win = true);
+ virtual bool ScaleWindowGroup(std::vector<Window> const& windows,
+ int state, bool force);
+
+ virtual bool IsScreenGrabbed() const;
+ virtual bool IsViewPortSwitchStarted() const;
+
+ virtual void MoveResizeWindow(Window window_id, nux::Geometry geometry);
+ virtual void StartMove(Window window_id, int x, int y);
+
+ virtual int GetWindowMonitor(Window window_id) const;
+ virtual nux::Geometry GetWindowGeometry(Window window_id) const;
+ virtual nux::Geometry GetWindowSavedGeometry(Window window_id) const;
+ virtual nux::Geometry GetScreenGeometry() const;
+ virtual nux::Geometry GetWorkAreaGeometry(Window window_id) const;
+
+ virtual unsigned long long GetWindowActiveNumber(Window window_id) const;
+
+ virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo);
+
+ virtual void CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any);
+
+ virtual int WorkspaceCount() const;
+
+ virtual bool SaveInputFocus();
+ virtual bool RestoreInputFocus();
+
+ virtual std::string GetWindowName(Window window_id) const;
+
+protected:
+ virtual void AddProperties(GVariantBuilder* builder);
+
+private:
+ bool expo_state_;
+ bool in_show_desktop_;
+};
+
+}
+
+#endif // UNITYSHARED_WINDOW_MANAGER_H
diff --git a/unity-shared/StaticCairoText.cpp b/unity-shared/StaticCairoText.cpp
index 33cea145c..6a036f65f 100644
--- a/unity-shared/StaticCairoText.cpp
+++ b/unity-shared/StaticCairoText.cpp
@@ -32,10 +32,6 @@
#include <pango/pango.h>
#include <pango/pangocairo.h>
-#if defined(NUX_OS_LINUX)
-#include <X11/Xlib.h>
-#endif
-
#include <UnityCore/GLibWrapper.h>
#include "CairoTexture.h"
diff --git a/unity-shared/WindowManager.cpp b/unity-shared/WindowManager.cpp
index dc09eeeff..a0bdc3f1a 100644
--- a/unity-shared/WindowManager.cpp
+++ b/unity-shared/WindowManager.cpp
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -17,269 +17,16 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
-#include "WindowManager.h"
+#include "XWindowManager.h"
-static WindowManager* window_manager = NULL;
-class WindowManagerDummy : public WindowManager
+unity::XWindowManager::XWindowManager()
+ : move_resize_atom_(XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
+ "_NET_WM_MOVERESIZE", FALSE))
{
- guint32 GetActiveWindow() const
- {
- return 0;
- }
-
- unsigned long long GetWindowActiveNumber (guint32 xid) const
- {
- return 0;
- }
-
- bool IsScreenGrabbed() const
- {
- return false;
- }
-
- bool IsViewPortSwitchStarted() const
- {
- return false;
- }
-
- void ShowDesktop()
- {
- g_debug("%s", G_STRFUNC);
- }
-
- bool InShowDesktop() const
- {
- return false;
- }
-
- bool IsWindowMaximized(guint32 xid) const
- {
- return false;
- }
-
- bool IsWindowDecorated(guint32 xid)
- {
- return true;
- }
-
- bool IsWindowOnCurrentDesktop(guint32 xid) const
- {
- return true;
- }
-
- bool IsWindowObscured(guint32 xid) const
- {
- return false;
- }
-
- bool IsWindowMapped(guint32 xid) const
- {
- return true;
- }
-
- bool IsWindowVisible(guint32 xid) const
- {
- return true;
- }
-
- bool IsWindowOnTop(guint32 xid) const
- {
- return false;
- }
-
- bool IsWindowClosable(guint32 xid) const
- {
- return true;
- }
-
- bool IsWindowMinimizable(guint32 xid) const
- {
- return true;
- }
-
- bool IsWindowMaximizable(guint32 xid) const
- {
- return true;
- }
-
- void Restore(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void RestoreAt(guint32 xid, int x, int y)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void Minimize(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void Close(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void Activate(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void Raise(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void Lower(guint32 xid)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor, bool only_top_win)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force)
- {
- g_debug("%s", G_STRFUNC);
- return false;
- }
-
- int GetWindowMonitor(guint32 xid) const
- {
- return -1;
- }
-
- nux::Geometry GetWindowGeometry(guint xid) const
- {
- int width = (guint32)xid >> 16;
- int height = (guint32)xid & 0x0000FFFF;
- return nux::Geometry(0, 0, width, height);
- }
-
- nux::Geometry GetWindowSavedGeometry(guint xid) const
- {
- return nux::Geometry(0, 0, 1, 1);
- }
-
- nux::Geometry GetScreenGeometry() const
- {
- return nux::Geometry(0, 0, 1, 1);
- }
-
- nux::Geometry GetWorkAreaGeometry(guint32 xid) const
- {
- return nux::Geometry(0, 0, 1, 1);
- }
-
- void SetWindowIconGeometry(Window window, nux::Geometry const& geo)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any)
- {
- active = false;
- any = false;
- }
-
- int WorkspaceCount () const
- {
- return 1;
- }
-
- void TerminateScale()
- {
- g_debug("%s", G_STRFUNC);
- }
-
- bool IsScaleActive() const
- {
- g_debug("%s", G_STRFUNC);
- return false;
- }
-
- bool IsScaleActiveForGroup() const
- {
- g_debug("%s", G_STRFUNC);
- return false;
- }
-
- void InitiateExpo()
- {
- g_debug("%s", G_STRFUNC);
- }
-
- void TerminateExpo()
- {
- g_debug("%s", G_STRFUNC);
- }
-
- bool IsExpoActive() const
- {
- g_debug("%s", G_STRFUNC);
- return false;
- }
-
- bool IsWallActive() const
- {
- g_debug("%s", G_STRFUNC);
- return false;
- }
-
- void MoveResizeWindow(guint32 xid, nux::Geometry geometry)
- {
- g_debug("%s", G_STRFUNC);
- }
-
- bool saveInputFocus()
- {
- return false;
- }
-
- bool restoreInputFocus()
- {
- return false;
- }
-
-
- void AddProperties(GVariantBuilder* builder)
- {
- }
-
- std::string GetWindowName(guint32 xid) const
- {
- return "unknown";
- }
-};
-
-WindowManager*
-WindowManager::Default()
-{
- if (!window_manager)
- window_manager = new WindowManagerDummy();
-
- return window_manager;
-}
-
-void
-WindowManager::SetDefault(WindowManager* manager)
-{
- window_manager = manager;
-}
-
-std::string WindowManager::GetName() const
-{
- return "WindowManager";
}
-#define NET_WM_MOVERESIZE_MOVE 8
-
-void WindowManager::StartMove(guint32 xid, int x, int y)
+void unity::XWindowManager::StartMove(Window window_id, int x, int y)
{
if (x < 0 || y < 0)
return;
@@ -319,10 +66,12 @@ void WindowManager::StartMove(guint32 xid, int x, int y)
ev.xclient.serial = 0;
ev.xclient.send_event = true;
- ev.xclient.window = xid;
- ev.xclient.message_type = m_MoveResizeAtom;
+ ev.xclient.window = window_id;
+ ev.xclient.message_type = move_resize_atom_;
ev.xclient.format = 32;
+ const long NET_WM_MOVERESIZE_MOVE = 8;
+
ev.xclient.data.l[0] = x; // x_root
ev.xclient.data.l[1] = y; // y_root
ev.xclient.data.l[2] = NET_WM_MOVERESIZE_MOVE; //direction
diff --git a/unity-shared/WindowManager.h b/unity-shared/WindowManager.h
index f014cd19c..6c2f54bab 100644
--- a/unity-shared/WindowManager.h
+++ b/unity-shared/WindowManager.h
@@ -1,5 +1,6 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -16,141 +17,29 @@
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
*/
-#ifndef WINDOW_MANAGER_H
-#define WINDOW_MANAGER_H
+#ifndef UNITYSHARED_XWINDOW_MANAGER_H
+#define UNITYSHARED_XWINDOW_MANAGER_H
#include <Nux/Nux.h>
#include <gdk/gdkx.h>
#include <core/core.h>
-#include "unity-shared/Introspectable.h"
+#include "unity-shared/WindowManager.h"
-class WindowManager : public unity::debug::Introspectable
+namespace unity
{
- // This is a glue interface that breaks the dependancy of Unity with Compiz
- // Basically it has a default implementation that does nothing useful, but
- // the idea is that unity.cpp uses SetDefault() early enough in it's
- // initialization so the things that require it get a usable implementation
+class XWindowManager : public WindowManager
+{
public:
- WindowManager() :
- m_MoveResizeAtom(XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
- "_NET_WM_MOVERESIZE", FALSE))
- {
- };
-
- enum class FocusVisibility
- {
- OnlyVisible,
- ForceUnminimizeInvisible,
- ForceUnminimizeOnCurrentDesktop
- };
-
- static WindowManager* Default();
- static void SetDefault(WindowManager* manager);
-
- virtual guint32 GetActiveWindow() const = 0;
-
- virtual bool IsWindowMaximized(guint32 xid) const = 0;
- virtual bool IsWindowDecorated(guint32 xid) = 0;
- virtual bool IsWindowOnCurrentDesktop(guint32 xid) const = 0;
- virtual bool IsWindowObscured(guint32 xid) const = 0;
- virtual bool IsWindowMapped(guint32 xid) const = 0;
- virtual bool IsWindowVisible(guint32 xid) const = 0;
- virtual bool IsWindowOnTop(guint32 xid) const = 0;
- virtual bool IsWindowClosable(guint32 xid) const = 0;
- virtual bool IsWindowMinimizable(guint32 xid) const = 0;
- virtual bool IsWindowMaximizable(guint32 xid) const = 0;
-
- virtual void ShowDesktop() = 0;
- virtual bool InShowDesktop() const = 0;
-
- virtual void Restore(guint32 xid) = 0;
- virtual void RestoreAt(guint32 xid, int x, int y) = 0;
- virtual void Minimize(guint32 xid) = 0;
- virtual void Close(guint32 xid) = 0;
-
- virtual void Activate(guint32 xid) = 0;
- virtual void Raise(guint32 xid) = 0;
- virtual void Lower(guint32 xid) = 0;
-
- virtual void TerminateScale() = 0;
- virtual bool IsScaleActive() const = 0;
- virtual bool IsScaleActiveForGroup() const = 0;
-
- virtual void InitiateExpo() = 0;
- virtual void TerminateExpo() = 0;
- virtual bool IsExpoActive() const = 0;
-
- virtual bool IsWallActive() const = 0;
-
- virtual void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1, bool only_top_win = true) = 0;
- virtual bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force) = 0;
-
- virtual void Decorate(guint32 xid) {};
- virtual void Undecorate(guint32 xid) {};
-
- virtual bool IsScreenGrabbed() const = 0;
- virtual bool IsViewPortSwitchStarted() const = 0;
+ XWindowManager();
- virtual void MoveResizeWindow(guint32 xid, nux::Geometry geometry) = 0;
- void StartMove(guint32 xid, int, int);
-
- virtual int GetWindowMonitor(guint32 xid) const = 0;
- virtual nux::Geometry GetWindowGeometry(guint32 xid) const = 0;
- virtual nux::Geometry GetWindowSavedGeometry(guint32 xid) const = 0;
- virtual nux::Geometry GetScreenGeometry() const = 0;
- virtual nux::Geometry GetWorkAreaGeometry(guint32 xid = 0) const = 0;
-
- virtual unsigned long long GetWindowActiveNumber(guint32 xid) const = 0;
-
- virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo) = 0;
-
- virtual void CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any) = 0;
-
- virtual int WorkspaceCount() const = 0;
-
- virtual bool saveInputFocus() = 0;
- virtual bool restoreInputFocus() = 0;
-
- virtual std::string GetWindowName(guint32 xid) const = 0;
-
- // Signals
- sigc::signal<void, guint32> window_mapped;
- sigc::signal<void, guint32> window_unmapped;
- sigc::signal<void, guint32> window_maximized;
- sigc::signal<void, guint32> window_restored;
- sigc::signal<void, guint32> window_minimized;
- sigc::signal<void, guint32> window_unminimized;
- sigc::signal<void, guint32> window_shaded;
- sigc::signal<void, guint32> window_unshaded;
- sigc::signal<void, guint32> window_shown;
- sigc::signal<void, guint32> window_hidden;
- sigc::signal<void, guint32> window_resized;
- sigc::signal<void, guint32> window_moved;
- sigc::signal<void, guint32> window_focus_changed;
- sigc::signal<void, guint32> window_decorated;
- sigc::signal<void, guint32> window_undecorated;
-
- sigc::signal<void> initiate_spread;
- sigc::signal<void> terminate_spread;
-
- sigc::signal<void> initiate_expo;
- sigc::signal<void> terminate_expo;
-
- sigc::signal<void> compiz_screen_grabbed;
- sigc::signal<void> compiz_screen_ungrabbed;
- sigc::signal<void> compiz_screen_viewport_switch_started;
- sigc::signal<void> compiz_screen_viewport_switch_ended;
-
- sigc::signal<void, const char*, const char*, CompOption::Vector&> compiz_event;
-
-protected:
- std::string GetName() const;
- virtual void AddProperties(GVariantBuilder* builder) = 0;
+ virtual void StartMove(Window window_id, int x, int y);
private:
- Atom m_MoveResizeAtom;
+ Atom move_resize_atom_;
};
+}
+
#endif // WINDOW_MANAGER_H