diff -r f0a8f63f9312 -r 770365ded9f8 pidgin/gtkutils.c --- a/pidgin/gtkutils.c Tue Oct 11 23:32:23 2016 -0500 +++ b/pidgin/gtkutils.c Thu May 25 20:30:56 2017 -0500 @@ -1189,20 +1189,12 @@ GdkRectangle monitor; gint monitor_num; gint space_left, space_right, space_above, space_below; - gint needed_width; - gint needed_height; - gint xthickness; - gint ythickness; gboolean rtl; g_return_if_fail(GTK_IS_MENU(menu)); widget = GTK_WIDGET(menu); screen = gtk_widget_get_screen(widget); - context = gtk_widget_get_style_context(widget); - gtk_style_context_get(context, gtk_style_context_get_state(context), - "xthickness", &xthickness, - "ythickness", &ythickness, NULL); rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL); /* @@ -1245,24 +1237,14 @@ /* position horizontally */ - /* the amount of space we need to position the menu. Note the - * menu is offset "xthickness" pixels - */ - needed_width = requisition.width - xthickness; - - if (needed_width <= space_left || - needed_width <= space_right) + if (requisition.width <= space_left || + requisition.width <= space_right) { - if ((rtl && needed_width <= space_left) || - (!rtl && needed_width > space_right)) + if ((rtl && requisition.width <= space_left) || + (!rtl && requisition.width > space_right)) { /* position left */ - *x = *x + xthickness - requisition.width + 1; - } - else - { - /* position right */ - *x = *x - xthickness; + *x = *x - requisition.width + 1; } /* x is clamped on-screen further down */ @@ -1301,20 +1283,19 @@ /* Position vertically. The algorithm is the same as above, but * simpler because we don't have to take RTL into account. */ - needed_height = requisition.height - ythickness; - - if (needed_height <= space_above || - needed_height <= space_below) + + if (requisition.height <= space_above || + requisition.height <= space_below) { - if (needed_height <= space_below) - *y = *y - ythickness; - else - *y = *y + ythickness - requisition.height + 1; + if (requisition.height > space_below) { + *y = *y - requisition.height + 1; + } *y = CLAMP (*y, monitor.y, monitor.y + monitor.height - requisition.height); } - else if (needed_height > space_below && needed_height > space_above) + else if (requisition.height > space_below && + requisition.height > space_above) { if (space_below >= space_above) *y = monitor.y + monitor.height - requisition.height; @@ -1340,18 +1321,13 @@ GtkTreePath *path; GtkTreeViewColumn *col; GdkRectangle rect; - GtkStyleContext *context; - gint ythickness; - - context = gtk_widget_get_style_context(GTK_WIDGET(menu)); - gtk_style_context_get(context, gtk_style_context_get_state(context), - "ythickness", &ythickness, NULL); + gdk_window_get_origin (gtk_widget_get_window(widget), x, y); gtk_tree_view_get_cursor (tv, &path, &col); gtk_tree_view_get_cell_area (tv, path, col, &rect); *x += rect.x+rect.width; - *y += rect.y+rect.height+ythickness; + *y += rect.y + rect.height; pidgin_menu_position_func_helper(menu, x, y, push_in, data); }