After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 606007 - Context menu opens at 0,0 when using keyboard's context menu key
Context menu opens at 0,0 when using keyboard's context menu key
Status: RESOLVED FIXED
Product: tomboy
Classification: Applications
Component: General
1.0.x
Other Linux
: Low trivial
: ---
Assigned To: Greg Poirier
Tomboy Maintainers
Depends on:
Blocks: 587499
 
 
Reported: 2010-01-04 11:07 UTC by Debarshi Ray
Modified: 2011-04-17 23:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to address comment 2 (1.01 KB, patch)
2010-01-06 21:39 UTC, Greg Poirier
none Details | Review
Fixes multiple context menus (3.51 KB, patch)
2010-01-07 00:56 UTC, Greg Poirier
none Details | Review
Replacement for previous patch (3.79 KB, patch)
2010-01-09 23:39 UTC, Greg Poirier
rejected Details | Review
Patch to only show one context menu (2.62 KB, patch)
2010-12-08 21:07 UTC, Nicolas C.
rejected Details | Review
Patch making the context menu opening near the selected row (3.26 KB, patch)
2010-12-08 21:08 UTC, Nicolas C.
needs-work Details | Review
Proposed fixed (4.15 KB, patch)
2011-04-05 21:50 UTC, Greg Poirier
none Details | Review
Proposed patch (3.63 KB, patch)
2011-04-12 08:18 UTC, Greg Poirier
reviewed Details | Review
proposed, reviewed fix with corrections. (3.22 KB, patch)
2011-04-17 20:35 UTC, Greg Poirier
committed Details | Review

Description Debarshi Ray 2010-01-04 11:07:30 UTC
In search all notes window:

1. Select notebook
2. Select note
3. Click on selected notebook (press escape to avoid editing)
4. Press context menu key
=> Two context menus open.

Corresponding Gnote bug: https://bugzilla.gnome.org/602493
Comment 1 Sandy Armstrong 2010-01-06 02:43:08 UTC
Looks like the Gnote bug was fixed, so the same fix can probably be applied to Tomboy.

Patches welcome; I'd need to dig out my old keyboard to be able to test right now.
Comment 2 Greg Poirier 2010-01-06 19:50:30 UTC
In Gnome 2.2, I'm not getting two context menus.  I'm curious, but which two do you see?  I just get the note context menu, but the context menu key makes it open at 0,0 on the screen instead of over the note.
Comment 3 Greg Poirier 2010-01-06 20:48:57 UTC
Ahh, and I figured out why.  TreeSelection.GetSelected doesn't work when using multiple selections--so we're always returning immediately in RecentChanges.cs:872.  Pretty much no matter what.
Comment 4 Greg Poirier 2010-01-06 21:39:55 UTC
Created attachment 150934 [details] [review]
Patch to address comment 2

This doesn't address the original problem as I'm unable to reproduce it, but at least it opens closer to the selection now.  Any closer, and I'd have to dig further into Gtk than I would like to atm.
Comment 5 Greg Poirier 2010-01-07 00:55:21 UTC
Comment on attachment 150934 [details] [review]
Patch to address comment 2

New patch coming that addresses this in a different way and fixes the bug.
Comment 6 Greg Poirier 2010-01-07 00:56:34 UTC
Created attachment 150943 [details] [review]
Fixes multiple context menus

Thanks for the tip on the Gnote commit.  That was pretty helpful, and does exactly what we need it to.  I also retooled my previous patch to address the context-menu appearing at 0,0 on the screen.
Comment 7 Greg Poirier 2010-01-09 23:39:55 UTC
Created attachment 151104 [details] [review]
Replacement for previous patch

Got rid of a couple of dangling variable declarations that I forgot to remove.
Comment 8 Sandy Armstrong 2010-10-28 21:45:11 UTC
I still don't have a keyboard to confirm this fix with.
Comment 9 Nicolas C. 2010-12-08 21:07:12 UTC
Created attachment 176097 [details] [review]
Patch to only show one context menu

I wanted to confirm the fix, I ended up digging deeper and showing the popup menu nearer to the selected row than Greg's patch. I also separated the two patches: the one backporting the fix from Gnote concerning the two context menus shown (this one), and the one showing the popup menu at a better position (see next comment).
Comment 10 Nicolas C. 2010-12-08 21:08:25 UTC
Created attachment 176098 [details] [review]
Patch making the context menu opening near the selected row
Comment 11 Greg Poirier 2011-04-05 20:36:27 UTC
Review of attachment 176097 [details] [review]:

The reason I ended up rolling these into a single patch was because 1) the gnote patch had the problem of opening at 0,0 and 2) get_selected() can't be used:


(Tomboy:27182): Gtk-CRITICAL **: IA__gtk_tree_selection_get_selected: assertion `selection->type != GTK_SELECTION_MULTIPLE' failed

You have to use get_selected_rows instead (or GetSelectedRows()). I'm going to re-verify my original patch and push that.
Comment 12 Greg Poirier 2011-04-05 20:55:57 UTC
Review of attachment 176098 [details] [review]:

I prefer what you did here to what I did in my patch. There's one problem, however: Addins are able to use GetWidgetScreenPos(), so we can't remove it.

Addins/Tasks/TaskListWindow.cs:			GetWidgetScreenPos (tree, ref pos_x, ref pos_y);
Addins/Tasks/TaskListWindow.cs:		void GetWidgetScreenPos (Gtk.Widget widget, ref int x, ref int y)
Addins/Tasks/TaskListWindow.cs:				GetWidgetScreenPos (widget.Parent, ref x, ref y);

I'd like to see a combination of your two patches that doesn't remove GetWidgetScreenPos(), then I can re-visit GetWidgetScreenPos() at some point later. The positioning of the pop-up menu is good. Thanks for the GdkWindow catch, that's slick. I hadn't read the API docs for Gtk.Widget yet.
Comment 13 Greg Poirier 2011-04-05 20:57:22 UTC
Also, ignore what I said about pushing my patch in comment 11. I'll push a combination of both. If you want to put it together, feel free, but I can knock it out this week.
Comment 14 Greg Poirier 2011-04-05 21:09:21 UTC
Review of attachment 151104 [details] [review]:

Use a combination of other submitted patches instead, since this one is crufty.
Comment 15 Greg Poirier 2011-04-05 21:50:25 UTC
Created attachment 185235 [details] [review]
Proposed fixed

This is what I proposed in my previous comment. Leave GetWidgetScreenPos() in place, but otherwise accept all of Nicolas's work.
Comment 16 Greg Poirier 2011-04-12 08:18:25 UTC
Created attachment 185780 [details] [review]
Proposed patch

Fixed a couple of simple typos I noticed.
Comment 17 Aaron D Borden 2011-04-13 04:09:17 UTC
Review of attachment 185780 [details] [review]:

Looks good, minor comments.

::: Tomboy/RecentChanges.cs
@@ +909,3 @@
+			selected_rows = currentTree.Selection.GetSelectedRows ();
+			// Get TreeView's coordinates
+			currentTree.GdkWindow.GetOrigin(out pos_x, out pos_y);

Code style: space between method name and "("

@@ -1395,3 @@
-					// Allow Escape to close the window
-					OnCloseWindow (this, EventArgs.Empty);
-					break;

Why remove this?
Comment 18 Greg Poirier 2011-04-13 04:24:30 UTC
Thanks for catching those. 

I'm not sure how the Escape key change got in there. I'll look at that and see if it was intentional, but I don't think it was.
Comment 19 Greg Poirier 2011-04-17 20:35:06 UTC
Created attachment 186160 [details] [review]
proposed, reviewed fix with corrections.

Okay. Last time around. I'm attaching the last patch and pushing with the changes you mentioned.
Comment 20 Greg Poirier 2011-04-17 23:31:29 UTC
Review of attachment 186160 [details] [review]:

Reviewed and committed.
Comment 21 Greg Poirier 2011-04-17 23:32:59 UTC
commit 94d5294f8fca60495db88da15cf9fd305d3955b1