comparison src/gtkblist.c @ 7662:63ac63ec4b46

[gaim-migrate @ 8306] Mac OS X already has drop shadows, and the drop shadows for the tooltips look kind of funny on OSX anyway... So this patch turns off drop shadows on OSX even if we're using Gtk2.2. At least, I assume it does, since I'm running 2.0 anyway. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Sat, 29 Nov 2003 17:03:21 +0000
parents 6db061321ec4
children 1d0314b99747
comparison
equal deleted inserted replaced
7661:11cf58db372e 7662:63ac63ec4b46
50 50
51 #include <gdk/gdkkeysyms.h> 51 #include <gdk/gdkkeysyms.h>
52 #include <gtk/gtk.h> 52 #include <gtk/gtk.h>
53 #include <gdk/gdk.h> 53 #include <gdk/gdk.h>
54 54
55 #if (GTK_CHECK_VERSION(2,2,0) && !(defined(__APPLE__) && defined(__MACH__)))
56 #define WANT_DROP_SHADOW
57 #endif
58
55 typedef struct 59 typedef struct
56 { 60 {
57 GaimAccount *account; 61 GaimAccount *account;
58 62
59 GtkWidget *window; 63 GtkWidget *window;
111 struct _gaim_gtk_blist_node { 115 struct _gaim_gtk_blist_node {
112 GtkTreeRowReference *row; 116 GtkTreeRowReference *row;
113 gboolean contact_expanded; 117 gboolean contact_expanded;
114 }; 118 };
115 119
116 #if GTK_CHECK_VERSION(2,2,0) 120 #ifdef WANT_DROP_SHADOW
117 /**************************** Weird drop shadow stuff *******************/ 121 /**************************** Weird drop shadow stuff *******************/
118 /* This is based on a patch for drop shadows in GTK menus available at http://www.xfce.org/gtkmenu-shadow/ */ 122 /* This is based on a patch for drop shadows in GTK menus available at http://www.xfce.org/gtkmenu-shadow/ */
119 123
120 enum side { 124 enum side {
121 EAST_SIDE, 125 EAST_SIDE,
1289 1293
1290 g_object_unref (pixbuf); 1294 g_object_unref (pixbuf);
1291 g_object_unref (layout); 1295 g_object_unref (layout);
1292 g_free(tooltiptext); 1296 g_free(tooltiptext);
1293 1297
1294 #if GTK_CHECK_VERSION(2,2,0) 1298 #ifdef WANT_DROP_SHADOW
1295 shadow_paint(gtkblist, NULL, EAST_SIDE); 1299 shadow_paint(gtkblist, NULL, EAST_SIDE);
1296 shadow_paint(gtkblist, NULL, SOUTH_SIDE); 1300 shadow_paint(gtkblist, NULL, SOUTH_SIDE);
1297 #endif 1301 #endif
1298 1302
1299 return; 1303 return;
1308 int scr_w,scr_h, w, h, x, y; 1312 int scr_w,scr_h, w, h, x, y;
1309 PangoLayout *layout; 1313 PangoLayout *layout;
1310 gboolean tooltip_top = FALSE; 1314 gboolean tooltip_top = FALSE;
1311 char *tooltiptext = NULL; 1315 char *tooltiptext = NULL;
1312 struct _gaim_gtk_blist_node *gtknode; 1316 struct _gaim_gtk_blist_node *gtknode;
1313 #if GTK_CHECK_VERSION(2,2,0) 1317 #ifdef WANT_DROP_SHADOW
1314 GdkWindowAttr attr; 1318 GdkWindowAttr attr;
1315 #endif 1319 #endif
1316 1320
1317 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL)) 1321 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL))
1318 return FALSE; 1322 return FALSE;
1365 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips"); 1369 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
1366 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event", 1370 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
1367 G_CALLBACK(gaim_gtk_blist_paint_tip), node); 1371 G_CALLBACK(gaim_gtk_blist_paint_tip), node);
1368 gtk_widget_ensure_style (gtkblist->tipwindow); 1372 gtk_widget_ensure_style (gtkblist->tipwindow);
1369 1373
1370 #if GTK_CHECK_VERSION(2,2,0) 1374 #ifdef WANT_DROP_SHADOW
1371 attr.window_type = GDK_WINDOW_TEMP; 1375 attr.window_type = GDK_WINDOW_TEMP;
1372 attr.override_redirect = TRUE; 1376 attr.override_redirect = TRUE;
1373 attr.x = gtkblist->tipwindow->allocation.x; 1377 attr.x = gtkblist->tipwindow->allocation.x;
1374 attr.y = gtkblist->tipwindow->allocation.y; 1378 attr.y = gtkblist->tipwindow->allocation.y;
1375 attr.width = gtkblist->tipwindow->allocation.width; 1379 attr.width = gtkblist->tipwindow->allocation.width;
1428 g_free(tooltiptext); 1432 g_free(tooltiptext);
1429 gtk_widget_set_size_request(gtkblist->tipwindow, w, h); 1433 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
1430 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y); 1434 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
1431 gtk_widget_show(gtkblist->tipwindow); 1435 gtk_widget_show(gtkblist->tipwindow);
1432 1436
1433 #if GTK_CHECK_VERSION(2,2,0) 1437 #ifdef WANT_DROP_SHADOW
1434 map_shadow_windows(gtkblist); 1438 map_shadow_windows(gtkblist);
1435 #endif 1439 #endif
1436 1440
1437 return FALSE; 1441 return FALSE;
1438 } 1442 }
1444 if ((event->y > gtkblist->tip_rect.y) && ((event->y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y)) 1448 if ((event->y > gtkblist->tip_rect.y) && ((event->y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y))
1445 return FALSE; 1449 return FALSE;
1446 /* We've left the cell. Remove the timeout and create a new one below */ 1450 /* We've left the cell. Remove the timeout and create a new one below */
1447 if (gtkblist->tipwindow) { 1451 if (gtkblist->tipwindow) {
1448 gtk_widget_destroy(gtkblist->tipwindow); 1452 gtk_widget_destroy(gtkblist->tipwindow);
1449 #if GTK_CHECK_VERSION(2,2,0) 1453 #ifdef WANT_DROP_SHADOW
1450 gdk_window_set_user_data (gtkblist->east_shadow, NULL); 1454 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
1451 gdk_window_destroy (gtkblist->east_shadow); 1455 gdk_window_destroy (gtkblist->east_shadow);
1452 gtkblist->east_shadow = NULL; 1456 gtkblist->east_shadow = NULL;
1453 1457
1454 gdk_window_set_user_data (gtkblist->south_shadow, NULL); 1458 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
1483 g_source_remove(gtkblist->timeout); 1487 g_source_remove(gtkblist->timeout);
1484 gtkblist->timeout = 0; 1488 gtkblist->timeout = 0;
1485 } 1489 }
1486 if (gtkblist->tipwindow) { 1490 if (gtkblist->tipwindow) {
1487 gtk_widget_destroy(gtkblist->tipwindow); 1491 gtk_widget_destroy(gtkblist->tipwindow);
1488 #if GTK_CHECK_VERSION(2,2,0) 1492 #ifdef WANT_DROP_SHADOW
1489 gdk_window_set_user_data (gtkblist->east_shadow, NULL); 1493 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
1490 gdk_window_destroy (gtkblist->east_shadow); 1494 gdk_window_destroy (gtkblist->east_shadow);
1491 gtkblist->east_shadow = NULL; 1495 gtkblist->east_shadow = NULL;
1492 1496
1493 gdk_window_set_user_data (gtkblist->south_shadow, NULL); 1497 gdk_window_set_user_data (gtkblist->south_shadow, NULL);