Mercurial > pidgin.yaz
comparison console/libgnt/gntmain.c @ 14876:70623f0d5cdc
[gaim-migrate @ 17645]
Use terminfo/termcap information (from ncurses) as much as possible. There
still need to be some manual 'refinement' based on $TERM. I'll see if I
can get rid of those. Also, I am probably going to allow users to provide
information that terminfo can't provide, like the keycode for ctrl+up etc.
Let me know if any of the keybinding doesn't work.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 01 Nov 2006 03:38:23 +0000 |
parents | 3d1be4577fa9 |
children | 5228f8cf2a6a |
comparison
equal
deleted
inserted
replaced
14875:7357d46ba817 | 14876:70623f0d5cdc |
---|---|
820 if (!ret) | 820 if (!ret) |
821 { | 821 { |
822 if (buffer[0] == 27) | 822 if (buffer[0] == 27) |
823 { | 823 { |
824 /* Some special key has been pressed */ | 824 /* Some special key has been pressed */ |
825 if (strcmp(buffer+1, GNT_KEY_POPUP) == 0) | 825 if (strcmp(buffer, GNT_KEY_POPUP) == 0) |
826 {} | 826 {} |
827 else if (strcmp(buffer + 1, "c") == 0) | 827 else if (strcmp(buffer + 1, "c") == 0) |
828 { | 828 { |
829 /* Alt + c was pressed. I am going to use it to close a window. */ | 829 /* Alt + c was pressed. I am going to use it to close a window. */ |
830 if (ordered) | 830 if (ordered) |
904 GntWidget *widget = GNT_WIDGET(ordered->data); | 904 GntWidget *widget = GNT_WIDGET(ordered->data); |
905 | 905 |
906 gnt_widget_get_position(widget, &x, &y); | 906 gnt_widget_get_position(widget, &x, &y); |
907 gnt_widget_get_size(widget, &w, &h); | 907 gnt_widget_get_size(widget, &w, &h); |
908 | 908 |
909 if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) | 909 if (strcmp(buffer, GNT_KEY_LEFT) == 0) |
910 { | 910 { |
911 if (x > X_MIN) | 911 if (x > X_MIN) |
912 { | 912 { |
913 x--; | 913 x--; |
914 changed = TRUE; | 914 changed = TRUE; |
915 } | 915 } |
916 } | 916 } |
917 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) | 917 else if (strcmp(buffer, GNT_KEY_RIGHT) == 0) |
918 { | 918 { |
919 if (x + w < X_MAX) | 919 if (x + w < X_MAX) |
920 { | 920 { |
921 x++; | 921 x++; |
922 changed = TRUE; | 922 changed = TRUE; |
923 } | 923 } |
924 } | 924 } |
925 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) | 925 else if (strcmp(buffer, GNT_KEY_UP) == 0) |
926 { | 926 { |
927 if (y > Y_MIN) | 927 if (y > Y_MIN) |
928 { | 928 { |
929 y--; | 929 y--; |
930 changed = TRUE; | 930 changed = TRUE; |
931 } | 931 } |
932 } | 932 } |
933 else if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) | 933 else if (strcmp(buffer, GNT_KEY_DOWN) == 0) |
934 { | 934 { |
935 if (y + h < Y_MAX) | 935 if (y + h < Y_MAX) |
936 { | 936 { |
937 y++; | 937 y++; |
938 changed = TRUE; | 938 changed = TRUE; |
981 gboolean changed = FALSE; | 981 gboolean changed = FALSE; |
982 int width, height; | 982 int width, height; |
983 | 983 |
984 gnt_widget_get_size(widget, &width, &height); | 984 gnt_widget_get_size(widget, &width, &height); |
985 | 985 |
986 if (strcmp(buffer + 1, GNT_KEY_DOWN) == 0) | 986 if (strcmp(buffer, GNT_KEY_DOWN) == 0) |
987 { | 987 { |
988 if (widget->priv.y + height < Y_MAX) | 988 if (widget->priv.y + height < Y_MAX) |
989 { | 989 { |
990 height++; | 990 height++; |
991 changed = TRUE; | 991 changed = TRUE; |
992 } | 992 } |
993 } | 993 } |
994 else if (strcmp(buffer + 1, GNT_KEY_UP) == 0) | 994 else if (strcmp(buffer, GNT_KEY_UP) == 0) |
995 { | 995 { |
996 height--; | 996 height--; |
997 changed = TRUE; | 997 changed = TRUE; |
998 } | 998 } |
999 else if (strcmp(buffer + 1, GNT_KEY_LEFT) == 0) | 999 else if (strcmp(buffer, GNT_KEY_LEFT) == 0) |
1000 { | 1000 { |
1001 width--; | 1001 width--; |
1002 changed = TRUE; | 1002 changed = TRUE; |
1003 } | 1003 } |
1004 else if (strcmp(buffer + 1, GNT_KEY_RIGHT) == 0) | 1004 else if (strcmp(buffer, GNT_KEY_RIGHT) == 0) |
1005 { | 1005 { |
1006 if (widget->priv.x + width < X_MAX) | 1006 if (widget->priv.x + width < X_MAX) |
1007 { | 1007 { |
1008 width++; | 1008 width++; |
1009 changed = TRUE; | 1009 changed = TRUE; |