This commit is contained in:
Dave Davenport 2016-02-19 20:08:14 +01:00
parent 6e3bb506de
commit 758d155a20
3 changed files with 8 additions and 22 deletions

View file

@ -510,13 +510,6 @@ void remove_pid_file ( int fd )
*/
int config_sanity_check ( Display *display )
{
if ( config.threads == 0 ) {
config.threads = 1;
long procs = sysconf ( _SC_NPROCESSORS_CONF );
if ( procs > 0 ) {
config.threads = MIN ( procs, 128l );
}
}
// If alternative row is not set, copy the normal background color.
// Do this at the beginning as we might use it in the error dialog.
if ( config.menu_bg_alt == NULL ) {

View file

@ -86,7 +86,6 @@ int return_code = EXIT_SUCCESS;
void process_result ( RofiViewState *state );
void process_result_error ( RofiViewState *state );
gboolean main_loop_x11_event_handler ( G_GNUC_UNUSED gpointer data );
void rofi_set_return_code ( int code )
{
@ -207,7 +206,6 @@ static void run_switcher ( ModeMode mode )
char *input = g_strdup ( config.filter );
__run_switcher_internal ( mode, input );
g_free ( input );
main_loop_x11_event_handler ( NULL );
}
void process_result ( RofiViewState *state )
{
@ -547,7 +545,7 @@ static void reload_configuration ()
/**
* Process X11 events in the main-loop (gui-thread) of the application.
*/
gboolean main_loop_x11_event_handler ( G_GNUC_UNUSED gpointer data )
static gboolean main_loop_x11_event_handler ( G_GNUC_UNUSED gpointer data )
{
RofiViewState *state = rofi_view_get_active ();
if ( state != NULL ) {
@ -645,14 +643,6 @@ static void error_trap_pop ( G_GNUC_UNUSED SnDisplay *display, Display *xdispl
--error_trap_depth;
}
static gboolean delayed_start ( G_GNUC_UNUSED gpointer data )
{
// Force some X Events to be handled.. seems the only way to get a reliable startup.
rofi_view_queue_redraw ();
main_loop_x11_event_handler ( NULL );
return FALSE;
}
static gboolean startup ( G_GNUC_UNUSED gpointer data )
{
TICK_N ( "Startup" );
@ -705,7 +695,6 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
}
if ( index >= 0 ) {
run_switcher ( index );
g_idle_add ( delayed_start, GINT_TO_POINTER ( index ) );
}
else {
fprintf ( stderr, "The %s switcher has not been enabled\n", sname );

View file

@ -69,8 +69,6 @@
// What todo with these.
extern Display *display;
extern SnLauncheeContext *sncontext;
// FIXME: remove
gboolean main_loop_x11_event_handler ( G_GNUC_UNUSED gpointer data );
GThreadPool *tpool = NULL;
@ -1712,7 +1710,6 @@ void rofi_view_error_dialog ( const char *msg, int markup )
sn_launchee_context_complete ( sncontext );
}
rofi_view_set_active ( state );
main_loop_x11_event_handler ( NULL );
}
void rofi_view_cleanup ()
@ -1745,6 +1742,13 @@ void rofi_view_cleanup ()
void rofi_view_workers_initialize ( void )
{
TICK_N ( "Setup Threadpool, start" );
if ( config.threads == 0 ) {
config.threads = 1;
long procs = sysconf ( _SC_NPROCESSORS_CONF );
if ( procs > 0 ) {
config.threads = MIN ( procs, 128l );
}
}
// Create thread pool
GError *error = NULL;
tpool = g_thread_pool_new ( rofi_view_call_thread, NULL, config.threads, FALSE, &error );