summaryrefslogtreecommitdiff
path: root/src/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/utilities')
-rw-r--r--src/utilities/bindingManager.vala9
-rw-r--r--src/utilities/focusGrabber.vala14
-rw-r--r--src/utilities/logger.vala41
3 files changed, 19 insertions, 45 deletions
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala
index 669c863..255dbfb 100644
--- a/src/utilities/bindingManager.vala
+++ b/src/utilities/bindingManager.vala
@@ -227,8 +227,13 @@ public class BindingManager : GLib.Object {
/////////////////////////////////////////////////////////////////////
private Gdk.FilterReturn event_filter(Gdk.XEvent gdk_xevent, Gdk.Event gdk_event) {
- void* pointer = &gdk_xevent;
- X.Event* xevent = (X.Event*) pointer;
+
+ #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) {
diff --git a/src/utilities/focusGrabber.vala b/src/utilities/focusGrabber.vala
index 293e103..e5900d6 100644
--- a/src/utilities/focusGrabber.vala
+++ b/src/utilities/focusGrabber.vala
@@ -53,7 +53,12 @@ public class FocusGrabber : GLib.Object {
var display = Gdk.Display.get_default();
var manager = display.get_device_manager();
- unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #if VALA_0_16 || VALA_0_17
+ GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #else
+ unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #endif
+
foreach(var device in list) {
if ((device.input_source == Gdk.InputSource.KEYBOARD && keyboard)
|| (device.input_source != Gdk.InputSource.KEYBOARD && pointer))
@@ -81,7 +86,12 @@ public class FocusGrabber : GLib.Object {
bool grabbed_all = true;
- unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #if VALA_0_16
+ GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #else
+ unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #endif
+
foreach(var device in list) {
if ((device.input_source == Gdk.InputSource.KEYBOARD && keyboard)
|| (device.input_source != Gdk.InputSource.KEYBOARD && pointer)) {
diff --git a/src/utilities/logger.vala b/src/utilities/logger.vala
index 116cbcd..69310fc 100644
--- a/src/utilities/logger.vala
+++ b/src/utilities/logger.vala
@@ -68,10 +68,8 @@ public class Logger {
/////////////////////////////////////////////////////////////////////
private static const int max_log_length = 1000000;
- private static const int max_stats_length = 1000000;
private static int log_length;
- private static int stats_length;
/////////////////////////////////////////////////////////////////////
/// Possible terminal colors.
@@ -94,7 +92,6 @@ public class Logger {
public static void init() {
log_length = -1;
- stats_length = -1;
try {
regex = new Regex("""(.*)\.vala(:\d+): (.*)""");
@@ -104,44 +101,6 @@ public class Logger {
}
/////////////////////////////////////////////////////////////////////
- /// Appends a line to the statistics file
- /////////////////////////////////////////////////////////////////////
-
- public static int get_statistics_size() {
- if (stats_length == -1) {
- var stats = GLib.FileStream.open(Paths.stats, "a");
- stats_length = (int)stats.tell();
- }
-
- return stats_length;
- }
-
- public static void stats(string line) {
- var stats = GLib.FileStream.open(Paths.stats, "a");
-
- if (stats != null) {
- if (stats_length == -1)
- stats_length = (int)stats.tell();
-
- string final_line = "[" + get_time() + "] " + line + "\n";
- stats.puts(final_line);
- stats_length += final_line.length;
- }
-
- if (stats_length > max_stats_length) {
- string content = "";
-
- try {
- GLib.FileUtils.get_contents(Paths.stats, out content);
- int split_index = content.index_of_char('\n', stats_length - (int)(max_stats_length*0.9));
- GLib.FileUtils.set_contents(Paths.stats, content.substring(split_index+1));
-
- stats_length -= (split_index+1);
- } catch (GLib.FileError e) {}
- }
- }
-
- /////////////////////////////////////////////////////////////////////
/// Appends a line to the log file
/////////////////////////////////////////////////////////////////////