[gnome-contacts/wip/sorted] Don't select on button press but on release (like a button)
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/wip/sorted] Don't select on button press but on release (like a button)
- Date: Fri, 11 May 2012 14:51:05 +0000 (UTC)
commit a06929cb46d6355b06176ac2bd016f12873ca2bd
Author: Alexander Larsson <alexl redhat com>
Date: Fri May 11 14:40:32 2012 +0200
Don't select on button press but on release (like a button)
src/contacts-sorted.vala | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-sorted.vala b/src/contacts-sorted.vala
index da031d9..cbff98d 100644
--- a/src/contacts-sorted.vala
+++ b/src/contacts-sorted.vala
@@ -256,10 +256,24 @@ public class Contacts.Sorted : Container {
return false;
}
+ private Widget? button_down_child;
public override bool button_press_event (Gdk.EventButton event) {
if (event.button == 1) {
unowned ChildInfo? child = find_child_at_y ((int)event.y);
- select_and_activate (child);
+ if (child != null)
+ button_down_child = child.widget;
+
+ /* TODO: Should mark as active while down, and handle grab breaks */
+ }
+ return false;
+ }
+
+ public override bool button_release_event (Gdk.EventButton event) {
+ if (event.button == 1) {
+ unowned ChildInfo? child = find_child_at_y ((int)event.y);
+ if (child != null && child.widget == button_down_child)
+ select_and_activate (child);
+ button_down_child = null;
}
return false;
}
@@ -434,7 +448,8 @@ public class Contacts.Sorted : Container {
Gdk.EventMask.LEAVE_NOTIFY_MASK |
Gdk.EventMask.POINTER_MOTION_MASK |
Gdk.EventMask.EXPOSURE_MASK |
- Gdk.EventMask.BUTTON_PRESS_MASK;
+ Gdk.EventMask.BUTTON_PRESS_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK;
attributes.wclass = Gdk.WindowWindowClass.INPUT_OUTPUT;
var window = new Gdk.Window (get_parent_window (), attributes,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]