Mercurial > pidgin
comparison console/libgnt/gntmain.c @ 14415:76d345643ba4
[gaim-migrate @ 17123]
Reverse the colors of the borders of a window when resizing or moving.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 02 Sep 2006 04:40:27 +0000 |
parents | 8375ecb6152b |
children | 553bbd68387e |
comparison
equal
deleted
inserted
replaced
14414:e52d5626824a | 14415:76d345643ba4 |
---|---|
643 | 643 |
644 gnt_widget_clicked(ordered->data, event, x, y); | 644 gnt_widget_clicked(ordered->data, event, x, y); |
645 return FALSE; /* XXX: this should be TRUE */ | 645 return FALSE; /* XXX: this should be TRUE */ |
646 } | 646 } |
647 | 647 |
648 static void | |
649 window_reverse(GntWidget *win, gboolean set) | |
650 { | |
651 int i; | |
652 int w, h; | |
653 WINDOW *d; | |
654 | |
655 if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) | |
656 return; | |
657 | |
658 d = dupwin(win->window); | |
659 gnt_widget_get_size(win, &w, &h); | |
660 | |
661 #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) | |
662 | |
663 /* the top and bottom */ | |
664 for (i = 0; i < w; i++) { | |
665 chtype ch = mvwinch(d, 0, i); | |
666 mvwaddch(win->window, 0, i, DECIDE(ch)); | |
667 ch = mvwinch(d, h-1, i); | |
668 mvwaddch(win->window, h-1, i, DECIDE(ch)); | |
669 } | |
670 | |
671 /* the left an right */ | |
672 for (i = 0; i < h; i++) { | |
673 chtype ch = mvwinch(d, i, 0); | |
674 mvwaddch(win->window, i, 0, DECIDE(ch)); | |
675 ch = mvwinch(d, i, w-1); | |
676 mvwaddch(win->window, i, w-1, DECIDE(ch)); | |
677 } | |
678 | |
679 wrefresh(win->window); | |
680 delwin(d); | |
681 } | |
682 | |
648 static gboolean | 683 static gboolean |
649 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) | 684 io_invoke(GIOChannel *source, GIOCondition cond, gpointer null) |
650 { | 685 { |
651 char keys[256]; | 686 char keys[256]; |
652 gboolean ret = FALSE; | 687 gboolean ret = FALSE; |
726 } | 761 } |
727 else if (strcmp(buffer + 1, "m") == 0 && focus_list) | 762 else if (strcmp(buffer + 1, "m") == 0 && focus_list) |
728 { | 763 { |
729 /* Move a window */ | 764 /* Move a window */ |
730 mode = GNT_KP_MODE_MOVE; | 765 mode = GNT_KP_MODE_MOVE; |
766 window_reverse(ordered->data, TRUE); | |
731 } | 767 } |
732 else if (strcmp(buffer + 1, "w") == 0 && focus_list) | 768 else if (strcmp(buffer + 1, "w") == 0 && focus_list) |
733 { | 769 { |
734 /* Window list */ | 770 /* Window list */ |
735 mode = GNT_KP_MODE_WINDOW_LIST; | 771 mode = GNT_KP_MODE_WINDOW_LIST; |
742 } | 778 } |
743 else if (strcmp(buffer + 1, "r") == 0 && focus_list) | 779 else if (strcmp(buffer + 1, "r") == 0 && focus_list) |
744 { | 780 { |
745 /* Resize window */ | 781 /* Resize window */ |
746 mode = GNT_KP_MODE_RESIZE; | 782 mode = GNT_KP_MODE_RESIZE; |
783 window_reverse(ordered->data, TRUE); | |
747 } | 784 } |
748 else if (strcmp(buffer + 1, ",") == 0 && focus_list) | 785 else if (strcmp(buffer + 1, ",") == 0 && focus_list) |
749 { | 786 { |
750 /* Re-order the list of windows */ | 787 /* Re-order the list of windows */ |
751 shift_window(ordered->data, -1); | 788 shift_window(ordered->data, -1); |
826 } | 863 } |
827 } | 864 } |
828 else if (*buffer == '\r') | 865 else if (*buffer == '\r') |
829 { | 866 { |
830 mode = GNT_KP_MODE_NORMAL; | 867 mode = GNT_KP_MODE_NORMAL; |
868 window_reverse(ordered->data, FALSE); | |
831 } | 869 } |
832 } | 870 } |
833 else if (mode == GNT_KP_MODE_WINDOW_LIST && _list.window) | 871 else if (mode == GNT_KP_MODE_WINDOW_LIST && _list.window) |
834 { | 872 { |
835 gnt_widget_key_pressed(_list.window, buffer); | 873 gnt_widget_key_pressed(_list.window, buffer); |
846 action_list = NULL; | 884 action_list = NULL; |
847 } | 885 } |
848 } | 886 } |
849 else if (mode == GNT_KP_MODE_RESIZE) | 887 else if (mode == GNT_KP_MODE_RESIZE) |
850 { | 888 { |
851 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) | 889 if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) { |
852 mode = GNT_KP_MODE_NORMAL; | 890 mode = GNT_KP_MODE_NORMAL; |
853 else if (buffer[0] == 27) | 891 window_reverse(ordered->data, FALSE); |
854 { | 892 } else if (buffer[0] == 27) { |
855 GntWidget *widget = ordered->data; | 893 GntWidget *widget = ordered->data; |
856 gboolean changed = FALSE; | 894 gboolean changed = FALSE; |
857 int width, height; | 895 int width, height; |
858 | 896 |
859 gnt_widget_get_size(widget, &width, &height); | 897 gnt_widget_get_size(widget, &width, &height); |
886 } | 924 } |
887 | 925 |
888 if (changed) | 926 if (changed) |
889 { | 927 { |
890 gnt_screen_resize_widget(widget, width, height); | 928 gnt_screen_resize_widget(widget, width, height); |
929 window_reverse(widget, TRUE); | |
891 } | 930 } |
892 } | 931 } |
893 } | 932 } |
894 | 933 |
895 return TRUE; | 934 return TRUE; |
1297 setup__list(); | 1336 setup__list(); |
1298 action_list = &_list; | 1337 action_list = &_list; |
1299 win = action_list->window; | 1338 win = action_list->window; |
1300 tree = action_list->tree; | 1339 tree = action_list->tree; |
1301 | 1340 |
1302 gnt_box_set_title(GNT_BOX(win), "Available Actions"); | 1341 gnt_box_set_title(GNT_BOX(win), "Actions"); |
1303 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); | 1342 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); |
1304 /* XXX: Do we really want this? */ | 1343 /* XXX: Do we really want this? */ |
1305 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); | 1344 gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); |
1306 | 1345 |
1307 for (iter = actions; iter; iter = iter->next) { | 1346 for (iter = actions; iter; iter = iter->next) { |