summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@blame.services>2022-07-23 00:28:55 +0200
committerDave Davenport <qball@blame.services>2022-07-23 00:28:55 +0200
commit0e90fb065f488cde2584e1f0059e169141b04830 (patch)
treeabbe1a5a9890499f5c4d5fd16fcdc781bb8e4479
parent820b19e09a74484b6861fb1d684490f194b2cf0f (diff)
[Build] Fix some compile warnings.
-rw-r--r--include/mode-private.h2
-rw-r--r--include/mode.h2
-rw-r--r--include/theme.h2
-rw-r--r--meson.build1
-rw-r--r--source/mode.c2
-rw-r--r--source/modes/combi.c2
-rw-r--r--source/modes/dmenu.c32
-rw-r--r--source/modes/drun.c2
-rw-r--r--source/modes/filebrowser.c2
-rw-r--r--source/modes/run.c2
-rw-r--r--source/modes/script.c9
-rw-r--r--source/modes/window.c5
-rw-r--r--source/rofi.c2
-rw-r--r--source/theme.c7
-rw-r--r--source/view.c4
-rw-r--r--source/widgets/widget.c6
-rw-r--r--source/xrmoptions.c4
-rw-r--r--test/box-test.c447
-rw-r--r--test/helper-config-cmdline-parser.c195
-rw-r--r--test/helper-expand.c167
-rw-r--r--test/helper-pidfile.c18
-rw-r--r--test/helper-test.c366
-rw-r--r--test/helper-tokenize.c714
-rw-r--r--test/mode-test.c18
-rw-r--r--test/scrollbar-test.c202
-rw-r--r--test/textbox-test.c312
-rw-r--r--test/theme-parser-test.c15
-rw-r--r--test/widget-test.c352
28 files changed, 1411 insertions, 1481 deletions
diff --git a/include/mode-private.h b/include/mode-private.h
index 0f5bcaed..8becbdab 100644
--- a/include/mode-private.h
+++ b/include/mode-private.h
@@ -67,7 +67,7 @@ typedef char *(*_mode_get_display_value)(const Mode *sw,
*/
typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
unsigned int selected_line,
- int height);
+ unsigned int height);
/**
* @param sw The #Mode pointer
diff --git a/include/mode.h b/include/mode.h
index b0b8314a..3825ee43 100644
--- a/include/mode.h
+++ b/include/mode.h
@@ -139,7 +139,7 @@ char *mode_get_display_value(const Mode *mode, unsigned int selected_line,
* @returns allocated new cairo_surface_t if applicable
*/
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
- int height);
+ unsigned int height);
/**
* @param mode The mode to query
diff --git a/include/theme.h b/include/theme.h
index 789aa5f3..45faa67c 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -144,7 +144,7 @@ void rofi_theme_property_free(Property *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
*
diff --git a/meson.build b/meson.build
index 987c021e..1a04ae87 100644
--- a/meson.build
+++ b/meson.build
@@ -22,6 +22,7 @@ flags = [
'-Wunreachable-code',
'-Werror=missing-prototypes',
'-Wno-inline', # A bit too noisy with Bison…
+ '-Wextra'
]
foreach f : flags
if c_compiler.has_argument(f)
diff --git a/source/mode.c b/source/mode.c
index 588f9718..02c4aaee 100644
--- a/source/mode.c
+++ b/source/mode.c
@@ -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,
- int height) {
+ unsigned int height) {
g_assert(mode != NULL);
if (mode->_get_icon != NULL) {
diff --git a/source/modes/combi.c b/source/modes/combi.c
index cc60c33c..6293aa62 100644
--- a/source/modes/combi.c
+++ b/source/modes/combi.c
@@ -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,
- int height) {
+ unsigned int height) {
CombiModePrivateData *pd = mode_get_private_data(sw);
for (unsigned i = 0; i < pd->num_switchers; i++) {
if (index >= pd->starts[i] && index < (pd->starts[i] + pd->lengths[i])) {
diff --git a/source/modes/dmenu.c b/source/modes/dmenu.c
index 62dc76d7..ad4a7ae5 100644
--- a/source/modes/dmenu.c
+++ b/source/modes/dmenu.c
@@ -56,8 +56,8 @@
static int dmenu_mode_init(Mode *sw);
static int dmenu_token_match(const Mode *sw, rofi_int_matcher **tokens,
unsigned int index);
-static cairo_surface_t *dmenu_get_icon(const Mode *sw,
- unsigned int selected_line, int height);
+static cairo_surface_t *
+dmenu_get_icon(const Mode *sw, unsigned int selected_line, unsigned int height);
static char *dmenu_get_message(const Mode *sw);
static inline unsigned int bitget(uint32_t const *const array,
@@ -192,9 +192,13 @@ static gboolean dmenu_async_read_proc(gint fd, GIOCondition condition,
gpointer user_data) {
DmenuModePrivateData *pd = (DmenuModePrivateData *)user_data;
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.
if (read(fd, &command, 1) == 1) {
- if ( command == 'r' ){
+ if (command == 'r') {
Block *block = NULL;
gboolean changed = FALSE;
// Empty out the AsyncQueue (that is thread safe) from all blocks pushed
@@ -204,10 +208,10 @@ static gboolean dmenu_async_read_proc(gint fd, GIOCondition condition,
if (pd->cmd_list_real_length < (pd->cmd_list_length + block->length)) {
pd->cmd_list_real_length = MAX(pd->cmd_list_real_length * 2, 4096);
pd->cmd_list = g_realloc(pd->cmd_list, sizeof(DmenuScriptEntry) *
- pd->cmd_list_real_length);
+ pd->cmd_list_real_length);
}
memcpy(&(pd->cmd_list[pd->cmd_list_length]), &(block->values[0]),
- sizeof(DmenuScriptEntry) * block->length);
+ sizeof(DmenuScriptEntry) * block->length);
pd->cmd_list_length += block->length;
g_free(block);
changed = TRUE;
@@ -215,8 +219,8 @@ static gboolean dmenu_async_read_proc(gint fd, GIOCondition condition,
if (changed) {
rofi_view_reload();
}
- } else if ( command == 'q' ){
- if ( pd->loading ) {
+ } else if (command == 'q') {
+ if (pd->loading) {
rofi_view_set_overlay(rofi_view_get_active(), NULL);
}
}
@@ -239,7 +243,7 @@ static void read_input_sync(DmenuModePrivateData *pd, unsigned int pre_read) {
static gpointer read_input_thread(gpointer userdata) {
DmenuModePrivateData *pd = (DmenuModePrivateData *)userdata;
ssize_t nread = 0;
- size_t len = 0;
+ ssize_t len = 0;
char *line = NULL;
// Create the message passing queue to the UI thread.
pd->async_queue = g_async_queue_new();
@@ -276,7 +280,7 @@ static gpointer read_input_thread(gpointer userdata) {
if (readbytes > 0) {
nread += readbytes;
line[nread] = '\0';
- size_t i = 0;
+ ssize_t i = 0;
while (i < nread) {
if (line[i] == pd->separator) {
line[i] = '\0';
@@ -632,7 +636,8 @@ static char *dmenu_get_message(const Mode *sw) {
return NULL;
}
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);
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);
}
-static void dmenu_finish(DmenuModePrivateData *pd, RofiViewState *state, int retv) {
+static void dmenu_finish(DmenuModePrivateData *pd, RofiViewState *state,
+ int retv) {
if (pd->reading_thread) {
// Stop listinig to new messages from reading thread.
@@ -779,7 +785,7 @@ static void dmenu_finalize(RofiViewState *state) {
rofi_view_restart(state);
rofi_view_set_selected_line(state, pd->selected_line);
if (!restart) {
- dmenu_finish(pd,state, retv);
+ dmenu_finish(pd, state, retv);
}
return;
}
@@ -835,7 +841,7 @@ static void dmenu_finalize(RofiViewState *state) {
rofi_view_restart(state);
rofi_view_set_selected_line(state, pd->selected_line);
} else {
- dmenu_finish(pd,state, retv);
+ dmenu_finish(pd, state, retv);
}
}
diff --git a/source/modes/drun.c b/source/modes/drun.c
index 711b57d8..f71e888b 100644
--- a/source/modes/drun.c
+++ b/source/modes/drun.c
@@ -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,
- int height) {
+ unsigned int height) {
DRunModePrivateData *pd = (DRunModePrivateData *)mode_get_private_data(sw);
if (pd->file_complete) {
return pd->completer->_get_icon(pd->completer, selected_line, height);
diff --git a/source/modes/filebrowser.c b/source/modes/filebrowser.c
index 94a35623..2f889471 100644
--- a/source/modes/filebrowser.c
+++ b/source/modes/filebrowser.c
@@ -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,
- int height) {
+ unsigned int height) {
FileBrowserModePrivateData *pd =
(FileBrowserModePrivateData *)mode_get_private_data(sw);
g_return_val_if_fail(pd->array != NULL, NULL);
diff --git a/source/modes/run.c b/source/modes/run.c
index e7a49f7f..1393471f 100644
--- a/source/modes/run.c
+++ b/source/modes/run.c
@@ -534,7 +534,7 @@ static char *run_get_message(const Mode *sw) {
return NULL;
}
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);
if (pd->file_complete) {
return pd->completer->_get_icon(pd->completer, selected_line, height);
diff --git a/source/modes/script.c b/source/modes/script.c
index c67ed263..25d8e852 100644
--- a/source/modes/script.c
+++ b/source/modes/script.c
@@ -429,8 +429,9 @@ static char *script_get_message(const Mode *sw) {
ScriptModePrivateData *pd = sw->private_data;
return g_strdup(pd->message);
}
-static cairo_surface_t *
-script_get_icon(const Mode *sw, unsigned int selected_line, int height) {
+static cairo_surface_t *script_get_icon(const Mode *sw,
+ unsigned int selected_line,
+ unsigned int height) {
ScriptModePrivateData *pd =
(ScriptModePrivateData *)mode_get_private_data(sw);
g_return_val_if_fail(pd->cmd_list != NULL, NULL);
@@ -454,7 +455,7 @@ typedef struct ScriptUser {
} ScriptUser;
ScriptUser *user_scripts = NULL;
-int num_scripts = 0;
+size_t num_scripts = 0;
void script_mode_cleanup(void) {
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) {
- 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) {
return i;
}
diff --git a/source/modes/window.c b/source/modes/window.c
index a121b8c7..768292c4 100644
--- a/source/modes/window.c
+++ b/source/modes/window.c
@@ -399,7 +399,8 @@ static gboolean window_client_reload(G_GNUC_UNUSED void *data) {
}
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);
if (window_reload_timeout > 0) {
g_source_remove(window_reload_timeout);
@@ -1023,7 +1024,7 @@ static cairo_surface_t *get_net_wm_icon(xcb_window_t xid,
return surface;
}
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);
client *c = window_client(rmpd, rmpd->ids->array[selected_line]);
if (c == NULL) {
diff --git a/source/rofi.c b/source/rofi.c
index 4d40b1cd..176ecb93 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -772,7 +772,7 @@ static gboolean record(G_GNUC_UNUSED void *data) {
return G_SOURCE_CONTINUE;
}
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) {
int fp = GPOINTER_TO_INT(user_data);
dprintf(fp, "[%s]: %s\n", log_domain == NULL ? "default" : log_domain,
diff --git a/source/theme.c b/source/theme.c
index 83556c2f..7270d22d 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -120,7 +120,8 @@ RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance) {
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);
retv->name = g_strdup(p->name);
@@ -137,7 +138,7 @@ Property *rofi_theme_property_copy(const Property *p) {
retv->value.link.ref = NULL;
if (p->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;
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,
gpointer value, gpointer 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);
}
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table) {
diff --git a/source/view.c b/source/view.c
index 18b8175d..29569f40 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1007,8 +1007,8 @@ inline static void rofi_view_nav_last(RofiViewState *state) {
// state->selected = state->filtered_lines - 1;
listview_set_selected(state->list_view, -1);
}
-static void selection_changed_callback(listview *lv, unsigned int index,
- void *udata) {
+static void selection_changed_callback(G_GNUC_UNUSED listview *lv,
+ unsigned int index, void *udata) {
RofiViewState *state = (RofiViewState *)udata;
if (state->tb_current_entry) {
if (index < state->filtered_lines) {
diff --git a/source/widgets/widget.c b/source/widgets/widget.c
index c556e98a..29812a61 100644
--- a/source/widgets/widget.c
+++ b/source/widgets/widget.c
@@ -526,8 +526,10 @@ widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y) {
return NULL;
}
-WidgetTriggerActionResult widget_check_action(widget *wid, guint action, gint x,
- gint y) {
+WidgetTriggerActionResult widget_check_action(widget *wid,
+ G_GNUC_UNUSED guint action,
+ G_GNUC_UNUSED gint x,
+ G_GNUC_UNUSED gint y) {
if (wid == NULL) {
return FALSE;
}
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 14756096..1c53aeeb 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -744,13 +744,13 @@ gboolean config_parse_set_property(const Property *p, char **error) {
iter = g_list_next(iter)) {
if (g_strcmp0(((Property *)(iter->data))->name, p->name) == 0) {
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;
}
}
g_debug("Adding option: %s to backup list.", p->name);
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;
}
diff --git a/test/box-test.c b/test/box-test.c
index af309f9c..e2a300e5 100644
--- a/test/box-test.c
+++ b/test/box-test.c
@@ -25,268 +25,255 @@
*
*/
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
+#include "helper.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.h>
#include <widgets/widget-internal.h>
-#include "rofi.h"
-#include "xrmoptions.h"
-#include "helper.h"
-#include "rofi-icon-fetcher.h"
-unsigned int test =0;
-#define TASSERT( a ) { \
- assert ( a ); \
- printf ( "Test %3u passed (%s)\n", ++test, # a ); \
-}
+#include <widgets/widget.h>
+unsigned int test = 0;
+#define TASSERT(a) \
+ { \
+ assert(a); \
+ printf("Test %3u passed (%s)\n", ++test, #a); \
+ }
-#define TASSERTE( a, b ) { \
- if ( ( a ) == ( b ) ) { \
- printf ( "Test %u passed (%s == %s) (%d == %d)\n", ++test, # a, # b, a, b ); \
- } else { \
- printf ( "Test %u failed (%s == %s) (%d != %d)\n", ++test, # a, # b, a, b ); \
- abort ( ); \
- } \
-}
+#define TASSERTE(a, b) \
+ { \
+ if ((a) == (b)) { \
+ printf("Test %u passed (%s == %s) (%d == %d)\n", ++test, #a, #b, a, b); \
+ } else { \
+ printf("Test %u failed (%s == %s) (%d != %d)\n", ++test, #a, #b, a, b); \
+ abort(); \
+ } \
+ }
-#define TASSERTW( a, b ) { \
- if ( ( a ) == ( b ) ) { \
- printf ( "Test %u passed (%s == %s) (%p == %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
- } else { \
- printf ( "Test %u failed (%s == %s) (%p != %p)\n", ++test, # a, # b, (void *)a, (void *)b ); \
- abort ( ); \
- } \
-}
+#define TASSERTW(a, b) \
+ { \
+ if ((a) == (b)) { \
+ printf("Test %u passed (%s == %s) (%p == %p)\n", ++test, #a, #b, \
+ (void *)a, (void *)b); \
+ } else { \
+ printf("Test %u failed (%s == %s) (%p != %p)\n", ++test, #a, #b, \
+ (void *)a, (void *)b); \
+ abort(); \
+ } \
+ }
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;
}
-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;
}
-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;
}
-int monitor_active ( G_GNUC_UNUSED workarea *mon )
-{
- return 0;
-}
-
-gboolean config_parse_set_property ( G_GNUC_UNUSED const Property *p, G_GNUC_UNUSED char **error )
-{
- return FALSE;
-}
-char * rofi_expand_path ( G_GNUC_UNUSED const char *path )
-{
- return NULL;
-}
+int monitor_active(G_GNUC_UNUSED workarea *mon) { return 0; }
-char * helper_get_theme_path ( const char *file, const char *ext)
-{
- return g_strdup ( file );
-}
-void rofi_add_error_message ( G_GNUC_UNUSED GString *msg )
-{
-}
-int textbox_get_estimated_char_height ( void );
-int textbox_get_estimated_char_height ( void )
-{
- return 16;
-}
-double textbox_get_estimated_ch ( void );
-double textbox_get_estimated_ch ( void )
-{
- return 8;
+gboolean config_parse_set_property(G_GNUC_UNUSED const Property *p,
+ G_GNUC_UNUSED char **error) {
+ return FALSE;
}
-void rofi_view_get_current_monitor ( G_GNUC_UNUSED int *width, G_GNUC_UNUSED int *height )
-{
+char *rofi_expand_path(G_GNUC_UNUSED const char *path) { return NULL; }
+char *helper_get_theme_path(const char *file, G_GNUC_UNUSED const char *ext) {
+ return g_strdup(file);
}
+void rofi_add_error_message(G_GNUC_UNUSED GString *msg) {}
+int textbox_get_estimated_char_height(void);
+int textbox_get_estimated_char_height(void) { return 16; }
+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,
+ G_GNUC_UNUSED int *height) {}
-int main ( G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv )
-{
- {
- box *b = box_create ( NULL, "box", ROFI_ORIENTATION_HORIZONTAL );
- //box_set_padding ( b, 5 );
- widget_resize ( WIDGET (b), 100, 20);
+int main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) {
+ {
+ box *b = box_create(NULL, "box", ROFI_ORIENTATION_HORIZONTAL);
+ // box_set_padding ( b, 5 );
+ widget_resize(WIDGET(b), 100, 20);
- widget *wid1 = g_malloc0(sizeof(widget));
- wid1->parent = WIDGET(b);
- box_add ( b , WIDGET( wid1 ), TRUE );
- // Widget not enabled. no width allocated.
- TASSERTE ( wid1->h, 0 );
- TASSERTE ( wid1->w, 0 );
- widget_enable ( WIDGET ( wid1 ) );
- widget_update ( WIDGET ( b ) ) ;
- // Widget enabled. so width allocated.
- TASSERTE ( wid1->h, 20 );
- TASSERTE ( wid1->w, 100 );
- widget *wid2 = g_malloc0(sizeof(widget));
- wid2->parent = WIDGET (b) ;
- widget_enable ( WIDGET ( wid2 ) );
- box_add ( b , WIDGET( wid2 ), TRUE );
- TASSERTE ( wid1->h, 20);
- TASSERTE ( wid1->w, 49);
- TASSERTE ( wid2->h, 20);
- TASSERTE ( wid2->w, 49);
+ widget *wid1 = g_malloc0(sizeof(widget));
+ wid1->parent = WIDGET(b);
+ box_add(b, WIDGET(wid1), TRUE);
+ // Widget not enabled. no width allocated.
+ TASSERTE(wid1->h, 0);
+ TASSERTE(wid1->w, 0);
+ widget_enable(WIDGET(wid1));
+ widget_update(WIDGET(b));
+ // Widget enabled. so width allocated.
+ TASSERTE(wid1->h, 20);
+ TASSERTE(wid1->w, 100);
+ widget *wid2 = g_malloc0(sizeof(widget));
+ wid2->parent = WIDGET(b);
+ widget_enable(WIDGET(wid2));
+ box_add(b, WIDGET(wid2), TRUE);
+ TASSERTE(wid1->h, 20);
+ TASSERTE(wid1->w, 49);
+ TASSERTE(wid2->h, 20);
+ TASSERTE(wid2->w, 49);
- widget *wid3 = g_malloc0(sizeof(widget));
- wid3->parent = WIDGET (b);
- widget_enable ( WIDGET ( wid3 ) );
- box_add ( b , WIDGET( wid3 ), FALSE );
- TASSERTE ( wid1->h, 20);
- TASSERTE ( wid1->w, 48);
- TASSERTE ( wid2->h, 20);
- TASSERTE ( wid2->w, 48);
+ widget *wid3 = g_malloc0(sizeof(widget));
+ wid3->parent = WIDGET(b);
+ widget_enable(WIDGET(wid3));
+ box_add(b, WIDGET(wid3), FALSE);
+ TASSERTE(wid1->h, 20);
+ TASSERTE(wid1->w, 48);
+ TASSERTE(wid2->h, 20);
+ TASSERTE(wid2->w, 48);
- widget_resize ( WIDGET (wid3) , 20, 10 );
- // TODO should this happen automagically?
- widget_update ( WIDGET ( b ) ) ;
- TASSERTE ( wid1->h, 20);
- TASSERTE ( wid1->w, 38);
- TASSERTE ( wid2->h, 20);
- TASSERTE ( wid2->w, 38);
- TASSERTE ( wid3->h, 20);
- TASSERTE ( wid3->w, 20);
+ widget_resize(WIDGET(wid3), 20, 10);
+ // TODO should this happen automagically?
+ widget_update(WIDGET(b));
+ TASSERTE(wid1->h, 20);
+ TASSERTE(wid1->w, 38);
+ TASSERTE(wid2->h, 20);
+ TASSERTE(wid2->w, 38);
+ TASSERTE(wid3->h, 20);
+ TASSERTE(wid3->w, 20);
- widget_resize ( WIDGET (b ), 200, 20 );
- TASSERTE ( wid1->h, 20);
- TASSERTE ( wid1->w, 88);
- TASSERTE ( wid2->h, 20);
- TASSERTE ( wid2->w, 88);
- TASSERTE ( wid3->h, 20);
- TASSERTE ( wid3->w, 20);
-// TASSERTE ( box_get_fixed_pixels ( b ) , 24 );
+ widget_resize(WIDGET(b), 200, 20);
+ TASSERTE(wid1->h, 20);
+ TASSERTE(wid1->w, 88);
+ TASSERTE(wid2->h, 20);
+ TASSERTE(wid2->w, 88);
+ TASSERTE(wid3->h, 20);
+ TASSERTE(wid3->w, 20);
+ // TASSERTE ( box_get_fixed_pixels ( b ) , 24 );
- widget *wid4 = g_malloc0(sizeof(widget));
- wid4->parent = WIDGET ( b );
- widget_enable ( WIDGET ( wid4 ) );
- widget_resize ( WIDGET ( wid4 ), 20, 20 );
- box_add ( b , WIDGET( wid4 ), FALSE );
- TASSERTE ( wid4->x, 200-20);
- widget *wid5 = g_malloc0(sizeof(widget));
- wid5->parent = WIDGET ( b );
- widget_enable ( WIDGET ( wid5 ) );
- widget_resize ( WIDGET ( wid5 ), 20, 20 );
- box_add ( b , WIDGET( wid5 ), TRUE );
- TASSERTE ( wid5->x, 149);
- widget_free ( WIDGET ( b ) );
- }
- {
- box *b = box_create ( NULL, "box", ROFI_ORIENTATION_VERTICAL );
- widget_resize ( WIDGET (b), 20, 100);
- //box_set_padding ( b, 5 );
+ widget *wid4 = g_malloc0(sizeof(widget));
+ wid4->parent = WIDGET(b);
+ widget_enable(WIDGET(wid4));
+ widget_resize(WIDGET(wid4), 20, 20);
+ box_add(b, WIDGET(wid4), FALSE);
+ TASSERTE(wid4->x, 200 - 20);
+ widget *wid5 = g_malloc0(sizeof(widget));
+ wid5->parent = WIDGET(b);
+ widget_enable(WIDGET(wid5));
+ widget_resize(WIDGET(wid5), 20, 20);
+ box_add(b, WIDGET(wid5), TRUE);
+ TASSERTE(wid5->x, 149);
+ widget_free(WIDGET(b));
+ }
+ {
+ box *b = box_create(NULL, "box", ROFI_ORIENTATION_VERTICAL);
+ widget_resize(WIDGET(b), 20, 100);</