Commit Graph

1505 Commits

Author SHA1 Message Date
Mooffie
306b30ed30 Ticket #3687: store the 'hotlist' file in data dir, not config dir.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:48:02 +03:00
Andrew Borodin
8002e52293 (mc_config_init_config_paths): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Andrew Borodin
496abc0e1f Rename mc_config_get_profile_root() to mc_get_profile_root()
...and move it out from lib/mcconfig.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-12-04 09:37:50 +03:00
Mooffie
239a8d0117 Ticket #3684: replace $MC_HOME with $MC_PROFILE_ROOT, a better "profile" mechanism.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-29 11:10:19 +03:00
Mooffie
e68f105e0e Ticket #3718: Options/Layout/Equal split gets reverted.
WRadio sends MSG_NOTIFY with MSG_KEY as parameter to it's owner
when selected item is changed.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-24 09:41:07 +03:00
Mooffie
7f81194304 (mc_search_run): document the return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
2356acc26d NULL-ize some variables to make unit tests happy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
9a39e35dc3 Use g_assert() instead of assert(3).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
eec71bccff Ticket #3703: fix potential NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andrew Borodin
0e2833e398 MSG_INIT is handled by default.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
9c43890f0d (my_systemv): cleanup unreachable-code warning.
Compiler with my_exit() 'noreturn' knowledge will complain about
never reachable break statement.

Reported by clang compiler.

(Maybe there is a better code sequence)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
7e689e8e43 (vfs_die): cleanup no attribute noreturn warning.
utilvfs.c: In function 'vfs_die':
utilvfs.c:354:1: warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]
 vfs_die (const char *m)
 ^~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
b91ab44b43 (my_exit): cleanup no attribute noreturn warning.
utilunix.c:360:1: error: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:55 +03:00
Andreas Mohr
38fc00669d lib/serialize.c: cleanup -Wformat-signedness warning.
serialize.c: In function 'mc_serialize_str':
serialize.c:116:34: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
     return g_strdup_printf ("%c%zd" SRLZ_DELIM_S "%s", prefix, strlen (data), data);
                                  ^
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 5 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 6 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_serialize_str()"
                   ^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
                      FUNC_NAME
                      ^~~~~~~~~
serialize.c: In function 'mc_deserialize_config':
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:301:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:313:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 #define FUNC_NAME "mc_deserialize_config()"
                   ^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
     prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
                                   ^~~~~~~~~
serialize.c:325:17: note: in expansion of macro 'prepend_error_and_exit'
                 prepend_error_and_exit ();
                 ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
9df8bc2d12 (vfs_path_deserialize): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andrew Borodin
de0e960de5 (vfs_path_serialize): get rid of dynamic string allocation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Andreas Mohr
31b0bcd584 (mc_search__hex_translate_to_regex): cleanup -Wformat-signedness warning.
hex.c: In function 'mc_search__hex_translate_to_regex':
hex.c:79:39: error: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=]
         if (sscanf (tmp_str + loop, "%x%n", &val, &ptr))
                                                ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 13:12:54 +03:00
Egmont Koblinger
0cceb99c2e Ticket #3711: support color aliases in skin files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:52:37 +03:00
Andrew Borodin
4247120b4a (tty_init): support curses other than ncurses.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:46:18 +03:00
Andrew Borodin
787e24966d Ticket #3697: fix broken compatibility with ncurses.
Revert "Ticket #3665: fix compatibility with netbsd curses."

This reverts commit 38d4c655d3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-21 10:46:18 +03:00
Andrew Borodin
b19c336951 (parse_256_or_true_color_name): minor optimization.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 15:56:59 +03:00
Egmont Koblinger
31320b597c Ticket #3145: support for True Color (16 millions colors).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 15:56:59 +03:00
Andrew Borodin
5169a9dd95 Ticket #3714: (dialog_change_screen_size): fix dialog resizing order.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 12:36:57 +03:00
Mooffie
607eb74cbb Ticket #3721: clean up radio widget's MSG_CURSOR.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-13 12:31:47 +03:00
Andrew Borodin
83504f2bb5 Revert "(size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte)."
This reverts commit bae814d0d4.
2016-11-08 13:19:37 +03:00
Andrew Borodin
e3d457eb3d Revert "Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage."
This reverts commit 3024f309c2.
2016-11-08 13:19:29 +03:00
Michael Osipov
3024f309c2 Ticket #3666: (size_trunc_len): fix segfault because of small buffer usage.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-11-06 18:30:41 +03:00
Michael Osipov
bae814d0d4 (size_trunc_len): align to properly use either IEC or SI prefixes with the unit B (byte).
Additionally always put a space between number and unit which is
required by the norms.

It is important to note that really small buffers have to be bigger than it
appears because they store bytes and non-Latin scripts need more than one byte
with UTF-8 to encode them, e.g., the string "1023 МиБ" in Russian requires
11 bytes + null terminator.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Michael Osipov
b3867a6e15 Ticket #3666: Improper use of IEC and SI prefixes for size in size_trunc().
size_trunc() has been aligned to properly use either IEC or SI prefixes with
the unit B (byte). Additionally always put a space between number and unit
which is required by the norms.

Obsolete gettext message ids have been removed and some cleaned up for
duplicate words or leading spaces.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-26 13:33:12 +03:00
Andrew Borodin
716479ba4f Ticket #3700: fix segfault after switch left panel to info mode.
(widget_replace): if new widget cannot take focus, move focus to other widget
before widget replacement.

In our case, the focused file panel is replaced by Info one. Info panel
a) isn't selectable (it never takes focus) and b) uses CWD of current
panel. Therefore focus must be moved to other file panel to make it
current and correctly set up it's CWD before first draw of Info panel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-23 08:08:15 +03:00
Andrew Borodin
ef5f1fa3eb Ticket #3672: allow rebind TAB key to change panel.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-10-03 15:21:57 +03:00
Andrew Borodin
0cc22928af lib/widget/menu.c: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:52:07 +03:00
Andrew Borodin
36cc88b5f2 Reimplement widget focus/selection.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
599361b3fc (dlg_set_bottom_widget): rename to widget_set_bottom.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
d200893347 (dlg_select_widget): rename to widget_select.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
35451978f6 Rename WDialog APIs:
dlg_one_up -> dlg_select_prev_widget
dlg_one_down -> dlg_select_next_widget

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
b19ae2b938 Refactoring of change of current widget.
Add new WDialog APIs:

  * dlg_set_current_widget_next
  * dlg_set_current_widget_prev
  * dlg_get_widget_next_of
  * dlg_get_widget_prev_of

and use them:

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
47f9b77194 WMenuBar: remove WMenuBar::is_active. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
0df5ad5686 WInput: avoid double draw on resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
fd7c6c1c5d Menu: avoid double draw on resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
91c72122a8 (widget_set_size): send MSG_DRAW after MSG_RESIZE.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
240350db95 Refactoring of widget drawing to avoid multiple widget redraw.
Send MSG_DRAW message immediately after MSG_FOCUS/MSG_UNFOCUS.
Thus, the MSG_DRAW message handler is the only place where widget
should be drawn. Widget should not draw itself in other message
handlers.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:30:20 +03:00
Andrew Borodin
e1a2e8f8ec WButton: remove WButton::selected. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
ad166313a4 WListbox: remove WListbox::focused. Use WST_FOCUSED instead.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
c37f9b770a WST_FOCUSED: add new state and handle it.
Notify widget's owner that widget gets or loses focus.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
3debdac657 (menubar_callback): refactoring of menu draw after get focus and resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
41144d619c (widget_set_state): return cb_ret_t instead of gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
c90b806728 Don't focus widget that doesn't have the WOP_SELECTABLE option.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
a64a7ba2fa Use WOP_SELECTABLE option in menu.
If menu is not active, it is not selectable also in order to disallow
select and focus the inactive menu.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Andrew Borodin
5ac1c5a3e0 Ticket #2919: refactoring of focus/unfocus of widgets.
Initial step: add WOP_SELECTABLE option and set it up explicitly for
widgets that can be selected.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:26:00 +03:00
Mooffie
61f4ef98b9 lib/mcconfig/paths.c: reduce scope of 'homedir' var.
To ensure that nobody uses the 'homedir' variable in the future without
initializing it first, we make it private to the function, thereby effectively
removing it.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Mooffie
92889819ea lib/mcconfig/paths.c: cleanup.
We can conclude, by reading their GLib source[1], by their documentation,
and by looking at how popular programs use them[2], that the functions
g_get_user_{config,cache,data}_dir() don't return a NULL or empty string.
So the handling of this case can go.

[1] https://git.gnome.org/browse/glib/tree/glib/gutils.c
[2] E.g., google "g_get_user_data_dir".

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin
6127e5aea6 Get rid of #define const_cast(). 2016-09-11 11:11:01 +03:00
Andrew Borodin
b22e376abf Fix typos. 2016-09-11 11:11:01 +03:00
Andrew Borodin
0df9d1ce0b Define NCURSES_CONST if curses library doesn't define it.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Andrew Borodin
adc6bd83d6 (dlg_adjust_position): refactoring. 2016-09-11 11:11:01 +03:00
Andrew Borodin
fb4f4674c7 Ticket #3641: code cleanup before 4.8.18 release.
(dlg_adjust_position): don't change origin of non-centered dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-09-11 11:11:01 +03:00
Mooffie
4a0f265d95 Ticket #3075: (midnight_callback): make alt-enter, ctrl-enter, ctrl-shift-enter bindable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-08-04 10:23:29 +03:00
Andreas Mohr
b36cec44e3 Cleanup unused macros.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andreas Mohr
d013592eb4 (mc_search__translate_replace_glob_to_regex): cleanup compile warning.
glob.c:143:21: warning: implicit conversion loses integer precision: 'int' to 'char' [-Wconversion]
                c = ++cnt;
                  ~ ^~~~~
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
28e4dfd059 (mc_ctl): join conditions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
e2c62afcc7 (vfs_strip_suffix_from_filename): refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
b808dc564f lib/tty/key.h: remove declaration of unimplemented function.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
9f606a6668 (vfs_setup_cwd): move directory test to separate function. 2016-07-29 09:32:04 +03:00
Andrew Borodin
e07408e8c7 (check_callback): clean unneeded type casting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:32:04 +03:00
Andrew Borodin
b0e3552847 Refactoring of widget's position and size calculation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andrew Borodin
86fd77155e Refactoring of dialog's position and size calculation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
wwp
e629712197 Ticket #3562: fix Glib-critical asserts in empty WListbox.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andreas Mohr
e4badcf7bc (mc_search_set_error): cleanup compile warning on older gcc compilers:
search.c: In function 'mc_search_set_error':
search.c:497:36: error: declaration of 'mc_search' shadows a global declaration [-Werror=shadow]
search.c:419:1: error: shadowed declaration is here [-Werror=shadow]

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andreas Mohr
8710d2522f (variable_completion_function): cleanup Wconditional-uninitialized warning.
input_complete.c:383:42: error: variable 'p' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
        temp = g_string_new_len (*env_p, p - *env_p);
                                         ^

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
Andrew Borodin
c343697407 Minor refactoring of mc shutdown.
Move calls of disable_mouse() and disable_bracketed_paste()
to main() because init_mouse() and enable_bracketed_paste()
are called here.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:29:36 +03:00
rofl0r
38d4c655d3 Ticket #3665: fix compatibility with netbsd curses.
The code that manipulates the ncurses backend into changing
the key combination to generate SIGINT from CTRL-c to CTRL-g does
so by accessing undocumented internal ncurses data structures.
This breaks compilation with netbsd-curses[0], and could also break
when the ncurses author decides to change internal structures in a
future release.

Fix it by using a portable approach that works everywhere using libc
primitives instead.

[0] https://github.com/sabotage-linux/netbsd-curses

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-29 09:21:02 +03:00
Andrew Borodin
0c73ca195f Ticket #3660: unable to view archive content using F3.
(mc_popen): fix termination of command array.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-09 19:21:15 +03:00
Andrew Borodin
7c74fd90f0 Ticket #3661: wrong handling of mouse clicks in long listing mode.
This occurs if the left panel is in long listing mode and the right
panel is in full listing mode:
When the left panel is active and you click on the right side of the
panel, the click event is directed to the (inactive) right panel instead
of the (active) left panel.

This occurs if the right panel is in long listing mode:
When the left panel is active and you click on the left panel, the click
event is always directed to the (inactive) right panel. It's impossible
to click anything on the left panel, if the right panel is in long
listing mode.

Thanks Seray Rosh <seray.rosh@web.de> for intial patch.

Initial commit: refactoring of widget selection.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-07-09 19:13:20 +03:00
Andrew Borodin
76a4969b00 Ticket #3642: make --with-subshell=optional working again.
The bug was introduced in 83b02196c8.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-28 09:40:27 +03:00
Yuri Khan
968882335a Do not botch SIGWINCH delivery to the subshell.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-28 09:34:11 +03:00
Andrew Borodin
b4af91dfc0 Reorganize WDialog flags.
* DLG_FULLSCREEN: move and rename to WPOS_FULLSCREEN.
 * DLG_CENTER: move and rename to WPOS_CENTER.
 * DLG_TRYUP: move and rename to WPOS_TRYUP.
 * WDialog::fullscreen: remove, use WPOS_FULLSCREEN instead.
 * WDialog::compact: new field. Use instead of DLG_COMPACT.
 * WDialog:🎏 remove.
 * dlg_flags_t: remove.
 * dlg_create: add new agruments: pos_flags, compact. Remove
argument: flags.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:41:00 +03:00
Andrew Borodin
0933b08964 (dlg_set_position): minor refactoring.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
163d9cd94a Rename DLG_WANT_TAB to WOP_WANT_TAB and move it to widget_options_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
2dab74fddd By default, WOP_WANT_HOTKEY option is off.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
d44220c75f If widget wants cursor, define that explicitly.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
db0d01b9d6 Add WST_MODAL state.
* WDialog::modal: remove. Use WST_MODAL instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
fd4e56bf39 WOP_TOP_SELECT: new widget option
...to place widget on top of other widgets in dialog.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
4b72fb5f5e Join widget_state_t and dlg_state_t.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
0a2877edef Move WOP_WANT_IDLE option to widget_state_t flags
...and rename to WST_IDLE.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
b337287336 Move WOP_DISABLED option to widget_state_t flags
...and rename to WST_DISABLED.

  * Widget::state: new field.
  * (widget_set_state): new function.
  * (widget_set_options): symplify.
  * (input_set_options): remove.
  * MSG_ENABLE, MSG_DISABLE: new messages.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
a9fcd6c4c6 widget_state_t: new type.
(widget_get_state): new widget API.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
f5a1dfcef4 (widget_get_options): new widget API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
4a0cd948df Change prefix of widget options: W_ -> WOP_.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
619480c68b Ticket #3632: refactoring of widget flags.
Initial commit: rename functions:
  * widget_default_set_options_callback -> widget_default_set_options
  * input_set_options_callback -> input_set_options

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-06-02 20:34:38 +03:00
Andrew Borodin
44859027b4 Ticket #3646: Filtered View doesn't work.
The bug:
1. Go to the source directory for version 4.8.17.
2. Enter the command "ls -l misc/mc*". The output will show at least 7 files.
3. Start mc.
4. Press Meta-! to open the "Filtered View" dialogue box.
5. Enter the same command: "ls -l misc/mc*".
Result:
MC displays the following error:
"ls: cannot access misc/mc*: No such file or directory".

Fix:
(mc_popen): use popen(3) way: pass command to /bin/sh using the -c flag.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-28 08:16:31 +03:00
Andrew Borodin
7f8ab40a44 Do not recreate "String not found" error string every time.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-22 14:16:19 +03:00
Andrew Borodin
8252345666 Allow search be interruptible.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-22 14:16:19 +03:00
Andrew Borodin
1101ef2cd9 (mc_search__run_regex): minor optimization.
Since mc_search__run_regex() pften is called in various iterative
procedures, don't reallocate regex buffer every time and use already
allocated one before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-22 14:16:19 +03:00
Andrew Borodin
1c22d44970 Ticket #3637: fix memory leaks in search engine.
(mc_search_set_error): new search API to set the code and message
of search error.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-22 14:16:19 +03:00
Andreas Mohr
a31d6ac29e Replace obsolete INTLLIBS with LIBINTL for libmc
As per #3629, use `LIBINTL` for `gettext.m4` versions >= 0.11.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-05-07 16:28:47 +03:00
Andrew Borodin
3204563bff Move definition of reset_hp_softkeys variable to lib/tty/tty-slang.[ch].
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:28:47 +03:00
Andrew Borodin
bdb81cd482 Sync with gnulib 6ed53f13bc39d9a0252549e98a2a59441fb2351f.
lib/strutil/xstrtol.c: prohibit monstrosities like "1bB".

Problem reported by Young Mo Kang in: http://bugs.gnu.org/23388.

(xstrtoumax): Allow trailing second suffixes like "B" only if the first
suffix needs a base.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:28:47 +03:00
Andrew Borodin
abbfde35b2 lib/widget/input_complete.c: apply coding guidelines.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
1bfe137d2a (command_completion_function): cleanup cppcheck warning.
As other local functions use "text" as function parameter variable
to fix cppcheck warning:

[lib/widget/input_complete.c:569]: (error) Uninitialized variable: text

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
2151edaff2 Get rid of global variables mc_main_config and mc_panels_config.
Use mc_global.main_config and mc_global.panels_congig instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
1c2060c28f (mc_realpath): cleanup cppcheck warning.
Cleanup following cppcheck warnings:

[lib/utilunix.c:1109]: (style) Unused variable: link_path.
[lib/utilunix.c:1113]: (style) Variable 'readlinks' is assigned a value that is never used.
[lib/utilunix.c:1114]: (style) Unused variable: n.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
67035605b9 lib/vfs/direntry.c: cleanup cppcheck warnings.
Cleanup following cppcheck warnings:

[lib/vfs/direntry.c:121]: (style) Clarify calculation precedence for '&' and '?'.
[lib/vfs/direntry.c:386]: (style) Clarify calculation precedence for '&' and '?'.
[lib/vfs/direntry.c:391]: (style) Clarify calculation precedence for '&' and '?'.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
80f138c1ba (mc_shell_get_installed_in_system): fix description.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
eecf1fc946 Fix typo.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
cae521c61d Clarify type cast in tgetsrt() calls.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
ccad69bccf Clarify type cast in SLtt_tgetsrt() calls.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
dcf2ac11c1 (dlg_set_top_or_bottom_widget): move to proper file section.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
bc14ff44c8 Remove min() and max() macros. Use MIN() and MAX() macros from GLib.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
0641e942e5 (input_is_empty): new WInput API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
2d77cb32f9 lib/strutil/strutilutf8.c: grammar.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
eef076cef6 cppcheck: Cleanup Passing NULL after the last typed argument warning
Cleanup Passing NULL after the last typed argument warning.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
5a7d7d0087 (mouse_get_local): cleanup uninitialized warning.
Cleanup uninitialized warning with gcc compiler (gcc-4.4.7-4.el6).

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
8bb9605bfd VFS optimization: ret rid of double call of vfs_get_openfile() in file operations.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
623015eb0d (mc_closedir): fix NULL dereference.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andrew Borodin
a9e5957196 (mc_fstat): fix function used to set up of errno value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Andreas Mohr
284a19aff1 (find_widget_type): Make Solaris Studio happy
Make Solaris Studio 12.4 happy.

"dialog.c", line 1029: warning: argument #2 is incompatible with prototype:
        prototype: pointer to const void
        argument : pointer to function (...) returning enum (...)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-07 16:19:02 +03:00
Yuri Khan
c1975a3a35 Do not duplicate alternate screen switching.
S-Lang already handles that in SLsmg_init_smg() and SLsmg_reset_smg().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-05 10:01:13 +03:00
Yuri Khan
abb4996589 Ticket #3640: Subshell cursor position lost after window resizing.
Refactoring: rename functions:

do_enter_ca_mode -> tty_enter_ca_mode
do_exit_ca_mode -> tty_exit_ca_mode

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-05-05 10:01:13 +03:00
Yury V. Zaytsev
0430ec719b Add csh to the list of fallback shell options
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
2016-04-25 21:44:01 +02:00
Yury V. Zaytsev
6dfbebf71e Ticket #2742: detect csh as tcsh by name
Signed-off-by: Yury V. Zaytsev <yury.zaytsev@traveltainment.de>
2016-04-25 21:44:01 +02:00
Andrew Borodin
ba526badf2 (ST_BLKSIZE): fix signed and unsigned comparision.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-25 13:15:12 +03:00
Andrew Borodin
e7c01c7781 Ticket #2193: use Coreutils way to define buffer size to copy file.
m4.include/stat-size.m4, lib/stat-size.h: get these files from Gnulib.
src/filemanager/ioblksize.h: get this file from Coreutils.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-25 13:12:51 +03:00
Andrew Borodin
fde36f2d1a lib/charsets.[ch]: clarify usage of const qualifier.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
ff9d37cb8f lib/widget/input_complete.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andrew Borodin
ecfba8399c lib/widget/input.c: cleanup -Wcast-qual warning.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
68d7f53039 lib/widget/dialog.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
a5cd35d11e lib/widget/buttonbar.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
3231160d99 lib/vfs/path.c: cleanup some -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
9dddb0c78f lib/tty/tty-ncurses.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
983ada66b0 lib/tty/key.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andrew Borodin
41035995c8 lib/strutil/{strutil8bit.c,strutilutf8.c}: cleanup -Wcast-qual warning.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
c0b60e274e lib/skin/ini-file.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
f3f927c19e lib/search/regex.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:44 +03:00
Andreas Mohr
0535ddddcc lib/search/lib.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:43 +03:00
Andreas Mohr
97e370e396 lib/mcconfig/paths.c: cleanup -Wcast-qual warning.
Signed-off-by: Andreas Mohr <and@gmx.li>
2016-04-16 10:23:43 +03:00
Andreas Mohr
16f229114a Ticket #3598: cleanup some -Wcast-qual compiler warnings.
Introduce CONST_WIDGET helper and use it.

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-16 10:23:43 +03:00
Mooffie
438e841226 Rename mouse.was_drag to mouse.last_msg.
Get rid of the 'click' variable.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Andrew Borodin
8490ca7be4 Drop old mouse API and use the new one.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Mooffie
781b810c13 Fix menu handling.
We now send mouse events to widgets in reverse Z-order, as done in common GUIs.
This makes it easy to implement "invisible" menubars correctly.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Andrew Borodin
c9a437a9c2 Optimize menu activation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 15:29:55 +03:00
Andrew Borodin
fa4e69b3b4 WMenuBar: execute menu item after drag action.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Mooffie
cae293b4d7 WMenuBar: a few mouse handling fixes. 2016-04-01 14:16:08 +03:00
Andrew Borodin
d974021678 WMenuBar: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Andrew Borodin
e8c6608fa5 WRadio: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Andrew Borodin
ebac1745bc WInput: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Andrew Borodin
30a56a9793 WCheck: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Andrew Borodin
23d5dbdf94 WButtonBar: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Andrew Borodin
1401f751cb WListbox: optimize mouse event processing.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00
Mooffie
70184b8a2d WListbox: use the new mouse API.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-04-01 14:16:08 +03:00