Daniele Bartolini 5 lat temu
rodzic
commit
54f14c14ea

+ 8 - 8
tools/level_editor/editor_view.vala

@@ -114,9 +114,9 @@ namespace Crown
 
 		private bool on_button_release(Gdk.EventButton ev)
 		{
-			_mouse_left   = ev.button == 1 ? false : _mouse_left;
-			_mouse_middle = ev.button == 2 ? false : _mouse_middle;
-			_mouse_right  = ev.button == 3 ? false : _mouse_right;
+			_mouse_left   = ev.button == Gdk.BUTTON_PRIMARY   ? false : _mouse_left;
+			_mouse_middle = ev.button == Gdk.BUTTON_MIDDLE    ? false : _mouse_middle;
+			_mouse_right  = ev.button == Gdk.BUTTON_SECONDARY ? false : _mouse_right;
 
 			string s = LevelEditorApi.set_mouse_state(_mouse_curr_x
 				, _mouse_curr_y
@@ -132,7 +132,7 @@ namespace Crown
 			}
 			else
 			{
-				if (ev.button == 1)
+				if (ev.button == Gdk.BUTTON_PRIMARY)
 					s += LevelEditorApi.mouse_up((int)ev.x, (int)ev.y);
 			}
 
@@ -145,9 +145,9 @@ namespace Crown
 			// Grab keyboard focus
 			_event_box.grab_focus();
 
-			_mouse_left   = ev.button == 1 ? true : _mouse_left;
-			_mouse_middle = ev.button == 2 ? true : _mouse_middle;
-			_mouse_right  = ev.button == 3 ? true : _mouse_right;
+			_mouse_left   = ev.button == Gdk.BUTTON_PRIMARY   ? true : _mouse_left;
+			_mouse_middle = ev.button == Gdk.BUTTON_MIDDLE    ? true : _mouse_middle;
+			_mouse_right  = ev.button == Gdk.BUTTON_SECONDARY ? true : _mouse_right;
 
 			string s = LevelEditorApi.set_mouse_state(_mouse_curr_x
 				, _mouse_curr_y
@@ -167,7 +167,7 @@ namespace Crown
 			}
 			else
 			{
-				if (ev.button == 1)
+				if (ev.button == Gdk.BUTTON_PRIMARY)
 					s += LevelEditorApi.mouse_down((int)ev.x, (int)ev.y);
 			}
 

+ 1 - 1
tools/level_editor/level_tree_view.vala

@@ -137,7 +137,7 @@ namespace Crown
 
 		private bool on_button_pressed(Gdk.EventButton ev)
 		{
-			if (ev.button == 3) // Right
+			if (ev.button == Gdk.BUTTON_SECONDARY)
 			{
 				Gtk.Menu menu = new Gtk.Menu();
 				Gtk.MenuItem mi;

+ 2 - 2
tools/level_editor/project_browser.vala

@@ -181,7 +181,7 @@ namespace Crown
 
 		private bool on_button_pressed(Gdk.EventButton ev)
 		{
-			if (ev.button == 3) // Right
+			if (ev.button == Gdk.BUTTON_SECONDARY)
 			{
 				Gtk.TreePath path;
 				int cell_x;
@@ -326,7 +326,7 @@ namespace Crown
 					}
 				}
 			}
-			else if (ev.button == 1) // Left
+			else if (ev.button == Gdk.BUTTON_PRIMARY)
 			{
 				if (ev.type == Gdk.EventType.2BUTTON_PRESS)
 				{

+ 1 - 1
tools/level_editor/resource_chooser.vala

@@ -150,7 +150,7 @@ namespace Crown
 
 		private bool on_button_released(Gdk.EventButton ev)
 		{
-			if (ev.button == 1)
+			if (ev.button == Gdk.BUTTON_PRIMARY)
 			{
 				Gtk.TreePath path;
 				int cell_x;

+ 1 - 1
tools/widgets/entry_double.vala

@@ -60,7 +60,7 @@ namespace Crown
 
 		private bool on_button_release(Gdk.EventButton ev)
 		{
-			if (ev.button == 1 && this.has_focus) // Left button
+			if (ev.button == Gdk.BUTTON_PRIMARY && this.has_focus)
 			{
 				this.text = "%.6g".printf(_value);
 				this.set_position(-1);