Commit Graph

1397 Commits

Author SHA1 Message Date
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