[gnome-games] [same-gnome-clutter] Unhighlight tiles when mouse leaves game board
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] [same-gnome-clutter] Unhighlight tiles when mouse leaves game board
- Date: Mon, 20 Jul 2009 05:41:37 +0000 (UTC)
commit fb46da294b8c9de9fc3d2f979b7dc0c29cfacea6
Author: Tim Horton <hortont424 gmail com>
Date: Mon Jul 20 01:40:47 2009 -0400
[same-gnome-clutter] Unhighlight tiles when mouse leaves game board
same-gnome-clutter/src/Board.js | 15 +++++++++++++++
same-gnome-clutter/src/Light.js | 11 ++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/same-gnome-clutter/src/Board.js b/same-gnome-clutter/src/Board.js
index 7a4ee2f..500a66e 100644
--- a/same-gnome-clutter/src/Board.js
+++ b/same-gnome-clutter/src/Board.js
@@ -1,5 +1,6 @@
Clutter = imports.gi.Clutter;
GLib = imports.gi.GLib;
+Gdk = imports.gi.Gdk;
Light = imports.Light;
Score = imports.Score;
main = imports.main;
@@ -117,6 +118,15 @@ Board = new GType({
if(!connected[i].get_closed())
connected[i].opacity = 180;
+ return false;
+ }
+
+ function board_left()
+ {
+ for(var i in all_lights)
+ if(!all_lights[i].get_closed())
+ all_lights[i].opacity = 180;
+
main.message_label.label = "";
return false;
@@ -288,6 +298,11 @@ Board = new GType({
// Implementation
this.reactive = true;
+ // Enable & connect to widget leave signal
+ var gdkwindow = main.clutter_embed.get_window();
+ gdkwindow.set_events(gdkwindow.get_events() | Gdk.EventMask.LEAVE_NOTIFY_MASK);
+ main.clutter_embed.signal.leave_notify_event.connect(board_left);
+
Settings.Watcher.signal.colors_changed.connect(colors_changed);
}
});
diff --git a/same-gnome-clutter/src/Light.js b/same-gnome-clutter/src/Light.js
index 874c826..bd4ee74 100644
--- a/same-gnome-clutter/src/Light.js
+++ b/same-gnome-clutter/src/Light.js
@@ -4,10 +4,10 @@ main = imports.main;
Settings = imports.Settings;
Light = new GType({
- parent: Clutter.Group.type,
- name: "Light",
- init: function(self)
- {
+ parent: Clutter.Group.type,
+ name: "Light",
+ init: function(self)
+ {
// Private
var closed = false;
var light_x, light_y;
@@ -116,10 +116,11 @@ Light = new GType({
this.set_anchor_point(main.tile_size / 2, main.tile_size / 2);
+ this.add_actor(new Clutter.Rectangle({width: main.tile_size, height: main.tile_size, color: {alpha:255}}));
this.add_actor(this.on);
Settings.Watcher.signal.theme_changed.connect(theme_changed);
- }
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]