diff src/audacious/ui_preferences.c @ 4513:867d7caeb95b

- indentation of ui_main.c - moving around some functions and removing some (unused) ones
author mf0102 <0102@gmx.at>
date Tue, 22 Apr 2008 18:27:57 +0200
parents 5125b5910d0e
children b3e4f5c31546
line wrap: on
line diff
--- a/src/audacious/ui_preferences.c	Tue Apr 22 17:45:49 2008 +0200
+++ b/src/audacious/ui_preferences.c	Tue Apr 22 18:27:57 2008 +0200
@@ -97,6 +97,11 @@
     const gchar *tag;
 } TitleFieldTag;
 
+typedef struct {
+    gint x;
+    gint y;
+} MenuPos;
+
 static GtkWidget *prefswin = NULL;
 static GtkWidget *filepopup_settings = NULL;
 static GtkWidget *colorize_settings = NULL;
@@ -562,6 +567,24 @@
 }
 
 static void
+util_menu_position(GtkMenu * menu, gint * x, gint * y,
+                   gboolean * push_in, gpointer data)
+{
+    GtkRequisition requisition;
+    gint screen_width;
+    gint screen_height;
+    MenuPos *pos = data;
+
+    gtk_widget_size_request(GTK_WIDGET(menu), &requisition);
+
+    screen_width = gdk_screen_width();
+    screen_height = gdk_screen_height();
+
+    *x = CLAMP(pos->x - 2, 0, MAX(0, screen_width - requisition.width));
+    *y = CLAMP(pos->y - 2, 0, MAX(0, screen_height - requisition.height));
+}
+
+static void
 on_titlestring_help_button_clicked(GtkButton * button,
                                    gpointer data) 
 {