comparison src/gtkutils.c @ 11525:b47708f46a38

[gaim-migrate @ 13773] Here's the rest of that custom smiley receiving patch, with some changes from me. I'm still not all that happy with it, but that's probably not the author's fault, and I don't have time to take it further right now. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 12 Sep 2005 13:25:41 +0000
parents 17142948653e
children 8b494b5763c2
comparison
equal deleted inserted replaced
11524:4fd0c3a663b8 11525:b47708f46a38
55 55
56 #include "gtkconv.h" 56 #include "gtkconv.h"
57 #include "gtkdialogs.h" 57 #include "gtkdialogs.h"
58 #include "gtkimhtml.h" 58 #include "gtkimhtml.h"
59 #include "gtkimhtmltoolbar.h" 59 #include "gtkimhtmltoolbar.h"
60 #include "gtkthemes.h"
60 #include "gtkutils.h" 61 #include "gtkutils.h"
61 62
62 static guint accels_save_timer = 0; 63 static guint accels_save_timer = 0;
63 64
64 static gboolean 65 static gboolean
91 g_return_if_fail(GTK_IS_IMHTML(imhtml)); 92 g_return_if_fail(GTK_IS_IMHTML(imhtml));
92 93
93 g_signal_connect(G_OBJECT(imhtml), "url_clicked", 94 g_signal_connect(G_OBJECT(imhtml), "url_clicked",
94 G_CALLBACK(url_clicked_cb), NULL); 95 G_CALLBACK(url_clicked_cb), NULL);
95 96
96 smiley_themeize(imhtml); 97 gaim_gtkthemes_smiley_themeize(imhtml);
97 98
98 gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), &gtkimhtml_cbs); 99 gtk_imhtml_set_funcs(GTK_IMHTML(imhtml), &gtkimhtml_cbs);
99 } 100 }
100 101
101 GtkWidget * 102 GtkWidget *
239 label = gtk_label_new(str); 240 label = gtk_label_new(str);
240 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); 241 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
241 gtk_label_set_pattern(GTK_LABEL(label), "_"); 242 gtk_label_set_pattern(GTK_LABEL(label), "_");
242 gtk_container_add(GTK_CONTAINER(menuitem), label); 243 gtk_container_add(GTK_CONTAINER(menuitem), label);
243 gtk_widget_show(label); 244 gtk_widget_show(label);
244 /* FIXME: Go back and fix this 245 /* FIXME: Go back and fix this
245 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0], 246 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0],
246 GDK_MOD1_MASK, GTK_ACCEL_LOCKED); 247 GDK_MOD1_MASK, GTK_ACCEL_LOCKED);
247 */ 248 */
248 gaim_set_accessible_label (menuitem, label); 249 gaim_set_accessible_label (menuitem, label);
249 return menuitem; 250 return menuitem;
1204 gtk_widget_size_request (widget, &requisition); 1205 gtk_widget_size_request (widget, &requisition);
1205 1206
1206 monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); 1207 monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
1207 1208
1208 push_in = FALSE; 1209 push_in = FALSE;
1209 1210
1210 /* 1211 /*
1211 * The placement of popup menus horizontally works like this (with 1212 * The placement of popup menus horizontally works like this (with
1212 * RTL in parentheses) 1213 * RTL in parentheses)
1213 * 1214 *
1214 * - If there is enough room to the right (left) of the mouse cursor, 1215 * - If there is enough room to the right (left) of the mouse cursor,
1215 * position the menu there. 1216 * position the menu there.
1216 * 1217 *
1217 * - Otherwise, if if there is enough room to the left (right) of the 1218 * - Otherwise, if if there is enough room to the left (right) of the
1218 * mouse cursor, position the menu there. 1219 * mouse cursor, position the menu there.
1219 * 1220 *
1220 * - Otherwise if the menu is smaller than the monitor, position it 1221 * - Otherwise if the menu is smaller than the monitor, position it
1221 * on the side of the mouse cursor that has the most space available 1222 * on the side of the mouse cursor that has the most space available
1222 * 1223 *
1223 * - Otherwise (if there is simply not enough room for the menu on the 1224 * - Otherwise (if there is simply not enough room for the menu on the
1224 * monitor), position it as far left (right) as possible. 1225 * monitor), position it as far left (right) as possible.
1234 space_below = monitor.y + monitor.height - *y - 1; 1235 space_below = monitor.y + monitor.height - *y - 1;
1235 1236
1236 /* position horizontally */ 1237 /* position horizontally */
1237 1238
1238 /* the amount of space we need to position the menu. Note the 1239 /* the amount of space we need to position the menu. Note the
1239 * menu is offset "xthickness" pixels 1240 * menu is offset "xthickness" pixels
1240 */ 1241 */
1241 needed_width = requisition.width - xthickness; 1242 needed_width = requisition.width - xthickness;
1242 1243
1243 if (needed_width <= space_left || 1244 if (needed_width <= space_left ||
1244 needed_width <= space_right) 1245 needed_width <= space_right)
1298 { 1299 {
1299 if (needed_height <= space_below) 1300 if (needed_height <= space_below)
1300 *y = *y - ythickness; 1301 *y = *y - ythickness;
1301 else 1302 else
1302 *y = *y + ythickness - requisition.height + 1; 1303 *y = *y + ythickness - requisition.height + 1;
1303 1304
1304 *y = CLAMP (*y, monitor.y, 1305 *y = CLAMP (*y, monitor.y,
1305 monitor.y + monitor.height - requisition.height); 1306 monitor.y + monitor.height - requisition.height);
1306 } 1307 }
1307 else if (needed_height > space_below && needed_height > space_above) 1308 else if (needed_height > space_below && needed_height > space_above)
1308 { 1309 {