Don't select on button press but on release (like a button)
This commit is contained in:
parent
087200ef2c
commit
a06929cb46
1 changed files with 17 additions and 2 deletions
|
@ -256,10 +256,24 @@ public class Contacts.Sorted : Container {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Widget? button_down_child;
|
||||||
public override bool button_press_event (Gdk.EventButton event) {
|
public override bool button_press_event (Gdk.EventButton event) {
|
||||||
if (event.button == 1) {
|
if (event.button == 1) {
|
||||||
unowned ChildInfo? child = find_child_at_y ((int)event.y);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -434,7 +448,8 @@ public class Contacts.Sorted : Container {
|
||||||
Gdk.EventMask.LEAVE_NOTIFY_MASK |
|
Gdk.EventMask.LEAVE_NOTIFY_MASK |
|
||||||
Gdk.EventMask.POINTER_MOTION_MASK |
|
Gdk.EventMask.POINTER_MOTION_MASK |
|
||||||
Gdk.EventMask.EXPOSURE_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;
|
attributes.wclass = Gdk.WindowWindowClass.INPUT_OUTPUT;
|
||||||
var window = new Gdk.Window (get_parent_window (), attributes,
|
var window = new Gdk.Window (get_parent_window (), attributes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue