[retro-gtk] retro-gtk: Drop usage of 'using' keyword
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gtk: Drop usage of 'using' keyword
- Date: Mon, 13 Feb 2017 16:09:11 +0000 (UTC)
commit 933a6d6bc83b62b3394bcfca6525893137d15c41
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon Feb 13 10:34:31 2017 +0100
retro-gtk: Drop usage of 'using' keyword
Drop the usage of the 'using' keyword in favor of explicit namespaces.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gtk/audio/pa-player.vala | 12 +--
retro-gtk/input/gamepad-button-type.vala | 3 -
retro-gtk/input/keyboard-state.vala | 15 ++--
retro-gtk/input/keyboard.vala | 127 ++++++++++++++---------------
retro-gtk/input/mouse.vala | 29 +++----
retro-gtk/input/virtual-gamepad.vala | 9 +--
6 files changed, 87 insertions(+), 108 deletions(-)
---
diff --git a/retro-gtk/audio/pa-player.vala b/retro-gtk/audio/pa-player.vala
index c9206a3..f77fe23 100644
--- a/retro-gtk/audio/pa-player.vala
+++ b/retro-gtk/audio/pa-player.vala
@@ -1,16 +1,12 @@
// This file is part of RetroGtk. License: GPLv3
-using PulseAudio;
-
-using Retro;
-
namespace RetroGtk {
public class PaPlayer : GLib.Object {
private Retro.Core core;
private ulong on_audio_output_id;
private double sample_rate;
- private Simple simple;
+ private PulseAudio.Simple simple;
public void set_core (Retro.Core core) {
if (this.core != null)
@@ -31,12 +27,12 @@ public class PaPlayer : GLib.Object {
private void prepare_for_sample_rate (double sample_rate) {
this.sample_rate = sample_rate;
- var sample_spec = SampleSpec() {
- format = SampleFormat.S16NE,
+ var sample_spec = PulseAudio.SampleSpec() {
+ format = PulseAudio.SampleFormat.S16NE,
rate = (uint32) sample_rate,
channels = 2
};
- simple = new Simple (null, null, Stream.Direction.PLAYBACK,
+ simple = new PulseAudio.Simple (null, null, PulseAudio.Stream.Direction.PLAYBACK,
null, "", sample_spec, null, null,
null);
}
diff --git a/retro-gtk/input/gamepad-button-type.vala b/retro-gtk/input/gamepad-button-type.vala
index ee8443a..17bfad8 100644
--- a/retro-gtk/input/gamepad-button-type.vala
+++ b/retro-gtk/input/gamepad-button-type.vala
@@ -1,8 +1,5 @@
// This file is part of RetroGtk. License: GPLv3
-using Gtk;
-using Cairo;
-
namespace RetroGtk {
public enum GamepadButtonType {
diff --git a/retro-gtk/input/keyboard-state.vala b/retro-gtk/input/keyboard-state.vala
index 92a00b0..ac671ba 100644
--- a/retro-gtk/input/keyboard-state.vala
+++ b/retro-gtk/input/keyboard-state.vala
@@ -1,19 +1,16 @@
// This file is part of RetroGtk. License: GPLv3
-using Gtk;
-using Gdk;
-
namespace RetroGtk {
public class KeyboardState : Object {
- public Widget widget { get; construct; }
+ public Gtk.Widget widget { get; construct; }
private HashTable<uint?, bool?> key_state;
- private Keymap keymap;
+ private Gdk.Keymap keymap;
public signal void key_state_changed ();
- public KeyboardState (Widget widget) {
+ public KeyboardState (Gtk.Widget widget) {
Object (widget: widget);
}
@@ -47,10 +44,10 @@ public class KeyboardState : Object {
key_state = new HashTable<uint?, bool?> (int_hash, int_equal);
- keymap = Keymap.get_default ();
+ keymap = Gdk.Keymap.get_default ();
}
- private bool on_key_press_event (Widget source, EventKey event) {
+ private bool on_key_press_event (Gtk.Widget source, Gdk.EventKey event) {
if (key_state.contains ((uint) event.hardware_keycode)) {
key_state.replace ((uint) event.hardware_keycode, true);
}
@@ -63,7 +60,7 @@ public class KeyboardState : Object {
return false;
}
- private bool on_key_release_event (Widget source, EventKey event) {
+ private bool on_key_release_event (Gtk.Widget source, Gdk.EventKey event) {
if (key_state.contains ((uint) event.hardware_keycode)) {
key_state.replace ((uint) event.hardware_keycode, false);
}
diff --git a/retro-gtk/input/keyboard.vala b/retro-gtk/input/keyboard.vala
index a97c640..034a388 100644
--- a/retro-gtk/input/keyboard.vala
+++ b/retro-gtk/input/keyboard.vala
@@ -1,18 +1,13 @@
// This file is part of RetroGtk. License: GPLv3
-using Gtk;
-using Gdk;
-
-using Retro;
-
namespace RetroGtk {
public class Keyboard : Object {
- public Widget widget { get; construct; }
+ public Gtk.Widget widget { get; construct; }
- public signal void key_event (bool down, KeyboardKey keycode, uint32 character, KeyboardModifierKey
key_modifiers);
+ public signal void key_event (bool down, Retro.KeyboardKey keycode, uint32 character,
Retro.KeyboardModifierKey key_modifiers);
- public Keyboard (Widget widget) {
+ public Keyboard (Gtk.Widget widget) {
Object (widget: widget);
}
@@ -21,141 +16,141 @@ public class Keyboard : Object {
widget.key_release_event.connect ((w, e) => on_key_event (e, false));
}
- private KeyboardModifierKey modifier_key_converter (uint keyval, Gdk.ModifierType modifiers) {
- var retro_modifiers = KeyboardModifierKey.NONE;
+ private Retro.KeyboardModifierKey modifier_key_converter (uint keyval, Gdk.ModifierType modifiers) {
+ var retro_modifiers = Retro.KeyboardModifierKey.NONE;
if ((bool) (modifiers & Gdk.ModifierType.SHIFT_MASK))
- retro_modifiers |= KeyboardModifierKey.SHIFT;
+ retro_modifiers |= Retro.KeyboardModifierKey.SHIFT;
if ((bool) (modifiers & Gdk.ModifierType.CONTROL_MASK))
- retro_modifiers |= KeyboardModifierKey.CTRL;
+ retro_modifiers |= Retro.KeyboardModifierKey.CTRL;
if ((bool) (modifiers & Gdk.ModifierType.MOD1_MASK))
- retro_modifiers |= KeyboardModifierKey.ALT;
+ retro_modifiers |= Retro.KeyboardModifierKey.ALT;
if ((bool) (modifiers & Gdk.ModifierType.META_MASK))
- retro_modifiers |= KeyboardModifierKey.META;
+ retro_modifiers |= Retro.KeyboardModifierKey.META;
if (keyval == Gdk.Key.Num_Lock)
- retro_modifiers |= KeyboardModifierKey.NUMLOCK;
+ retro_modifiers |= Retro.KeyboardModifierKey.NUMLOCK;
if ((bool) (modifiers & Gdk.ModifierType.LOCK_MASK))
- retro_modifiers |= KeyboardModifierKey.CAPSLOCK;
+ retro_modifiers |= Retro.KeyboardModifierKey.CAPSLOCK;
if (keyval == Gdk.Key.Scroll_Lock)
- retro_modifiers |= KeyboardModifierKey.SCROLLOCK;
+ retro_modifiers |= Retro.KeyboardModifierKey.SCROLLOCK;
return retro_modifiers;
}
- private KeyboardKey key_converter (uint keyval) {
+ private Retro.KeyboardKey key_converter (uint keyval) {
// Common keys (0x0020 to 0x00fe)
if (keyval < 0x80) {
var key = (0x7f & keyval);
// If the key is uppercase, turn it lower case
if (key >= 'A' && key <= 'Z')
- return (KeyboardKey) (key + 0x20);
+ return (Retro.KeyboardKey) (key + 0x20);
- return (KeyboardKey) key;
+ return (Retro.KeyboardKey) key;
}
// Function keys
var fx = keyval - Gdk.Key.F1;
- if (fx < 15) return (KeyboardKey) ((uint) KeyboardKey.F1 + fx);
+ if (fx < 15) return (Retro.KeyboardKey) ((uint) Retro.KeyboardKey.F1 + fx);
// Keypad digits
var kp = keyval - Gdk.Key.KP_0;
- if (kp < 10) return (KeyboardKey) ((uint) KeyboardKey.KP0 + kp);
+ if (kp < 10) return (Retro.KeyboardKey) ((uint) Retro.KeyboardKey.KP0 + kp);
// Various keys
// Missing keys: MODE, COMPOSE, POWER
switch (keyval) {
case Gdk.Key.BackSpace:
- return KeyboardKey.BACKSPACE;
+ return Retro.KeyboardKey.BACKSPACE;
case Gdk.Key.Tab:
- return KeyboardKey.TAB;
+ return Retro.KeyboardKey.TAB;
case Gdk.Key.Clear:
- return KeyboardKey.CLEAR;
+ return Retro.KeyboardKey.CLEAR;
case Gdk.Key.Return:
- return KeyboardKey.RETURN;
+ return Retro.KeyboardKey.RETURN;
case Gdk.Key.Pause:
- return KeyboardKey.PAUSE;
+ return Retro.KeyboardKey.PAUSE;
case Gdk.Key.Escape:
- return KeyboardKey.ESCAPE;
+ return Retro.KeyboardKey.ESCAPE;
case Gdk.Key.Delete:
- return KeyboardKey.DELETE;
+ return Retro.KeyboardKey.DELETE;
case Gdk.Key.Up:
- return KeyboardKey.UP;
+ return Retro.KeyboardKey.UP;
case Gdk.Key.Down:
- return KeyboardKey.DOWN;
+ return Retro.KeyboardKey.DOWN;
case Gdk.Key.Left:
- return KeyboardKey.LEFT;
+ return Retro.KeyboardKey.LEFT;
case Gdk.Key.Right:
- return KeyboardKey.RIGHT;
+ return Retro.KeyboardKey.RIGHT;
case Gdk.Key.Insert:
- return KeyboardKey.INSERT;
+ return Retro.KeyboardKey.INSERT;
case Gdk.Key.Home:
- return KeyboardKey.HOME;
+ return Retro.KeyboardKey.HOME;
case Gdk.Key.End:
- return KeyboardKey.END;
+ return Retro.KeyboardKey.END;
case Gdk.Key.Page_Up:
- return KeyboardKey.PAGEUP;
+ return Retro.KeyboardKey.PAGEUP;
case Gdk.Key.Page_Down:
- return KeyboardKey.PAGEDOWN;
+ return Retro.KeyboardKey.PAGEDOWN;
case Gdk.Key.KP_Decimal:
- return KeyboardKey.KP_PERIOD;
+ return Retro.KeyboardKey.KP_PERIOD;
case Gdk.Key.KP_Divide:
- return KeyboardKey.KP_DIVIDE;
+ return Retro.KeyboardKey.KP_DIVIDE;
case Gdk.Key.KP_Multiply:
- return KeyboardKey.KP_MULTIPLY;
+ return Retro.KeyboardKey.KP_MULTIPLY;
case Gdk.Key.KP_Subtract:
- return KeyboardKey.KP_MINUS;
+ return Retro.KeyboardKey.KP_MINUS;
case Gdk.Key.KP_Add:
- return KeyboardKey.KP_PLUS;
+ return Retro.KeyboardKey.KP_PLUS;
case Gdk.Key.KP_Enter:
- return KeyboardKey.KP_ENTER;
+ return Retro.KeyboardKey.KP_ENTER;
case Gdk.Key.KP_Equal:
- return KeyboardKey.KP_EQUALS;
+ return Retro.KeyboardKey.KP_EQUALS;
case Gdk.Key.Num_Lock:
- return KeyboardKey.NUMLOCK;
+ return Retro.KeyboardKey.NUMLOCK;
case Gdk.Key.Caps_Lock:
- return KeyboardKey.CAPSLOCK;
+ return Retro.KeyboardKey.CAPSLOCK;
case Gdk.Key.Scroll_Lock:
- return KeyboardKey.SCROLLOCK;
+ return Retro.KeyboardKey.SCROLLOCK;
case Gdk.Key.Shift_R:
- return KeyboardKey.RSHIFT;
+ return Retro.KeyboardKey.RSHIFT;
case Gdk.Key.Shift_L:
- return KeyboardKey.LSHIFT;
+ return Retro.KeyboardKey.LSHIFT;
case Gdk.Key.Control_R:
- return KeyboardKey.RCTRL;
+ return Retro.KeyboardKey.RCTRL;
case Gdk.Key.Control_L:
- return KeyboardKey.LCTRL;
+ return Retro.KeyboardKey.LCTRL;
case Gdk.Key.Alt_R:
- return KeyboardKey.RALT;
+ return Retro.KeyboardKey.RALT;
case Gdk.Key.Alt_L:
- return KeyboardKey.LALT;
+ return Retro.KeyboardKey.LALT;
case Gdk.Key.Meta_R:
- return KeyboardKey.RMETA;
+ return Retro.KeyboardKey.RMETA;
case Gdk.Key.Meta_L:
- return KeyboardKey.LMETA;
+ return Retro.KeyboardKey.LMETA;
case Gdk.Key.Super_R:
- return KeyboardKey.RSUPER;
+ return Retro.KeyboardKey.RSUPER;
case Gdk.Key.Super_L:
- return KeyboardKey.LSUPER;
+ return Retro.KeyboardKey.LSUPER;
case Gdk.Key.Help:
- return KeyboardKey.HELP;
+ return Retro.KeyboardKey.HELP;
case Gdk.Key.Print:
- return KeyboardKey.PRINT;
+ return Retro.KeyboardKey.PRINT;
case Gdk.Key.Sys_Req:
- return KeyboardKey.SYSREQ;
+ return Retro.KeyboardKey.SYSREQ;
case Gdk.Key.Break:
- return KeyboardKey.BREAK;
+ return Retro.KeyboardKey.BREAK;
case Gdk.Key.Menu:
- return KeyboardKey.MENU;
+ return Retro.KeyboardKey.MENU;
case Gdk.Key.EuroSign:
- return KeyboardKey.EURO;
+ return Retro.KeyboardKey.EURO;
case Gdk.Key.Undo:
- return KeyboardKey.UNDO;
+ return Retro.KeyboardKey.UNDO;
default:
- return KeyboardKey.UNKNOWN;
+ return Retro.KeyboardKey.UNKNOWN;
}
}
diff --git a/retro-gtk/input/mouse.vala b/retro-gtk/input/mouse.vala
index fb79df0..06545c9 100644
--- a/retro-gtk/input/mouse.vala
+++ b/retro-gtk/input/mouse.vala
@@ -1,12 +1,9 @@
// This file is part of RetroGtk. License: GPLv3
-using Gtk;
-using Gdk;
-
namespace RetroGtk {
private class MotionParser : Object {
- private Screen screen;
+ private Gdk.Screen screen;
private bool _grab_pointer;
public bool grab_pointer {
@@ -23,10 +20,10 @@ private class MotionParser : Object {
/*
* Return wether a movement happened or not
*/
- public bool parse_event (EventMotion event, out int x_movement, out int y_movement) {
+ public bool parse_event (Gdk.EventMotion event, out int x_movement, out int y_movement) {
var device = event.device;
- Screen s;
+ Gdk.Screen s;
int x, y;
device.get_position (out s, out x, out y);
@@ -71,7 +68,7 @@ private class MotionParser : Object {
}
public class Mouse : Object, Retro.InputDevice {
- public Widget widget { get; construct; }
+ public Gtk.Widget widget { get; construct; }
public bool parse {
get { return parser.grab_pointer; }
@@ -85,7 +82,7 @@ public class Mouse : Object, Retro.InputDevice {
private ulong ungrab_id;
- public Mouse (Widget widget) {
+ public Mouse (Gtk.Widget widget) {
Object (widget: widget);
}
@@ -103,7 +100,7 @@ public class Mouse : Object, Retro.InputDevice {
// Ungrab on press of Escape
widget.key_press_event.connect ((w, e) => {
- if (e.keyval == Key.Escape && (bool) (e.state & ModifierType.CONTROL_MASK))
+ if (e.keyval == Gdk.Key.Escape && (bool) (e.state & Gdk.ModifierType.CONTROL_MASK))
ungrab (e.time);
return false;
});
@@ -146,7 +143,7 @@ public class Mouse : Object, Retro.InputDevice {
return 1 << Retro.DeviceType.MOUSE;
}
- private bool on_button_press_event (Widget source, EventButton event) {
+ private bool on_button_press_event (Gtk.Widget source, Gdk.EventButton event) {
if (!parse) {
grab (event.device, event.window, event.time);
return false;
@@ -162,7 +159,7 @@ public class Mouse : Object, Retro.InputDevice {
return false;
}
- private bool on_button_release_event (Widget source, EventButton event) {
+ private bool on_button_release_event (Gtk.Widget source, Gdk.EventButton event) {
if (button_state.contains (event.button)) {
button_state.replace (event.button, false);
}
@@ -173,7 +170,7 @@ public class Mouse : Object, Retro.InputDevice {
/**
* Update the pointer's position
*/
- private bool on_motion_notify_event (Widget source, EventMotion event) {
+ private bool on_motion_notify_event (Gtk.Widget source, Gdk.EventMotion event) {
if (!parse) return false;
int x, y;
@@ -201,16 +198,16 @@ public class Mouse : Object, Retro.InputDevice {
/**
* Grab the poiner
*/
- private void grab (Device device, Gdk.Window window, uint32 time) {
+ private void grab (Gdk.Device device, Gdk.Window window, uint32 time) {
// Save the pointer's position
- Screen screen;
+ Gdk.Screen screen;
int x, y;
device.get_position (out screen, out x, out y);
// Grab the device
parse = true;
- var cursor = new Cursor (CursorType.BLANK_CURSOR);
- device.grab (window, GrabOwnership.NONE, false, EventMask.ALL_EVENTS_MASK, cursor, time);
+ var cursor = new Gdk.Cursor (Gdk.CursorType.BLANK_CURSOR);
+ device.grab (window, Gdk.GrabOwnership.NONE, false, Gdk.EventMask.ALL_EVENTS_MASK, cursor,
time);
// Ungrab the device when asked
ungrab_id = ungrab.connect ((time) => {
diff --git a/retro-gtk/input/virtual-gamepad.vala b/retro-gtk/input/virtual-gamepad.vala
index a2cffb7..9973c18 100644
--- a/retro-gtk/input/virtual-gamepad.vala
+++ b/retro-gtk/input/virtual-gamepad.vala
@@ -1,21 +1,18 @@
// This file is part of RetroGtk. License: GPLv3
-using Gtk;
-using Gdk;
-
namespace RetroGtk {
public class VirtualGamepad : Object, Retro.InputDevice {
- public Widget widget { get; construct; }
+ public Gtk.Widget widget { get; construct; }
public GamepadConfiguration configuration { get; construct set; }
private KeyboardState keyboard;
- public VirtualGamepad (Widget widget) {
+ public VirtualGamepad (Gtk.Widget widget) {
Object (widget: widget);
}
- public VirtualGamepad.with_configuration (Widget widget, GamepadConfiguration configuration) {
+ public VirtualGamepad.with_configuration (Gtk.Widget widget, GamepadConfiguration configuration) {
Object (widget: widget, configuration: configuration);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]