# HG changeset patch # User Sadrul Habib Chowdhury # Date 1157172027 0 # Node ID 76d345643ba4c2278a85d1789d77fc0d87efa762 # Parent e52d5626824ab6d58c59264d7b00835c331c259f [gaim-migrate @ 17123] Reverse the colors of the borders of a window when resizing or moving. committer: Tailor Script diff -r e52d5626824a -r 76d345643ba4 console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Sat Sep 02 01:25:43 2006 +0000 +++ b/console/libgnt/gntmain.c Sat Sep 02 04:40:27 2006 +0000 @@ -645,6 +645,41 @@ return FALSE; /* XXX: this should be TRUE */ } +static void +window_reverse(GntWidget *win, gboolean set) +{ + int i; + int w, h; + WINDOW *d; + + if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) + return; + + d = dupwin(win->window); + gnt_widget_get_size(win, &w, &h); + +#define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) + + /* the top and bottom */ + for (i = 0; i < w; i++) { + chtype ch = mvwinch(d, 0, i); + mvwaddch(win->window, 0, i, DECIDE(ch)); + ch = mvwinch(d, h-1, i); + mvwaddch(win->window, h-1, i, DECIDE(ch)); + } + + /* the left an right */ + for (i = 0; i < h; i++) { + chtype ch = mvwinch(d, i, 0); + mvwaddch(win->window, i, 0, DECIDE(ch)); + ch = mvwinch(d, i, w-1); + mvwaddch(win->window, i, w-1, DECIDE(ch)); + } + + wrefresh(win->window); + delwin(d); +} + static gboolean io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) { @@ -728,6 +763,7 @@ { /* Move a window */ mode = GNT_KP_MODE_MOVE; + window_reverse(ordered->data, TRUE); } else if (strcmp(buffer + 1, "w") == 0 && focus_list) { @@ -744,6 +780,7 @@ { /* Resize window */ mode = GNT_KP_MODE_RESIZE; + window_reverse(ordered->data, TRUE); } else if (strcmp(buffer + 1, ",") == 0 && focus_list) { @@ -828,6 +865,7 @@ else if (*buffer == '\r') { mode = GNT_KP_MODE_NORMAL; + window_reverse(ordered->data, FALSE); } } else if (mode == GNT_KP_MODE_WINDOW_LIST && _list.window) @@ -848,10 +886,10 @@ } else if (mode == GNT_KP_MODE_RESIZE) { - if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) + if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) { mode = GNT_KP_MODE_NORMAL; - else if (buffer[0] == 27) - { + window_reverse(ordered->data, FALSE); + } else if (buffer[0] == 27) { GntWidget *widget = ordered->data; gboolean changed = FALSE; int width, height; @@ -888,6 +926,7 @@ if (changed) { gnt_screen_resize_widget(widget, width, height); + window_reverse(widget, TRUE); } } } @@ -1299,7 +1338,7 @@ win = action_list->window; tree = action_list->tree; - gnt_box_set_title(GNT_BOX(win), "Available Actions"); + gnt_box_set_title(GNT_BOX(win), "Actions"); GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); /* XXX: Do we really want this? */ gnt_tree_set_compare_func(GNT_TREE(tree), compare_action);