summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-01-15 18:59:03 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-01-15 18:59:03 +0100
commit484946ba512d2f441471e3d7e1b839b4f71c54a7 (patch)
treecfe32a46fee52ab246d2258d7fcec862eb1af9ad
parent45fa2e053bf7f7d51f3e0583abe3d53de4ebdcfd (diff)
Merge Upstream Release
-rw-r--r--.gitignore2
-rw-r--r--.pc/.dpkg-source-unapply0
-rw-r--r--.pc/.quilt_patches1
-rw-r--r--.pc/.quilt_series1
-rw-r--r--.pc/.version1
-rw-r--r--.pc/001-gee-0.8.patch/CMakeLists.txt231
-rw-r--r--.pc/applied-patches1
-rw-r--r--CMakeLists.txt2
-rw-r--r--debian/changelog6
-rw-r--r--gnome-pie.sublime-project22
-rwxr-xr-xmake.sh2
-rw-r--r--resources/ui/icon_select.ui2
-rw-r--r--resources/ui/preferences.ui4
-rw-r--r--resources/ui/settings.ui2
-rw-r--r--resources/ui/slice_select.ui4
-rw-r--r--resources/ui/trigger_select.ui3
-rw-r--r--src/deamon.vala74
-rw-r--r--src/gui/indicator.vala4
-rw-r--r--src/renderers/pieWindow.vala124
-rw-r--r--src/renderers/sliceRenderer.vala148
-rw-r--r--src/utilities/bindingManager.vala126
-rw-r--r--src/utilities/paths.vala136
22 files changed, 582 insertions, 314 deletions
diff --git a/.gitignore b/.gitignore
index b64af18..0ebfa9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@ build/*
gnome-pie
Makefile
.valencia
+*~
+gnome-pie.sublime-workspace
diff --git a/.pc/.dpkg-source-unapply b/.pc/.dpkg-source-unapply
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.pc/.dpkg-source-unapply
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
new file mode 100644
index 0000000..6857a8d
--- /dev/null
+++ b/.pc/.quilt_patches
@@ -0,0 +1 @@
+debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
new file mode 100644
index 0000000..c206706
--- /dev/null
+++ b/.pc/.quilt_series
@@ -0,0 +1 @@
+series
diff --git a/.pc/.version b/.pc/.version
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/.pc/.version
@@ -0,0 +1 @@
+2
diff --git a/.pc/001-gee-0.8.patch/CMakeLists.txt b/.pc/001-gee-0.8.patch/CMakeLists.txt
new file mode 100644
index 0000000..9e06bc7
--- /dev/null
+++ b/.pc/001-gee-0.8.patch/CMakeLists.txt
@@ -0,0 +1,231 @@
+################################################################
+# Project Gnome-Pie
+################################################################
+
+project("gnomepie" C)
+
+cmake_minimum_required(VERSION 2.6)
+
+# Location where cmake first looks for modules.
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala)
+
+################################################################
+# Find Vala
+################################################################
+
+include(ValaPrecompile)
+include(ValaVersion)
+
+find_package(Vala)
+ensure_vala_version("0.11.0" MINIMUM)
+
+################################################################
+# Configure and find libraries
+################################################################
+
+find_package(PkgConfig)
+
+# check whether GTK3 is supported
+pkg_check_modules(GTK3 gtk+-3.0)
+
+if (${GTK3_FOUND})
+ pkg_check_modules(INDICATOR3 appindicator3-0.1)
+ pkg_check_modules(UNIQUE REQUIRED unique-3.0)
+ pkg_check_modules(WNCK REQUIRED libwnck-3.0)
+ pkg_check_modules(BAMF REQUIRED libbamf3)
+else (${GTK3_FOUND})
+ pkg_check_modules(GTK2 REQUIRED gtk+-2.0)
+ pkg_check_modules(INDICATOR appindicator-0.1)
+ pkg_check_modules(UNIQUE REQUIRED unique-1.0)
+ pkg_check_modules(WNCK REQUIRED libwnck-1.0)
+ pkg_check_modules(BAMF REQUIRED libbamf)
+endif (${GTK3_FOUND})
+
+pkg_check_modules(GIO REQUIRED gio-unix-2.0)
+pkg_check_modules(CAIRO REQUIRED cairo)
+pkg_check_modules(GEE REQUIRED gee-1.0)
+pkg_check_modules(X11 REQUIRED x11)
+pkg_check_modules(XML REQUIRED libxml-2.0)
+pkg_check_modules(XTST REQUIRED xtst)
+pkg_check_modules(GMENU3 libgnome-menu-3.0)
+
+find_library(M_LIB m)
+find_library(GTHREAD_LIB gthread-2.0)
+
+set(CFLAGS
+ ${GIO_CFLAGS}
+ ${GTK2_CFLAGS} ${GTK2_CFLAGS_OTHER}
+ ${GTK3_CFLAGS} ${GTK3_CFLAGS_OTHER}
+ ${CAIRO_CFLAGS} ${CAIRO_CFLAGS_OTHER}
+ ${GEE_CFLAGS} ${CAIRO_CFLAGS_OTHER}
+ ${X11_CFLAGS} ${X11_CFLAGS_OTHER}
+ -DGMENU_I_KNOW_THIS_IS_UNSTABLE
+ -DWNCK_I_KNOW_THIS_IS_UNSTABLE
+ -DGETTEXT_PACKAGE="gnomepie"
+ -s -O3 -w
+# -g
+)
+
+# fallback to gtk2 if gtk3 wasn't found
+if (${GTK3_FOUND})
+ LIST(APPEND CFLAGS -DHAVE_GTK_3)
+endif (${GTK3_FOUND})
+
+# fallback to gnome-menus2 if gnome-menus3 wasn't found
+if (${GMENU3_FOUND})
+ LIST(APPEND CFLAGS -DHAVE_GMENU_3)
+else (${GMENU3_FOUND})
+ pkg_check_modules(GMENU REQUIRED libgnome-menu)
+endif (${GMENU3_FOUND})
+
+# notify application of presence of libappindicator
+if (${INDICATOR_FOUND})
+ LIST(APPEND CFLAGS -DHAVE_APPINDICATOR)
+endif (${INDICATOR_FOUND})
+if (${INDICATOR3_FOUND})
+ LIST(APPEND CFLAGS -DHAVE_APPINDICATOR)
+endif (${INDICATOR3_FOUND})
+
+add_definitions(${CFLAGS})
+
+set(LIBS
+ ${GIO_LIBRARIES}
+ ${GTK2_LIBRARIES}
+ ${GTK3_LIBRARIES}
+ ${CAIRO_LIBRARIES}
+ ${GEE_LIBRARIES}
+ ${INDICATOR_LIBRARIES}
+ ${INDICATOR3_LIBRARIES}
+ ${XML_LIBRARIES}
+ ${XTST_LIBRARIES}
+ ${GMENU_LIBRARIES}
+ ${GMENU3_LIBRARIES}
+ ${UNIQUE_LIBRARIES}
+ ${X11_LIBRARIES}
+ ${WNCK_LIBRARIES}
+ ${BAMF_LIBRARIES}
+ ${M_LIB}
+ ${GTHREAD_LIB}
+)
+link_libraries(${LIBS})
+
+set(LIB_PATHS
+ ${GIO_LIBRARY_DIRS}
+ ${GTK2_LIBRARY_DIRS}
+ ${GTK3_LIBRARY_DIRS}
+ ${CAIRO_LIBRARY_DIRS}
+ ${GEE_LIBRARY_DIRS}
+ ${INDICATOR_LIBRARY_DIRS}
+ ${INDICATOR3_LIBRARY_DIRS}
+ ${XML_LIBRARY_DIRS}
+ ${XTST_LIBRARY_DIRS}
+ ${GMENU_LIBRARY_DIRS}
+ ${GMENU3_LIBRARY_DIRS}
+ ${UNIQUE_LIBRARY_DIRS}
+ ${X11_LIBRARY_DIRS}
+ ${WNCK_LIBRARY_DIRS}
+ ${BAMF_LIBRARY_DIRS}
+)
+link_directories(${LIB_PATHS})
+
+set(INCLUDE_PATHS
+ ${GIO_INCLUDE_DIRS}
+ ${GTK2_INCLUDE_DIRS}
+ ${GTK3_INCLUDE_DIRS}
+ ${CAIRO_INCLUDE_DIRS}
+ ${GEE_INCLUDE_DIRS}
+ ${INDICATOR_INCLUDE_DIRS}
+ ${INDICATOR3_INCLUDE_DIRS}
+ ${XML_INCLUDE_DIRS}
+ ${XTST_INCLUDE_DIRS}
+ ${GMENU_INCLUDE_DIRS}
+ ${GMENU3_INCLUDE_DIRS}
+ ${UNIQUE_INCLUDE_DIRS}
+ ${X11_INCLUDE_DIRS}
+ ${BAMF_INCLUDE_DIRS}
+ ${WNCK_INCLUDE_DIRS}
+)
+include_directories(${INCLUDE_PATHS})
+
+################################################################
+# Add executable
+################################################################
+
+set(EXECUTABLE_OUTPUT_PATH ${gnomepie_SOURCE_DIR})
+
+set(VALA_PKGS
+ cairo
+ gee-1.0
+ x11
+ gio-unix-2.0
+ posix
+ libxml-2.0
+ xtst
+)
+
+if (${INDICATOR_FOUND})
+ LIST(APPEND VALA_PKGS appindicator-0.1)
+endif (${INDICATOR_FOUND})
+
+if (${INDICATOR3_FOUND})
+ LIST(APPEND VALA_PKGS appindicator3-0.1)
+endif (${INDICATOR3_FOUND})
+
+if (${GMENU3_FOUND})
+ LIST(APPEND VALA_PKGS libgnome-menu-3.0)
+else (${GMENU3_FOUND})
+ LIST(APPEND VALA_PKGS libgnome-menu)
+endif (${GMENU3_FOUND})
+
+if (${GTK3_FOUND})
+ LIST(APPEND VALA_PKGS gtk+-3.0)
+ LIST(APPEND VALA_PKGS gdk-x11-3.0)
+ LIST(APPEND VALA_PKGS libbamf3)
+ LIST(APPEND VALA_PKGS libwnck-3.0)
+ LIST(APPEND VALA_PKGS unique-3.0)
+else (${GTK3_FOUND})
+ LIST(APPEND VALA_PKGS gtk+-2.0)
+ LIST(APPEND VALA_PKGS gdk-x11-2.0)
+ LIST(APPEND VALA_PKGS bamf)
+ LIST(APPEND VALA_PKGS libwnck-1.0)
+ LIST(APPEND VALA_PKGS unique-1.0)
+endif (${GTK3_FOUND})
+
+add_subdirectory(src)
+
+################################################################
+# Add uninstall option
+################################################################
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/CMake_Uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/CMake_Uninstall.cmake"
+ IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/CMake_Uninstall.cmake)
+
+################################################################
+# Summary
+################################################################
+
+message( "" )
+message( "Summary:" )
+message( " EXECUTABLE_OUTPUT_PATH = ${EXECUTABLE_OUTPUT_PATH}" )
+message( " VALA_EXECUTABLE = ${VALA_EXECUTABLE}" )
+message( "Libs:" )
+message( " GTK2_LIBRARIES = ${GTK2_LIBRARIES}" )
+message( " GTK3_LIBRARIES = ${GTK3_LIBRARIES}" )
+message( " CAIRO_LIBRARIES = ${CAIRO_LIBRARIES}" )
+message( " GEE_LIBRARIES = ${GEE_LIBRARIES}" )
+message( " INDICATOR_LIBRARIES = ${INDICATOR_LIBRARIES}" )
+message( " INDICATOR3_LIBRARIES = ${INDICATOR3_LIBRARIES}" )
+message( " XML_LIBRARIES = ${XML_LIBRARIES}" )
+message( " XTST_LIBRARIES = ${XTST_LIBRARIES}" )
+message( " GMENU_LIBRARIES = ${GMENU_LIBRARIES}" )
+message( " GMENU3_LIBRARIES = ${GMENU3_LIBRARIES}" )
+message( " UNIQUE_LIBRARIES = ${UNIQUE_LIBRARIES}" )
+message( " X11_LIBRARIES = ${X11_LIBRARIES}" )
+message( " BAMF_LIBRARIES = ${BAMF_LIBRARIES}" )
+message( " WNCK_LIBRARIES = ${WNCK_LIBRARIES}" )
+message( "" )
diff --git a/.pc/applied-patches b/.pc/applied-patches
new file mode 100644
index 0000000..eb5e810
--- /dev/null
+++ b/.pc/applied-patches
@@ -0,0 +1 @@
+001-gee-0.8.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e06bc7..1c7729e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,7 +137,7 @@ set(INCLUDE_PATHS
${INDICATOR_INCLUDE_DIRS}
${INDICATOR3_INCLUDE_DIRS}
${XML_INCLUDE_DIRS}
- ${XTST_INCLUDE_DIRS}
+ ${XTST_INCLUDE_DIRS}
${GMENU_INCLUDE_DIRS}
${GMENU3_INCLUDE_DIRS}
${UNIQUE_INCLUDE_DIRS}
diff --git a/debian/changelog b/debian/changelog
index 14715ce..ccfe545 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+gnome-pie (0.5.6-1) UNRELEASED; urgency=medium
+
+ * New upstream release.
+
+ -- Jörg Frings-Fürst <debian@jff-webhosting.net> Thu, 15 Jan 2015 18:50:10 +0100
+
gnome-pie (0.5.5-1) unstable; urgency=medium
* New Maintainer (Closes: #755431).
diff --git a/gnome-pie.sublime-project b/gnome-pie.sublime-project
new file mode 100644
index 0000000..f56473f
--- /dev/null
+++ b/gnome-pie.sublime-project
@@ -0,0 +1,22 @@
+{
+ "build_systems":
+ [
+ {
+ "cmd":
+ [
+ "./make.sh"
+ ],
+ "file_regex": "^(..[^:]*):(.*)$",
+ "name": "gnome-pie-project",
+ "working_dir": "${project_path}"
+ }
+ ],
+ "folders":
+ [
+ {
+ "follow_symlinks": true,
+ "path": ".",
+ "folder_exclude_patterns": ["build"]
+ }
+ ]
+}
diff --git a/make.sh b/make.sh
index 0bd7ca8..6c27dce 100755
--- a/make.sh
+++ b/make.sh
@@ -2,4 +2,4 @@
mkdir build
-cd build; cmake ..; make && ( cd .. )
+cd build; cmake ..; make -j8 && ( cd .. )
diff --git a/resources/ui/icon_select.ui b/resources/ui/icon_select.ui
index b39ea2a..3aae9f7 100644
--- a/resources/ui/icon_select.ui
+++ b/resources/ui/icon_select.ui
@@ -6,7 +6,7 @@
<property name="height_request">425</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Select an icon</property>
- <property name="resizable">False</property>
+ <property name="resizable">True</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
diff --git a/resources/ui/preferences.ui b/resources/ui/preferences.ui
index 8ee988c..d6a5686 100644
--- a/resources/ui/preferences.ui
+++ b/resources/ui/preferences.ui
@@ -6,7 +6,7 @@
<property name="height_request">475</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Gnome-Pie Settings</property>
- <property name="resizable">False</property>
+ <property name="resizable">True</property>
<property name="window_position">center</property>
<property name="has_resize_grip">False</property>
<child>
@@ -260,7 +260,7 @@
<property name="ypad">6</property>
<property name="label" translatable="yes">&lt;b&gt;&lt;big&gt;This Pie is empty!&lt;/big&gt;
-Start adding Slices to it!&lt;/b&gt; This can be done by dragging stuff to the plus sign below. You can try a lot! For example application launchers or folders. Even URLs from your browser are possible...
+Start adding Slices to it!&lt;/b&gt; This can be done by dragging stuff to the plus sign below. You can try a lot! For example application launchers or folders. Even URLs from your browser are possible...
For manual and advanced configuration click on the plus sign.</property>
<property name="use_markup">True</property>
diff --git a/resources/ui/settings.ui b/resources/ui/settings.ui
index 77e3403..21d1fb5 100644
--- a/resources/ui/settings.ui
+++ b/resources/ui/settings.ui
@@ -7,7 +7,7 @@
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">General Settings</property>
- <property name="resizable">False</property>
+ <property name="resizable">True</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
diff --git a/resources/ui/slice_select.ui b/resources/ui/slice_select.ui
index 6ea5087..c09adac 100644
--- a/resources/ui/slice_select.ui
+++ b/resources/ui/slice_select.ui
@@ -4,10 +4,12 @@
<object class="GtkDialog" id="window">
<property name="width_request">550</property>
<property name="height_request">450</property>
+ <property name="default_width">550</property>
+ <property name="default_height">450</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Slice Options</property>
- <property name="resizable">False</property>
+ <property name="resizable">True</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
diff --git a/resources/ui/trigger_select.ui b/resources/ui/trigger_select.ui
index 9967997..6ffa4a7 100644
--- a/resources/ui/trigger_select.ui
+++ b/resources/ui/trigger_select.ui
@@ -3,10 +3,11 @@
<requires lib="gtk+" version="2.20"/>
<object class="GtkDialog" id="window">
<property name="width_request">350</property>
+ <property name="default_width">350</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Activation Settings</property>
- <property name="resizable">False</property>
+ <property name="resizable">True</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
diff --git a/src/deamon.vala b/src/deamon.vala
index 8cf95f8..fb9618b 100644
--- a/src/deamon.vala
+++ b/src/deamon.vala
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2011 by Simon Schneegans
This program is free software: you can redistribute it and/or modify it
@@ -12,17 +12,17 @@ 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/>.
+this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This class runs in the background. It has an Indicator sitting in the
/// user's panel. It initializes everything and guarantees that there is
/// only one instance of Gnome-Pie running.
/////////////////////////////////////////////////////////////////////////
-
+
public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
@@ -30,19 +30,19 @@ public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
public static string version;
-
+
/////////////////////////////////////////////////////////////////////
/// The beginning of everything.
/////////////////////////////////////////////////////////////////////
public static int main(string[] args) {
- version = "0.5.5";
-
+ version = "0.5.6";
+
Logger.init();
Gdk.threads_init();
Gtk.init(ref args);
Paths.init();
-
+
message("Welcome to Gnome-Pie " + version + "!");
// create the Deamon and run it
@@ -51,28 +51,28 @@ public class Deamon : GLib.Object {
return 0;
}
-
+
/////////////////////////////////////////////////////////////////////
/// The AppIndicator of Gnome-Pie.
/////////////////////////////////////////////////////////////////////
private Indicator indicator = null;
-
+
/////////////////////////////////////////////////////////////////////
/// Varaibles set by the commend line parser.
/////////////////////////////////////////////////////////////////////
-
+
private static string open_pie = null;
private static bool reset = false;
-
+
/////////////////////////////////////////////////////////////////////
/// Available command line options.
/////////////////////////////////////////////////////////////////////
-
+
private const GLib.OptionEntry[] options = {
- { "open", 'o', 0, GLib.OptionArg.STRING, out open_pie,
+ { "open", 'o', 0, GLib.OptionArg.STRING, out open_pie,
"Open the Pie with the given ID", "ID" },
- { "reset", 'r', 0, GLib.OptionArg.NONE, out reset,
+ { "reset", 'r', 0, GLib.OptionArg.NONE, out reset,
"Reset all options to default values" },
{ null }
};
@@ -81,7 +81,7 @@ public class Deamon : GLib.Object {
/// C'tor of the Deamon. It checks whether it's the firts running
/// instance of Gnome-Pie.
/////////////////////////////////////////////////////////////////////
-
+
public void run(string[] args) {
// create command line options
var context = new GLib.OptionContext("");
@@ -94,16 +94,16 @@ public class Deamon : GLib.Object {
} catch(GLib.OptionError error) {
warning(error.message);
}
-
+
if (Deamon.reset) {
if (GLib.FileUtils.remove(Paths.pie_config) == 0)
message("Removed file \"%s\"", Paths.pie_config);
if (GLib.FileUtils.remove(Paths.settings) == 0)
message("Removed file \"%s\"", Paths.settings);
-
+
return;
}
-
+
// create unique application
var app = new Unique.App("org.gnome.gnomepie", null);
@@ -118,21 +118,21 @@ public class Deamon : GLib.Object {
var data = new Unique.MessageData();
data.set_text(open_pie, open_pie.length);
app.send_message(Unique.Command.ACTIVATE, data);
-
+
return;
- }
-
+ }
+
message("Gnome-Pie is already running. Sending request to open config menu.");
app.send_message(Unique.Command.ACTIVATE, null);
-
+
return;
}
-
+
// wait for incoming messages
app.message_received.connect((cmd, data, event_time) => {
if (cmd == Unique.Command.ACTIVATE) {
var pie = data.get_text();
-
+
if (pie != null && pie != "") PieManager.open_pie(pie);
else this.indicator.show_preferences();
@@ -141,43 +141,43 @@ public class Deamon : GLib.Object {
return Unique.Response.PASSTHROUGH;
});
-
+
Gdk.threads_enter();
-
+
// init locale support
Intl.bindtextdomain ("gnomepie", Paths.locales);
Intl.textdomain ("gnomepie");
-
+
// init toolkits and static stuff
ActionRegistry.init();
GroupRegistry.init();
-
+
PieManager.init();
Icon.init();
-
+
// launch the indicator
this.indicator = new Indicator();
// connect SigHandlers
Posix.signal(Posix.SIGINT, sig_handler);
Posix.signal(Posix.SIGTERM, sig_handler);
-
+
// finished loading... so run the prog!
message("Started happily...");
-
+
// open pie if neccessary
- if (open_pie != null)
+ if (open_pie != null)
PieManager.open_pie(open_pie);
-
+
Gtk.main();
-
+
Gdk.threads_leave();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Print a nifty message when the prog is killed.
/////////////////////////////////////////////////////////////////////
-
+
private static void sig_handler(int sig) {
stdout.printf("\n");
message("Caught signal (%d), bye!".printf(sig));
diff --git a/src/gui/indicator.vala b/src/gui/indicator.vala
index c334dd1..18d4e68 100644
--- a/src/gui/indicator.vala
+++ b/src/gui/indicator.vala
@@ -68,7 +68,7 @@ public class Indicator : GLib.Object {
public Indicator() {
string icon = "";
-
+
#if HAVE_GTK_3
if (Gdk.X11Screen.get_window_manager_name(Gdk.Screen.get_default()) == "Mutter")
#else
@@ -77,7 +77,7 @@ public class Indicator : GLib.Object {
icon = "gnome-pie";
else
icon = "gnome-pie-symbolic";
-
+
#if HAVE_APPINDICATOR
string path = "";
diff --git a/src/renderers/pieWindow.vala b/src/renderers/pieWindow.vala
index 66ed863..a95b3e3 100644
--- a/src/renderers/pieWindow.vala
+++ b/src/renderers/pieWindow.vala
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2011 by Simon Schneegans
This program is free software: you can redistribute it and/or modify it
@@ -12,14 +12,14 @@ 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/>.
-*/
+this program. If not, see <http://www.gnu.org/licenses/>.
+*/
using GLib.Math;
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// An invisible window. Used to draw Pies onto.
/////////////////////////////////////////////////////////////////////////
@@ -28,54 +28,54 @@ public class PieWindow : Gtk.Window {
/////////////////////////////////////////////////////////////////////
/// Signal which gets emitted when the PieWindow is about to close.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_closing();
-
+
/////////////////////////////////////////////////////////////////////
/// Signal which gets emitted when the PieWindow is closed.
/////////////////////////////////////////////////////////////////////
-
+
public signal void on_closed();
-
+
/////////////////////////////////////////////////////////////////////
/// The background image used for fake transparency if
/// has_compositing is false.
/////////////////////////////////////////////////////////////////////
-
+
public Image background { get; private set; default=null; }
-
+
/////////////////////////////////////////////////////////////////////
/// The owned renderer.
/////////////////////////////////////////////////////////////////////
private PieRenderer renderer;
-
+
/////////////////////////////////////////////////////////////////////
/// True, if the Pie is currently fading out.
/////////////////////////////////////////////////////////////////////
-
+
private bool closing = false;
private bool closed = false;
-
+
/////////////////////////////////////////////////////////////////////
/// A timer used for calculating the frame time.
/////////////////////////////////////////////////////////////////////
-
+
private GLib.Timer timer;
-
+
/////////////////////////////////////////////////////////////////////
/// True, if the screen supports compositing.
/////////////////////////////////////////////////////////////////////
-
+
private bool has_compositing = false;
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor, sets up the window.
/////////////////////////////////////////////////////////////////////
public PieWindow() {
this.renderer = new PieRenderer();
-
+
this.set_title("Gnome-Pie");
this.set_skip_taskbar_hint(true);
this.set_skip_pager_hint(true);
@@ -85,7 +85,8 @@ public class PieWindow : Gtk.Window {
this.set_resizable(false);
this.icon_name = "gnome-pie";
this.set_accept_focus(false);
-
+ this.app_paintable = true;
+
// check for compositing
if (this.screen.is_composited()) {
#if HAVE_GTK_3
@@ -95,7 +96,7 @@ public class PieWindow : Gtk.Window {
#endif
this.has_compositing = true;
}
-
+
// set up event filter
this.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK |
Gdk.EventMask.KEY_RELEASE_MASK |
@@ -107,13 +108,13 @@ public class PieWindow : Gtk.Window {
if (e.button == 1 || this.renderer.turbo_mode) this.activate_slice();
return true;
});
-
+
// cancel on right click
this.button_press_event.connect ((e) => {
if (e.button == 3) this.cancel();
return true;
});
-
+
// remember last pressed key in order to disable key repeat
uint last_key = 0;
this.key_press_event.connect((e) => {
@@ -123,7 +124,7 @@ public class PieWindow : Gtk.Window {
}
return true;
});
-
+
// activate on key release if turbo_mode is enabled
this.key_release_event.connect((e) => {
last_key = 0;
@@ -133,13 +134,13 @@ public class PieWindow : Gtk.Window {
this.handle_key_release(e.keyval);
return true;
});
-
+
// notify the renderer of mouse move events
this.motion_notify_event.connect((e) => {
this.renderer.on_mouse_move();
return true;
});
-
+
this.show.connect_after(() => {
Gtk.grab_add(this);
FocusGrabber.grab(this.get_window(), true, true, false);
@@ -152,7 +153,7 @@ public class PieWindow : Gtk.Window {
this.expose_event.connect(this.draw_window);
#endif
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads a Pie to be rendered.
/////////////////////////////////////////////////////////////////////
@@ -162,14 +163,14 @@ public class PieWindow : Gtk.Window {
this.set_window_position(pie);
this.set_size_request(renderer.size, renderer.size);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Opens the window. load_pie should have been called before.
/////////////////////////////////////////////////////////////////////
-
+
public void open() {
this.realize();
-
+
// capture the background image if there is no compositing
if (!this.has_compositing) {
int x, y, width, height;
@@ -177,7 +178,7 @@ public class PieWindow : Gtk.Window {
this.get_size(out width, out height);
this.background = new Image.capture_screen(x, y, width+1, height+1);
}
-
+
// capture the input focus
this.show();
@@ -185,38 +186,38 @@ public class PieWindow : Gtk.Window {
this.timer = new GLib.Timer();
this.timer.start();
this.queue_draw();
-
+
// the main draw loop
- GLib.Timeout.add((uint)(1000.0/Config.global.refresh_rate), () => {
+ GLib.Timeout.add((uint)(1000.0/Config.global.refresh_rate), () => {
if (this.closed)
return false;
-
+
this.queue_draw();
return this.visible;
- });
+ });
}
-
+
/////////////////////////////////////////////////////////////////////
/// Gets the center position of the window.
/////////////////////////////////////////////////////////////////////
-
+
public void get_center_pos(out int out_x, out int out_y) {
int x=0, y=0, width=0, height=0;
this.get_position(out x, out y);
this.get_size(out width, out height);
-
+
out_x = x + width/2;
out_y = y + height/2;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Draw the Pie.
/////////////////////////////////////////////////////////////////////
#if HAVE_GTK_3
- private bool draw_window(Cairo.Context ctx) {
+ private bool draw_window(Cairo.Context ctx) {
#else
- private bool draw_window(Gtk.Widget da, Gdk.EventExpose event) {
+ private bool draw_window(Gtk.Widget da, Gdk.EventExpose event) {
// clear the window
var ctx = Gdk.cairo_create(this.get_window());
#endif
@@ -230,29 +231,29 @@ public class PieWindow : Gtk.Window {
ctx.set_source_surface(background.surface, -1, -1);
ctx.paint();
}
-
+
// align the context to the center of the PieWindow
ctx.translate(this.width_request*0.5, this.height_request*0.5);
-
+
// get the mouse position
double mouse_x = 0.0, mouse_y = 0.0;
this.get_pointer(out mouse_x, out mouse_y);
-
+
// store the frame time
double frame_time = this.timer.elapsed();
this.timer.reset();
-
+
// render the Pie
this.renderer.draw(frame_time, ctx, (int)(mouse_x - this.width_request*0.5),
(int)(mouse_y - this.height_request*0.5));
-
+
return true;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Activates the currently activate slice.
/////////////////////////////////////////////////////////////////////
-
+
private void activate_slice() {
if (!this.closing) {
this.closing = true;
@@ -260,7 +261,7 @@ public class PieWindow : Gtk.Window {
Gtk.grab_remove(this);
FocusGrabber.ungrab();
this.renderer.activate();
-
+
GLib.Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
this.closed = true;
this.on_closed();
@@ -269,11 +270,11 @@ public class PieWindow : Gtk.Window {
});
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Activates no slice and closes the PieWindow.
/////////////////////////////////////////////////////////////////////
-
+
private void cancel() {
if (!this.closing) {
this.closing = true;
@@ -281,7 +282,7 @@ public class PieWindow : Gtk.Window {
Gtk.grab_remove(this);
FocusGrabber.ungrab();
this.renderer.cancel();
-
+
GLib.Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
this.closed = true;
this.on_closed();
@@ -290,21 +291,21 @@ public class PieWindow : Gtk.Window {
});
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Sets the position of the window to the center of the screen or to
/// the mouse.
/////////////////////////////////////////////////////////////////////
-
+
private void set_window_position(Pie pie) {
if(PieManager.get_is_centered(pie.id)) this.set_position(Gtk.WindowPosition.CENTER);
else this.set_position(Gtk.WindowPosition.MOUSE);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Do some useful stuff when keys are pressed.
/////////////////////////////////////////////////////////////////////
-
+
private void handle_key_press(uint key) {
if (Gdk.keyval_name(key) == "Escape") this.cancel();
else if (Gdk.keyval_name(key) == "Return") this.activate_slice();
@@ -316,31 +317,30 @@ public class PieWindow : Gtk.Window {
else if (Gdk.keyval_name(key) == "Alt_L") this.renderer.show_hotkeys = true;
else {
int index = -1;
-
- if (key >= 48 && key <= 57) index = (int)key - 48;
+
+ if (key >= 48 && key <= 57) index = ((int)key - 39)%10;
else if (key >= 97 && key <= 122) index = (int)key - 87;
else if (key >= 65 && key <= 90) index = (int)key - 55;
-
+
if (index >= 0 && index < this.renderer.slice_count()) {
this.renderer.key_board_control = true;
this.renderer.set_highlighted_slice(index);
-
+
if (this.renderer.active_slice == index) {
GLib.Timeout.add((uint)(Config.global.theme.transition_time*1000.0), ()=> {
this.activate_slice();
return false;
});
}
-
}
}
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Do some useful stuff when keys are released.
/////////////////////////////////////////////////////////////////////
-
+
private void handle_key_release(uint key) {
if (!this.renderer.turbo_mode) {
if (Gdk.keyval_name(key) == "Alt_L") this.renderer.show_hotkeys = false;
diff --git a/src/renderers/sliceRenderer.vala b/src/renderers/sliceRenderer.vala
index 743f13e..2ecf7c4 100644
--- a/src/renderers/sliceRenderer.vala
+++ b/src/renderers/sliceRenderer.vala
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2011 by Simon Schneegans
This program is free software: you can redistribute it and/or modify it
@@ -12,14 +12,14 @@ 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/>.
+this program. If not, see <http://www.gnu.org/licenses/>.
*/
using GLib.Math;
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// Renders a Slice of a Pie. According to the current theme.
/////////////////////////////////////////////////////////////////////////
@@ -30,57 +30,57 @@ public class SliceRenderer : GLib.Object {
/////////////////////////////////////////////////////////////////////
public bool active {get; private set; default = false;}
-
+
/////////////////////////////////////////////////////////////////////
/// The Image which should be displayed as center caption when this
/// slice is active.
/////////////////////////////////////////////////////////////////////
-
+
public Image caption {get; private set;}
-
+
/////////////////////////////////////////////////////////////////////
/// The color which should be used for colorizing center layers when
/// this slice is active.
/////////////////////////////////////////////////////////////////////
-
+
public Color color {get; private set;}
-
+
/////////////////////////////////////////////////////////////////////
/// The two Images used, when this slice is active or not.
/////////////////////////////////////////////////////////////////////
-
+
private Image active_icon;
private Image inactive_icon;
-
+
/////////////////////////////////////////////////////////////////////
/// The Image displaying the associated hot key of this slice.
/////////////////////////////////////////////////////////////////////
-
+
private Image hotkey;
-
+
/////////////////////////////////////////////////////////////////////
/// The Action which is rendered by this SliceRenderer.
/////////////////////////////////////////////////////////////////////
-
+
private Action action;
-
+
/////////////////////////////////////////////////////////////////////
/// The PieRenderer which owns this SliceRenderer.
/////////////////////////////////////////////////////////////////////
- private unowned PieRenderer parent;
-
+ private unowned PieRenderer parent;
+
/////////////////////////////////////////////////////////////////////
/// The index of this slice in a pie. Clockwise assigned, starting
/// from the right-most slice.
/////////////////////////////////////////////////////////////////////
-
+
private int position;
-
+
/////////////////////////////////////////////////////////////////////
/// AnimatedValues needed for a slice.
/////////////////////////////////////////////////////////////////////
-
+
private AnimatedValue fade; // for transitions from active to inactive
private AnimatedValue scale; // for zoom effect
private AnimatedValue alpha; // for fading in/out
@@ -94,24 +94,24 @@ public class SliceRenderer : GLib.Object {
public SliceRenderer(PieRenderer parent) {
this.parent = parent;
-
+
this.fade = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time);
this.wobble = new AnimatedValue.linear(0.0, 0.0, Config.global.theme.transition_time);
this.alpha = new AnimatedValue.linear(0.0, 1.0, Config.global.theme.fade_in_time);
- this.scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
- 1.0/Config.global.theme.max_zoom,
- 1.0/Config.global.theme.max_zoom,
- Config.global.theme.transition_time,
+ this.scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
+ 1.0/Config.global.theme.max_zoom,
+ 1.0/Config.global.theme.max_zoom,
+ Config.global.theme.transition_time,
Config.global.theme.springiness);
- this.fade_scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
- Config.global.theme.fade_in_zoom, 1.0,
- Config.global.theme.fade_in_time,
+ this.fade_scale = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
+ Config.global.theme.fade_in_zoom, 1.0,
+ Config.global.theme.fade_in_time,
Config.global.theme.springiness);
- this.fade_rotation = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
- Config.global.theme.fade_in_rotation, 0.0,
+ this.fade_rotation = new AnimatedValue.cubic(AnimatedValue.Direction.OUT,
+ Config.global.theme.fade_in_rotation, 0.0,
Config.global.theme.fade_in_time);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Loads an Action. All members are initialized accordingly.
/////////////////////////////////////////////////////////////////////
@@ -119,64 +119,64 @@ public class SliceRenderer : GLib.Object {
public void load(Action action, int position) {
this.position = position;
this.action = action;
-
-
+
+
if (Config.global.theme.caption)
- this.caption = new RenderedText(action.name,
+ this.caption = new RenderedText(action.name,
Config.global.theme.caption_width,
Config.global.theme.caption_height,
Config.global.theme.caption_font,
Config.global.theme.caption_color,
Config.global.global_scale);
-
+
this.active_icon = new ThemedIcon(action.name, action.icon, true);
this.inactive_icon = new ThemedIcon(action.name, action.icon, false);
-
+
this.color = new Color.from_icon(this.active_icon);
-
+
string hotkey_label = "";
if (position < 10) {
- hotkey_label = "%u".printf(position);
+ hotkey_label = "%u".printf((position+1)%10);
} else if (position < 36) {
hotkey_label = "%c".printf((char)(55 + position));
}
-
+
this.hotkey = new RenderedText(hotkey_label, (int)Config.global.theme.slice_radius*2,
(int)Config.global.theme.slice_radius*2, "sans 20",
Config.global.theme.caption_color, Config.global.global_scale);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Activaes the Action of this slice.
/////////////////////////////////////////////////////////////////////
-
+
public void activate() {
action.activate();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Initiates the fade-out animation by resetting the targets of the
/// AnimatedValues to 0.0.
/////////////////////////////////////////////////////////////////////
-
+
public void fade_out() {
this.alpha.reset_target(0.0, Config.global.theme.fade_out_time);
- this.fade_scale = new AnimatedValue.cubic(AnimatedValue.Direction.IN,
- this.fade_scale.val,
- Config.global.theme.fade_out_zoom,
- Config.global.theme.fade_out_time,
+ this.fade_scale = new AnimatedValue.cubic(AnimatedValue.Direction.IN,
+ this.fade_scale.val,
+ Config.global.theme.fade_out_zoom,
+ Config.global.theme.fade_out_time,
Config.global.theme.springiness);
- this.fade_rotation = new AnimatedValue.cubic(AnimatedValue.Direction.IN,
- this.fade_rotation.val,
- Config.global.theme.fade_out_rotation,
+ this.fade_rotation = new AnimatedValue.cubic(AnimatedValue.Direction.IN,
+ this.fade_rotation.val,
+ Config.global.theme.fade_out_rotation,
Config.global.theme.fade_out_time);
}
-
+
/////////////////////////////////////////////////////////////////////
/// Should be called if the active slice of the PieRenderer changes.
/// The members activity, caption and color are set accordingly.
/////////////////////////////////////////////////////////////////////
-
+
public void set_active_slice(SliceRenderer? active_slice) {
if (active_slice == this) {
this.fade.reset_target(1.0, Config.global.theme.transition_time);
@@ -184,13 +184,13 @@ public class SliceRenderer : GLib.Object {
this.fade.reset_target(0.0, Config.global.theme.transition_time);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Draws all layers of the slice.
/////////////////////////////////////////////////////////////////////
public void draw(double frame_time, Cairo.Context ctx, double angle, double distance) {
-
+
// update the AnimatedValues
this.scale.update(frame_time);
this.alpha.update(frame_time);
@@ -198,16 +198,16 @@ public class SliceRenderer : GLib.Object {
this.fade_scale.update(frame_time);
this.fade_rotation.update(frame_time);
this.wobble.update(frame_time);
-
+
double direction = 2.0 * PI * position/parent.slice_count() + this.fade_rotation.val;
double max_scale = 1.0/Config.global.theme.max_zoom;
double diff = fabs(angle-direction);
if (diff > PI)
diff = 2 * PI - diff;
-
+
active = ((parent.active_slice >= 0) && (diff < PI/parent.slice_count()));
-
+
if (parent.active_slice >= 0) {
double wobble = Config.global.theme.wobble*diff/PI*(1-diff/PI);
if ((direction < angle && direction > angle - PI) || direction > PI+angle) {
@@ -218,61 +218,61 @@ public class SliceRenderer : GLib.Object {
} else {
this.wobble.reset_target(0, Config.global.theme.transition_time*0.5);
}
-
+
direction += this.wobble.val;
if (diff < 2 * PI * Config.global.theme.zoom_range)
max_scale = (Config.global.theme.max_zoom/(diff * (Config.global.theme.max_zoom - 1)
/(2 * PI * Config.global.theme.zoom_range) + 1))
/Config.global.theme.max_zoom;
-
-
-
+
+
+
max_scale = (parent.active_slice >= 0 ? max_scale : 1.0/Config.global.theme.max_zoom);
-
+
if (fabs(this.scale.end - max_scale) > Config.global.theme.max_zoom*0.005)
this.scale.reset_target(max_scale, Config.global.theme.transition_time);
-
+
ctx.save();
-
+
// distance from the center
double radius = Config.global.theme.radius;
-
+
// increase radius if there are many slices in a pie
if (atan((Config.global.theme.slice_radius+Config.global.theme.slice_gap)
/(radius/Config.global.theme.max_zoom)) > PI/parent.slice_count()) {
radius = (Config.global.theme.slice_radius+Config.global.theme.slice_gap)
/tan(PI/parent.slice_count())*Config.global.theme.max_zoom;
}
-
+
// transform the context
ctx.scale(scale.val*fade_scale.val, scale.val*fade_scale.val);
ctx.translate(cos(direction)*radius, sin(direction)*radius);
-
+
ctx.push_group();
-
+
ctx.set_operator(Cairo.Operator.ADD);
-
+
// paint the images
if (fade.val > 0.0) active_icon.paint_on(ctx, this.alpha.val*this.fade.val);
if (fade.val < 1.0) inactive_icon.paint_on(ctx, this.alpha.val*(1.0 - fade.val));
-
+
if (this.parent.show_hotkeys) {
ctx.set_operator(Cairo.Operator.ATOP);
ctx.set_source_rgba(0, 0, 0, 0.5);
ctx.paint();
}
-
+
ctx.set_operator(Cairo.Operator.OVER);
-
-
+
+
ctx.pop_group_to_source();
ctx.paint();
-
+
// draw hotkeys if necassary
if (this.parent.show_hotkeys)
this.hotkey.paint_on(ctx, 1.0);
-
+
ctx.restore();
}
}
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala
index 255dbfb..0c74ece 100644
--- a/src/utilities/bindingManager.vala
+++ b/src/utilities/bindingManager.vala
@@ -17,8 +17,8 @@ this program. If not, see <http://www.gnu.org/licenses/>.
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
-/// Globally binds key stroke to given ID's. When one of the bound
+/////////////////////////////////////////////////////////////////////////
+/// Globally binds key stroke to given ID's. When one of the bound
/// strokes is invoked, a signal with the according ID is emitted.
/////////////////////////////////////////////////////////////////////////
@@ -30,61 +30,61 @@ public class BindingManager : GLib.Object {
/////////////////////////////////////////////////////////////////////
public signal void on_press(string id);
-
+
/////////////////////////////////////////////////////////////////////
/// A list storing bindings, which are invoked even if Gnome-Pie
/// doesn't have the current focus
/////////////////////////////////////////////////////////////////////
-
+
private Gee.List<Keybinding> bindings = new Gee.ArrayList<Keybinding>();
/////////////////////////////////////////////////////////////////////
/// Ignored modifier masks, used to grab all keys even if these locks
/// are active.
/////////////////////////////////////////////////////////////////////
-
+
private static uint[] lock_modifiers = {
0,
Gdk.ModifierType.MOD2_MASK,
Gdk.ModifierType.LOCK_MASK,
Gdk.ModifierType.MOD5_MASK,
-
+
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.LOCK_MASK,
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.MOD5_MASK,
Gdk.ModifierType.LOCK_MASK|Gdk.ModifierType.MOD5_MASK,
-
+
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.LOCK_MASK|Gdk.ModifierType.MOD5_MASK
};
-
+
/////////////////////////////////////////////////////////////////////
/// Some variables to remember which delayed binding was delayed.
/// When the delay passes without another event indicating that the
/// Trigger was released, the stored binding will be activated.
/////////////////////////////////////////////////////////////////////
-
+
private uint32 delayed_count = 0;
private X.Event? delayed_event = null;
private Keybinding? delayed_binding = null;
-
+
/////////////////////////////////////////////////////////////////////
/// Helper class to store keybinding
/////////////////////////////////////////////////////////////////////
-
+
private class Keybinding {
-
+
public Keybinding(Trigger trigger, string id) {
this.trigger = trigger;
this.id = id;
}
-
+
public Trigger trigger { get; set; }
public string id { get; set; }
}
-
+
/////////////////////////////////////////////////////////////////////
/// C'tor adds the event filter to the root window.
/////////////////////////////////////////////////////////////////////
-
+
public BindingManager() {
// init filter to retrieve X.Events
Gdk.Window rootwin = Gdk.get_default_root_window();
@@ -92,45 +92,45 @@ public class BindingManager : GLib.Object {
rootwin.add_filter(event_filter);
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Binds the ID to the given accelerator.
/////////////////////////////////////////////////////////////////////
-
+
public void bind(Trigger trigger, string id) {
if(trigger.key_code != 0) {
- X.Display display = Gdk.x11_get_default_xdisplay();
- X.ID xid = Gdk.x11_get_default_root_xwindow();
-
+ X.Display display = Gdk.X11.get_default_xdisplay();
+ X.ID xid = Gdk.X11.get_default_root_xwindow();
+
Gdk.error_trap_push();
-
+
foreach(uint lock_modifier in lock_modifiers) {
if (trigger.with_mouse) {
display.grab_button(trigger.key_code, trigger.modifiers|lock_modifier, xid, false,
- X.EventMask.ButtonPressMask | X.EventMask.ButtonReleaseMask,
+ X.EventMask.ButtonPressMask | X.EventMask.ButtonReleaseMask,
X.GrabMode.Async, X.GrabMode.Async, xid, 0);
} else {
- display.grab_key(trigger.key_code, trigger.modifiers|lock_modifier,
+ display.grab_key(trigger.key_code, trigger.modifiers|lock_modifier,
xid, false, X.GrabMode.Async, X.GrabMode.Async);
}
}
-
+
Gdk.flush();
-
+
Keybinding binding = new Keybinding(trigger, id);
bindings.add(binding);
display.flush();
}
}
-
+
/////////////////////////////////////////////////////////////////////
/// Unbinds the accelerator of the given ID.
/////////////////////////////////////////////////////////////////////
-
+
public void unbind(string id) {
- X.Display display = Gdk.x11_get_default_xdisplay();
- X.ID xid = Gdk.x11_get_default_root_xwindow();
-
+ X.Display display = Gdk.X11.get_default_xdisplay();
+ X.ID xid = Gdk.X11.get_default_root_xwindow();
+
Gee.List<Keybinding> remove_bindings = new Gee.ArrayList<Keybinding>();
foreach(var binding in bindings) {
if(id == binding.id) {
@@ -139,7 +139,7 @@ public class BindingManager : GLib.Object {
display.ungrab_button(binding.trigger.key_code, binding.trigger.modifiers|lock_modifier, xid);
} else {
display.ungrab_key(binding.trigger.key_code, binding.trigger.modifiers|lock_modifier, xid);
- }
+ }
}
remove_bindings.add(binding);
}
@@ -148,68 +148,68 @@ public class BindingManager : GLib.Object {
bindings.remove_all(remove_bindings);
display.flush();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns a human readable accelerator for the given ID.
/////////////////////////////////////////////////////////////////////
-
+
public string get_accelerator_label_of(string id) {
foreach (var binding in bindings) {
if (binding.id == id) {
return binding.trigger.label_with_specials;
}
}
-
+
return _("Not bound");
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns the accelerator to which the given ID is bound.
/////////////////////////////////////////////////////////////////////
-
+
public string get_accelerator_of(string id) {
foreach (var binding in bindings) {
if (binding.id == id) {
return binding.trigger.name;
}
}
-
+
return "";
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns whether the pie with the given ID is in turbo mode.
/////////////////////////////////////////////////////////////////////
-
+
public bool get_is_turbo(string id) {
foreach (var binding in bindings) {
if (binding.id == id) {
return binding.trigger.turbo;
}
}
-
+
return false;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns whether the pie with the given ID opens centered.
/////////////////////////////////////////////////////////////////////
-
+
public bool get_is_centered(string id) {
foreach (var binding in bindings) {
if (binding.id == id) {
return binding.trigger.centered;
}
}
-
+
return false;
}
-
+
/////////////////////////////////////////////////////////////////////
/// Returns the name ID of the Pie bound to the given Trigger.
/// Returns "" if there is nothing bound to this trigger.
/////////////////////////////////////////////////////////////////////
-
+
public string get_assigned_id(Trigger trigger) {
foreach (var binding in bindings) {
var first = binding.trigger.name.replace("[turbo]", "").replace("[delayed]", "");
@@ -218,23 +218,23 @@ public class BindingManager : GLib.Object {
return binding.id;
}
}
-
+
return "";
}
/////////////////////////////////////////////////////////////////////
/// Event filter method needed to fetch X.Events.
/////////////////////////////////////////////////////////////////////
-
- private Gdk.FilterReturn event_filter(Gdk.XEvent gdk_xevent, Gdk.Event gdk_event) {
-
+
+ private Gdk.FilterReturn event_filter(Gdk.XEvent gdk_xevent, Gdk.Event gdk_event) {
+
#if VALA_0_16 || VALA_0_17
X.Event* xevent = (X.Event*) gdk_xevent;
#else
void* pointer = &gdk_xevent;
X.Event* xevent = (X.Event*) pointer;
#endif
-
+
if(xevent->type == X.EventType.KeyPress) {
foreach(var binding in bindings) {
// remove NumLock, CapsLock and ScrollLock from key state
@@ -247,7 +247,7 @@ public class BindingManager : GLib.Object {
}
}
}
- }
+ }
else if(xevent->type == X.EventType.ButtonPress) {
foreach(var binding in bindings) {
// remove NumLock, CapsLock and ScrollLock from key state
@@ -263,49 +263,49 @@ public class BindingManager : GLib.Object {
}
else if(xevent->type == X.EventType.ButtonRelease || xevent->type == X.EventType.KeyRelease) {
this.activate_delayed(null, *xevent);
- }
-
+ }
+
return Gdk.FilterReturn.CONTINUE;
}
-
+
/////////////////////////////////////////////////////////////////////
/// This method is always called when a trigger is activated which is
/// delayed. Therefore on_press() is only emitted, when this method
/// is not called again within 300 milliseconds. Else a fake event is
/// sent in order to simulate the actual key which has been pressed.
/////////////////////////////////////////////////////////////////////
-
+
private void activate_delayed(Keybinding? binding , X.Event event) {
// increase event count, so any waiting event will realize that
// something happened in the meantime
var current_count = ++this.delayed_count;
-
+
if (binding == null && this.delayed_event != null) {
// if the trigger is released and an event is currently waiting
// simulate that the trigger has been pressed without any inter-
// ference of Gnome-Pie
- X.Display display = Gdk.x11_get_default_xdisplay();
-
+ X.Display display = Gdk.X11.get_default_xdisplay();
+
// unbind the trigger, else we'll capture that event again ;)
unbind(delayed_binding.id);
-
+
if (this.delayed_binding.trigger.with_mouse) {
// simulate mouse click
X.Test.fake_button_event(display, this.delayed_event.xbutton.button, true, 0);
display.flush();
-
+
X.Test.fake_button_event(display, this.delayed_event.xbutton.button, false, 0);
display.flush();
-
+
} else {
// simulate key press
X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, true, 0);
display.flush();
-
+
X.Test.fake_key_event(display, this.delayed_event.xkey.keycode, false, 0);
display.flush();
}
-
+
// bind it again
bind(delayed_binding.trigger, delayed_binding.id);
} else if (binding != null) {
diff --git a/src/utilities/paths.vala b/src/utilities/paths.vala
index fe8897b..5b39c45 100644
--- a/src/utilities/paths.vala
+++ b/src/utilities/paths.vala
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2011 by Simon Schneegans
This program is free software: you can redistribute it and/or modify it
@@ -12,12 +12,12 @@ 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/>.
+this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// A static class which stores all relevant paths used by Gnome-Pie.
/// These depend upon the location from which the program was launched.
/////////////////////////////////////////////////////////////////////////
@@ -28,122 +28,122 @@ public class Paths : GLib.Object {
/// The config directory,
/// usually ~/.config/gnome-pie/.
/////////////////////////////////////////////////////////////////////
-
+
public static string config_directory { get; private set; default=""; }
/////////////////////////////////////////////////////////////////////
/// The log file,
/// usually ~/.config/gnome-pie/gnome-pie.log.
/////////////////////////////////////////////////////////////////////
-
+
public static string log { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The statistics file,
/// usually ~/.config/gnome-pie/gnome-pie.stats.
/////////////////////////////////////////////////////////////////////
-
+
public static string stats { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The settings file,
/// usually ~/.config/gnome-pie/gnome-pie.conf.
/////////////////////////////////////////////////////////////////////
-
+
public static string settings { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The pie configuration file
/// usually ~/.config/gnome-pie/pies.conf.
/////////////////////////////////////////////////////////////////////
-
+
public static string pie_config { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The directory containing themes installed by the user
/// usually ~/.config/gnome-pie/themes.
/////////////////////////////////////////////////////////////////////
-
+
public static string local_themes { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The directory containing pre-installed themes
/// usually /usr/share/gnome-pie/themes.
/////////////////////////////////////////////////////////////////////
-
+
public static string global_themes { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The directory containing locale files
/// usually /usr/share/locale.
/////////////////////////////////////////////////////////////////////
-
+
public static string locales { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The directory containing UI declaration files
/// usually /usr/share/gnome-pie/ui/.
/////////////////////////////////////////////////////////////////////
-
+
public static string ui_files { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The autostart file of gnome-pie_config
/// usually ~/.config/autostart/gnome-pie.desktop.
/////////////////////////////////////////////////////////////////////
-
+
public static string autostart { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The path where all pie-launchers are stored
/// usually ~/.config/gnome-pie/launchers.
/////////////////////////////////////////////////////////////////////
-
+
public static string launchers { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// The path to the executable.
/////////////////////////////////////////////////////////////////////
-
+
public static string executable { get; private set; default=""; }
-
+
/////////////////////////////////////////////////////////////////////
/// Initializes all values above.
/////////////////////////////////////////////////////////////////////
-
+
public static void init() {
-
+
// get path of executable
try {
executable = GLib.File.new_for_path(GLib.FileUtils.read_link("/proc/self/exe")).get_path();
} catch (GLib.FileError e) {
warning("Failed to get path of executable!");
}
-
+
// append resources to icon search path to icon theme, if neccasary
var icon_dir = GLib.File.new_for_path(GLib.Path.get_dirname(executable)).get_child("resources");
-
+
if (icon_dir.query_exists()) {
string path = icon_dir.get_path();
Gtk.IconTheme.get_default().append_search_path(path);
}
-
+
Gtk.IconTheme.get_default().append_search_path("/usr/share/pixmaps/");
-
+
// get global paths
var default_dir = GLib.File.new_for_path("/usr/share/gnome-pie/");
if(!default_dir.query_exists()) {
default_dir = GLib.File.new_for_path("/usr/local/share/gnome-pie/");
-
+
if(!default_dir.query_exists()) {
default_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
executable)).get_child("resources");
}
}
-
+
global_themes = default_dir.get_path() + "/themes";
ui_files = default_dir.get_path() + "/ui";
-
+
// get locales path
var locale_dir = GLib.File.new_for_path("/usr/share/locale/de/LC_MESSAGES/gnomepie.mo");
if(locale_dir.query_exists()) {
@@ -155,16 +155,16 @@ public class Paths : GLib.Object {
} else {
locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
executable)).get_child("resources/locale/de/LC_MESSAGES/gnomepie.mo");
-
+
if(locale_dir.query_exists()) {
locale_dir = GLib.File.new_for_path(GLib.Path.get_dirname(
executable)).get_child("resources/locale");
}
}
}
-
+
locales = locale_dir.get_path();
-
+
// get local paths
var config_dir = GLib.File.new_for_path(
GLib.Environment.get_user_config_dir()).get_child("gnome-pie");
@@ -177,9 +177,9 @@ public class Paths : GLib.Object {
error(e.message);
}
}
-
+
config_directory = config_dir.get_path();
-
+
// create local themes directory if neccasary
var themes_dir = config_dir.get_child("themes");
if(!themes_dir.query_exists()) {
@@ -189,9 +189,9 @@ public class Paths : GLib.Object {
error(e.message);
}
}
-
+
local_themes = themes_dir.get_path();
-
+
// create launchers directory if neccasary
var launchers_dir = config_dir.get_child("launchers");
if(!launchers_dir.query_exists()) {
@@ -201,17 +201,17 @@ public class Paths : GLib.Object {
error(e.message);
}
}
-
+
launchers = launchers_dir.get_path();
-
+
// check for config file
var config_file = config_dir.get_child("pies.conf");
-
+
pie_config = config_file.get_path();
settings = config_dir.get_path() + "/gnome-pie.conf";
log = config_dir.get_path() + "/gnome-pie.log";
stats = config_dir.get_path() + "/gnome-pie.stats";
-
+
if (!GLib.File.new_for_path(log).query_exists()) {
try {
FileUtils.set_contents(log, "");
@@ -219,7 +219,7 @@ public class Paths : GLib.Object {
error(e.message);
}
}
-
+
if (!GLib.File.new_for_path(stats).query_exists()) {
try {
FileUtils.set_contents(stats, "");
@@ -227,36 +227,36 @@ public class Paths : GLib.Object {
error(e.message);
}
}
-
+
// autostart file name
- autostart = GLib.Path.build_filename(GLib.Environment.get_user_config_dir(),
+ autostart = GLib.Path.build_filename(GLib.Environment.get_user_config_dir(),
"autostart", "gnome-pie.desktop", null);
-
+
// print results
- if (!GLib.File.new_for_path(pie_config).query_exists())
+ if (!GLib.File.new_for_path(pie_config).query_exists())
warning("Failed to find pie configuration file \"pies.conf\"! (This should only happen when Gnome-Pie is started for the first time...)");
-
- if (!GLib.File.new_for_path(settings).query_exists())
+
+ if (!GLib.File.new_for_path(settings).query_exists())
warning("Failed to find settings file \"gnome-pie.conf\"! (This should only happen when Gnome-Pie is started for the first time...)");
-
- if (!GLib.File.new_for_path(log).query_exists())
+
+ if (!GLib.File.new_for_path(log).query_exists())
warning("Failed to find log file \"gnome-pie.log\"!");
-
- if (!GLib.File.new_for_path(stats).query_exists())
+
+ if (!GLib.File.new_for_path(stats).query_exists())
warning("Failed to find statistics file \"gnome-pie.stats\"!");
-
- if (!GLib.File.new_for_path(local_themes).query_exists())
+
+ if (!GLib.File.new_for_path(local_themes).query_exists())
warning("Failed to find local themes directory!");
-
- if (!GLib.File.new_for_path(launchers).query_exists())
+
+ if (!GLib.File.new_for_path(launchers).query_exists())
warning("Failed to find launchers directory!");
-
- if (!GLib.File.new_for_path(global_themes).query_exists())
- warning("Failed to find global themes directory!");
-
- if (!GLib.File.new_for_path(ui_files).query_exists())
- warning("Failed to find UI files directory!");
- }
+
+ if (!GLib.File.new_for_path(global_themes).query_exists())
+ warning("Failed to find global themes directory!");
+
+ if (!GLib.File.new_for_path(ui_files).query_exists())
+ warning("Failed to find UI files directory!");
+ }
}
}