[Xfce4-commits] <design:master> Allow action button to be prelighted separately from its row.
Jannis Pohlmann
noreply at xfce.org
Tue May 31 23:52:01 CEST 2011
Updating branch refs/heads/master
to 41e54340a3813c31b50f461d9bf4ae380d630a80 (commit)
from 74e117e7e4b1c8fda45c77cb7bd310b17cec2b8b (commit)
commit 41e54340a3813c31b50f461d9bf4ae380d630a80
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue May 31 23:50:49 2011 +0200
Allow action button to be prelighted separately from its row.
.../demo-code/custom-view/shortcut-row.vala | 34 +++++++++++++++++---
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
index 6826133..ff988bd 100644
--- a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
+++ b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
@@ -87,6 +87,22 @@ public class ShortcutRow : EventBox {
button.clicked.connect (connect_device);
+ button.state_changed.connect (() => {
+ if (button.state == StateType.PRELIGHT) {
+ if (this.state == StateType.PRELIGHT) {
+ int x, y;
+ button.get_pointer (out x, out y);
+
+ int w, h;
+ button.window.get_geometry (null, null, out w, out h, null);
+
+ if (x < 0 || y < 0 || x >= w || y >= h) {
+ button.set_state (StateType.NORMAL);
+ }
+ }
+ }
+ });
+
if (connected) {
button.show ();
}
@@ -153,7 +169,7 @@ public class ShortcutRow : EventBox {
event.area.width, event.area.height);
forall ((child) => {
- child.expose_event (event);
+ propagate_expose (child, event);
});
return false;
@@ -202,7 +218,7 @@ public class ShortcutRow : EventBox {
}
public override bool button_press_event (Gdk.EventButton event) {
- if (get_state () == StateType.SELECTED) {
+ if (state == StateType.SELECTED) {
if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
set_state (StateType.NORMAL);
}
@@ -214,15 +230,23 @@ public class ShortcutRow : EventBox {
}
public override bool enter_notify_event (Gdk.EventCrossing event) {
- if (get_state () != StateType.SELECTED) {
+ if (state != StateType.SELECTED) {
set_state (StateType.PRELIGHT);
}
return true;
}
public override bool leave_notify_event (Gdk.EventCrossing event) {
- if (get_state () == StateType.PRELIGHT) {
- set_state (StateType.NORMAL);
+ if (state == StateType.PRELIGHT) {
+ int x, y;
+ button.get_pointer (out x, out y);
+
+ int w, h;
+ button.window.get_geometry (null, null, out w, out h, null);
+
+ if (x < 0 || y < 0 || x >= w || y >= h) {
+ set_state (StateType.NORMAL);
+ }
}
return true;
}
More information about the Xfce4-commits
mailing list