option-parser: Make bools boolean

When option-parser is confronted with a boolean option, have it write a
bool rather than treating the value as a pointer to an int32.

(lib)weston already heavily uses bool types internally, so this has the
nice side effect of eliminating quite a few local variables which only
existed as integer shadows of internal boolean variables.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone
2019-11-26 00:32:22 +00:00
committed by Daniel Stone
parent b8c3926445
commit dd8219b3fb
9 changed files with 51 additions and 86 deletions
+2 -2
View File
@@ -45,8 +45,8 @@
#define NUM_COMPLEX_REGION_RECTS 9
static int32_t option_complex_confine_region;
static int32_t option_help;
static bool option_complex_confine_region;
static bool option_help;
struct confine {
struct display *display;
+3 -3
View File
@@ -77,7 +77,7 @@ struct text_entry {
uint32_t serial;
uint32_t reset_serial;
uint32_t content_purpose;
uint32_t click_to_show;
bool click_to_show;
char *preferred_language;
bool button_pressed;
};
@@ -1504,10 +1504,10 @@ global_handler(struct display *display, uint32_t name,
}
/** Display help for command line options, and exit */
static uint32_t opt_help = 0;
static bool opt_help = false;
/** Require a distinct click to show the input panel (virtual keyboard) */
static uint32_t opt_click_to_show = 0;
static bool opt_click_to_show = false;
/** Set a specific (RFC-3066) language. Used for the virtual keyboard, etc. */
static const char *opt_preferred_language = NULL;
+9 -9
View File
@@ -55,7 +55,7 @@ static int width = 500;
static int height = 400;
/** set if window has no borders */
static int noborder = 0;
static bool noborder = false;
/** if non-zero, maximum window width */
static int width_max = 0;
@@ -64,25 +64,25 @@ static int width_max = 0;
static int height_max = 0;
/** set to log redrawing */
static int log_redraw = 0;
static bool log_redraw = false;
/** set to log resizing */
static int log_resize = 0;
static bool log_resize = false;
/** set to log keyboard focus */
static int log_focus = 0;
static bool log_focus = false;
/** set to log key events */
static int log_key = 0;
static bool log_key = false;
/** set to log button events */
static int log_button = 0;
static bool log_button = false;
/** set to log axis events */
static int log_axis = 0;
static bool log_axis = false;
/** set to log motion events */
static int log_motion = 0;
static bool log_motion = false;
/**
* \struct eventdemo
@@ -513,7 +513,7 @@ main(int argc, char *argv[])
if (!log_redraw && !log_resize && !log_focus && !log_key &&
!log_button && !log_axis && !log_motion)
log_redraw = log_resize = log_focus = log_key =
log_button = log_axis = log_motion = 1;
log_button = log_axis = log_motion = true;
/* Connect to the display and have the arguments parsed */
d = display_create(&argc, argv);
+1 -1
View File
@@ -54,7 +54,7 @@
#include "shared/weston-egl-ext.h"
static int option_blit;
static bool option_blit;
struct nested {
struct display *display;
+2 -2
View File
@@ -56,8 +56,8 @@
static int32_t option_red_mode;
static int32_t option_triangle_mode;
static int32_t option_no_triangle;
static int32_t option_help;
static bool option_no_triangle;
static bool option_help;
static const struct weston_option options[] = {
{ WESTON_OPTION_INTEGER, "red-mode", 'r', &option_red_mode },
+2 -2
View File
@@ -50,8 +50,8 @@
#include "shared/xalloc.h"
#include "window.h"
static int option_fullscreen;
static int option_maximize;
static bool option_fullscreen;
static bool option_maximize;
static char *option_font;
static int option_font_size;
static char *option_term;