From a74d44ad93fdbf637d6eccc7a116639287db207c Mon Sep 17 00:00:00 2001 From: selurvedu Date: Wed, 22 Apr 2020 02:10:31 +0000 Subject: [PATCH] Fix mouse hover highlighting the wrong message Fixes #795. --- .../ui/conversation_content_view/conversation_view.vala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala index 07fa8945..1cf15892 100644 --- a/main/src/ui/conversation_content_view/conversation_view.vala +++ b/main/src/ui/conversation_content_view/conversation_view.vala @@ -128,11 +128,12 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins last_y_root = y_root; - // Get pointer location in main - int geometry_x, geometry_y, geometry_width, geometry_height, dest_x, dest_y; + int toplevel_window_pos_x, toplevel_window_pos_y, dest_x, dest_y; Widget toplevel_widget = this.get_toplevel(); - toplevel_widget.get_window().get_geometry(out geometry_x, out geometry_y, out geometry_width, out geometry_height); - toplevel_widget.translate_coordinates(main, x_root - geometry_x, y_root - geometry_y, out dest_x, out dest_y); + // Obtain the position of the main application window relative to the root window + toplevel_widget.get_window().get_origin(out toplevel_window_pos_x, out toplevel_window_pos_y); + // Get the pointer location relative to the `main` box + toplevel_widget.translate_coordinates(main, x_root - toplevel_window_pos_x, y_root - toplevel_window_pos_y, out dest_x, out dest_y); // Get widget under pointer int h = 0;