summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/ApplicationManager.h10
-rw-r--r--unity-shared/BamfApplicationManager.cpp21
-rw-r--r--unity-shared/BamfApplicationManager.h1
-rw-r--r--unity-shared/CMakeLists.txt7
-rw-r--r--unity-shared/DeltaRestrainment-Inl.h44
-rw-r--r--unity-shared/DeltaRestrainment.cpp39
-rw-r--r--unity-shared/pch/unity-shared_pch.hh33
7 files changed, 119 insertions, 36 deletions
diff --git a/unity-shared/ApplicationManager.h b/unity-shared/ApplicationManager.h
index 7ff8b0ba1..cf74e0c0a 100644
--- a/unity-shared/ApplicationManager.h
+++ b/unity-shared/ApplicationManager.h
@@ -67,15 +67,6 @@ public:
nux::ROProperty<bool> urgent;
};
-// Used for dbus menus, and nicer than a std::pair of strings.
-struct ApplicationMenu
-{
- ApplicationMenu(std::string const& path, std::string const& address)
- : path(path), remote_address(address) {}
- std::string path;
- std::string remote_address;
-};
-
class Application
{
@@ -94,7 +85,6 @@ public:
virtual bool OwnsWindow(Window window_id) const = 0;
virtual std::vector<std::string> GetSupportedMimeTypes() const = 0;
- virtual std::vector<ApplicationMenu> GetRemoteMenus() const = 0;
virtual ApplicationWindowPtr GetFocusableWindow() const = 0;
virtual void Focus(bool show_on_visible, int monitor) const = 0;
diff --git a/unity-shared/BamfApplicationManager.cpp b/unity-shared/BamfApplicationManager.cpp
index 5fcccd8da..1b52b92ff 100644
--- a/unity-shared/BamfApplicationManager.cpp
+++ b/unity-shared/BamfApplicationManager.cpp
@@ -398,27 +398,6 @@ std::vector<std::string> Application::GetSupportedMimeTypes() const
return result;
}
-std::vector<ApplicationMenu> Application::GetRemoteMenus() const
-{
- std::vector<ApplicationMenu> result;
- std::shared_ptr<GList> children(bamf_view_get_children(bamf_view_), g_list_free);
- for (GList* l = children.get(); l; l = l->next)
- {
- if (!BAMF_IS_INDICATOR(l->data))
- continue;
-
- auto indicator = static_cast<BamfIndicator*>(l->data);
- const gchar* path = bamf_indicator_get_dbus_menu_path(indicator);
- const gchar* address = bamf_indicator_get_remote_address(indicator);
-
- // It is possible for path or address to be null on error condintions, or if
- // the remote is not ready.
- if (path && address)
- result.push_back(ApplicationMenu(path, address));
- }
- return result;
-}
-
ApplicationWindowPtr Application::GetFocusableWindow() const
{
glib::Object<BamfView> view(bamf_application_get_focusable_child(bamf_app_),
diff --git a/unity-shared/BamfApplicationManager.h b/unity-shared/BamfApplicationManager.h
index 9823c8e2e..3e0fe1090 100644
--- a/unity-shared/BamfApplicationManager.h
+++ b/unity-shared/BamfApplicationManager.h
@@ -120,7 +120,6 @@ public:
virtual bool OwnsWindow(Window window_id) const;
virtual std::vector<std::string> GetSupportedMimeTypes() const;
- virtual std::vector<ApplicationMenu> GetRemoteMenus() const;
virtual ApplicationWindowPtr GetFocusableWindow() const;
virtual void Focus(bool show_on_visible, int monitor) const;
diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt
index 408a5fd0a..261a7fac7 100644
--- a/unity-shared/CMakeLists.txt
+++ b/unity-shared/CMakeLists.txt
@@ -9,10 +9,7 @@ set (CFLAGS
string (REPLACE ";" " " CFLAGS "${CFLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CFLAGS}")
-set (LIBS ${CACHED_UNITY_DEPS_LIBRARIES} ${UNITY_STANDALONE_LADD})
-
-set (LIB_PATHS ${CACHED_UNITY_DEPS_LIBRARY_DIRS})
-link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS})
+set (LIBS ${CACHED_UNITY_DEPS_LDFLAGS} ${UNITY_STANDALONE_LADD})
include_directories (.. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR})
@@ -28,6 +25,7 @@ set (UNITY_SHARED_SOURCES
DashStyle.cpp
DebugDBusInterface.cpp
DefaultThumbnailProvider.cpp
+ DeltaRestrainment.cpp
FontSettings.cpp
GraphicsUtils.cpp
IMTextEntry.cpp
@@ -83,6 +81,7 @@ endif()
add_library (unity-shared STATIC ${UNITY_SHARED_SOURCES})
target_link_libraries (unity-shared ${LIBS})
add_dependencies (unity-shared unity-core-${UNITY_API_VERSION})
+add_pch(pch/unity-shared_pch.hh unity-shared)
#
# We also need to build compiz specific parts and standalone variants of those parts
diff --git a/unity-shared/DeltaRestrainment-Inl.h b/unity-shared/DeltaRestrainment-Inl.h
new file mode 100644
index 000000000..acbbdf636
--- /dev/null
+++ b/unity-shared/DeltaRestrainment-Inl.h
@@ -0,0 +1,44 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/* Compiz unity plugin
+ * unity.cpp
+ *
+ * Copyright (c) 2010-11 Canonical Ltd.
+ *
+ * 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 3
+ * of the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * Your own copyright notice would go above. You are free to choose whatever
+ * licence you want, just take note that some compiz code is GPL and you will
+ * not be able to re-use it if you want to use a different licence.
+ */
+#ifndef _UNITY_DELTA_RESTRAINMENT_INL_H
+#define _UNITY_DELTA_RESTRAINMENT_INL_H
+
+#include <NuxCore/Rect.h>
+#include <NuxCore/Point.h>
+#include <Nux/Utils.h>
+
+namespace unity
+{
+namespace util
+{
+void restrainDelta (int &dx,
+ int &dy,
+ const nux::Geometry &rect,
+ const nux::Point &currentPoint);
+
+void applyDelta (int dx,
+ int dy,
+ int &x,
+ int &y);
+}
+}
+
+#endif
diff --git a/unity-shared/DeltaRestrainment.cpp b/unity-shared/DeltaRestrainment.cpp
new file mode 100644
index 000000000..2903ad623
--- /dev/null
+++ b/unity-shared/DeltaRestrainment.cpp
@@ -0,0 +1,39 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/* Compiz unity plugin
+ * unity.cpp
+ *
+ * Copyright (c) 2010-11 Canonical Ltd.
+ *
+ * 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 3
+ * of the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * Your own copyright notice would go above. You are free to choose whatever
+ * licence you want, just take note that some compiz code is GPL and you will
+ * not be able to re-use it if you want to use a different licence.
+ */
+#include <iostream>
+#include <algorithm>
+#include "DeltaRestrainment-Inl.h"
+
+void
+unity::util::restrainDelta(int &dx,
+ int &dy,
+ nux::Geometry const &rect,
+ nux::Point const &currentPoint)
+{
+ int restrain_x = std::min(0, (rect.x + rect.width) - (currentPoint.x + dx));
+ int restrain_y = std::min(0, (rect.y + rect.height) - (currentPoint.y + dy));
+
+ restrain_x += rect.x - std::min(rect.x, currentPoint.x + dx);
+ restrain_y += rect.y - std::min(rect.y, currentPoint.y + dy);
+
+ dx += restrain_x;
+ dy += restrain_y;
+}
diff --git a/unity-shared/pch/unity-shared_pch.hh b/unity-shared/pch/unity-shared_pch.hh
new file mode 100644
index 000000000..060dbba3c
--- /dev/null
+++ b/unity-shared/pch/unity-shared_pch.hh
@@ -0,0 +1,33 @@
+// -*- 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: Jussi Pakkanen <jussi.pakkanen@canonical.com>
+ */
+
+/*
+ * These are the precompiled header includes for UnityCore.
+ * Only system header files can be listed here.
+ */
+
+#include <vector>
+#include <string>
+#include <map>
+#include <memory>
+
+#include <Nux/Nux.h>
+#include <sigc++/sigc++.h>
+#include <boost/utility.hpp>
+#include <boost/algorithm/string.hpp>