[Goodies-commits] r6846 - in xfce4-dict/trunk: . lib
Enrico Troeger
enrico at xfce.org
Thu Mar 5 10:55:06 CET 2009
Author: enrico
Date: 2009-03-05 09:55:05 +0000 (Thu, 05 Mar 2009)
New Revision: 6846
Modified:
xfce4-dict/trunk/ChangeLog
xfce4-dict/trunk/lib/gui.c
Log:
Don't allocate the default cursor unnecessarily and reuse the GdkWindow we already got in the event handlers.
Modified: xfce4-dict/trunk/ChangeLog
===================================================================
--- xfce4-dict/trunk/ChangeLog 2009-03-04 16:15:21 UTC (rev 6845)
+++ xfce4-dict/trunk/ChangeLog 2009-03-05 09:55:05 UTC (rev 6846)
@@ -1,3 +1,9 @@
+2009-03-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * Don't allocate the default cursor unnecessarily and reuse the
+ GdkWindow we already got in the event handlers.
+
+
2009-02-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* Print the used dictionary in the spell checker results.
Modified: xfce4-dict/trunk/lib/gui.c
===================================================================
--- xfce4-dict/trunk/lib/gui.c 2009-03-04 16:15:21 UTC (rev 6845)
+++ xfce4-dict/trunk/lib/gui.c 2009-03-05 09:55:05 UTC (rev 6846)
@@ -40,7 +40,6 @@
static gboolean hovering_over_link = FALSE;
static GdkCursor *hand_cursor = NULL;
-static GdkCursor *regular_cursor = NULL;
static gboolean entry_is_dirty = FALSE;
static const GdkColor error_color = { 0, 0x8000, 0, 0 }; /* dark red */
@@ -130,13 +129,13 @@
}
-static void textview_set_cursor_if_appropriate(GtkTextView *text_view, gint x, gint y)
+static void textview_set_cursor_if_appropriate(GtkTextView *view, gint x, gint y, GdkWindow *win)
{
GSList *tags = NULL, *tagp = NULL;
GtkTextIter iter;
gboolean hovering = FALSE;
- gtk_text_view_get_iter_at_location(text_view, &iter, x, y);
+ gtk_text_view_get_iter_at_location(view, &iter, x, y);
tags = gtk_text_iter_get_tags(&iter);
for (tagp = tags; tagp != NULL; tagp = tagp->next)
@@ -163,11 +162,9 @@
hovering_over_link = hovering;
if (hovering_over_link)
- gdk_window_set_cursor(gtk_text_view_get_window(
- text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
+ gdk_window_set_cursor(win, hand_cursor);
else
- gdk_window_set_cursor(gtk_text_view_get_window(
- text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
+ gdk_window_set_cursor(win, NULL);
}
if (tags)
@@ -182,7 +179,7 @@
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view), GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y);
- textview_set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), x, y);
+ textview_set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), x, y, event->window);
gdk_window_get_pointer(text_view->window, NULL, NULL, NULL);
@@ -199,7 +196,7 @@
gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view),
GTK_TEXT_WINDOW_WIDGET, wx, wy, &bx, &by);
- textview_set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), bx, by);
+ textview_set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), bx, by, event->window);
return FALSE;
}
@@ -515,9 +512,6 @@
{
if (hand_cursor)
gdk_cursor_unref(hand_cursor);
-
- if (regular_cursor)
- gdk_cursor_unref(regular_cursor);
}
@@ -649,7 +643,6 @@
/* support for links (cross-references) for dictd responses */
{
hand_cursor = gdk_cursor_new(GDK_HAND2);
- regular_cursor = gdk_cursor_new(GDK_XTERM);
g_signal_connect(dd->main_textview, "key-press-event",
G_CALLBACK(textview_key_press_event), dd);
More information about the Goodies-commits
mailing list