diff options
author | Sedat Dilek <sedat.dilek@gmail.com> | 2013-06-15 05:07:35 -0400 |
---|---|---|
committer | Yann E. MORIN <yann.morin.1998@free.fr> | 2013-06-16 05:09:56 -0400 |
commit | 851f665725581d02d48ffbca50240cda44d698d4 (patch) | |
tree | 37b5334076beafc4564697545bd676b3df2029cd /scripts/kconfig/lxdialog | |
parent | fbe98bb9ed3dae23e320c6b113e35f129538d14a (diff) |
kconfig/lxdialog: Add definitions for mininimum (re)size values
Commit c8dc68ad0fbd ("kconfig/lxdialog: support resize") added support
for resizing, but forgot to collect all hardcoded values at one single
place.
Also add a definition for the check for a minimum screen/window size
of 80x19.
[ ChangeLog v3:
* Rename MENU_{HEIGTH,WIDTH}_MIN -> MENUBOX_{HEIGTH,WIDTH}_MIN
ChangeLog v2:
* Rename WIN_{HEIGTH,WIDTH}_MIN -> WINDOW_{HEIGTH,WIDTH}_MIN
* Mention the check for a minimum screen/window size in the changelog
* Add a comment above the block of new definitions ]
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Acked-by: Wang YanQing <udknight@gmail.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-rw-r--r-- | scripts/kconfig/lxdialog/checklist.c | 4 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/dialog.h | 14 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/inputbox.c | 4 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/menubox.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/textbox.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/util.c | 2 | ||||
-rw-r--r-- | scripts/kconfig/lxdialog/yesno.c | 4 |
7 files changed, 23 insertions, 9 deletions
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index a2eb80fbc896..30340571190e 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c | |||
@@ -132,9 +132,9 @@ int dialog_checklist(const char *title, const char *prompt, int height, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | do_resize: | 134 | do_resize: |
135 | if (getmaxy(stdscr) < (height + 6)) | 135 | if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN)) |
136 | return -ERRDISPLAYTOOSMALL; | 136 | return -ERRDISPLAYTOOSMALL; |
137 | if (getmaxx(stdscr) < (width + 6)) | 137 | if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN)) |
138 | return -ERRDISPLAYTOOSMALL; | 138 | return -ERRDISPLAYTOOSMALL; |
139 | 139 | ||
140 | max_choice = MIN(list_height, item_count()); | 140 | max_choice = MIN(list_height, item_count()); |
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 1099337079b6..b4343d384926 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -200,6 +200,20 @@ int item_is_tag(char tag); | |||
200 | int on_key_esc(WINDOW *win); | 200 | int on_key_esc(WINDOW *win); |
201 | int on_key_resize(void); | 201 | int on_key_resize(void); |
202 | 202 | ||
203 | /* minimum (re)size values */ | ||
204 | #define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */ | ||
205 | #define CHECKLIST_WIDTH_MIN 6 | ||
206 | #define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */ | ||
207 | #define INPUTBOX_WIDTH_MIN 2 | ||
208 | #define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */ | ||
209 | #define MENUBOX_WIDTH_MIN 65 | ||
210 | #define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */ | ||
211 | #define TEXTBOX_WIDTH_MIN 8 | ||
212 | #define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */ | ||
213 | #define YESNO_WIDTH_MIN 4 | ||
214 | #define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */ | ||
215 | #define WINDOW_WIDTH_MIN 80 | ||
216 | |||
203 | int init_dialog(const char *backtitle); | 217 | int init_dialog(const char *backtitle); |
204 | void set_dialog_backtitle(const char *backtitle); | 218 | void set_dialog_backtitle(const char *backtitle); |
205 | void set_dialog_subtitles(struct subtitle_list *subtitles); | 219 | void set_dialog_subtitles(struct subtitle_list *subtitles); |
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index 21404a04d7c3..7b01add415a8 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
@@ -56,9 +56,9 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width | |||
56 | strcpy(instr, init); | 56 | strcpy(instr, init); |
57 | 57 | ||
58 | do_resize: | 58 | do_resize: |
59 | if (getmaxy(stdscr) <= (height - 2)) | 59 | if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN)) |
60 | return -ERRDISPLAYTOOSMALL; | 60 | return -ERRDISPLAYTOOSMALL; |
61 | if (getmaxx(stdscr) <= (width - 2)) | 61 | if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) |
62 | return -ERRDISPLAYTOOSMALL; | 62 | return -ERRDISPLAYTOOSMALL; |
63 | 63 | ||
64 | /* center dialog box on screen */ | 64 | /* center dialog box on screen */ |
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 48d382e7e374..00d28410adc9 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c | |||
@@ -193,7 +193,7 @@ int dialog_menu(const char *title, const char *prompt, | |||
193 | do_resize: | 193 | do_resize: |
194 | height = getmaxy(stdscr); | 194 | height = getmaxy(stdscr); |
195 | width = getmaxx(stdscr); | 195 | width = getmaxx(stdscr); |
196 | if (height < 15 || width < 65) | 196 | if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN) |
197 | return -ERRDISPLAYTOOSMALL; | 197 | return -ERRDISPLAYTOOSMALL; |
198 | 198 | ||
199 | height -= 4; | 199 | height -= 4; |
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index a48bb93e0907..907cdcb397c1 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -80,7 +80,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, | |||
80 | 80 | ||
81 | do_resize: | 81 | do_resize: |
82 | getmaxyx(stdscr, height, width); | 82 | getmaxyx(stdscr, height, width); |
83 | if (height < 8 || width < 8) | 83 | if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN) |
84 | return -ERRDISPLAYTOOSMALL; | 84 | return -ERRDISPLAYTOOSMALL; |
85 | if (initial_height != 0) | 85 | if (initial_height != 0) |
86 | height = initial_height; | 86 | height = initial_height; |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a0e97c299410..78fe4e9d8778 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -317,7 +317,7 @@ int init_dialog(const char *backtitle) | |||
317 | getyx(stdscr, saved_y, saved_x); | 317 | getyx(stdscr, saved_y, saved_x); |
318 | 318 | ||
319 | getmaxyx(stdscr, height, width); | 319 | getmaxyx(stdscr, height, width); |
320 | if (height < 19 || width < 80) { | 320 | if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) { |
321 | endwin(); | 321 | endwin(); |
322 | return -ERRDISPLAYTOOSMALL; | 322 | return -ERRDISPLAYTOOSMALL; |
323 | } | 323 | } |
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c index 4e6e8090c20b..abb0c392e01b 100644 --- a/scripts/kconfig/lxdialog/yesno.c +++ b/scripts/kconfig/lxdialog/yesno.c | |||
@@ -45,9 +45,9 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) | |||
45 | WINDOW *dialog; | 45 | WINDOW *dialog; |
46 | 46 | ||
47 | do_resize: | 47 | do_resize: |
48 | if (getmaxy(stdscr) < (height + 4)) | 48 | if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN)) |
49 | return -ERRDISPLAYTOOSMALL; | 49 | return -ERRDISPLAYTOOSMALL; |
50 | if (getmaxx(stdscr) < (width + 4)) | 50 | if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) |
51 | return -ERRDISPLAYTOOSMALL; | 51 | return -ERRDISPLAYTOOSMALL; |
52 | 52 | ||
53 | /* center dialog box on screen */ | 53 | /* center dialog box on screen */ |