1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

remove broken dummy mode

This commit is contained in:
ailin-nemui 2016-08-12 19:33:56 +02:00
parent 61fa6eb35b
commit de11e0f4f2
4 changed files with 35 additions and 160 deletions

View File

@ -51,9 +51,6 @@ use
.I HOSTNAME
for your irc session
.TP
.BI "\-d, \-\-dummy"
use dummy terminal mode
.TP
.BI "\-v, \-\-version"
display the version of Irssi
.TP

View File

@ -41,7 +41,6 @@ irssi_SOURCES = \
statusbar-config.c \
statusbar-items.c \
term.c \
term-dummy.c \
$(use_term_sources) \
textbuffer.c \
textbuffer-commands.c \

View File

@ -74,10 +74,7 @@ void mainwindow_activity_deinit(void);
void mainwindows_layout_init(void);
void mainwindows_layout_deinit(void);
void term_dummy_init(void);
void term_dummy_deinit(void);
static int dirty, full_redraw, dummy;
static int dirty, full_redraw;
static GMainLoop *main_loop;
int quitting;
@ -122,7 +119,7 @@ void irssi_set_dirty(void)
static void dirty_check(void)
{
if (!dirty || dummy)
if (!dirty)
return;
term_resize_dirty();
@ -171,27 +168,22 @@ static void textui_finish_init(void)
{
quitting = FALSE;
if (dummy)
term_dummy_init();
else {
term_refresh_freeze();
textbuffer_init();
textbuffer_view_init();
textbuffer_commands_init();
gui_expandos_init();
gui_printtext_init();
gui_readline_init();
lastlog_init();
mainwindows_init();
mainwindow_activity_init();
mainwindows_layout_init();
gui_windows_init();
statusbar_init();
term_refresh_thaw();
term_refresh_freeze();
textbuffer_init();
textbuffer_view_init();
textbuffer_commands_init();
gui_expandos_init();
gui_printtext_init();
gui_readline_init();
lastlog_init();
mainwindows_init();
mainwindow_activity_init();
mainwindows_layout_init();
gui_windows_init();
statusbar_init();
term_refresh_thaw();
/* don't check settings with dummy mode */
settings_check();
}
settings_check();
module_register("core", "fe-text");
@ -233,25 +225,21 @@ static void textui_deinit(void)
dirty_check(); /* one last time to print any quit messages */
signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
if (dummy)
term_dummy_deinit();
else {
lastlog_deinit();
statusbar_deinit();
gui_printtext_deinit();
gui_readline_deinit();
gui_windows_deinit();
mainwindows_layout_deinit();
mainwindow_activity_deinit();
mainwindows_deinit();
gui_expandos_deinit();
textbuffer_commands_deinit();
textbuffer_view_deinit();
textbuffer_deinit();
lastlog_deinit();
statusbar_deinit();
gui_printtext_deinit();
gui_readline_deinit();
gui_windows_deinit();
mainwindows_layout_deinit();
mainwindow_activity_deinit();
mainwindows_deinit();
gui_expandos_deinit();
textbuffer_commands_deinit();
textbuffer_view_deinit();
textbuffer_deinit();
term_refresh_thaw();
term_deinit();
}
term_refresh_thaw();
term_deinit();
theme_unregister();
@ -276,7 +264,6 @@ int main(int argc, char **argv)
{
static int version = 0;
static GOptionEntry options[] = {
{ "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, "Use the dummy terminal mode", NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL },
{ NULL }
};
@ -295,7 +282,6 @@ int main(int argc, char **argv)
srand(time(NULL));
dummy = FALSE;
quitting = FALSE;
core_preinit(argv[0]);
@ -319,9 +305,8 @@ int main(int argc, char **argv)
loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL);
textui_init();
if (!dummy && !term_init()) {
fprintf(stderr, "Can't initialize screen handling, quitting.\n");
fprintf(stderr, "You can still use the dummy mode with -d parameter\n");
if (!term_init()) {
fprintf(stderr, "Can't initialize screen handling.\n");
return 1;
}
@ -332,9 +317,9 @@ int main(int argc, char **argv)
/* Does the same as g_main_run(main_loop), except we
can call our dirty-checker after each iteration */
while (!quitting) {
if (!dummy) term_refresh_freeze();
term_refresh_freeze();
g_main_iteration(TRUE);
if (!dummy) term_refresh_thaw();
term_refresh_thaw();
if (reload_config) {
/* SIGHUP received, do /RELOAD */

View File

@ -1,106 +0,0 @@
/*
term-dummy.c : irssi
Copyright (C) 2001 Timo Sirainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "module.h"
#include "signals.h"
#include "fe-windows.h"
static int newline;
static GIOChannel *stdin_channel;
static int readtag;
static GString *input;
static void sig_gui_printtext(WINDOW_REC *window, void *fgcolor,
void *bgcolor, void *pflags,
char *str, void *level)
{
if (newline) {
newline = FALSE;
printf("\r");
}
printf("%s", str);
}
static void sig_gui_printtext_finished(WINDOW_REC *window)
{
printf("\n");
newline = TRUE;
}
static void sig_window_created(WINDOW_REC *window)
{
window->width = 80;
window->height = 25;
}
static void readline(void)
{
unsigned char buffer[128];
char *p;
int ret, i;
ret = read(0, buffer, sizeof(buffer));
if (ret == 0 || (ret == -1 && errno != EINTR)) {
/* lost terminal */
signal_emit("command quit", 1, "Lost terminal");
return;
}
for (i = 0; i < ret; i++)
g_string_append_c(input, buffer[i]);
p = strchr(input->str, '\n');
if (p != NULL) {
*p = '\0';
signal_emit("send command", 3, input->str,
active_win->active_server, active_win->active);
*p = '\n';
g_string_erase(input, 0, (int) (p-input->str)+1);
}
}
void term_dummy_init(void)
{
newline = TRUE;
input = g_string_new(NULL);
signal_add("gui print text", (SIGNAL_FUNC) sig_gui_printtext);
signal_add("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
signal_add("window created", (SIGNAL_FUNC) sig_window_created);
stdin_channel = g_io_channel_unix_new(0);
readtag = g_input_add_full(stdin_channel,
G_PRIORITY_HIGH, G_INPUT_READ,
(GInputFunction) readline, NULL);
g_io_channel_unref(stdin_channel);
}
void term_dummy_deinit(void)
{
signal_remove("gui print text", (SIGNAL_FUNC) sig_gui_printtext);
signal_remove("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
signal_remove("window created", (SIGNAL_FUNC) sig_window_created);
g_source_remove(readtag);
g_string_free(input, TRUE);
}