NeoMutt  2018-07-16 +952-a2da0a
Teaching an old dog new tricks
DOXYGEN
resize.c File Reference

GUI handle the resizing of the screen. More...

#include "config.h"
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include "mutt/mutt.h"
#include "mutt_curses.h"
#include "mutt_window.h"
+ Include dependency graph for resize.c:

Go to the source code of this file.

Functions

struct winsize mutt_get_winsize (void)
 Use an ioctl to get the window size. More...
 
void mutt_resize_screen (void)
 Update NeoMutt's opinion about the window size (CURSES) More...
 

Detailed Description

GUI handle the resizing of the screen.

Authors
  • Michael R. Elkins
  • Ivan J.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file resize.c.

Function Documentation

struct winsize mutt_get_winsize ( void  )

Use an ioctl to get the window size.

Return values
objWindow size

Definition at line 49 of file resize.c.

50 {
51  struct winsize w = { 0 };
52  int fd = open("/dev/tty", O_RDONLY);
53  if (fd != -1)
54  {
55  ioctl(fd, TIOCGWINSZ, &w);
56  close(fd);
57  }
58  return w;
59 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void mutt_resize_screen ( void  )

Update NeoMutt's opinion about the window size (CURSES)

Definition at line 98 of file resize.c.

99 {
100  struct winsize w = mutt_get_winsize();
101 
102  int screenrows = w.ws_row;
103  int screencols = w.ws_col;
104 
105  if (screenrows <= 0)
106  {
107  const char *cp = mutt_str_getenv("LINES");
108  if (cp && (mutt_str_atoi(cp, &screenrows) < 0))
109  screenrows = 24;
110  }
111 
112  if (screencols <= 0)
113  {
114  const char *cp = mutt_str_getenv("LINES");
115  if (cp && (mutt_str_atoi(cp, &screencols) < 0))
116  screencols = 80;
117  }
118 
119  resizeterm(screenrows, screencols);
121 }
int mutt_str_atoi(const char *str, int *dst)
Convert ASCII string to an integer.
Definition: string.c:262
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:1049
void mutt_window_reflow(void)
Resize the Windows to fit the screen.
Definition: mutt_window.c:222
struct winsize mutt_get_winsize(void)
Use an ioctl to get the window size.
Definition: resize.c:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function: