aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/conversation_content_view/file_default_widget.vala42
-rw-r--r--main/src/ui/conversation_content_view/file_image_widget.vala19
2 files changed, 19 insertions, 42 deletions
diff --git a/main/src/ui/conversation_content_view/file_default_widget.vala b/main/src/ui/conversation_content_view/file_default_widget.vala
index c2af92e3..33b8f8a7 100644
--- a/main/src/ui/conversation_content_view/file_default_widget.vala
+++ b/main/src/ui/conversation_content_view/file_default_widget.vala
@@ -17,16 +17,10 @@ public class FileDefaultWidget : EventBox {
[GtkChild] public EventBox stack_event_box;
private FileTransfer.State state;
- private bool pointer_inside = false;
public FileDefaultWidget() {
this.enter_notify_event.connect(on_pointer_entered);
this.leave_notify_event.connect(on_pointer_left);
-
- stack_event_box.enter_notify_event.connect((event) => { pointer_inside = true; return false; });
- mime_label.enter_notify_event.connect((event) => { pointer_inside = true; return false; });
- stack_event_box.leave_notify_event.connect((event) => { pointer_inside = true; return false; });
- mime_label.leave_notify_event.connect((event) => { pointer_inside = true; return false; });
}
public void update_file_info(string? mime_type, FileTransfer.State state, long size) {
@@ -66,32 +60,24 @@ public class FileDefaultWidget : EventBox {
}
private bool on_pointer_entered(Gdk.EventCrossing event) {
- pointer_inside = true;
- Timeout.add(20, () => {
- if (pointer_inside) {
- event.get_window().set_cursor(new Cursor.for_display(Gdk.Display.get_default(), CursorType.HAND2));
- content_type_image.opacity = 0.7;
- if (state == FileTransfer.State.NOT_STARTED) {
- image_stack.set_visible_child_name("download_image");
- }
- }
- return false;
- });
+ if (event.detail == Gdk.NotifyType.INFERIOR) return false;
+
+ event.get_window().set_cursor(new Cursor.for_display(Gdk.Display.get_default(), CursorType.HAND2));
+ content_type_image.opacity = 0.7;
+ if (state == FileTransfer.State.NOT_STARTED) {
+ image_stack.set_visible_child_name("download_image");
+ }
return false;
}
private bool on_pointer_left(Gdk.EventCrossing event) {
- pointer_inside = false;
- Timeout.add(20, () => {
- if (!pointer_inside) {
- event.get_window().set_cursor(new Cursor.for_display(Gdk.Display.get_default(), CursorType.XTERM));
- content_type_image.opacity = 0.5;
- if (state == FileTransfer.State.NOT_STARTED) {
- image_stack.set_visible_child_name("content_type_image");
- }
- }
- return false;
- });
+ if (event.detail == Gdk.NotifyType.INFERIOR) return false;
+
+ event.get_window().set_cursor(new Cursor.for_display(Gdk.Display.get_default(), CursorType.XTERM));
+ content_type_image.opacity = 0.5;
+ if (state == FileTransfer.State.NOT_STARTED) {
+ image_stack.set_visible_child_name("content_type_image");
+ }
return false;
}
diff --git a/main/src/ui/conversation_content_view/file_image_widget.vala b/main/src/ui/conversation_content_view/file_image_widget.vala
index 8005f996..f7841736 100644
--- a/main/src/ui/conversation_content_view/file_image_widget.vala
+++ b/main/src/ui/conversation_content_view/file_image_widget.vala
@@ -11,7 +11,6 @@ public class FileImageWidget : EventBox {
private ScalingImage image;
FileDefaultWidget file_default_widget;
FileDefaultWidgetController file_default_widget_controller;
- private bool pointer_inside = false;
public FileImageWidget() {
this.halign = Align.START;
@@ -60,25 +59,17 @@ public class FileImageWidget : EventBox {
overlay.add(image);
overlay.add_overlay(file_default_widget);
- this.enter_notify_event.connect(() => {
+ this.enter_notify_event.connect((event) => {
+ if (event.detail == Gdk.NotifyType.INFERIOR) return false;
file_default_widget.visible = true;
return false;
});
- this.leave_notify_event.connect(() => {
- pointer_inside = false;
- Timeout.add(20, () => {
- if (!pointer_inside) {
- file_default_widget.visible = false;
- }
- return false;
- });
-
+ this.leave_notify_event.connect((event) => {
+ if (event.detail == Gdk.NotifyType.INFERIOR) return false;
+ file_default_widget.visible = false;
return false;
});
- file_default_widget.enter_notify_event.connect(() => { pointer_inside = true; return false; });
- file_default_widget.leave_notify_event.connect(() => { pointer_inside = true; return false; });
-
this.add(overlay);
}
}