[Xfce4-commits] <midori:master> Use allocation accessor in katze utils
Christian Dywan
noreply at xfce.org
Fri Feb 19 19:08:05 CET 2010
Updating branch refs/heads/master
to 20602673fe923e572738ae143b7217fd0206a5aa (commit)
from fa66334289fe9281dcfa75255686ca909231b15b (commit)
commit 20602673fe923e572738ae143b7217fd0206a5aa
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Feb 19 17:22:34 2010 +0100
Use allocation accessor in katze utils
katze/katze-utils.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/katze/katze-utils.c b/katze/katze-utils.c
index 65b0763..21192d4 100644
--- a/katze/katze-utils.c
+++ b/katze/katze-utils.c
@@ -31,6 +31,7 @@
#if !GTK_CHECK_VERSION (2, 18, 0)
#define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt)
+ #define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation
#endif
static void
@@ -920,21 +921,24 @@ katze_widget_popup_position_menu (GtkMenu* menu,
{
gint wx, wy;
gint menu_width;
+ GtkAllocation allocation;
GtkRequisition menu_req;
GtkRequisition widget_req;
KatzePopupInfo* info = user_data;
GtkWidget* widget = info->widget;
gint widget_height;
+ gtk_widget_get_allocation (widget, &allocation);
+
/* Retrieve size and position of both widget and menu */
if (!gtk_widget_get_has_window (widget))
{
- gdk_window_get_position (widget->window, &wx, &wy);
- wx += widget->allocation.x;
- wy += widget->allocation.y;
+ gdk_window_get_position (gtk_widget_get_window (widget), &wx, &wy);
+ wx += allocation.x;
+ wy += allocation.y;
}
else
- gdk_window_get_origin (widget->window, &wx, &wy);
+ gdk_window_get_origin (gtk_widget_get_window (widget), &wx, &wy);
gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
gtk_widget_size_request (widget, &widget_req);
menu_width = menu_req.width;
@@ -945,7 +949,7 @@ katze_widget_popup_position_menu (GtkMenu* menu,
; /* Do nothing? */
else if (info->position == KATZE_MENU_POSITION_RIGHT)
{
- *x = wx + widget->allocation.width - menu_width;
+ *x = wx + allocation.width - menu_width;
*y = wy + widget_height;
} else if (info->position == KATZE_MENU_POSITION_LEFT)
{
More information about the Xfce4-commits
mailing list