1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Rename Dialogs -> Modes

Try to fix some of old syntax.
This commit is contained in:
Dave Davenport 2022-02-23 23:18:53 +01:00
parent 32d33ade16
commit 534aa6ad54
28 changed files with 215 additions and 248 deletions

View file

@ -80,15 +80,15 @@ SOURCES=\
source/xrmoptions.c\
source/xcb.c\
source/css-colors.c\
source/dialogs/run.c\
source/dialogs/ssh.c\
source/dialogs/drun.c\
source/dialogs/dmenu.c\
source/dialogs/combi.c\
source/dialogs/window.c\
source/dialogs/script.c\
source/dialogs/help-keys.c\
source/dialogs/filebrowser.c\
source/modes/run.c\
source/modes/ssh.c\
source/modes/drun.c\
source/modes/dmenu.c\
source/modes/combi.c\
source/modes/window.c\
source/modes/script.c\
source/modes/help-keys.c\
source/modes/filebrowser.c\
include/display.h\
include/xcb.h\
include/xcb-internal.h\
@ -116,17 +116,17 @@ SOURCES=\
include/widgets/listview.h\
include/widgets/scrollbar.h\
include/xrmoptions.h\
include/dialogs/ssh.h\
include/dialogs/run.h\
include/dialogs/drun.h\
include/dialogs/dmenu.h\
include/dialogs/combi.h\
include/dialogs/script.h\
include/dialogs/window.h\
include/dialogs/dialogs.h\
include/dialogs/help-keys.h\
include/dialogs/filebrowser.h\
include/dialogs/dmenuscriptshared.h\
include/modes/ssh.h\
include/modes/run.h\
include/modes/drun.h\
include/modes/dmenu.h\
include/modes/combi.h\
include/modes/script.h\
include/modes/window.h\
include/modes/modes.h\
include/modes/help-keys.h\
include/modes/filebrowser.h\
include/modes/dmenuscriptshared.h\
resources/resources.c\
resources/resources.h
@ -534,7 +534,7 @@ mode_test_LDADD=$(textbox_test_LDADD) $(check_LIBS)
mode_test_SOURCES=\
config/config.c\
test/mode-test.c\
source/dialogs/help-keys.c\
source/modes/help-keys.c\
source/helper.c\
source/theme.c\
source/css-colors.c\

View file

@ -1452,19 +1452,19 @@ View: The main window view functions.
.IP \(bu 2
Widgets.Box: The Box widget.
.IP \(bu 2
Dialogs.DMenu: The dmenu mode.
Modes.DMenu: The dmenu mode.
.IP \(bu 2
Dialogs.Run: The run mode.
Modes.Run: The run mode.
.IP \(bu 2
Dialogs.DRun: The desktop file run mode.
Modes.DRun: The desktop file run mode.
.IP \(bu 2
Dialogs.Window: The window mode.
Modes.Window: The window mode.
.IP \(bu 2
Dialogs.Script: The script mode.
Modes.Script: The script mode.
.IP \(bu 2
Dialogs.Combi: The script mode.
Modes.Combi: The script mode.
.IP \(bu 2
Dialogs.Ssh: The ssh mode.
Modes.Ssh: The ssh mode.
.IP \(bu 2
Rofi: The main application.
.IP \(bu 2

View file

@ -919,13 +919,13 @@ environment variable. At the time of creation of this page, the following debug
* X11Helper: The X11 Helper functions.
* View: The main window view functions.
* Widgets.Box: The Box widget.
* Dialogs.DMenu: The dmenu mode.
* Dialogs.Run: The run mode.
* Dialogs.DRun: The desktop file run mode.
* Dialogs.Window: The window mode.
* Dialogs.Script: The script mode.
* Dialogs.Combi: The script mode.
* Dialogs.Ssh: The ssh mode.
* Modes.DMenu: The dmenu mode.
* Modes.Run: The run mode.
* Modes.DRun: The desktop file run mode.
* Modes.Window: The window mode.
* Modes.Script: The script mode.
* Modes.Combi: The script mode.
* Modes.Ssh: The ssh mode.
* Rofi: The main application.
* Timings: Get timing output.
* Theme: Theme engine debug output. (warning lots of output).

View file

@ -25,23 +25,23 @@
*
*/
#ifndef ROFI_DIALOGS_DIALOGS_H
#define ROFI_DIALOGS_DIALOGS_H
#ifndef ROFI_MODES_MODES_H
#define ROFI_MODES_MODES_H
/**
* @defgroup MODES Modes
*/
/**
* List of available dialogs.
* List of available modes.
*/
#include "dialogs/combi.h"
#include "dialogs/dmenu.h"
#include "dialogs/drun.h"
#include "dialogs/filebrowser.h"
#include "dialogs/help-keys.h"
#include "dialogs/run.h"
#include "dialogs/script.h"
#include "dialogs/ssh.h"
#include "dialogs/window.h"
#endif // ROFI_DIALOGS_DIALOGS_H
#include "modes/combi.h"
#include "modes/dmenu.h"
#include "modes/drun.h"
#include "modes/filebrowser.h"
#include "modes/help-keys.h"
#include "modes/run.h"
#include "modes/script.h"
#include "modes/ssh.h"
#include "modes/window.h"
#endif // ROFI_MODES_MODES_H

View file

@ -159,15 +159,15 @@ rofi_sources = files(
'source/xrmoptions.c',
'source/rofi-types.c',
'source/xcb.c',
'source/dialogs/run.c',
'source/dialogs/ssh.c',
'source/dialogs/drun.c',
'source/dialogs/dmenu.c',
'source/dialogs/combi.c',
'source/dialogs/window.c',
'source/dialogs/script.c',
'source/dialogs/help-keys.c',
'source/dialogs/filebrowser.c',
'source/modes/run.c',
'source/modes/ssh.c',
'source/modes/drun.c',
'source/modes/dmenu.c',
'source/modes/combi.c',
'source/modes/window.c',
'source/modes/script.c',
'source/modes/help-keys.c',
'source/modes/filebrowser.c',
'include/display.h',
'include/xcb.h',
'include/xcb-internal.h',
@ -195,17 +195,17 @@ rofi_sources = files(
'include/widgets/listview.h',
'include/widgets/scrollbar.h',
'include/xrmoptions.h',
'include/dialogs/ssh.h',
'include/dialogs/run.h',
'include/dialogs/drun.h',
'include/dialogs/dmenu.h',
'include/dialogs/combi.h',
'include/dialogs/script.h',
'include/dialogs/window.h',
'include/dialogs/dialogs.h',
'include/dialogs/help-keys.h',
'include/dialogs/filebrowser.h',
'include/dialogs/dmenuscriptshared.h',
'include/modes/ssh.h',
'include/modes/run.h',
'include/modes/drun.h',
'include/modes/dmenu.h',
'include/modes/combi.h',
'include/modes/script.h',
'include/modes/window.h',
'include/modes/modes.h',
'include/modes/help-keys.h',
'include/modes/filebrowser.h',
'include/modes/dmenuscriptshared.h',
)
theme_lexer_sources = files('lexer/theme-lexer.l')
theme_parser_sources = files('lexer/theme-parser.y')
@ -452,7 +452,7 @@ if check.found()
],
objects: rofi.extract_objects([
'config/config.c',
'source/dialogs/help-keys.c',
'source/modes/help-keys.c',
'source/helper.c',
'source/theme.c',
'source/css-colors.c',

View file

@ -26,7 +26,7 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Combi"
#define G_LOG_DOMAIN "Modes.Combi"
#include "helper.h"
#include "settings.h"
@ -36,7 +36,7 @@
#include "mode-private.h"
#include "widgets/textbox.h"
#include <dialogs/dialogs.h>
#include <modes/modes.h>
#include <pango/pango.h>
#include <theme.h>

View file

@ -26,9 +26,9 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.DMenu"
#define G_LOG_DOMAIN "Modes.DMenu"
#include "dialogs/dmenu.h"
#include "modes/dmenu.h"
#include "helper.h"
#include "rofi-icon-fetcher.h"
#include "rofi.h"
@ -50,7 +50,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/dmenuscriptshared.h"
#include "modes/dmenuscriptshared.h"
static int dmenu_mode_init(Mode *sw);
static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens,

View file

@ -26,7 +26,7 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.DRun"
#define G_LOG_DOMAIN "Modes.DRun"
#include <config.h>
#ifdef ENABLE_DRUN
@ -44,8 +44,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/drun.h"
#include "dialogs/filebrowser.h"
#include "modes/drun.h"
#include "modes/filebrowser.h"
#include "helper.h"
#include "history.h"
#include "mode-private.h"

View file

@ -36,7 +36,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "dialogs/filebrowser.h"
#include "modes/filebrowser.h"
#include "helper.h"
#include "history.h"
#include "mode-private.h"

View file

@ -38,7 +38,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/help-keys.h"
#include "modes/help-keys.h"
#include "helper.h"
#include "rofi.h"
#include "settings.h"

View file

@ -31,7 +31,7 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Run"
#define G_LOG_DOMAIN "Modes.Run"
#include <config.h>
#include <stdio.h>
@ -46,8 +46,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/filebrowser.h"
#include "dialogs/run.h"
#include "modes/filebrowser.h"
#include "modes/run.h"
#include "helper.h"
#include "history.h"
#include "rofi.h"

View file

@ -26,9 +26,9 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Script"
#define G_LOG_DOMAIN "Modes.Script"
#include "dialogs/script.h"
#include "modes/script.h"
#include "helper.h"
#include "rofi.h"
#include <assert.h>
@ -46,7 +46,7 @@
#include "rofi-icon-fetcher.h"
#include "dialogs/dmenuscriptshared.h"
#include "modes/dmenuscriptshared.h"
typedef struct {
/** ID of the current script. */

View file

@ -33,7 +33,7 @@
/**
* Log domain for the ssh mode.
*/
#define G_LOG_DOMAIN "Dialogs.Ssh"
#define G_LOG_DOMAIN "Modes.Ssh"
#include <config.h>
#include <glib.h>
@ -51,7 +51,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/ssh.h"
#include "modes/ssh.h"
#include "history.h"
#include "rofi.h"
#include "settings.h"

View file

@ -26,7 +26,7 @@
*/
/** The log domain of this dialog. */
#define G_LOG_DOMAIN "Dialogs.Window"
#define G_LOG_DOMAIN "Modes.Window"
#include <config.h>
@ -49,8 +49,8 @@
#include "xcb-internal.h"
#include "xcb.h"
#include "dialogs/window.h"
#include "helper.h"
#include "modes/window.h"
#include "rofi.h"
#include "settings.h"
#include "widgets/textbox.h"

View file

@ -59,9 +59,9 @@
#include "rofi.h"
#include "settings.h"
#include "dialogs/dialogs.h"
#include "helper.h"
#include "mode.h"
#include "modes/modes.h"
#include "widgets/textbox.h"
#include "xrmoptions.h"

View file

@ -54,11 +54,11 @@
#include "settings.h"
#include "timings.h"
#include "dialogs/dialogs.h"
#include "display.h"
#include "helper-theme.h"
#include "helper.h"
#include "mode.h"
#include "modes/modes.h"
#include "xcb-internal.h"
#include "xrmoptions.h"

View file

@ -63,7 +63,7 @@
#include "xcb.h"
#include <libsn/sn.h>
#include "dialogs/window.h"
#include "modes/window.h"
#include "mode.h"
#include <rofi.h>

View file

@ -25,187 +25,155 @@
*
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <glib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <mode.h>
#include <mode-private.h>
#include <dialogs/help-keys.h>
#include <xkbcommon/xkbcommon.h>
#include "theme.h"
#include "rofi.h"
#include "display.h"
#include "xcb.h"
#include "rofi.h"
#include "theme.h"
#include "widgets/textbox.h"
#include <keyb.h>
#include "xcb.h"
#include <helper.h>
#include <keyb.h>
#include <mode-private.h>
#include <mode.h>
#include <modes/help-keys.h>
#include <xkbcommon/xkbcommon.h>
#include <check.h>
#include "rofi-icon-fetcher.h"
#include <check.h>
ThemeWidget *rofi_theme = NULL;
uint32_t rofi_icon_fetcher_query ( const char *name, const int size )
{
uint32_t rofi_icon_fetcher_query(const char *name, const int size) { return 0; }
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
const int hsize) {
return 0;
}
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize )
{
return 0;
}
void rofi_clear_error_messages ( void ) {}
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid )
{
return NULL;
}
void rofi_clear_error_messages(void) {}
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid) { return NULL; }
gboolean rofi_theme_parse_string ( const char *string )
{
return FALSE;
}
gboolean rofi_theme_parse_string(const char *string) { return FALSE; }
double textbox_get_estimated_char_height ( void )
{
return 16.0;
}
double textbox_get_estimated_ch ( void )
{
return 9.0;
}
void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
{
}
int monitor_active ( G_GNUC_UNUSED workarea *d )
{
return 0;
}
int rofi_view_error_dialog ( const char *msg, G_GNUC_UNUSED int markup )
{
fputs ( msg, stderr );
double textbox_get_estimated_char_height(void) { return 16.0; }
double textbox_get_estimated_ch(void) { return 9.0; }
void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
int monitor_active(G_GNUC_UNUSED workarea *d) { return 0; }
int rofi_view_error_dialog(const char *msg, G_GNUC_UNUSED int markup) {
fputs(msg, stderr);
return TRUE;
}
void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
{
}
RofiViewState * rofi_view_get_active ( void )
{
return NULL;
}
gboolean rofi_view_check_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_UNUSED BindingsScope scope, G_GNUC_UNUSED guint action )
{
void rofi_view_get_current_monitor(G_GNUC_UNUSED int *width,
G_GNUC_UNUSED int *height) {}
RofiViewState *rofi_view_get_active(void) { return NULL; }
gboolean rofi_view_check_action(G_GNUC_UNUSED RofiViewState *state,
G_GNUC_UNUSED BindingsScope scope,
G_GNUC_UNUSED guint action) {
return FALSE;
}
void rofi_view_trigger_action ( G_GNUC_UNUSED RofiViewState *state, G_GNUC_UNUSED BindingsScope scope, G_GNUC_UNUSED guint action )
{
}
void rofi_view_trigger_action(G_GNUC_UNUSED RofiViewState *state,
G_GNUC_UNUSED BindingsScope scope,
G_GNUC_UNUSED guint action) {}
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) {}
#ifndef _ck_assert_ptr_null
/* Pointer against NULL comparison macros with improved output
* compared to ck_assert(). */
/* OP may only be == or != */
#define _ck_assert_ptr_null(X, OP) do { \
const void* _ck_x = (X); \
ck_assert_msg(_ck_x OP NULL, \
"Assertion '%s' failed: %s == %#x", \
#X" "#OP" NULL", \
#X, _ck_x); \
} while (0)
#define _ck_assert_ptr_null(X, OP) \
do { \
const void *_ck_x = (X); \
ck_assert_msg(_ck_x OP NULL, "Assertion '%s' failed: %s == %#x", \
#X " " #OP " NULL", #X, _ck_x); \
} while (0)
#define ck_assert_ptr_null(X) _ck_assert_ptr_null(X, ==)
#define ck_assert_ptr_nonnull(X) _ck_assert_ptr_null(X, !=)
#endif
static void test_mode_setup ( void )
{
ck_assert_int_eq ( mode_init ( &help_keys_mode ), TRUE);
}
static void test_mode_teardown ( void )
{
mode_destroy ( &help_keys_mode );
static void test_mode_setup(void) {
ck_assert_int_eq(mode_init(&help_keys_mode), TRUE);
}
static void test_mode_teardown(void) { mode_destroy(&help_keys_mode); }
START_TEST(test_mode_create)
{
ck_assert_ptr_nonnull ( help_keys_mode.private_data );
START_TEST(test_mode_create) {
ck_assert_ptr_nonnull(help_keys_mode.private_data);
}
END_TEST
START_TEST(test_mode_destroy)
{
mode_destroy ( &help_keys_mode );
ck_assert_ptr_null ( help_keys_mode.private_data );
START_TEST(test_mode_destroy) {
mode_destroy(&help_keys_mode);
ck_assert_ptr_null(help_keys_mode.private_data);
}
END_TEST
START_TEST(test_mode_num_items)
{
unsigned int rows = mode_get_num_entries ( &help_keys_mode);
ck_assert_int_eq ( rows, 74);
for ( unsigned int i =0; i < rows; i++ ) {
START_TEST(test_mode_num_items) {
unsigned int rows = mode_get_num_entries(&help_keys_mode);
ck_assert_int_eq(rows, 74);
for (unsigned int i = 0; i < rows; i++) {
int state = 0;
GList *list = NULL;
char *v = mode_get_display_value ( &help_keys_mode, i, &state, &list, TRUE );
ck_assert_ptr_nonnull ( v );
g_free ( v );
v = mode_get_display_value ( &help_keys_mode, i, &state, &list, FALSE );
ck_assert_ptr_null ( v );
char *v = mode_get_display_value(&help_keys_mode, i, &state, &list, TRUE);
ck_assert_ptr_nonnull(v);
g_free(v);
v = mode_get_display_value(&help_keys_mode, i, &state, &list, FALSE);
ck_assert_ptr_null(v);
}
mode_destroy ( &help_keys_mode );
mode_destroy(&help_keys_mode);
}
END_TEST
START_TEST(test_mode_result)
{
START_TEST(test_mode_result) {
char *res;
res = NULL;
ck_assert_int_eq ( mode_result ( &help_keys_mode, MENU_NEXT, &res,0), NEXT_DIALOG);
g_free ( res );
ck_assert_int_eq(mode_result(&help_keys_mode, MENU_NEXT, &res, 0),
NEXT_DIALOG);
g_free(res);
res = NULL;
ck_assert_int_eq ( mode_result ( &help_keys_mode, MENU_PREVIOUS, &res,0), PREVIOUS_DIALOG);
g_free ( res );
ck_assert_int_eq(mode_result(&help_keys_mode, MENU_PREVIOUS, &res, 0),
PREVIOUS_DIALOG);
g_free(res);
res = NULL;
ck_assert_int_eq ( mode_result ( &help_keys_mode, MENU_QUICK_SWITCH|1, &res,0), 1);
g_free ( res );
ck_assert_int_eq(mode_result(&help_keys_mode, MENU_QUICK_SWITCH | 1, &res, 0),
1);
g_free(res);
res = NULL;
ck_assert_int_eq ( mode_result ( &help_keys_mode, MENU_QUICK_SWITCH|2, &res,0), 2);
g_free ( res );
ck_assert_int_eq(mode_result(&help_keys_mode, MENU_QUICK_SWITCH | 2, &res, 0),
2);
g_free(res);
}
END_TEST
START_TEST(test_mode_match_entry)
{
rofi_int_matcher **t = helper_tokenize( "primary-paste", FALSE );
ck_assert_ptr_nonnull ( t );
START_TEST(test_mode_match_entry) {
rofi_int_matcher **t = helper_tokenize("primary-paste", FALSE);
ck_assert_ptr_nonnull(t);
ck_assert_int_eq ( mode_token_match ( &help_keys_mode, t, 0), TRUE );
ck_assert_int_eq ( mode_token_match ( &help_keys_mode, t, 1), FALSE );
helper_tokenize_free ( t );
t = helper_tokenize( "y-paste", FALSE );
ck_assert_ptr_nonnull ( t );
ck_assert_int_eq ( mode_token_match ( &help_keys_mode, t, 0), TRUE );
ck_assert_int_eq ( mode_token_match ( &help_keys_mode, t, 1), TRUE );
ck_assert_int_eq ( mode_token_match ( &help_keys_mode, t, 2), FALSE );
helper_tokenize_free ( t );
ck_assert_int_eq(mode_token_match(&help_keys_mode, t, 0), TRUE);
ck_assert_int_eq(mode_token_match(&help_keys_mode, t, 1), FALSE);
helper_tokenize_free(t);
t = helper_tokenize("y-paste", FALSE);
ck_assert_ptr_nonnull(t);
ck_assert_int_eq(mode_token_match(&help_keys_mode, t, 0), TRUE);
ck_assert_int_eq(mode_token_match(&help_keys_mode, t, 1), TRUE);
ck_assert_int_eq(mode_token_match(&help_keys_mode, t, 2), FALSE);
helper_tokenize_free(t);
}
END_TEST
static Suite * mode_suite (void)
{
static Suite *mode_suite(void) {
Suite *s;
TCase *tc_core;
@ -216,17 +184,16 @@ static Suite * mode_suite (void)
tcase_add_checked_fixture(tc_core, test_mode_setup, test_mode_teardown);
tcase_add_test(tc_core, test_mode_create);
tcase_add_test(tc_core, test_mode_num_items);
tcase_add_test(tc_core, test_mode_result );
tcase_add_test(tc_core, test_mode_result);
tcase_add_test(tc_core, test_mode_destroy);
tcase_add_test(tc_core, test_mode_match_entry );
tcase_add_test(tc_core, test_mode_match_entry);
suite_add_tcase(s, tc_core);
return s;
}
int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
{
setup_abe ();
int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
setup_abe();
int number_failed = 0;
Suite *s;
SRunner *sr;