PATCH: smart bonobo toolbar popup window.
- From: "Juan Pablo Mendoza M." <pablo_juan yahoo com>
- To: gnome-components-list gnome org
- Subject: PATCH: smart bonobo toolbar popup window.
- Date: Tue, 06 Feb 2001 22:16:45 -0700 (MST)
Saludos,
Some one already has looked at this patch ?
I resumit it again to apply in HEAD without warning.
I bee glad of rework the patch if you people don`t like the current
behavior, but i find annoying have to move a window in order to see the
toolbar popup window (because the windows is close to the screen border).
[sorry about the fucked english].
On Tue, 23 Jan 2001, Juan Pablo Mendoza M. wrote:
> Saludos,
>
> A little patch to make the toolbar popup window a little more smarter.
--
Juan Pablo Mendoza Mendoza. | "They killed Kenny!
pablo_juan yahoo com | THOSE BASTARDS!"
Index: bonobo-ui-toolbar.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-ui-toolbar.c,v
retrieving revision 1.42
diff -u -r1.42 bonobo-ui-toolbar.c
--- bonobo-ui-toolbar.c 2001/01/26 00:50:24 1.42
+++ bonobo-ui-toolbar.c 2001/02/07 04:53:45
@@ -315,10 +315,53 @@
}
static void
+popup_window_calc_uposition (BonoboUIToolbar *toolbar, int *x, int *y)
+{
+ BonoboUIToolbarPrivate *priv;
+ int popup_win_width, popup_win_height;
+ int screen_width, screen_height;
+ int popup_item_width, popup_item_height;
+ int popup_item_x, popup_item_y;
+
+ priv = toolbar->priv;
+
+ gtk_widget_realize (priv->popup_window);
+
+ gdk_window_get_origin (GTK_WIDGET (toolbar)->window, x, y);
+
+ screen_width = gdk_screen_width ();
+ screen_height = gdk_screen_height ();
+
+ popup_win_width = priv->popup_window->allocation.width;
+ popup_win_height = priv->popup_window->allocation.height;
+
+ popup_item_width = GTK_WIDGET(priv->popup_item)->allocation.width;
+ popup_item_height = GTK_WIDGET(priv->popup_item)->allocation.height;
+
+ popup_item_x = GTK_WIDGET(priv->popup_item)->allocation.x;
+ popup_item_y = GTK_WIDGET(priv->popup_item)->allocation.y;
+
+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
+ *x += popup_item_x - popup_win_width;
+ *y += popup_item_y + popup_item_height;
+ if (*x < 0)
+ *x = 0;
+ if (*y + popup_win_height > screen_height)
+ *y -= popup_item_y + popup_item_height + popup_win_height;
+ } else {
+ *x += popup_item_x + popup_item_width;
+ *y += popup_item_y - popup_win_height;
+ if (*x + popup_win_width > screen_width)
+ *x -= popup_item_x + popup_item_width + popup_win_width;
+ if (*y < 0)
+ *y = 0;
+ }
+}
+
+static void
show_popup_window (BonoboUIToolbar *toolbar)
{
BonoboUIToolbarPrivate *priv;
- const GtkAllocation *toolbar_allocation;
int x, y;
priv = toolbar->priv;
@@ -326,15 +369,8 @@
priv->items_moved_to_popup_window = TRUE;
create_popup_window (toolbar);
-
- gdk_window_get_origin (GTK_WIDGET (toolbar)->window, &x, &y);
-
- toolbar_allocation = & GTK_WIDGET (toolbar)->allocation;
- if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
- x += toolbar_allocation->x + toolbar_allocation->width;
- else
- y += toolbar_allocation->y + toolbar_allocation->height;
+ popup_window_calc_uposition (toolbar, &x, &y);
gtk_widget_set_uposition (GTK_WIDGET (priv->popup_window), x, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]