mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Undo gmainloop related changes
Revert "Merge pull request #1943 from H3rnand3zzz/gmainloop This reverts commit609fde0998
, reversing changes made to2ec94064ed
. Revert "Merge pull request #1948 from H3rnand3zzz/fix/rl-less-refreshes" This reverts commit11762fd2b0
, reversing changes made to609fde0998
. We have got several issues, that we don't quite see how to solve, with the merge of the gmainloop PR. * Slashguard is broken (#1955) (though #1956 could fix that) * One person reported problems with copy paste selection via mouse * Some input buffer seems not to be cleared correctly It happened that I was debugging profanity used `/connect` and typed the password. I then debugged so long that a time out occurred, so profanity disconnected. Then it printed "unknown command: $password". There was something else that I forgot now. Bottomline is: so far we didn't get it right so we will undo these changes until someone proposes a working solution. We got a slight performance increase (apparently noticable when alt+mouse scrolling) but got too many issues with this change.
This commit is contained in:
parent
569e37f018
commit
88b26cfdb9
@ -130,7 +130,6 @@ unittest_sources = \
|
|||||||
tests/unittests/xmpp/stub_xmpp.c \
|
tests/unittests/xmpp/stub_xmpp.c \
|
||||||
tests/unittests/xmpp/stub_message.c \
|
tests/unittests/xmpp/stub_message.c \
|
||||||
tests/unittests/ui/stub_ui.c tests/unittests/ui/stub_ui.h \
|
tests/unittests/ui/stub_ui.c tests/unittests/ui/stub_ui.h \
|
||||||
tests/unittests/ui/stub_inputwin.c tests/unittests/ui/stub_inputwin.h \
|
|
||||||
tests/unittests/ui/stub_vcardwin.c \
|
tests/unittests/ui/stub_vcardwin.c \
|
||||||
tests/unittests/log/stub_log.c \
|
tests/unittests/log/stub_log.c \
|
||||||
tests/unittests/chatlog/stub_chatlog.c \
|
tests/unittests/chatlog/stub_chatlog.c \
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
@ -61,7 +60,6 @@
|
|||||||
#include "command/cmd_defs.h"
|
#include "command/cmd_defs.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
#include "event/client_events.h"
|
#include "event/client_events.h"
|
||||||
#include "ui/inputwin.h"
|
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/window_list.h"
|
#include "ui/window_list.h"
|
||||||
#include "xmpp/resource.h"
|
#include "xmpp/resource.h"
|
||||||
@ -88,15 +86,15 @@
|
|||||||
static void _init(char* log_level, char* config_file, char* log_file, char* theme_name);
|
static void _init(char* log_level, char* config_file, char* log_file, char* theme_name);
|
||||||
static void _shutdown(void);
|
static void _shutdown(void);
|
||||||
static void _connect_default(const char* const account);
|
static void _connect_default(const char* const account);
|
||||||
static gboolean _main_update(gpointer data);
|
|
||||||
|
|
||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
static gboolean force_quit = FALSE;
|
static gboolean force_quit = FALSE;
|
||||||
GMainLoop* mainloop = NULL;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
prof_run(char* log_level, char* account_name, char* config_file, char* log_file, char* theme_name)
|
prof_run(char* log_level, char* account_name, char* config_file, char* log_file, char* theme_name)
|
||||||
{
|
{
|
||||||
|
gboolean cont = TRUE;
|
||||||
|
|
||||||
_init(log_level, config_file, log_file, theme_name);
|
_init(log_level, config_file, log_file, theme_name);
|
||||||
plugins_on_start();
|
plugins_on_start();
|
||||||
_connect_default(account_name);
|
_connect_default(account_name);
|
||||||
@ -107,24 +105,21 @@ prof_run(char* log_level, char* account_name, char* config_file, char* log_file,
|
|||||||
|
|
||||||
session_init_activity();
|
session_init_activity();
|
||||||
|
|
||||||
mainloop = g_main_loop_new(NULL, TRUE);
|
char* line = NULL;
|
||||||
g_timeout_add(1000 / 60, _main_update, NULL);
|
while (cont && !force_quit) {
|
||||||
inp_add_watch();
|
|
||||||
g_main_loop_run(mainloop);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
prof_set_quit(void)
|
|
||||||
{
|
|
||||||
force_quit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
_main_update(gpointer data)
|
|
||||||
{
|
|
||||||
log_stderr_handler();
|
log_stderr_handler();
|
||||||
session_check_autoaway();
|
session_check_autoaway();
|
||||||
|
|
||||||
|
line = inp_readline();
|
||||||
|
if (line) {
|
||||||
|
ProfWin* window = wins_get_current();
|
||||||
|
cont = cmd_process_input(window, line);
|
||||||
|
free(line);
|
||||||
|
line = NULL;
|
||||||
|
} else {
|
||||||
|
cont = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
otr_poll();
|
otr_poll();
|
||||||
#endif
|
#endif
|
||||||
@ -133,13 +128,16 @@ _main_update(gpointer data)
|
|||||||
session_process_events();
|
session_process_events();
|
||||||
iq_autoping_check();
|
iq_autoping_check();
|
||||||
ui_update();
|
ui_update();
|
||||||
chat_state_idle();
|
|
||||||
#ifdef HAVE_GTK
|
#ifdef HAVE_GTK
|
||||||
tray_update();
|
tray_update();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Always repeat
|
void
|
||||||
return TRUE;
|
prof_set_quit(void)
|
||||||
|
{
|
||||||
|
force_quit = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -44,6 +44,5 @@ void prof_run(char* log_level, char* account_name, char* config_file, char* log_
|
|||||||
void prof_set_quit(void);
|
void prof_set_quit(void);
|
||||||
|
|
||||||
extern pthread_mutex_t lock;
|
extern pthread_mutex_t lock;
|
||||||
extern GMainLoop* mainloop;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -171,41 +171,6 @@ create_input_window(void)
|
|||||||
_inp_win_update_virtual();
|
_inp_win_update_virtual();
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
_inp_callback(GIOChannel* source, GIOCondition condition, gpointer data)
|
|
||||||
{
|
|
||||||
rl_callback_read_char();
|
|
||||||
|
|
||||||
if (rl_line_buffer && rl_line_buffer[0] != '/' && rl_line_buffer[0] != '\0' && rl_line_buffer[0] != '\n') {
|
|
||||||
chat_state_activity();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_reset_idle_time();
|
|
||||||
|
|
||||||
if (inp_line) {
|
|
||||||
ProfWin* window = wins_get_current();
|
|
||||||
|
|
||||||
if (!cmd_process_input(window, inp_line))
|
|
||||||
g_main_loop_quit(mainloop);
|
|
||||||
|
|
||||||
free(inp_line);
|
|
||||||
inp_line = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
inp_add_watch(void)
|
|
||||||
{
|
|
||||||
GIOChannel* channel = g_io_channel_unix_new(fileno(rl_instream));
|
|
||||||
if (g_io_channel_set_encoding(channel, NULL, NULL) != G_IO_STATUS_NORMAL) {
|
|
||||||
log_error("cannot set NULL encoding");
|
|
||||||
}
|
|
||||||
|
|
||||||
g_io_add_watch(channel, G_IO_IN, _inp_callback, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
inp_readline(void)
|
inp_readline(void)
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,5 @@ void inp_win_resize(void);
|
|||||||
void inp_put_back(void);
|
void inp_put_back(void);
|
||||||
char* inp_get_password(void);
|
char* inp_get_password(void);
|
||||||
char* inp_get_line(void);
|
char* inp_get_line(void);
|
||||||
void inp_add_watch(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
void
|
|
||||||
inp_add_watch(void)
|
|
||||||
{
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
void inp_add_watch(void);
|
|
Loading…
Reference in New Issue
Block a user