NeoMutt  2022-04-29-369-gff76d0
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 <unistd.h>
#include "mutt/lib.h"
#include "gui/lib.h"
+ Include dependency graph for resize.c:

Go to the source code of this file.

Functions

static struct winsize mutt_get_winsize (void)
 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

◆ mutt_get_winsize()

static struct winsize mutt_get_winsize ( void  )
static

Get the window size.

Return values
objWindow size

Definition at line 52 of file resize.c.

53{
54 struct winsize w = { 0 };
55
56 int fd = open("/dev/tty", O_RDONLY);
57 if (fd != -1)
58 {
59#ifdef HAVE_TCGETWINSIZE
60 tcgetwinsize(fd, &w);
61#else
62 ioctl(fd, TIOCGWINSZ, &w);
63#endif
64 close(fd);
65 }
66 return w;
67}
+ Here is the caller graph for this function:

◆ mutt_resize_screen()

void mutt_resize_screen ( void  )

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

Definition at line 72 of file resize.c.

73{
74 struct winsize w = mutt_get_winsize();
75
76 int screenrows = w.ws_row;
77 int screencols = w.ws_col;
78
79 if (screenrows <= 0)
80 {
81 const char *cp = mutt_str_getenv("LINES");
82 if (cp && !mutt_str_atoi_full(cp, &screenrows))
83 screenrows = 24;
84 }
85
86 if (screencols <= 0)
87 {
88 const char *cp = mutt_str_getenv("COLUMNS");
89 if (cp && !mutt_str_atoi_full(cp, &screencols))
90 screencols = 80;
91 }
92
93 resizeterm(screenrows, screencols);
94 rootwin_set_size(screencols, screenrows);
96}
const char * mutt_str_getenv(const char *name)
Get an environment variable.
Definition: string.c:927
void window_notify_all(struct MuttWindow *win)
Notify observers of changes to a Window and its children.
Definition: mutt_window.c:144
static struct winsize mutt_get_winsize(void)
Get the window size.
Definition: resize.c:52
void rootwin_set_size(int cols, int rows)
Set the dimensions of the Root Window.
Definition: rootwin.c:226
+ Here is the call graph for this function:
+ Here is the caller graph for this function: