/**
* rofi
*
* MIT/X11 License
* Copyright (c) 2012 Sean Pringle <sean.pringle@gmail.com>
* Modified 2013-2017 Qball Cow <qball@gmpclient.org>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <time.h>
#include <locale.h>
#include <gmodule.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/xkb.h>
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-compose.h>
#include <xkbcommon/xkbcommon-x11.h>
#include <sys/types.h>
#include <glib-unix.h>
#include <libgwater-xcb.h>
#include "xcb-internal.h"
#include "xkb-internal.h"
#include "settings.h"
#include "mode.h"
#include "rofi.h"
#include "helper.h"
#include "widgets/textbox.h"
#include "x11-helper.h"
#include "xrmoptions.h"
#include "dialogs/dialogs.h"
#include "view.h"
#include "view-internal.h"
#include "gitconfig.h"
#include "theme.h"
#include "timings.h"
#include "default-theme.h"
// Plugin abi version.
// TODO: move this check to mode.c
#include "mode-private.h"
#define LOG_DOMAIN "Rofi"
// Pidfile.
char *pidfile = NULL;
const char *cache_dir = NULL;
/** List of error messages.*/
GList *list_of_error_msgs = NULL;
static void rofi_collect_modi_destroy ( void );
void rofi_add_error_message ( GString *str )
{
list_of_error_msgs = g_list_append ( list_of_error_msgs, str );
}
/** global structure holding the keyboard status */
struct xkb_stuff xkb = {
.xcb_connection = NULL,
.context = NULL,
.keymap = NULL,
.state = NULL,
.compose = {
.table = NULL,
.state = NULL
}
};
/** Path to the configuration file */
char *config_path = NULL;
/** Array holding all activated modi. */
Mode **modi = NULL;
/** List of (possibly uninitialized) modi's */
Mode ** available_modi = NULL;
/** Length of #num_available_modi */
unsigned int num_available_modi = 0;
/** Number of activated modi in #modi array */
unsigned int num_modi = 0;
/** Current selected mode */
unsigned int curr_switcher = 0;
/** Glib main loop. */
GMainLoop *main_loop = NULL;
/** GWater xcb source, signalling events from the X server */
GWaterXcbSource *main_loop_source = NULL;
/** Flag indicating we are in dmenu mode. */
static int dmenu_mode = FALSE;
/** Rofi's return code */
int return_code =