comparison src/gtkimhtml.c @ 1955:9ed99b8c5c9c

[gaim-migrate @ 1965] gtkimhtml update. somewhat helps gtk2 porting. also makes it more efficient, though not faster. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 02 Jun 2001 02:04:06 +0000
parents d7cbedd1d651
children 0a3edeba05b6
comparison
equal deleted inserted replaced
1954:c15c3a3f6cd4 1955:9ed99b8c5c9c
1072 y = y - imhtml->tip_bit->font->ascent + imhtml->tip_bit->font->descent; 1072 y = y - imhtml->tip_bit->font->ascent + imhtml->tip_bit->font->descent;
1073 else 1073 else
1074 y = y + imhtml->tip_bit->font->ascent + imhtml->tip_bit->font->descent; 1074 y = y + imhtml->tip_bit->font->ascent + imhtml->tip_bit->font->descent;
1075 1075
1076 gtk_widget_set_usize (imhtml->tip_window, w, h); 1076 gtk_widget_set_usize (imhtml->tip_window, w, h);
1077 gtk_widget_popup (imhtml->tip_window, x, y); 1077 gtk_widget_set_uposition (imhtml->tip_window, x, y);
1078 gtk_widget_show (imhtml->tip_window);
1078 1079
1079 imhtml->tip_timer = 0; 1080 imhtml->tip_timer = 0;
1080 return FALSE; 1081 return FALSE;
1081 } 1082 }
1082 1083
1324 1325
1325 return TRUE; 1326 return TRUE;
1326 } 1327 }
1327 1328
1328 static void 1329 static void
1330 gtk_imhtml_adjustment_changed (GtkAdjustment *adjustment,
1331 GtkIMHtml *imhtml)
1332 {
1333 if (!GTK_WIDGET_MAPPED (imhtml))
1334 return;
1335
1336 gdk_window_clear (GTK_LAYOUT (imhtml)->bin_window);
1337 gtk_imhtml_draw_exposed (imhtml);
1338 }
1339
1340 static void
1329 gtk_imhtml_set_scroll_adjustments (GtkLayout *layout, 1341 gtk_imhtml_set_scroll_adjustments (GtkLayout *layout,
1330 GtkAdjustment *hadj, 1342 GtkAdjustment *hadj,
1331 GtkAdjustment *vadj) 1343 GtkAdjustment *vadj)
1332 { 1344 {
1333 if (parent_class->set_scroll_adjustments) 1345 gboolean need_adjust = FALSE;
1334 (* parent_class->set_scroll_adjustments) (layout, hadj, vadj); 1346
1347 g_return_if_fail (layout != NULL);
1348 g_return_if_fail (GTK_IS_IMHTML (layout));
1349
1350 if (hadj)
1351 g_return_if_fail (GTK_IS_ADJUSTMENT (hadj));
1352 else
1353 hadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
1354 if (vadj)
1355 g_return_if_fail (GTK_IS_ADJUSTMENT (vadj));
1356 else
1357 vadj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
1358
1359 if (layout->hadjustment && (layout->hadjustment != hadj)) {
1360 gtk_signal_disconnect_by_data (GTK_OBJECT (layout->hadjustment), layout);
1361 gtk_object_unref (GTK_OBJECT (layout->hadjustment));
1362 }
1363
1364 if (layout->vadjustment && (layout->vadjustment != vadj)) {
1365 gtk_signal_disconnect_by_data (GTK_OBJECT (layout->vadjustment), layout);
1366 gtk_object_unref (GTK_OBJECT (layout->vadjustment));
1367 }
1368
1369 if (layout->hadjustment != hadj) {
1370 layout->hadjustment = hadj;
1371 gtk_object_ref (GTK_OBJECT (layout->hadjustment));
1372 gtk_object_sink (GTK_OBJECT (layout->hadjustment));
1373
1374 gtk_signal_connect (GTK_OBJECT (layout->hadjustment), "value_changed",
1375 (GtkSignalFunc) gtk_imhtml_adjustment_changed, layout);
1376 need_adjust = TRUE;
1377 }
1378
1379 if (layout->vadjustment != vadj) {
1380 layout->vadjustment = vadj;
1381 gtk_object_ref (GTK_OBJECT (layout->vadjustment));
1382 gtk_object_sink (GTK_OBJECT (layout->vadjustment));
1383
1384 gtk_signal_connect (GTK_OBJECT (layout->vadjustment), "value_changed",
1385 (GtkSignalFunc) gtk_imhtml_adjustment_changed, layout);
1386 need_adjust = TRUE;
1387 }
1388
1389 if (need_adjust)
1390 gtk_imhtml_adjustment_changed (NULL, GTK_IMHTML (layout));
1335 } 1391 }
1336 1392
1337 static void 1393 static void
1338 gtk_imhtml_class_init (GtkIMHtmlClass *class) 1394 gtk_imhtml_class_init (GtkIMHtmlClass *class)
1339 { 1395 {