Skip to content
Permalink
Browse files

applet.c: Remove unused mate_panel_applet_position_menu ()

  • Loading branch information...
wmww authored and raveit65 committed Jan 26, 2019
1 parent d3ad5dc commit 3630b204548036d02abc663509b33ebe5797b3b3
Showing with 0 additions and 79 deletions.
  1. +0 −74 mate-panel/applet.c
  2. +0 −5 mate-panel/applet.h
@@ -636,80 +636,6 @@ mate_panel_applet_menu_set_recurse (GtkMenu *menu,
g_list_free (children);
}

void
mate_panel_applet_position_menu (GtkMenu *menu,
int *x,
int *y,
gboolean *push_in,
GtkWidget *applet)
{
GtkAllocation allocation;
GtkRequisition requisition;
GdkDevice *device;
GdkScreen *screen;
GtkWidget *parent;
int menu_x = 0;
int menu_y = 0;
int pointer_x;
int pointer_y;

parent = gtk_widget_get_parent (applet);

g_return_if_fail (PANEL_IS_WIDGET (parent));

screen = gtk_widget_get_screen (applet);

gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL);

gdk_window_get_origin (gtk_widget_get_window (applet), &menu_x, &menu_y);

device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (applet)));
gdk_window_get_device_position (gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL);

gtk_widget_get_allocation (applet, &allocation);

if (!gtk_widget_get_has_window (applet)) {
menu_x += allocation.x;
menu_y += allocation.y;
}

if (PANEL_WIDGET (parent)->orient == GTK_ORIENTATION_HORIZONTAL) {
if (gtk_widget_get_direction (GTK_WIDGET (menu)) != GTK_TEXT_DIR_RTL) {
if (pointer_x < allocation.width &&
requisition.width < pointer_x)
menu_x += MIN (pointer_x,
allocation.width - requisition.width);
} else {
menu_x += allocation.width - requisition.width;
if (pointer_x > 0 && pointer_x < allocation.width &&
pointer_x < allocation.width - requisition.width) {
menu_x -= MIN (allocation.width - pointer_x,
allocation.width - requisition.width);
}
}
menu_x = MIN (menu_x, WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.width);

if (menu_y > HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / 2)
menu_y -= requisition.height;
else
menu_y += allocation.height;
} else {
if (pointer_y < allocation.height &&
requisition.height < pointer_y)
menu_y += MIN (pointer_y, allocation.height - requisition.height);
menu_y = MIN (menu_y, HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.height);

if (menu_x > WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / 2)
menu_x -= requisition.width;
else
menu_x += allocation.width;
}

*x = menu_x;
*y = menu_y;
*push_in = FALSE;
}

static void
applet_show_menu (AppletInfo *info,
GdkEventButton *event)
@@ -111,11 +111,6 @@ void mate_panel_applet_menu_set_recurse (GtkMenu *menu,

gboolean mate_panel_applet_toggle_locked (AppletInfo *info);

void mate_panel_applet_position_menu (GtkMenu *menu,
int *x,
int *y,
gboolean *push_in,
GtkWidget *applet);
#ifdef __cplusplus
}
#endif

0 comments on commit 3630b20

Please sign in to comment.
You can’t perform that action at this time.