mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
[Build] Fix some compile warnings.
This commit is contained in:
parent
820b19e09a
commit
0e90fb065f
28 changed files with 1437 additions and 1507 deletions
|
@ -67,7 +67,7 @@ typedef char *(*_mode_get_display_value)(const Mode *sw,
|
||||||
*/
|
*/
|
||||||
typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
|
typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
|
||||||
unsigned int selected_line,
|
unsigned int selected_line,
|
||||||
int height);
|
unsigned int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
|
|
@ -139,7 +139,7 @@ char *mode_get_display_value(const Mode *mode, unsigned int selected_line,
|
||||||
* @returns allocated new cairo_surface_t if applicable
|
* @returns allocated new cairo_surface_t if applicable
|
||||||
*/
|
*/
|
||||||
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
||||||
int height);
|
unsigned int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
|
|
@ -144,7 +144,7 @@ void rofi_theme_property_free(Property *p);
|
||||||
*
|
*
|
||||||
* @returns a copy of p
|
* @returns a copy of p
|
||||||
*/
|
*/
|
||||||
Property *rofi_theme_property_copy(const Property *p);
|
Property *rofi_theme_property_copy(const Property *p, void *);
|
||||||
/**
|
/**
|
||||||
* @param widget
|
* @param widget
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,6 +22,7 @@ flags = [
|
||||||
'-Wunreachable-code',
|
'-Wunreachable-code',
|
||||||
'-Werror=missing-prototypes',
|
'-Werror=missing-prototypes',
|
||||||
'-Wno-inline', # A bit too noisy with Bison…
|
'-Wno-inline', # A bit too noisy with Bison…
|
||||||
|
'-Wextra'
|
||||||
]
|
]
|
||||||
foreach f : flags
|
foreach f : flags
|
||||||
if c_compiler.has_argument(f)
|
if c_compiler.has_argument(f)
|
||||||
|
|
|
@ -73,7 +73,7 @@ char *mode_get_display_value(const Mode *mode, unsigned int selected_line,
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
||||||
int height) {
|
unsigned int height) {
|
||||||
g_assert(mode != NULL);
|
g_assert(mode != NULL);
|
||||||
|
|
||||||
if (mode->_get_icon != NULL) {
|
if (mode->_get_icon != NULL) {
|
||||||
|
|
|
@ -277,7 +277,7 @@ static char *combi_get_completion(const Mode *sw, unsigned int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *combi_get_icon(const Mode *sw, unsigned int index,
|
static cairo_surface_t *combi_get_icon(const Mode *sw, unsigned int index,
|
||||||
int height) {
|
unsigned int height) {
|
||||||
CombiModePrivateData *pd = mode_get_private_data(sw);
|
CombiModePrivateData *pd = mode_get_private_data(sw);
|
||||||
for (unsigned i = 0; i < pd->num_switchers; i++) {
|
for (unsigned i = 0; i < pd->num_switchers; i++) {
|
||||||
if (index >= pd->starts[i] && index < (pd->starts[i] + pd->lengths[i])) {
|
if (index >= pd->starts[i] && index < (pd->starts[i] + pd->lengths[i])) {
|
||||||
|
|
|
@ -56,8 +56,8 @@
|
||||||
static int dmenu_mode_init(Mode *sw);
|
static int dmenu_mode_init(Mode *sw);
|
||||||
static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
static cairo_surface_t *dmenu_get_icon(const Mode *sw,
|
static cairo_surface_t *
|
||||||
unsigned int selected_line, int height);
|
dmenu_get_icon(const Mode *sw, unsigned int selected_line, unsigned int height);
|
||||||
static char *dmenu_get_message(const Mode *sw);
|
static char *dmenu_get_message(const Mode *sw);
|
||||||
|
|
||||||
static inline unsigned int bitget(uint32_t const *const array,
|
static inline unsigned int bitget(uint32_t const *const array,
|
||||||
|
@ -192,6 +192,10 @@ static gboolean dmenu_async_read_proc(gint fd, GIOCondition condition,
|
||||||
gpointer user_data) {
|
gpointer user_data) {
|
||||||
DmenuModePrivateData *pd = (DmenuModePrivateData *)user_data;
|
DmenuModePrivateData *pd = (DmenuModePrivateData *)user_data;
|
||||||
char command;
|
char command;
|
||||||
|
// Only interrested in read events.
|
||||||
|
if ((condition & G_IO_IN) != G_IO_IN) {
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
// Read the entry from the pipe that was used to signal this action.
|
// Read the entry from the pipe that was used to signal this action.
|
||||||
if (read(fd, &command, 1) == 1) {
|
if (read(fd, &command, 1) == 1) {
|
||||||
if (command == 'r') {
|
if (command == 'r') {
|
||||||
|
@ -239,7 +243,7 @@ static void read_input_sync(DmenuModePrivateData *pd, unsigned int pre_read) {
|
||||||
static gpointer read_input_thread(gpointer userdata) {
|
static gpointer read_input_thread(gpointer userdata) {
|
||||||
DmenuModePrivateData *pd = (DmenuModePrivateData *)userdata;
|
DmenuModePrivateData *pd = (DmenuModePrivateData *)userdata;
|
||||||
ssize_t nread = 0;
|
ssize_t nread = 0;
|
||||||
size_t len = 0;
|
ssize_t len = 0;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
// Create the message passing queue to the UI thread.
|
// Create the message passing queue to the UI thread.
|
||||||
pd->async_queue = g_async_queue_new();
|
pd->async_queue = g_async_queue_new();
|
||||||
|
@ -276,7 +280,7 @@ static gpointer read_input_thread(gpointer userdata) {
|
||||||
if (readbytes > 0) {
|
if (readbytes > 0) {
|
||||||
nread += readbytes;
|
nread += readbytes;
|
||||||
line[nread] = '\0';
|
line[nread] = '\0';
|
||||||
size_t i = 0;
|
ssize_t i = 0;
|
||||||
while (i < nread) {
|
while (i < nread) {
|
||||||
if (line[i] == pd->separator) {
|
if (line[i] == pd->separator) {
|
||||||
line[i] = '\0';
|
line[i] = '\0';
|
||||||
|
@ -632,7 +636,8 @@ static char *dmenu_get_message(const Mode *sw) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
static cairo_surface_t *dmenu_get_icon(const Mode *sw,
|
static cairo_surface_t *dmenu_get_icon(const Mode *sw,
|
||||||
unsigned int selected_line, int height) {
|
unsigned int selected_line,
|
||||||
|
unsigned int height) {
|
||||||
DmenuModePrivateData *pd = (DmenuModePrivateData *)mode_get_private_data(sw);
|
DmenuModePrivateData *pd = (DmenuModePrivateData *)mode_get_private_data(sw);
|
||||||
|
|
||||||
g_return_val_if_fail(pd->cmd_list != NULL, NULL);
|
g_return_val_if_fail(pd->cmd_list != NULL, NULL);
|
||||||
|
@ -650,7 +655,8 @@ static cairo_surface_t *dmenu_get_icon(const Mode *sw,
|
||||||
return rofi_icon_fetcher_get(uid);
|
return rofi_icon_fetcher_get(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dmenu_finish(DmenuModePrivateData *pd, RofiViewState *state, int retv) {
|
static void dmenu_finish(DmenuModePrivateData *pd, RofiViewState *state,
|
||||||
|
int retv) {
|
||||||
|
|
||||||
if (pd->reading_thread) {
|
if (pd->reading_thread) {
|
||||||
// Stop listinig to new messages from reading thread.
|
// Stop listinig to new messages from reading thread.
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ static char *_get_display_value(const Mode *sw, unsigned int selected_line,
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int height) {
|
unsigned int height) {
|
||||||
DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw);
|
DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw);
|
||||||
if (pd->file_complete) {
|
if (pd->file_complete) {
|
||||||
return pd->completer->_get_icon(pd->completer, selected_line, height);
|
return pd->completer->_get_icon(pd->completer, selected_line, height);
|
||||||
|
|
|
@ -561,7 +561,7 @@ static int file_browser_token_match(const Mode *sw, rofi_int_matcher **tokens,
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int height) {
|
unsigned int height) {
|
||||||
FileBrowserModePrivateData *pd =
|
FileBrowserModePrivateData *pd =
|
||||||
(FileBrowserModePrivateData *)mode_get_private_data(sw);
|
(FileBrowserModePrivateData *)mode_get_private_data(sw);
|
||||||
g_return_val_if_fail(pd->array != NULL, NULL);
|
g_return_val_if_fail(pd->array != NULL, NULL);
|
||||||
|
|
|
@ -534,7 +534,7 @@ static char *run_get_message(const Mode *sw) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int height) {
|
unsigned int height) {
|
||||||
RunModePrivateData *pd = (RunModePrivateData *)mode_get_private_data(sw);
|
RunModePrivateData *pd = (RunModePrivateData *)mode_get_private_data(sw);
|
||||||
if (pd->file_complete) {
|
if (pd->file_complete) {
|
||||||
return pd->completer->_get_icon(pd->completer, selected_line, height);
|
return pd->completer->_get_icon(pd->completer, selected_line, height);
|
||||||
|
|
|
@ -429,8 +429,9 @@ static char *script_get_message(const Mode *sw) {
|
||||||
ScriptModePrivateData *pd = sw->private_data;
|
ScriptModePrivateData *pd = sw->private_data;
|
||||||
return g_strdup(pd->message);
|
return g_strdup(pd->message);
|
||||||
}
|
}
|
||||||
static cairo_surface_t *
|
static cairo_surface_t *script_get_icon(const Mode *sw,
|
||||||
script_get_icon(const Mode *sw, unsigned int selected_line, int height) {
|
unsigned int selected_line,
|
||||||
|
unsigned int height) {
|
||||||
ScriptModePrivateData *pd =
|
ScriptModePrivateData *pd =
|
||||||
(ScriptModePrivateData *)mode_get_private_data(sw);
|
(ScriptModePrivateData *)mode_get_private_data(sw);
|
||||||
g_return_val_if_fail(pd->cmd_list != NULL, NULL);
|
g_return_val_if_fail(pd->cmd_list != NULL, NULL);
|
||||||
|
@ -454,7 +455,7 @@ typedef struct ScriptUser {
|
||||||
} ScriptUser;
|
} ScriptUser;
|
||||||
|
|
||||||
ScriptUser *user_scripts = NULL;
|
ScriptUser *user_scripts = NULL;
|
||||||
int num_scripts = 0;
|
size_t num_scripts = 0;
|
||||||
|
|
||||||
void script_mode_cleanup(void) {
|
void script_mode_cleanup(void) {
|
||||||
for (size_t i = 0; i < num_scripts; i++) {
|
for (size_t i = 0; i < num_scripts; i++) {
|
||||||
|
@ -493,7 +494,7 @@ void script_mode_gather_user_scripts(void) {
|
||||||
|
|
||||||
static int script_mode_has_user_script(char const *const user) {
|
static int script_mode_has_user_script(char const *const user) {
|
||||||
|
|
||||||
for (int i = 0; i < num_scripts; i++) {
|
for (size_t i = 0; i < num_scripts; i++) {
|
||||||
if (g_strcmp0(user_scripts[i].name, user) == 0) {
|
if (g_strcmp0(user_scripts[i].name, user) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,8 @@ static gboolean window_client_reload(G_GNUC_UNUSED void *data) {
|
||||||
}
|
}
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
void window_client_handle_signal(xcb_window_t win, gboolean create) {
|
void window_client_handle_signal(G_GNUC_UNUSED xcb_window_t win,
|
||||||
|
G_GNUC_UNUSED gboolean create) {
|
||||||
// g_idle_add_full(G_PRIORITY_HIGH_IDLE, window_client_reload, NULL, NULL);
|
// g_idle_add_full(G_PRIORITY_HIGH_IDLE, window_client_reload, NULL, NULL);
|
||||||
if (window_reload_timeout > 0) {
|
if (window_reload_timeout > 0) {
|
||||||
g_source_remove(window_reload_timeout);
|
g_source_remove(window_reload_timeout);
|
||||||
|
@ -1023,7 +1024,7 @@ static cairo_surface_t *get_net_wm_icon(xcb_window_t xid,
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
static cairo_surface_t *_get_icon(const Mode *sw, unsigned int selected_line,
|
||||||
int size) {
|
unsigned int size) {
|
||||||
WindowModePrivateData *rmpd = mode_get_private_data(sw);
|
WindowModePrivateData *rmpd = mode_get_private_data(sw);
|
||||||
client *c = window_client(rmpd, rmpd->ids->array[selected_line]);
|
client *c = window_client(rmpd, rmpd->ids->array[selected_line]);
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
|
|
|
@ -772,7 +772,7 @@ static gboolean record(G_GNUC_UNUSED void *data) {
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
static void rofi_custom_log_function(const char *log_domain,
|
static void rofi_custom_log_function(const char *log_domain,
|
||||||
GLogLevelFlags log_level,
|
G_GNUC_UNUSED GLogLevelFlags log_level,
|
||||||
const gchar *message, gpointer user_data) {
|
const gchar *message, gpointer user_data) {
|
||||||
int fp = GPOINTER_TO_INT(user_data);
|
int fp = GPOINTER_TO_INT(user_data);
|
||||||
dprintf(fp, "[%s]: %s\n", log_domain == NULL ? "default" : log_domain,
|
dprintf(fp, "[%s]: %s\n", log_domain == NULL ? "default" : log_domain,
|
||||||
|
|
|
@ -120,7 +120,8 @@ RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance) {
|
||||||
return retv;
|
return retv;
|
||||||
}
|
}
|
||||||
|
|
||||||
Property *rofi_theme_property_copy(const Property *p) {
|
Property *rofi_theme_property_copy(const Property *p,
|
||||||
|
G_GNUC_UNUSED void *data) {
|
||||||
Property *retv = rofi_theme_property_create(p->type);
|
Property *retv = rofi_theme_property_create(p->type);
|
||||||
retv->name = g_strdup(p->name);
|
retv->name = g_strdup(p->name);
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ Property *rofi_theme_property_copy(const Property *p) {
|
||||||
retv->value.link.ref = NULL;
|
retv->value.link.ref = NULL;
|
||||||
if (p->value.link.def_value) {
|
if (p->value.link.def_value) {
|
||||||
retv->value.link.def_value =
|
retv->value.link.def_value =
|
||||||
rofi_theme_property_copy(p->value.link.def_value);
|
rofi_theme_property_copy(p->value.link.def_value, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case P_PADDING: {
|
case P_PADDING: {
|
||||||
|
@ -635,7 +636,7 @@ void yyerror(YYLTYPE *yylloc, const char *what, const char *s) {
|
||||||
static void rofi_theme_copy_property_int(G_GNUC_UNUSED gpointer key,
|
static void rofi_theme_copy_property_int(G_GNUC_UNUSED gpointer key,
|
||||||
gpointer value, gpointer user_data) {
|
gpointer value, gpointer user_data) {
|
||||||
GHashTable *table = (GHashTable *)user_data;
|
GHashTable *table = (GHashTable *)user_data;
|
||||||
Property *p = rofi_theme_property_copy((Property *)value);
|
Property *p = rofi_theme_property_copy((Property *)value, NULL);
|
||||||
g_hash_table_replace(table, p->name, p);
|
g_hash_table_replace(table, p->name, p);
|
||||||
}
|
}
|
||||||
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table) {
|
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table) {
|
||||||
|
|
|
@ -1007,8 +1007,8 @@ inline static void rofi_view_nav_last(RofiViewState *state) {
|
||||||
// state->selected = state->filtered_lines - 1;
|
// state->selected = state->filtered_lines - 1;
|
||||||
listview_set_selected(state->list_view, -1);
|
listview_set_selected(state->list_view, -1);
|
||||||
}
|
}
|
||||||
static void selection_changed_callback(listview *lv, unsigned int index,
|
static void selection_changed_callback(G_GNUC_UNUSED listview *lv,
|
||||||
void *udata) {
|
unsigned int index, void *udata) {
|
||||||
RofiViewState *state = (RofiViewState *)udata;
|
RofiViewState *state = (RofiViewState *)udata;
|
||||||
if (state->tb_current_entry) {
|
if (state->tb_current_entry) {
|
||||||
if (index < state->filtered_lines) {
|
if (index < state->filtered_lines) {
|
||||||
|
|
|
@ -526,8 +526,10 @@ widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetTriggerActionResult widget_check_action(widget *wid, guint action, gint x,
|
WidgetTriggerActionResult widget_check_action(widget *wid,
|
||||||
gint y) {
|
G_GNUC_UNUSED guint action,
|
||||||
|
G_GNUC_UNUSED gint x,
|
||||||
|
G_GNUC_UNUSED gint y) {
|
||||||
if (wid == NULL) {
|
if (wid == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,13 +744,13 @@ gboolean config_parse_set_property(const Property *p, char **error) {
|
||||||
iter = g_list_next(iter)) {
|
iter = g_list_next(iter)) {
|
||||||
if (g_strcmp0(((Property *)(iter->data))->name, p->name) == 0) {
|
if (g_strcmp0(((Property *)(iter->data))->name, p->name) == 0) {
|
||||||
rofi_theme_property_free((Property *)(iter->data));
|
rofi_theme_property_free((Property *)(iter->data));
|
||||||
iter->data = (void *)rofi_theme_property_copy(p);
|
iter->data = (void *)rofi_theme_property_copy(p, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_debug("Adding option: %s to backup list.", p->name);
|
g_debug("Adding option: %s to backup list.", p->name);
|
||||||
extra_parsed_options =
|
extra_parsed_options =
|
||||||
g_list_append(extra_parsed_options, rofi_theme_property_copy(p));
|
g_list_append(extra_parsed_options, rofi_theme_property_copy(p, NULL));
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,28 +25,30 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <theme.h>
|
|
||||||
#include <widgets/box.h>
|
|
||||||
#include <widgets/widget.h>
|
|
||||||
#include <widgets/widget-internal.h>
|
|
||||||
#include "rofi.h"
|
|
||||||
#include "xrmoptions.h"
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
|
#include "rofi.h"
|
||||||
|
#include "xrmoptions.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <theme.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <widgets/box.h>
|
||||||
|
#include <widgets/widget-internal.h>
|
||||||
|
#include <widgets/widget.h>
|
||||||
unsigned int test = 0;
|
unsigned int test = 0;
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %3u passed (%s)\n", ++test, #a); \
|
printf("Test %3u passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TASSERTE( a, b ) { \
|
#define TASSERTE(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %u passed (%s == %s) (%d == %d)\n", ++test, #a, #b, a, b); \
|
printf("Test %u passed (%s == %s) (%d == %d)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -55,68 +57,53 @@ unsigned int test =0;
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TASSERTW( a, b ) { \
|
#define TASSERTW(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf ( "Test %u passed (%s == %s) (%p == %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
|
printf("Test %u passed (%s == %s) (%p == %p)\n", ++test, #a, #b, \
|
||||||
|
(void *)a, (void *)b); \
|
||||||
} else { \
|
} else { \
|
||||||
printf ( "Test %u failed (%s == %s) (%p != %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
|
printf("Test %u failed (%s == %s) (%p != %p)\n", ++test, #a, #b, \
|
||||||
|
(void *)a, (void *)b); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
ThemeWidget *rofi_configuration = NULL;
|
ThemeWidget *rofi_configuration = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
|
gboolean config_parse_set_property(G_GNUC_UNUSED const Property *p,
|
||||||
{
|
G_GNUC_UNUSED char **error) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
char * rofi_expand_path ( G_GNUC_UNUSED const char *path )
|
char *rofi_expand_path(G_GNUC_UNUSED const char *path) { return NULL; }
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * helper_get_theme_path ( const char *file, const char *ext)
|
char *helper_get_theme_path(const char *file, G_GNUC_UNUSED const char *ext) {
|
||||||
{
|
|
||||||
return g_strdup(file);
|
return g_strdup(file);
|
||||||
}
|
}
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
int textbox_get_estimated_char_height(void);
|
int textbox_get_estimated_char_height(void);
|
||||||
int textbox_get_estimated_char_height ( void )
|
int textbox_get_estimated_char_height(void) { return 16; }
|
||||||
{
|
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
double textbox_get_estimated_ch(void);
|
double textbox_get_estimated_ch(void);
|
||||||
double textbox_get_estimated_ch ( void )
|
double textbox_get_estimated_ch(void) { return 8; }
|
||||||
{
|
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,
|
||||||
return 8;
|
G_GNUC_UNUSED int *height) {}
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|
||||||
{
|
|
||||||
{
|
{
|
||||||
box *b = box_create(NULL, "box", ROFI_ORIENTATION_HORIZONTAL);
|
box *b = box_create(NULL, "box", ROFI_ORIENTATION_HORIZONTAL);
|
||||||
// box_set_padding ( b, 5 );
|
// box_set_padding ( b, 5 );
|
||||||
|
|
|
@ -25,28 +25,30 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <helper.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <xcb/xcb_ewmh.h>
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
#include "xcb-internal.h"
|
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "widgets/textbox.h"
|
#include "widgets/textbox.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "xcb-internal.h"
|
||||||
|
#include "xcb.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <helper.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %i passed (%s)\n", ++test, #a); \
|
printf("Test %i passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
#define TASSERTE( a, b ) { \
|
#define TASSERTE(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -56,61 +58,45 @@ static int test = 0;
|
||||||
}
|
}
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
void rofi_clear_error_messages (void )
|
void rofi_clear_error_messages(void) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean rofi_theme_parse_string ( const char *string )
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) {
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
double textbox_get_estimated_char_height(void) { return 12.0; }
|
||||||
{
|
void rofi_view_get_current_monitor(int *width, int *height) {
|
||||||
return 12.0;
|
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height )
|
|
||||||
{
|
|
||||||
*width = 1920;
|
*width = 1920;
|
||||||
*height = 1080;
|
*height = 1080;
|
||||||
}
|
}
|
||||||
double textbox_get_estimated_ch ( void )
|
double textbox_get_estimated_ch(void) { return 9.0; }
|
||||||
{
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
return 9.0;
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
}
|
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
{
|
|
||||||
|
|
||||||
if (setlocale(LC_ALL, "") == NULL) {
|
if (setlocale(LC_ALL, "") == NULL) {
|
||||||
fprintf(stderr, "Failed to set locale.\n");
|
fprintf(stderr, "Failed to set locale.\n");
|
||||||
|
@ -118,10 +104,10 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
}
|
}
|
||||||
char **list = NULL;
|
char **list = NULL;
|
||||||
int llength = 0;
|
int llength = 0;
|
||||||
char * test_str =
|
char *test_str = "{host} {terminal} -e bash -c \"{ssh-client} {host}; echo "
|
||||||
"{host} {terminal} -e bash -c \"{ssh-client} {host}; echo '{terminal} {host}'\" -i -3 -u 4";
|
"'{terminal} {host}'\" -i -3 -u 4";
|
||||||
helper_parse_setup ( test_str, &list, &llength, "{host}", "chuck",
|
helper_parse_setup(test_str, &list, &llength, "{host}", "chuck", "{terminal}",
|
||||||
"{terminal}", "x-terminal-emulator", NULL );
|
"x-terminal-emulator", NULL);
|
||||||
|
|
||||||
TASSERT(llength == 10);
|
TASSERT(llength == 10);
|
||||||
TASSERT(strcmp(list[0], "chuck") == 0);
|
TASSERT(strcmp(list[0], "chuck") == 0);
|
||||||
|
@ -159,5 +145,4 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
TASSERT(d == -3);
|
TASSERT(d == -3);
|
||||||
|
|
||||||
g_strfreev(list);
|
g_strfreev(list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,29 +25,31 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <helper.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <xcb/xcb_ewmh.h>
|
|
||||||
#include "theme.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
#include "xcb-internal.h"
|
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "widgets/textbox.h"
|
#include "widgets/textbox.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "xcb-internal.h"
|
||||||
|
#include "xcb.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <helper.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %i passed (%s)\n", ++test, #a); \
|
printf("Test %i passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
#define TASSERTE( a, b ) { \
|
#define TASSERTE(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -57,59 +59,43 @@ static int test = 0;
|
||||||
}
|
}
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
double textbox_get_estimated_char_height(void) { return 12.0; }
|
||||||
{
|
void rofi_view_get_current_monitor(int *width, int *height) {
|
||||||
return 12.0;
|
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height )
|
|
||||||
{
|
|
||||||
*width = 1920;
|
*width = 1920;
|
||||||
*height = 1080;
|
*height = 1080;
|
||||||
}
|
}
|
||||||
double textbox_get_estimated_ch ( void )
|
double textbox_get_estimated_ch(void) { return 9.0; }
|
||||||
{
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) { return 0; }
|
||||||
return 9.0;
|
|
||||||
}
|
|
||||||
gboolean rofi_theme_parse_string ( const char *string )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
|
|
||||||
int main ( int argc, char **argv )
|
int main(int argc, char **argv) {
|
||||||
{
|
|
||||||
cmd_set_arguments(argc, argv);
|
cmd_set_arguments(argc, argv);
|
||||||
|
|
||||||
if (setlocale(LC_ALL, "") == NULL) {
|
if (setlocale(LC_ALL, "") == NULL) {
|
||||||
|
@ -118,7 +104,8 @@ int main ( int argc, char **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test some path functions. Not easy as not sure what is right output on travis.
|
* Test some path functions. Not easy as not sure what is right output on
|
||||||
|
* travis.
|
||||||
*/
|
*/
|
||||||
// Test if root is preserved.
|
// Test if root is preserved.
|
||||||
char *str = rofi_expand_path("/");
|
char *str = rofi_expand_path("/");
|
||||||
|
|
|
@ -50,17 +50,25 @@ static int test = 0;
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query(const char *name, const int size) { return 0; }
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
|
G_GNUC_UNUSED const int size) {
|
||||||
const int hsize) {
|
return 0;
|
||||||
|
}
|
||||||
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid) { return NULL; }
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
|
|
||||||
gboolean rofi_theme_parse_string(const char *string) { return FALSE; }
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
double textbox_get_estimated_char_height(void) { return 12.0; }
|
double textbox_get_estimated_char_height(void) { return 12.0; }
|
||||||
void rofi_view_get_current_monitor(int *width, int *height) {
|
void rofi_view_get_current_monitor(int *width, int *height) {
|
||||||
*width = 1920;
|
*width = 1920;
|
||||||
|
|
|
@ -25,28 +25,30 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <helper.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <xcb/xcb_ewmh.h>
|
|
||||||
#include "theme.h"
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "xcb.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
#include "xcb-internal.h"
|
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "theme.h"
|
||||||
|
#include "xcb-internal.h"
|
||||||
|
#include "xcb.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <helper.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
|
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %i passed (%s)\n", ++test, #a); \
|
printf("Test %i passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
#define TASSERTE( a, b ) { \
|
#define TASSERTE(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
printf("Test %i passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -54,7 +56,8 @@ static int test = 0;
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define TASSERTL( a, b ) { \
|
#define TASSERTL(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %i passed (%s == %s) (%d == %d)\n", ++test, #a, #b, a, b); \
|
printf("Test %i passed (%s == %s) (%d == %d)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -67,61 +70,46 @@ static int test = 0;
|
||||||
|
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
|
|
||||||
gboolean rofi_theme_parse_string ( const char *string )
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) {
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
double textbox_get_estimated_char_height(void) { return 12.0; }
|
||||||
{
|
void rofi_view_get_current_monitor(int *width, int *height) {
|
||||||
return 12.0;
|
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height )
|
|
||||||
{
|
|
||||||
*width = 1920;
|
*width = 1920;
|
||||||
*height = 1080;
|
*height = 1080;
|
||||||
}
|
}
|
||||||
double textbox_get_estimated_ch ( void )
|
double textbox_get_estimated_ch(void) { return 9.0; }
|
||||||
{
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
return 9.0;
|
|
||||||
}
|
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
|
|
||||||
int main ( int argc, char **argv )
|
int main(int argc, char **argv) {
|
||||||
{
|
|
||||||
cmd_set_arguments(argc, argv);
|
cmd_set_arguments(argc, argv);
|
||||||
|
|
||||||
if (setlocale(LC_ALL, "") == NULL) {
|
if (setlocale(LC_ALL, "") == NULL) {
|
||||||
|
@ -149,14 +137,27 @@ int main ( int argc, char **argv )
|
||||||
* tokenize
|
* tokenize
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TASSERT ( levenshtein ( "aap", g_utf8_strlen ( "aap", -1), "aap", g_utf8_strlen ( "aap", -1) ) == 0 );
|
TASSERT(levenshtein("aap", g_utf8_strlen("aap", -1), "aap",
|
||||||
TASSERT ( levenshtein ( "aap", g_utf8_strlen ( "aap", -1), "aap ", g_utf8_strlen ( "aap ", -1) ) == 1 );
|
g_utf8_strlen("aap", -1)) == 0);
|
||||||
TASSERT ( levenshtein ( "aap ", g_utf8_strlen ( "aap ", -1), "aap", g_utf8_strlen ( "aap", -1) ) == 1 );
|
TASSERT(levenshtein("aap", g_utf8_strlen("aap", -1), "aap ",
|
||||||
TASSERTE ( levenshtein ( "aap", g_utf8_strlen ( "aap", -1), "aap noot", g_utf8_strlen ( "aap noot", -1) ), 5u );
|
g_utf8_strlen("aap ", -1)) == 1);
|
||||||
TASSERTE ( levenshtein ( "aap", g_utf8_strlen ( "aap", -1), "noot aap", g_utf8_strlen ( "noot aap", -1) ), 5u );
|
TASSERT(levenshtein("aap ", g_utf8_strlen("aap ", -1), "aap",
|
||||||
TASSERTE ( levenshtein ( "aap", g_utf8_strlen ( "aap", -1), "noot aap mies", g_utf8_strlen ( "noot aap mies", -1) ), 10u );
|
g_utf8_strlen("aap", -1)) == 1);
|
||||||
TASSERTE ( levenshtein ( "noot aap mies", g_utf8_strlen ( "noot aap mies", -1), "aap", g_utf8_strlen ( "aap", -1) ), 10u );
|
TASSERTE(levenshtein("aap", g_utf8_strlen("aap", -1), "aap noot",
|
||||||
TASSERTE ( levenshtein ( "otp", g_utf8_strlen ( "otp", -1), "noot aap", g_utf8_strlen ( "noot aap", -1) ), 5u );
|
g_utf8_strlen("aap noot", -1)),
|
||||||
|
5u);
|
||||||
|
TASSERTE(levenshtein("aap", g_utf8_strlen("aap", -1), "noot aap",
|
||||||
|
g_utf8_strlen("noot aap", -1)),
|
||||||
|
5u);
|
||||||
|
TASSERTE(levenshtein("aap", g_utf8_strlen("aap", -1), "noot aap mies",
|
||||||
|
g_utf8_strlen("noot aap mies", -1)),
|
||||||
|
10u);
|
||||||
|
TASSERTE(levenshtein("noot aap mies", g_utf8_strlen("noot aap mies", -1),
|
||||||
|
"aap", g_utf8_strlen("aap", -1)),
|
||||||
|
10u);
|
||||||
|
TASSERTE(levenshtein("otp", g_utf8_strlen("otp", -1), "noot aap",
|
||||||
|
g_utf8_strlen("noot aap", -1)),
|
||||||
|
5u);
|
||||||
/**
|
/**
|
||||||
* Quick converision check.
|
* Quick converision check.
|
||||||
*/
|
*/
|
||||||
|
@ -186,43 +187,58 @@ int main ( int argc, char **argv )
|
||||||
// TASSERT ( utf8_strncmp ( in, "Valid", 3 ) == 0);
|
// TASSERT ( utf8_strncmp ( in, "Valid", 3 ) == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TASSERTL ( rofi_scorer_fuzzy_evaluate ("aap noot mies", 12 , "aap noot mies", 12), -605);
|
TASSERTL(
|
||||||
|
rofi_scorer_fuzzy_evaluate("aap noot mies", 12, "aap noot mies", 12),
|
||||||
|
-605);
|
||||||
TASSERTL(rofi_scorer_fuzzy_evaluate("anm", 3, "aap noot mies", 12), -155);
|
TASSERTL(rofi_scorer_fuzzy_evaluate("anm", 3, "aap noot mies", 12), -155);
|
||||||
TASSERTL ( rofi_scorer_fuzzy_evaluate ("blu", 3, "aap noot mies", 12), 1073741824);
|
TASSERTL(rofi_scorer_fuzzy_evaluate("blu", 3, "aap noot mies", 12),
|
||||||
|
1073741824);
|
||||||
config.case_sensitive = TRUE;
|
config.case_sensitive = TRUE;
|
||||||
TASSERTL ( rofi_scorer_fuzzy_evaluate ("Anm", 3, "aap noot mies", 12), 1073741754);
|
TASSERTL(rofi_scorer_fuzzy_evaluate("Anm", 3, "aap noot mies", 12),
|
||||||
|
1073741754);
|
||||||
config.case_sensitive = FALSE;
|
config.case_sensitive = FALSE;
|
||||||
TASSERTL(rofi_scorer_fuzzy_evaluate("Anm", 3, "aap noot mies", 12), -155);
|
TASSERTL(rofi_scorer_fuzzy_evaluate("Anm", 3, "aap noot mies", 12), -155);
|
||||||
TASSERTL ( rofi_scorer_fuzzy_evaluate ("aap noot mies", 12,"Anm", 3 ), 1073741824);
|
TASSERTL(rofi_scorer_fuzzy_evaluate("aap noot mies", 12, "Anm", 3),
|
||||||
|
1073741824);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *a;
|
char *a;
|
||||||
a = helper_string_replace_if_exists ( "{terminal} [-t {title} blub ]-e {cmd}", "{cmd}", "aap", "{title}", "some title", "{terminal}", "rofi-sensible-terminal", NULL);
|
a = helper_string_replace_if_exists(
|
||||||
|
"{terminal} [-t {title} blub ]-e {cmd}", "{cmd}", "aap", "{title}",
|
||||||
|
"some title", "{terminal}", "rofi-sensible-terminal", NULL);
|
||||||
printf("%s\n", a);
|
printf("%s\n", a);
|
||||||
TASSERT ( g_utf8_collate ( a, "rofi-sensible-terminal -t some title blub -e aap") == 0);
|
TASSERT(g_utf8_collate(
|
||||||
|
a, "rofi-sensible-terminal -t some title blub -e aap") == 0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
a = helper_string_replace_if_exists ( "{terminal} [-t {title} blub ]-e {cmd}", "{cmd}", "aap", "{terminal}", "rofi-sensible-terminal", NULL);
|
a = helper_string_replace_if_exists("{terminal} [-t {title} blub ]-e {cmd}",
|
||||||
|
"{cmd}", "aap", "{terminal}",
|
||||||
|
"rofi-sensible-terminal", NULL);
|
||||||
printf("%s\n", a);
|
printf("%s\n", a);
|
||||||
TASSERT(g_utf8_collate(a, "rofi-sensible-terminal -e aap") == 0);
|
TASSERT(g_utf8_collate(a, "rofi-sensible-terminal -e aap") == 0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
a = helper_string_replace_if_exists ( "{name} [<span weight='light' size='small'><i>({category})</i></span>]", "{name}", "Librecad", "{category}", "Desktop app", "{terminal}", "rofi-sensible-terminal", NULL );
|
a = helper_string_replace_if_exists(
|
||||||
|
"{name} [<span weight='light' size='small'><i>({category})</i></span>]",
|
||||||
|
"{name}", "Librecad", "{category}", "Desktop app", "{terminal}",
|
||||||
|
"rofi-sensible-terminal", NULL);
|
||||||
printf("%s\n", a);
|
printf("%s\n", a);
|
||||||
TASSERT ( g_utf8_collate ( a, "Librecad <span weight='light' size='small'><i>(Desktop app)</i></span>") == 0);
|
TASSERT(g_utf8_collate(a, "Librecad <span weight='light' "
|
||||||
|
"size='small'><i>(Desktop app)</i></span>") == 0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
a = helper_string_replace_if_exists ( "{name}[ <span weight='light' size='small'><i>({category})</i></span>]", "{name}", "Librecad", "{terminal}", "rofi-sensible-terminal", NULL );
|
a = helper_string_replace_if_exists(
|
||||||
|
"{name}[ <span weight='light' size='small'><i>({category})</i></span>]",
|
||||||
|
"{name}", "Librecad", "{terminal}", "rofi-sensible-terminal", NULL);
|
||||||
TASSERT(g_utf8_collate(a, "Librecad") == 0);
|
TASSERT(g_utf8_collate(a, "Librecad") == 0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
a = helper_string_replace_if_exists ( "{terminal} [{title} blub ]-e {cmd}", "{cmd}", "aap", "{title}", "some title", "{terminal}", "rofi-sensible-terminal", NULL);
|
a = helper_string_replace_if_exists(
|
||||||
|
"{terminal} [{title} blub ]-e {cmd}", "{cmd}", "aap", "{title}",
|
||||||
|
"some title", "{terminal}", "rofi-sensible-terminal", NULL);
|
||||||
printf("%s\n", a);
|
printf("%s\n", a);
|
||||||
TASSERT ( g_utf8_collate ( a, "rofi-sensible-terminal some title blub -e aap") == 0);
|
TASSERT(g_utf8_collate(a, "rofi-sensible-terminal some title blub -e aap") ==
|
||||||
|
0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
a = helper_string_replace_if_exists ( "{terminal} [{title} blub ]-e {cmd}",
|
a = helper_string_replace_if_exists(
|
||||||
"{cmd}", "aap",
|
"{terminal} [{title} blub ]-e {cmd}", "{cmd}", "aap", "{title}", NULL,
|
||||||
"{title}", NULL,
|
"{terminal}", "rofi-sensible-terminal", NULL);
|
||||||
"{terminal}", "rofi-sensible-terminal",
|
|
||||||
NULL);
|
|
||||||
printf("%s\n", a);
|
printf("%s\n", a);
|
||||||
TASSERT(g_utf8_collate(a, "rofi-sensible-terminal -e aap") == 0);
|
TASSERT(g_utf8_collate(a, "rofi-sensible-terminal -e aap") == 0);
|
||||||
g_free(a);
|
g_free(a);
|
||||||
|
|
|
@ -25,83 +25,66 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <helper.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <xcb/xcb_ewmh.h>
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "theme.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
#include "xcb.h"
|
#include "rofi-types.h"
|
||||||
#include "xcb-internal.h"
|
|
||||||
#include "rofi.h"
|
#include "rofi.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "rofi-types.h"
|
#include "theme.h"
|
||||||
#include "widgets/textbox.h"
|
#include "widgets/textbox.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "xcb-internal.h"
|
||||||
|
#include "xcb.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <helper.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
|
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean rofi_theme_parse_string ( G_GNUC_UNUSED const char *string )
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) {
|
||||||
{
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
double textbox_get_estimated_char_height(void) { return 12.0; }
|
||||||
{
|
void rofi_view_get_current_monitor(int *width, int *height) {
|
||||||
return 12.0;
|
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height )
|
|
||||||
{
|
|
||||||
*width = 1920;
|
*width = 1920;
|
||||||
*height = 1080;
|
*height = 1080;
|
||||||
}
|
}
|
||||||
double textbox_get_estimated_ch ( void )
|
double textbox_get_estimated_ch(void) { return 9.0; }
|
||||||
{
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
return 9.0;
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
}
|
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
START_TEST(test_tokenizer_free )
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
{
|
START_TEST(test_tokenizer_free) { helper_tokenize_free(NULL); }
|
||||||
helper_tokenize_free ( NULL );
|
|
||||||
}
|
|
||||||
END_TEST
|
END_TEST
|
||||||
START_TEST ( test_tokenizer_match_normal_single_ci )
|
START_TEST(test_tokenizer_match_normal_single_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_NORMAL;
|
config.matching_method = MM_NORMAL;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
||||||
|
|
||||||
|
@ -117,8 +100,7 @@ START_TEST ( test_tokenizer_match_normal_single_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_normal_single_cs )
|
START_TEST(test_tokenizer_match_normal_single_cs) {
|
||||||
{
|
|
||||||
config.matching_method = MM_NORMAL;
|
config.matching_method = MM_NORMAL;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
||||||
|
|
||||||
|
@ -134,8 +116,7 @@ START_TEST ( test_tokenizer_match_normal_single_cs )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_normal_multiple_ci )
|
START_TEST(test_tokenizer_match_normal_multiple_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_NORMAL;
|
config.matching_method = MM_NORMAL;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -144,12 +125,10 @@ START_TEST ( test_tokenizer_match_normal_multiple_ci )
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "nootap mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "nootap mies"), TRUE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "noap miesot"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "noap miesot"), TRUE);
|
||||||
helper_tokenize_free(tokens);
|
helper_tokenize_free(tokens);
|
||||||
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_normal_single_ci_negate )
|
START_TEST(test_tokenizer_match_normal_single_ci_negate) {
|
||||||
{
|
|
||||||
config.matching_method = MM_NORMAL;
|
config.matching_method = MM_NORMAL;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("-noot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("-noot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
||||||
|
@ -161,8 +140,7 @@ START_TEST ( test_tokenizer_match_normal_single_ci_negate )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_normal_multiple_ci_negate )
|
START_TEST(test_tokenizer_match_normal_multiple_ci_negate) {
|
||||||
{
|
|
||||||
config.matching_method = MM_NORMAL;
|
config.matching_method = MM_NORMAL;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("-noot aap", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("-noot aap", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
||||||
|
@ -171,12 +149,10 @@ START_TEST ( test_tokenizer_match_normal_multiple_ci_negate )
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "nootap mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "nootap mies"), FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "noap miesot"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "noap miesot"), FALSE);
|
||||||
helper_tokenize_free(tokens);
|
helper_tokenize_free(tokens);
|
||||||
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_single_ci )
|
START_TEST(test_tokenizer_match_glob_single_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
||||||
|
|
||||||
|
@ -192,8 +168,7 @@ START_TEST ( test_tokenizer_match_glob_single_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_single_cs )
|
START_TEST(test_tokenizer_match_glob_single_cs) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
||||||
|
|
||||||
|
@ -205,12 +180,10 @@ START_TEST ( test_tokenizer_match_glob_single_cs )
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "Nooaap mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "Nooaap mies"), FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "noOTap mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "noOTap mies"), FALSE);
|
||||||
helper_tokenize_free(tokens);
|
helper_tokenize_free(tokens);
|
||||||
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_multiple_ci )
|
START_TEST(test_tokenizer_match_glob_multiple_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -222,8 +195,7 @@ START_TEST ( test_tokenizer_match_glob_multiple_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_single_ci_question )
|
START_TEST(test_tokenizer_match_glob_single_ci_question) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("n?ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("n?ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -235,8 +207,7 @@ START_TEST ( test_tokenizer_match_glob_single_ci_question )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_single_ci_star )
|
START_TEST(test_tokenizer_match_glob_single_ci_star) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("n*ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("n*ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -248,8 +219,7 @@ START_TEST ( test_tokenizer_match_glob_single_ci_star )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_glob_multiple_ci_star )
|
START_TEST(test_tokenizer_match_glob_multiple_ci_star) {
|
||||||
{
|
|
||||||
config.matching_method = MM_GLOB;
|
config.matching_method = MM_GLOB;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("n* ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("n* ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -262,8 +232,7 @@ START_TEST ( test_tokenizer_match_glob_multiple_ci_star )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_fuzzy_single_ci )
|
START_TEST(test_tokenizer_match_fuzzy_single_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_FUZZY;
|
config.matching_method = MM_FUZZY;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
||||||
|
|
||||||
|
@ -279,8 +248,7 @@ START_TEST ( test_tokenizer_match_fuzzy_single_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_fuzzy_single_cs )
|
START_TEST(test_tokenizer_match_fuzzy_single_cs) {
|
||||||
{
|
|
||||||
config.matching_method = MM_FUZZY;
|
config.matching_method = MM_FUZZY;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
||||||
|
|
||||||
|
@ -295,8 +263,7 @@ START_TEST ( test_tokenizer_match_fuzzy_single_cs )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_fuzzy_multiple_ci )
|
START_TEST(test_tokenizer_match_fuzzy_multiple_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_FUZZY;
|
config.matching_method = MM_FUZZY;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -316,8 +283,7 @@ START_TEST ( test_tokenizer_match_fuzzy_multiple_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_fuzzy_single_ci_split )
|
START_TEST(test_tokenizer_match_fuzzy_single_ci_split) {
|
||||||
{
|
|
||||||
config.matching_method = MM_FUZZY;
|
config.matching_method = MM_FUZZY;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("ont", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("ont", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
||||||
|
@ -328,8 +294,7 @@ START_TEST ( test_tokenizer_match_fuzzy_single_ci_split )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_fuzzy_multiple_ci_split )
|
START_TEST(test_tokenizer_match_fuzzy_multiple_ci_split) {
|
||||||
{
|
|
||||||
config.matching_method = MM_FUZZY;
|
config.matching_method = MM_FUZZY;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("o n t", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("o n t", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -342,8 +307,7 @@ START_TEST ( test_tokenizer_match_fuzzy_multiple_ci_split )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_single_ci )
|
START_TEST(test_tokenizer_match_regex_single_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", FALSE);
|
||||||
|
|
||||||
|
@ -359,8 +323,7 @@ START_TEST ( test_tokenizer_match_regex_single_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_single_cs )
|
START_TEST(test_tokenizer_match_regex_single_cs) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
rofi_int_matcher **tokens = helper_tokenize("noot", TRUE);
|
||||||
|
|
||||||
|
@ -375,8 +338,7 @@ START_TEST ( test_tokenizer_match_regex_single_cs )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_multiple_ci )
|
START_TEST(test_tokenizer_match_regex_multiple_ci) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("no ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -388,8 +350,7 @@ START_TEST ( test_tokenizer_match_regex_multiple_ci )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_single_ci_dq )
|
START_TEST(test_tokenizer_match_regex_single_ci_dq) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("n.?ot", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("n.?ot", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -401,8 +362,7 @@ START_TEST ( test_tokenizer_match_regex_single_ci_dq )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_single_two_char )
|
START_TEST(test_tokenizer_match_regex_single_two_char) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("n[oa]{2}t", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("n[oa]{2}t", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), TRUE);
|
||||||
|
@ -415,8 +375,7 @@ START_TEST ( test_tokenizer_match_regex_single_two_char )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST ( test_tokenizer_match_regex_single_two_word_till_end )
|
START_TEST(test_tokenizer_match_regex_single_two_word_till_end) {
|
||||||
{
|
|
||||||
config.matching_method = MM_REGEX;
|
config.matching_method = MM_REGEX;
|
||||||
rofi_int_matcher **tokens = helper_tokenize("^(aap|noap)\\sMie.*", FALSE);
|
rofi_int_matcher **tokens = helper_tokenize("^(aap|noap)\\sMie.*", FALSE);
|
||||||
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
ck_assert_int_eq(helper_token_match(tokens, "aap noot mies"), FALSE);
|
||||||
|
@ -429,8 +388,7 @@ START_TEST ( test_tokenizer_match_regex_single_two_word_till_end )
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
static Suite * helper_tokenizer_suite (void)
|
static Suite *helper_tokenizer_suite(void) {
|
||||||
{
|
|
||||||
Suite *s;
|
Suite *s;
|
||||||
|
|
||||||
s = suite_create("Tokenizer");
|
s = suite_create("Tokenizer");
|
||||||
|
@ -476,17 +434,16 @@ static Suite * helper_tokenizer_suite (void)
|
||||||
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_cs);
|
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_cs);
|
||||||
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_ci_dq);
|
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_ci_dq);
|
||||||
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_two_char);
|
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_two_char);
|
||||||
tcase_add_test(tc_regex, test_tokenizer_match_regex_single_two_word_till_end);
|
tcase_add_test(tc_regex,
|
||||||
|
test_tokenizer_match_regex_single_two_word_till_end);
|
||||||
tcase_add_test(tc_regex, test_tokenizer_match_regex_multiple_ci);
|
tcase_add_test(tc_regex, test_tokenizer_match_regex_multiple_ci);
|
||||||
suite_add_tcase(s, tc_regex);
|
suite_add_tcase(s, tc_regex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
{
|
|
||||||
if (setlocale(LC_ALL, "") == NULL) {
|
if (setlocale(LC_ALL, "") == NULL) {
|
||||||
fprintf(stderr, "Failed to set locale.\n");
|
fprintf(stderr, "Failed to set locale.\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -503,5 +460,4 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
number_failed = srunner_ntests_failed(sr);
|
number_failed = srunner_ntests_failed(sr);
|
||||||
srunner_free(sr);
|
srunner_free(sr);
|
||||||
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,15 +50,23 @@
|
||||||
|
|
||||||
ThemeWidget *rofi_theme = NULL;
|
ThemeWidget *rofi_theme = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query(const char *name, const int size) { return 0; }
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
|
G_GNUC_UNUSED const int size) {
|
||||||
const int hsize) {
|
return 0;
|
||||||
|
}
|
||||||
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid) { return NULL; }
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean rofi_theme_parse_string(const char *string) { return FALSE; }
|
gboolean rofi_theme_parse_string(G_GNUC_UNUSED const char *string) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
double textbox_get_estimated_char_height(void) { return 16.0; }
|
double textbox_get_estimated_char_height(void) { return 16.0; }
|
||||||
double textbox_get_estimated_ch(void) { return 9.0; }
|
double textbox_get_estimated_ch(void) { return 9.0; }
|
||||||
|
|
|
@ -25,30 +25,32 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <widgets/scrollbar.h>
|
|
||||||
#include <widgets/textbox.h>
|
|
||||||
#include <widgets/icon.h>
|
|
||||||
#include <widgets/listview.h>
|
|
||||||
#include <widgets/widget.h>
|
|
||||||
#include <widgets/widget-internal.h>
|
|
||||||
#include "rofi.h"
|
|
||||||
#include "xrmoptions.h"
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
|
#include "rofi.h"
|
||||||
|
#include "xrmoptions.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <widgets/icon.h>
|
||||||
|
#include <widgets/listview.h>
|
||||||
|
#include <widgets/scrollbar.h>
|
||||||
|
#include <widgets/textbox.h>
|
||||||
|
#include <widgets/widget-internal.h>
|
||||||
|
#include <widgets/widget.h>
|
||||||
unsigned int test = 0;
|
unsigned int test = 0;
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %3u passed (%s)\n", ++test, #a); \
|
printf("Test %3u passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TASSERTE( a, b ) { \
|
#define TASSERTE(a, b) \
|
||||||
|
{ \
|
||||||
if ((a) == (b)) { \
|
if ((a) == (b)) { \
|
||||||
printf("Test %u passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
printf("Test %u passed (%s == %s) (%u == %u)\n", ++test, #a, #b, a, b); \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -59,60 +61,41 @@ unsigned int test =0;
|
||||||
|
|
||||||
ThemeWidget *rofi_configuration = NULL;
|
ThemeWidget *rofi_configuration = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
char * helper_get_theme_path ( const char *file, const char *ext )
|
char *helper_get_theme_path(const char *file, G_GNUC_UNUSED const char *ext) {
|
||||||
{
|
|
||||||
return g_strdup(file);
|
return g_strdup(file);
|
||||||
}
|
}
|
||||||
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
|
gboolean config_parse_set_property(G_GNUC_UNUSED const Property *p,
|
||||||
{
|
G_GNUC_UNUSED char **error) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
{}
|
|
||||||
|
|
||||||
char * rofi_expand_path ( G_GNUC_UNUSED const char *path )
|
char *rofi_expand_path(G_GNUC_UNUSED const char *path) { return NULL; }
|
||||||
{
|
double textbox_get_estimated_char_height(void) { return 16; }
|
||||||
return NULL;
|
double textbox_get_estimated_ch(void) { return 8.0; }
|
||||||
}
|
|
||||||
double textbox_get_estimated_char_height ( void )
|
|
||||||
{
|
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
double textbox_get_estimated_ch ( void )
|
|
||||||
{
|
|
||||||
return 8.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void listview_set_selected ( G_GNUC_UNUSED listview *lv, G_GNUC_UNUSED unsigned int selected )
|
void listview_set_selected(G_GNUC_UNUSED listview *lv,
|
||||||
{
|
G_GNUC_UNUSED unsigned int selected) {}
|
||||||
|
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,
|
||||||
|
G_GNUC_UNUSED int *height) {}
|
||||||
|
|
||||||
}
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
|
||||||
{
|
|
||||||
scrollbar *sb = scrollbar_create(NULL, "scrollbar");
|
scrollbar *sb = scrollbar_create(NULL, "scrollbar");
|
||||||
widget_resize(WIDGET(sb), 10, 100);
|
widget_resize(WIDGET(sb), 10, 100);
|
||||||
|
|
||||||
|
@ -135,7 +118,6 @@ int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
||||||
scrollbar_set_handle_length(sb, 0);
|
scrollbar_set_handle_length(sb, 0);
|
||||||
TASSERTE(sb->pos_length, 1u);
|
TASSERTE(sb->pos_length, 1u);
|
||||||
|
|
||||||
|
|
||||||
guint cl = scrollbar_scroll_get_line(sb, 10);
|
guint cl = scrollbar_scroll_get_line(sb, 10);
|
||||||
TASSERTE(cl, 1010u);
|
TASSERTE(cl, 1010u);
|
||||||
cl = scrollbar_scroll_get_line(sb, 20);
|
cl = scrollbar_scroll_get_line(sb, 20);
|
||||||
|
|
|
@ -25,28 +25,29 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "display.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "xcb.h"
|
||||||
|
#include "xrmoptions.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <cairo-xlib.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <history.h>
|
#include <history.h>
|
||||||
#include <string.h>
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <widgets/textbox.h>
|
|
||||||
#include <rofi.h>
|
#include <rofi.h>
|
||||||
#include <cairo-xlib.h>
|
#include <stdio.h>
|
||||||
#include "display.h"
|
#include <string.h>
|
||||||
#include "xcb.h"
|
#include <widgets/textbox.h>
|
||||||
#include "settings.h"
|
#include <xcb/xcb.h>
|
||||||
#include "xrmoptions.h"
|
|
||||||
|
|
||||||
#include "rofi-icon-fetcher.h"
|
#include "rofi-icon-fetcher.h"
|
||||||
static int test = 0;
|
static int test = 0;
|
||||||
unsigned int normal_window_mode = 0;
|
unsigned int normal_window_mode = 0;
|
||||||
|
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %3i passed (%s)\n", ++test, #a); \
|
printf("Test %3i passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
|
@ -55,62 +56,53 @@ unsigned int normal_window_mode = 0;
|
||||||
|
|
||||||
ThemeWidget *rofi_configuration = NULL;
|
ThemeWidget *rofi_configuration = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
|
gboolean config_parse_set_property(G_GNUC_UNUSED const Property *p,
|
||||||
{
|
G_GNUC_UNUSED char **error) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
{
|
void rofi_view_queue_redraw() {}
|
||||||
}
|
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,
|
||||||
void rofi_view_queue_redraw ()
|
G_GNUC_UNUSED int *height) {}
|
||||||
{
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
{
|
cairo_surface_t *surf =
|
||||||
cairo_surface_t *surf = cairo_image_surface_create ( CAIRO_FORMAT_ARGB32, 100, 100 );
|
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);
|
||||||
cairo_t *draw = cairo_create(surf);
|
cairo_t *draw = cairo_create(surf);
|
||||||
PangoContext *p = pango_cairo_create_context(draw);
|
PangoContext *p = pango_cairo_create_context(draw);
|
||||||
|
|
||||||
|
|
||||||
textbox_setup();
|
textbox_setup();
|
||||||
textbox_set_pango_context("default", p);
|
textbox_set_pango_context("default", p);
|
||||||
|
|
||||||
|
textbox *box = textbox_create(NULL, WIDGET_TYPE_TEXTBOX_TEXT, "textbox",
|
||||||
textbox *box = textbox_create ( NULL, WIDGET_TYPE_TEXTBOX_TEXT, "textbox", TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT, NORMAL, "test",0,0 );
|
TB_EDITABLE | TB_AUTOWIDTH | TB_AUTOHEIGHT,
|
||||||
|
NORMAL, "test", 0, 0);
|
||||||
TASSERT(box != NULL);
|
TASSERT(box != NULL);
|
||||||
|
|
||||||
textbox_keybinding(box, MOVE_END);
|
textbox_keybinding(box, MOVE_END);
|
||||||
|
|
|
@ -47,14 +47,21 @@
|
||||||
|
|
||||||
#define REAL_COMPARE_DELTA 0.001
|
#define REAL_COMPARE_DELTA 0.001
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query(const char *name, const int size) { return 0; }
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
|
G_GNUC_UNUSED const int size) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
void rofi_clear_error_messages(void) {}
|
void rofi_clear_error_messages(void) {}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
|
uint32_t
|
||||||
const int hsize) {
|
rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
|
G_GNUC_UNUSED G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid) { return NULL; }
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
|
|
|
@ -25,73 +25,63 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
#include "display.h"
|
||||||
#include <stdlib.h>
|
#include "rofi-icon-fetcher.h"
|
||||||
#include <stdint.h>
|
#include "rofi.h"
|
||||||
#include <stdio.h>
|
#include "xcb.h"
|
||||||
|
#include "xrmoptions.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <widgets/widget.h>
|
#include <unistd.h>
|
||||||
#include <widgets/widget-internal.h>
|
#include <widgets/widget-internal.h>
|
||||||
#include "rofi.h"
|
#include <widgets/widget.h>
|
||||||
#include "display.h"
|
|
||||||
#include "xrmoptions.h"
|
|
||||||
#include "xcb.h"
|
|
||||||
#include "rofi-icon-fetcher.h"
|
|
||||||
unsigned int test = 0;
|
unsigned int test = 0;
|
||||||
#define TASSERT( a ) { \
|
#define TASSERT(a) \
|
||||||
|
{ \
|
||||||
assert(a); \
|
assert(a); \
|
||||||
printf("Test %3u passed (%s)\n", ++test, #a); \
|
printf("Test %3u passed (%s)\n", ++test, #a); \
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeWidget *rofi_configuration = NULL;
|
ThemeWidget *rofi_configuration = NULL;
|
||||||
|
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
|
uint32_t rofi_icon_fetcher_query(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
|
uint32_t rofi_icon_fetcher_query_advanced(G_GNUC_UNUSED const char *name,
|
||||||
{
|
G_GNUC_UNUSED const int wsize,
|
||||||
|
G_GNUC_UNUSED const int hsize) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
|
cairo_surface_t *rofi_icon_fetcher_get(G_GNUC_UNUSED const uint32_t uid) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
|
gboolean config_parse_set_property(G_GNUC_UNUSED const Property *p,
|
||||||
{
|
G_GNUC_UNUSED char **error) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
|
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
|
||||||
{
|
void rofi_view_queue_redraw(void) {}
|
||||||
}
|
int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
|
||||||
void rofi_view_queue_redraw ( void )
|
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,
|
||||||
{
|
G_GNUC_UNUSED int *height) {}
|
||||||
|
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
|
||||||
}
|
|
||||||
int monitor_active ( G_GNUC_UNUSED workarea *mon )
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
|
|
||||||
{
|
|
||||||
fputs(msg, stderr);
|
fputs(msg, stderr);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_startup_notification ( G_GNUC_UNUSED RofiHelperExecuteContext *context, G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup, G_GNUC_UNUSED gpointer *user_data )
|
void display_startup_notification(
|
||||||
{
|
G_GNUC_UNUSED RofiHelperExecuteContext *context,
|
||||||
}
|
G_GNUC_UNUSED GSpawnChildSetupFunc *child_setup,
|
||||||
|
G_GNUC_UNUSED gpointer *user_data) {}
|
||||||
|
|
||||||
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
|
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
|
||||||
{
|
|
||||||
// box 20 by 40
|
// box 20 by 40
|
||||||
widget *wid = (widget *)g_malloc0(sizeof(widget));
|
widget *wid = (widget *)g_malloc0(sizeof(widget));
|
||||||
widget_resize(wid, 20, 40);
|
widget_resize(wid, 20, 40);
|
||||||
|
|
Loading…
Reference in a new issue