pidgin: 68170ae1: Update hardware cursor correctly.

sadrul at pidgin.im sadrul at pidgin.im
Sun Apr 5 04:25:39 EDT 2009


-----------------------------------------------------------------
Revision: 68170ae1f29540e16f4dec277f9447650bc2b84c
Ancestor: 061002cf5a01655976ebc13c0df0e62feb4186ac
Author: sadrul at pidgin.im
Date: 2009-04-05T08:22:22
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/68170ae1f29540e16f4dec277f9447650bc2b84c

Modified files:
        ChangeLog finch/libgnt/gntbox.c finch/libgnt/gntcheckbox.c
        finch/libgnt/gntcombobox.c finch/libgnt/gntentry.c
        finch/libgnt/gnttextview.c finch/libgnt/gnttree.c
        finch/libgnt/gntwm.c

ChangeLog: 

Update hardware cursor correctly.

-------------- next part --------------
============================================================
--- ChangeLog	8c14a412b8b1af3bff2ba00309953db890f4b398
+++ ChangeLog	9826f8504f58dfc0169082823bcdd57e24b79241
@@ -35,6 +35,10 @@ version 2.6.0 (??/??/2009):
 	* The New Account dialog is now broken into three tabs.  Proxy
 	  configuration has been moved from the Advanced tab to the new tab.
 
+	Finch:
+	* The hardware cursor is updated correctly. This will be useful
+	  especially for users of braille terminals, screen readers etc.
+
 version 2.5.5 (03/01/2009):
 	libpurple:
 	* Fix a crash when removing an account with an unknown protocol id.
============================================================
--- finch/libgnt/gntbox.c	4530ea159e8499872d4f07760efaaa439ec7d8f7
+++ finch/libgnt/gntbox.c	f5e9556c140cff7a623223a82ca70f8b1b5ac1b6
@@ -78,13 +78,11 @@ gnt_box_draw(GntWidget *widget)
 
 	g_list_foreach(box->list, (GFunc)gnt_widget_draw, NULL);
 
-	gnt_box_sync_children(box);
-
 	if (box->title && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
 	{
 		int pos, right;
 		char *title = g_strdup(box->title);
-		
+
 		get_title_thingies(box, title, &pos, &right);
 
 		if (gnt_widget_has_focus(widget))
@@ -96,8 +94,8 @@ gnt_box_draw(GntWidget *widget)
 		mvwaddch(widget->window, 0, right, ACS_LTEE | gnt_color_pair(GNT_COLOR_NORMAL));
 		g_free(title);
 	}
-	
-	GNTDEBUG;
+
+	gnt_box_sync_children(box);
 }
 
 static void
@@ -723,6 +721,9 @@ void gnt_box_sync_children(GntBox *box)
 	if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
 		pos = 0;
 
+	if (!box->active)
+		find_focusable_widget(box);
+
 	for (iter = box->list; iter; iter = iter->next)
 	{
 		GntWidget *w = GNT_WIDGET(iter->data);
@@ -764,6 +765,9 @@ void gnt_box_sync_children(GntBox *box)
 		copywin(w->window, widget->window, 0, 0,
 				y, x, y + height - 1, x + width - 1, FALSE);
 		gnt_widget_set_position(w, x + widget->priv.x, y + widget->priv.y);
+		if (w == box->active) {
+			wmove(widget->window, y + getcury(w->window), x + getcurx(w->window));
+		}
 	}
 }
 
============================================================
--- finch/libgnt/gntcheckbox.c	d01f639e77038f36a469bde84b31f96d23a426c8
+++ finch/libgnt/gntcheckbox.c	e69aa270183df03aa36e68e029244907cc58d98e
@@ -42,7 +42,7 @@ gnt_check_box_draw(GntWidget *widget)
 		type = GNT_COLOR_HIGHLIGHT;
 	else
 		type = GNT_COLOR_NORMAL;
-	
+
 	wbkgdset(widget->window, '\0' | gnt_color_pair(type));
 
 	text = g_strdup_printf("[%c]", cb->checked ? 'X' : ' ');
@@ -51,7 +51,8 @@ gnt_check_box_draw(GntWidget *widget)
 
 	wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
 	mvwaddstr(widget->window, 0, 4, GNT_BUTTON(cb)->priv->text);
-	
+	wmove(widget->window, 0, 1);
+
 	GNTDEBUG;
 }
 
============================================================
--- finch/libgnt/gntcombobox.c	59421d856192fd78ce26c72b3c910154559555ef
+++ finch/libgnt/gntcombobox.c	b9b7a42f1f149ca8d54907aa0173bdfc841014a0
@@ -73,7 +73,7 @@ gnt_combo_box_draw(GntWidget *widget)
 	char *text = NULL, *s;
 	GntColorType type;
 	int len;
-	
+
 	if (box->dropdown && box->selected)
 		text = gnt_tree_get_selection_text(GNT_TREE(box->dropdown));
 
@@ -94,6 +94,7 @@ gnt_combo_box_draw(GntWidget *widget)
 	whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len);
 	mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL));
 	mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL));
+	wmove(widget->window, 1, 1);
 
 	g_free(text);
 	GNTDEBUG;
============================================================
--- finch/libgnt/gntentry.c	9d78ca2490339ca80842826ed16a89c8a0411457
+++ finch/libgnt/gntentry.c	4610b8252b64d4d03f882f740359a263d6650526
@@ -271,6 +271,7 @@ gnt_entry_draw(GntWidget *widget)
 	GntEntry *entry = GNT_ENTRY(widget);
 	int stop;
 	gboolean focus;
+	int curpos;
 
 	if ((focus = gnt_widget_has_focus(widget)))
 		wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TEXT_NORMAL));
@@ -289,9 +290,10 @@ gnt_entry_draw(GntWidget *widget)
 	if (stop < widget->priv.width)
 		mvwhline(widget->window, 0, stop, ENTRY_CHAR, widget->priv.width - stop);
 
+	curpos = gnt_util_onscreen_width(entry->scroll, entry->cursor);
 	if (focus)
-		mvwchgat(widget->window, 0, gnt_util_onscreen_width(entry->scroll, entry->cursor),
-				1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
+		mvwchgat(widget->window, 0, curpos, 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
+	wmove(widget->window, 0, curpos);
 
 	GNTDEBUG;
 }
============================================================
--- finch/libgnt/gnttextview.c	efe7b3b8b88f454ca86a8a39eaf5c4327f9a0daf
+++ finch/libgnt/gnttextview.c	2351495d00157ac4683ba3e156668bcacf6dbdce
@@ -177,7 +177,7 @@ gnt_text_view_draw(GntWidget *widget)
 					gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
 	}
 
-	GNTDEBUG;
+	wmove(widget->window, 0, 0);
 }
 
 static void
============================================================
--- finch/libgnt/gnttree.c	dce44e6e27641c2ee6be3128ea8454c928a939c0
+++ finch/libgnt/gnttree.c	c17d41d8069417b8de91e41485c66a8029ebec02
@@ -420,6 +420,7 @@ redraw_tree(GntTree *tree)
 	GntTreeRow *row;
 	int pos, up, down = 0;
 	int rows, scrcol;
+	int current = 0;
 
 	if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED))
 		return;
@@ -518,6 +519,7 @@ redraw_tree(GntTree *tree)
 
 		if (row == tree->current)
 		{
+			current = i;
 			attr |= A_BOLD;
 			if (gnt_widget_has_focus(widget))
 				attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT);
@@ -606,6 +608,7 @@ redraw_tree(GntTree *tree)
 		mvwaddnstr(widget->window, widget->priv.height - pos - 1, pos,
 				tree->priv->search->str, str - tree->priv->search->str);
 	}
+	wmove(widget->window, current, pos);
 
 	gnt_widget_queue_update(widget);
 }
============================================================
--- finch/libgnt/gntwm.c	c6871df7990dfc9a49619b0f111ba336e336840a
+++ finch/libgnt/gntwm.c	4f248b7ab0b3d8d3d012f9657aab566e5c937dc6
@@ -135,6 +135,17 @@ gnt_wm_copy_win(GntWidget *widget, GntNo
 	src = widget->window;
 	dst = node->window;
 	copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0);
+
+	/* Update the hardware cursor */
+	if (GNT_IS_WINDOW(widget) || GNT_IS_BOX(widget)) {
+		GntWidget *active = GNT_BOX(widget)->active;
+		if (active) {
+			int curx = active->priv.x + getcurx(active->window);
+			int cury = active->priv.y + getcury(active->window);
+			if (wmove(node->window, cury - widget->priv.y, curx - widget->priv.x) != OK)
+				wmove(node->window, 0, 0);
+		}
+	}
 }
 
 /**
@@ -1101,8 +1112,8 @@ refresh_screen(GntBindable *bindable, GL
 
 	g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, GINT_TO_POINTER(TRUE));
 	g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
+	gnt_ws_draw_taskbar(wm->cws, TRUE);
 	update_screen(wm);
-	gnt_ws_draw_taskbar(wm->cws, TRUE);
 	curs_set(0);   /* endwin resets the cursor to normal */
 
 	return TRUE;
@@ -1872,8 +1883,8 @@ void gnt_wm_new_window(GntWM *wm, GntWid
 		}
 	}
 
+	gnt_ws_draw_taskbar(wm->cws, FALSE);
 	update_screen(wm);
-	gnt_ws_draw_taskbar(wm->cws, FALSE);
 }
 
 void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget)
@@ -1910,8 +1921,8 @@ void gnt_wm_window_close(GntWM *wm, GntW
 		}
 	}
 
+	gnt_ws_draw_taskbar(wm->cws, FALSE);
 	update_screen(wm);
-	gnt_ws_draw_taskbar(wm->cws, FALSE);
 }
 
 time_t gnt_wm_get_idle_time()
@@ -2181,8 +2192,8 @@ gnt_wm_give_focus(GntWM *wm, GntWidget *
 		GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window);
 		top_panel(nd->panel);
 	}
+	gnt_ws_draw_taskbar(wm->cws, FALSE);
 	update_screen(wm);
-	gnt_ws_draw_taskbar(wm->cws, FALSE);
 }
 
 void gnt_wm_update_window(GntWM *wm, GntWidget *widget)
@@ -2207,8 +2218,8 @@ void gnt_wm_update_window(GntWM *wm, Gnt
 
 	if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) {
 		gnt_wm_copy_win(widget, node);
+		gnt_ws_draw_taskbar(wm->cws, FALSE);
 		update_screen(wm);
-		gnt_ws_draw_taskbar(wm->cws, FALSE);
 	} else if (ws && ws != wm->cws && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_URGENT)) {
 		if (!act || (act && !g_list_find(act, ws)))
 			act = g_list_prepend(act, ws);


More information about the Commits mailing list