(gtk3) position_popup_group_menu() takes exactly 3 arguments

Bug #1518058 reported by Egmont Koblinger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Terminator
Fix Released
Medium
Unassigned

Bug Description

Click on the left-hand button of the red bar (that opens the New group, Broadcast off .... menu).

This is printed to stderr:

TypeError: position_popup_group_menu() takes exactly 3 arguments (5 given)

Related branches

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Strange. I don't get that message here on 14.04. This is using GTK 3.10. Possibly something changed. What is your version?

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Also, does the menu still appear? If it does, is it at the mouse pointer, or just under the titlebar?

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

3.6.17.

The menu appears correctly, its corner being exactly at the mouse pointer.

So it's probably just an innocent warning, nothing more.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Nope, that's a bug. That popup is supposed to attach to the bottom of the button like a menu attaches to the bottom of the menu bar. That's the purpose of that position_popup_group_menu function. To calculate the correct screen coordinates for the menu.

Changed in terminator:
importance: Undecided → Medium
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

position_popup_group_menu is of type GtkMenuPositionFunc, which takes totally different arguments. Probably it's something that I completely missed to update the original gtk3 port.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Nope, it's not a gtk2->gtk3 mistake. This is a gtk3.x->gtk3.y issue, as it works fine on my gtk3. Bloody irritating when API just changes within the major release numbers in incompatible ways. Grrrr!

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

This fixes it for me:

- def position_popup_group_menu(self, menu, widget):
+ def position_popup_group_menu(self, menu, x, y, widget):

No more warning, and the menu's upper left corner is at the terminal's upper left corner, not where you clicked.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Are you sure this was a gtk change? Maybe something went wrong with the python binding?

Does it work for you with my patch?

I can't see any change in gtk_menu_popup or GtkMenuPositionFunc:
https://developer.gnome.org/gtk3/3.0/GtkMenu.html
vs.
https://developer.gnome.org/gtk3/stable/GtkMenu.html

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

If this patch breaks it for you, I guess you'll have to go for *args and figure out runtime which of the arguments is the widget.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

I mean... it's not that the fix makes sure it doesn't break older gtk3... I mean you should make sure before applying the patch :D

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Definitely breaks older gtk3. Not sure if it is an API change or GIR. To be honest I don't really understand the GIR format too well.

I have an alternate patch that should work for both of us.

=== modified file 'terminatorlib/terminal.py'
--- terminatorlib/terminal.py 2015-11-07 00:29:12 +0000
+++ terminatorlib/terminal.py 2015-11-28 18:39:57 +0000
@@ -549,8 +549,9 @@

         return(menu)

- def position_popup_group_menu(self, menu, widget):
+ def position_popup_group_menu(self, menu, *args):
         """Calculate the position of the group popup menu"""
+ widget = args[-1]
         _screen_w = Gdk.Screen.width()
         screen_h = Gdk.Screen.height()

Works for me, should work for you, and if they change the args again, I'm going to beat someone up!

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Ugh. Launchpad messed up indentation, so here it is as a file.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Yup, confirmed, works for me too. Thanks! (I'd definitely add a comment explaining wtf is going on, or a link to this bug.)

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Good idea, or in the future I'll be all "WTF?!?!?"

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :
Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Awesome /s

<rant>
That kind of thing is just plain annoying! It's just another irritant to people who develop using GTK. Maybe this is par for the course, but it sure doesn't help the reputation of GNOME when a point release can just randomly change positional placement of arguments, causing stuff to fail. It's one thing to mark something deprecated, and phase it out on the next major release, but this seems careless. The first warning (if you as a dev are not on the latest system) is when other people complain that stuff is broken.
</rant>

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

In rev 1689 for trunk if applicable.
In rev 1627 for gtk3 if applicable.

Changed in terminator:
status: New → Fix Committed
Changed in terminator:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.