summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2015-09-17 13:41:40 -0400
committerWilliam Hua <william.hua@canonical.com>2015-09-17 13:58:24 -0400
commit5659206e76975e03bfe8505c0d1d2784a2ab3724 (patch)
tree5288431b0289eb43cabef8f5e4e05178f8a31dcd
parent74c370c8d644319f91459e9d045772ae0050fa55 (diff)
downloadgtk+-wip/attachment.tar.gz
gtkmenubutton: remove menu_position_up_down_func () and menu_position_side_func ()wip/attachment
-rw-r--r--gtk/gtkmenubutton.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 2e09649788..0913052099 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -237,145 +237,6 @@ gtk_menu_button_state_flags_changed (GtkWidget *widget,
}
static void
-menu_position_up_down_func (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- GtkMenuButton *menu_button)
-{
- GtkMenuButtonPrivate *priv = menu_button->priv;
- GtkWidget *widget = GTK_WIDGET (menu_button);
- GtkWidget *toplevel;
- GtkTextDirection direction;
- GdkRectangle monitor;
- gint monitor_num;
- GdkScreen *screen;
- GdkWindow *window;
- GtkAllocation menu_allocation, allocation, arrow_allocation;
- GtkAlign align;
-
- /* In the common case the menu button is showing a dropdown menu, set the
- * corresponding type hint on the toplevel, so the WM can omit the top side
- * of the shadows.
- */
- if (priv->arrow_type == GTK_ARROW_DOWN)
- {
- toplevel = gtk_widget_get_toplevel (priv->menu);
- gtk_window_set_type_hint (GTK_WINDOW (toplevel), GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU);
- }
-
- align = gtk_widget_get_halign (priv->menu);
- direction = gtk_widget_get_direction (widget);
- window = gtk_widget_get_window (priv->align_widget ? priv->align_widget : widget);
-
- screen = gtk_widget_get_screen (GTK_WIDGET (menu));
- monitor_num = gdk_screen_get_monitor_at_window (screen, window);
- if (monitor_num < 0)
- monitor_num = 0;
- gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
-
- gtk_widget_get_allocation (priv->align_widget ? priv->align_widget : widget, &allocation);
- gtk_widget_get_allocation (widget, &arrow_allocation);
- gtk_widget_get_allocation (priv->menu, &menu_allocation);
-
- gdk_window_get_origin (window, x, y);
- *x += allocation.x;
- *y += allocation.y;
-
- /* treat the default align value like START */
- if (align == GTK_ALIGN_FILL)
- align = GTK_ALIGN_START;
-
- if (align == GTK_ALIGN_CENTER)
- *x -= (menu_allocation.width - allocation.width) / 2;
- else if ((align == GTK_ALIGN_START && direction == GTK_TEXT_DIR_LTR) ||
- (align == GTK_ALIGN_END && direction == GTK_TEXT_DIR_RTL))
- *x += MAX (allocation.width - menu_allocation.width, 0);
- else if (menu_allocation.width > allocation.width)
- *x -= menu_allocation.width - allocation.width;
-
- if (priv->arrow_type == GTK_ARROW_UP && *y - menu_allocation.height >= monitor.y)
- {
- *y -= menu_allocation.height;
- }
- else
- {
- if ((*y + arrow_allocation.height + menu_allocation.height) <= monitor.y + monitor.height)
- *y += arrow_allocation.height;
- else if ((*y - menu_allocation.height) >= monitor.y)
- *y -= menu_allocation.height;
- else if (monitor.y + monitor.height - (*y + arrow_allocation.height) > *y)
- *y += arrow_allocation.height;
- else
- *y -= menu_allocation.height;
- }
-
- *push_in = FALSE;
-}
-
-static void
-menu_position_side_func (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- GtkMenuButton *menu_button)
-{
- GtkMenuButtonPrivate *priv = menu_button->priv;
- GtkAllocation allocation;
- GtkAllocation menu_allocation;
- GtkWidget *widget = GTK_WIDGET (menu_button);
- GdkRectangle monitor;
- gint monitor_num;
- GdkScreen *screen;
- GdkWindow *window;
- GtkAlign align;
- GtkTextDirection direction;
-
- window = gtk_widget_get_window (widget);
-
- direction = gtk_widget_get_direction (widget);
- align = gtk_widget_get_valign (GTK_WIDGET (menu));
- screen = gtk_widget_get_screen (GTK_WIDGET (menu));
- monitor_num = gdk_screen_get_monitor_at_window (screen, window);
- if (monitor_num < 0)
- monitor_num = 0;
- gdk_screen_get_monitor_workarea (screen, monitor_num, &monitor);
-
- gdk_window_get_origin (gtk_button_get_event_window (GTK_BUTTON (menu_button)), x, y);
-
- gtk_widget_get_allocation (widget, &allocation);
- gtk_widget_get_allocation (priv->menu, &menu_allocation);
-
- if ((priv->arrow_type == GTK_ARROW_RIGHT && direction == GTK_TEXT_DIR_LTR) ||
- (priv->arrow_type == GTK_ARROW_LEFT && direction == GTK_TEXT_DIR_RTL))
-
- {
- if (*x + allocation.width + menu_allocation.width <= monitor.x + monitor.width)
- *x += allocation.width;
- else
- *x -= menu_allocation.width;
- }
- else
- {
- if (*x - menu_allocation.width >= monitor.x)
- *x -= menu_allocation.width;
- else
- *x += allocation.width;
- }
-
- /* treat the default align value like START */
- if (align == GTK_ALIGN_FILL)
- align = GTK_ALIGN_START;
-
- if (align == GTK_ALIGN_CENTER)
- *y -= (menu_allocation.height - allocation.height) / 2;
- else if (align == GTK_ALIGN_END)
- *y -= menu_allocation.height - allocation.height;
-
- *push_in = FALSE;
-}
-
-static void
popup_menu (GtkMenuButton *menu_button,
GdkEvent *event)
{