mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-07 13:08:07 +02:00
Merge branch 'cut-the-crust' into 'main'
src: Run through uncrustify See merge request plymouth/plymouth!181
This commit is contained in:
commit
0d30fe5957
58 changed files with 732 additions and 589 deletions
|
|
@ -355,8 +355,7 @@ on_key_answer (key_answer_state_t *answer_state,
|
|||
|
||||
if (answer_state->command != NULL)
|
||||
answer_via_command (answer_state->command, answer, NULL);
|
||||
else
|
||||
if (answer != NULL)
|
||||
else if (answer != NULL)
|
||||
write (STDOUT_FILENO, answer, strlen (answer));
|
||||
|
||||
ply_event_loop_exit (answer_state->state->loop, 0);
|
||||
|
|
@ -606,6 +605,7 @@ on_keystroke_request (state_t *state,
|
|||
"keys", &keys,
|
||||
NULL);
|
||||
key_answer_state_t *key_answer_state;
|
||||
|
||||
key_answer_state = calloc (1, sizeof(key_answer_state_t));
|
||||
key_answer_state->state = state;
|
||||
key_answer_state->keys = keys;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
ply_boot_splash_plugin_t * (*create_plugin)(ply_key_file_t * key_file);
|
||||
ply_boot_splash_plugin_t * (*create_plugin)(ply_key_file_t *key_file);
|
||||
void (*destroy_plugin)(ply_boot_splash_plugin_t *plugin);
|
||||
|
||||
void (*set_keyboard)(ply_boot_splash_plugin_t *plugin,
|
||||
|
|
|
|||
|
|
@ -657,6 +657,7 @@ bool ply_boot_splash_validate_input (ply_boot_splash_t *splash,
|
|||
const char *add_text)
|
||||
{
|
||||
bool input_valid = true;
|
||||
|
||||
assert (splash != NULL);
|
||||
assert (splash->plugin_interface != NULL);
|
||||
assert (splash->plugin != NULL);
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ void ply_boot_splash_set_keyboard (ply_boot_splash_t *splash,
|
|||
void ply_boot_splash_unset_keyboard (ply_boot_splash_t *splash);
|
||||
void ply_boot_splash_add_pixel_display (ply_boot_splash_t *splash,
|
||||
ply_pixel_display_t *pixel_display);
|
||||
void ply_boot_splash_remove_pixel_display (ply_boot_splash_t *splash,
|
||||
ply_pixel_display_t *pixel_display);
|
||||
void ply_boot_splash_add_text_display (ply_boot_splash_t *splash,
|
||||
ply_text_display_t *text_display);
|
||||
void ply_boot_splash_remove_pixel_display (ply_boot_splash_t *splash,
|
||||
ply_pixel_display_t *pixel_display);
|
||||
void ply_boot_splash_add_text_display (ply_boot_splash_t *splash,
|
||||
ply_text_display_t *text_display);
|
||||
void ply_boot_splash_remove_text_display (ply_boot_splash_t *splash,
|
||||
ply_text_display_t *text_display);
|
||||
void ply_boot_splash_free (ply_boot_splash_t *splash);
|
||||
|
|
|
|||
|
|
@ -56,36 +56,36 @@ static void create_pixel_displays_for_renderer (ply_device_manager_t *manager,
|
|||
|
||||
struct _ply_device_manager
|
||||
{
|
||||
ply_device_manager_flags_t flags;
|
||||
ply_event_loop_t *loop;
|
||||
ply_hashtable_t *terminals;
|
||||
ply_hashtable_t *renderers;
|
||||
ply_terminal_t *local_console_terminal;
|
||||
ply_list_t *keyboards;
|
||||
ply_list_t *text_displays;
|
||||
ply_list_t *pixel_displays;
|
||||
struct udev *udev_context;
|
||||
struct udev_monitor *udev_monitor;
|
||||
ply_fd_watch_t *fd_watch;
|
||||
ply_device_manager_flags_t flags;
|
||||
ply_event_loop_t *loop;
|
||||
ply_hashtable_t *terminals;
|
||||
ply_hashtable_t *renderers;
|
||||
ply_terminal_t *local_console_terminal;
|
||||
ply_list_t *keyboards;
|
||||
ply_list_t *text_displays;
|
||||
ply_list_t *pixel_displays;
|
||||
struct udev *udev_context;
|
||||
struct udev_monitor *udev_monitor;
|
||||
ply_fd_watch_t *fd_watch;
|
||||
|
||||
ply_keyboard_added_handler_t keyboard_added_handler;
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler;
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler;
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler;
|
||||
ply_text_display_added_handler_t text_display_added_handler;
|
||||
ply_text_display_removed_handler_t text_display_removed_handler;
|
||||
void *event_handler_data;
|
||||
ply_keyboard_added_handler_t keyboard_added_handler;
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler;
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler;
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler;
|
||||
ply_text_display_added_handler_t text_display_added_handler;
|
||||
ply_text_display_removed_handler_t text_display_removed_handler;
|
||||
void *event_handler_data;
|
||||
|
||||
uint32_t local_console_managed : 1;
|
||||
uint32_t local_console_is_text : 1;
|
||||
uint32_t serial_consoles_detected : 1;
|
||||
uint32_t renderers_activated : 1;
|
||||
uint32_t keyboards_activated : 1;
|
||||
uint32_t local_console_managed : 1;
|
||||
uint32_t local_console_is_text : 1;
|
||||
uint32_t serial_consoles_detected : 1;
|
||||
uint32_t renderers_activated : 1;
|
||||
uint32_t keyboards_activated : 1;
|
||||
|
||||
uint32_t paused : 1;
|
||||
uint32_t device_timeout_elapsed : 1;
|
||||
uint32_t found_drm_device : 1;
|
||||
uint32_t found_fb_device : 1;
|
||||
uint32_t paused : 1;
|
||||
uint32_t device_timeout_elapsed : 1;
|
||||
uint32_t found_drm_device : 1;
|
||||
uint32_t found_fb_device : 1;
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
@ -132,7 +132,6 @@ free_displays_for_renderer (ply_device_manager_t *manager,
|
|||
manager->pixel_display_removed_handler (manager->event_handler_data, display);
|
||||
ply_pixel_display_free (display);
|
||||
ply_list_remove_node (manager->pixel_displays, node);
|
||||
|
||||
}
|
||||
|
||||
node = next_node;
|
||||
|
|
@ -141,7 +140,7 @@ free_displays_for_renderer (ply_device_manager_t *manager,
|
|||
|
||||
static void
|
||||
free_keyboards_for_renderer (ply_device_manager_t *manager,
|
||||
ply_renderer_t *renderer)
|
||||
ply_renderer_t *renderer)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
|
||||
|
|
@ -474,7 +473,8 @@ verify_add_or_change (ply_device_manager_t *manager,
|
|||
}
|
||||
|
||||
static bool
|
||||
duplicate_device_path (ply_list_t *events, const char *device_path)
|
||||
duplicate_device_path (ply_list_t *events,
|
||||
const char *device_path)
|
||||
{
|
||||
struct udev_device *device;
|
||||
ply_list_node_t *node;
|
||||
|
|
@ -491,7 +491,8 @@ duplicate_device_path (ply_list_t *events, const char *device_path)
|
|||
}
|
||||
|
||||
static void
|
||||
process_udev_add_or_change_events (ply_device_manager_t *manager, ply_list_t *events)
|
||||
process_udev_add_or_change_events (ply_device_manager_t *manager,
|
||||
ply_list_t *events)
|
||||
{
|
||||
const char *action, *device_path;
|
||||
struct udev_device *device;
|
||||
|
|
@ -553,7 +554,7 @@ on_udev_event (ply_device_manager_t *manager)
|
|||
goto unref;
|
||||
}
|
||||
|
||||
ply_list_append_data (pending_events, udev_device_ref(device));
|
||||
ply_list_append_data (pending_events, udev_device_ref (device));
|
||||
unref:
|
||||
udev_device_unref (device);
|
||||
}
|
||||
|
|
@ -728,8 +729,8 @@ ply_device_manager_free (ply_device_manager_t *manager)
|
|||
|
||||
#ifdef HAVE_UDEV
|
||||
ply_event_loop_stop_watching_for_timeout (manager->loop,
|
||||
(ply_event_loop_timeout_handler_t)
|
||||
create_devices_from_udev, manager);
|
||||
(ply_event_loop_timeout_handler_t)
|
||||
create_devices_from_udev, manager);
|
||||
|
||||
if (manager->udev_monitor != NULL)
|
||||
udev_monitor_unref (manager->udev_monitor);
|
||||
|
|
@ -848,24 +849,24 @@ static void
|
|||
create_text_displays_for_terminal (ply_device_manager_t *manager,
|
||||
ply_terminal_t *terminal)
|
||||
{
|
||||
ply_text_display_t *display;
|
||||
ply_text_display_t *display;
|
||||
|
||||
if (!ply_terminal_is_open (terminal)) {
|
||||
if (!ply_terminal_open (terminal)) {
|
||||
ply_trace ("could not add terminal %s: %m",
|
||||
ply_terminal_get_name (terminal));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!ply_terminal_is_open (terminal)) {
|
||||
if (!ply_terminal_open (terminal)) {
|
||||
ply_trace ("could not add terminal %s: %m",
|
||||
ply_terminal_get_name (terminal));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ply_trace ("adding text display for terminal %s",
|
||||
ply_terminal_get_name (terminal));
|
||||
ply_trace ("adding text display for terminal %s",
|
||||
ply_terminal_get_name (terminal));
|
||||
|
||||
display = ply_text_display_new (terminal);
|
||||
ply_list_append_data (manager->text_displays, display);
|
||||
display = ply_text_display_new (terminal);
|
||||
ply_list_append_data (manager->text_displays, display);
|
||||
|
||||
if (manager->text_display_added_handler != NULL)
|
||||
manager->text_display_added_handler (manager->event_handler_data, display);
|
||||
if (manager->text_display_added_handler != NULL)
|
||||
manager->text_display_added_handler (manager->event_handler_data, display);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -1039,15 +1040,15 @@ create_fallback_devices (ply_device_manager_t *manager)
|
|||
}
|
||||
|
||||
void
|
||||
ply_device_manager_watch_devices (ply_device_manager_t *manager,
|
||||
double device_timeout,
|
||||
ply_keyboard_added_handler_t keyboard_added_handler,
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler,
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler,
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler,
|
||||
ply_text_display_added_handler_t text_display_added_handler,
|
||||
ply_text_display_removed_handler_t text_display_removed_handler,
|
||||
void *data)
|
||||
ply_device_manager_watch_devices (ply_device_manager_t *manager,
|
||||
double device_timeout,
|
||||
ply_keyboard_added_handler_t keyboard_added_handler,
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler,
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler,
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler,
|
||||
ply_text_display_added_handler_t text_display_added_handler,
|
||||
ply_text_display_removed_handler_t text_display_removed_handler,
|
||||
void *data)
|
||||
{
|
||||
bool done_with_initial_devices_setup;
|
||||
|
||||
|
|
@ -1082,9 +1083,9 @@ ply_device_manager_watch_devices (ply_device_manager_t *manager,
|
|||
watch_for_udev_events (manager);
|
||||
create_devices_for_subsystem (manager, SUBSYSTEM_DRM);
|
||||
ply_event_loop_watch_for_timeout (manager->loop,
|
||||
device_timeout,
|
||||
(ply_event_loop_timeout_handler_t)
|
||||
create_devices_from_udev, manager);
|
||||
device_timeout,
|
||||
(ply_event_loop_timeout_handler_t)
|
||||
create_devices_from_udev, manager);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1092,7 +1093,7 @@ bool
|
|||
ply_device_manager_has_displays (ply_device_manager_t *manager)
|
||||
{
|
||||
return ply_list_get_length (manager->pixel_displays) > 0 ||
|
||||
ply_list_get_length (manager->text_displays) > 0;
|
||||
ply_list_get_length (manager->text_displays) > 0;
|
||||
}
|
||||
|
||||
ply_list_t *
|
||||
|
|
|
|||
|
|
@ -29,32 +29,38 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
PLY_DEVICE_MANAGER_FLAGS_NONE = 0,
|
||||
PLY_DEVICE_MANAGER_FLAGS_NONE = 0,
|
||||
PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES = 1 << 0,
|
||||
PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1,
|
||||
PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS = 1 << 2
|
||||
PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV = 1 << 1,
|
||||
PLY_DEVICE_MANAGER_FLAGS_SKIP_RENDERERS = 1 << 2
|
||||
} ply_device_manager_flags_t;
|
||||
|
||||
typedef struct _ply_device_manager ply_device_manager_t;
|
||||
typedef void (* ply_keyboard_added_handler_t) (void *, ply_keyboard_t *);
|
||||
typedef void (* ply_keyboard_removed_handler_t) (void *, ply_keyboard_t *);
|
||||
typedef void (* ply_pixel_display_added_handler_t) (void *, ply_pixel_display_t *);
|
||||
typedef void (* ply_pixel_display_removed_handler_t) (void *, ply_pixel_display_t *);
|
||||
typedef void (* ply_text_display_added_handler_t) (void *, ply_text_display_t *);
|
||||
typedef void (* ply_text_display_removed_handler_t) (void *, ply_text_display_t *);
|
||||
typedef void (* ply_keyboard_added_handler_t) (void *,
|
||||
ply_keyboard_t *);
|
||||
typedef void (* ply_keyboard_removed_handler_t) (void *,
|
||||
ply_keyboard_t *);
|
||||
typedef void (* ply_pixel_display_added_handler_t) (void *,
|
||||
ply_pixel_display_t *);
|
||||
typedef void (* ply_pixel_display_removed_handler_t) (void *,
|
||||
ply_pixel_display_t *);
|
||||
typedef void (* ply_text_display_added_handler_t) (void *,
|
||||
ply_text_display_t *);
|
||||
typedef void (* ply_text_display_removed_handler_t) (void *,
|
||||
ply_text_display_t *);
|
||||
|
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
|
||||
ply_device_manager_t *ply_device_manager_new (const char *default_tty,
|
||||
ply_device_manager_flags_t flags);
|
||||
void ply_device_manager_watch_devices (ply_device_manager_t *manager,
|
||||
double device_timeout,
|
||||
ply_keyboard_added_handler_t keyboard_added_handler,
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler,
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler,
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler,
|
||||
ply_text_display_added_handler_t text_display_added_handler,
|
||||
ply_text_display_removed_handler_t text_display_removed_handler,
|
||||
void *data);
|
||||
void ply_device_manager_watch_devices (ply_device_manager_t *manager,
|
||||
double device_timeout,
|
||||
ply_keyboard_added_handler_t keyboard_added_handler,
|
||||
ply_keyboard_removed_handler_t keyboard_removed_handler,
|
||||
ply_pixel_display_added_handler_t pixel_display_added_handler,
|
||||
ply_pixel_display_removed_handler_t pixel_display_removed_handler,
|
||||
ply_text_display_added_handler_t text_display_added_handler,
|
||||
ply_text_display_removed_handler_t text_display_removed_handler,
|
||||
void *data);
|
||||
void ply_device_manager_pause (ply_device_manager_t *manager);
|
||||
void ply_device_manager_unpause (ply_device_manager_t *manager);
|
||||
bool ply_device_manager_has_serial_consoles (ply_device_manager_t *manager);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ struct _ply_keyboard
|
|||
ply_list_t *escape_handler_list;
|
||||
ply_list_t *enter_handler_list;
|
||||
|
||||
uint32_t is_active : 1;
|
||||
uint32_t is_active : 1;
|
||||
};
|
||||
|
||||
static bool ply_keyboard_watch_for_terminal_input (ply_keyboard_t *keyboard);
|
||||
|
|
@ -201,7 +201,7 @@ process_keyboard_input (ply_keyboard_t *keyboard,
|
|||
wchar_t key;
|
||||
ply_list_node_t *node;
|
||||
|
||||
if (keyboard_input[0] == KEY_ESCAPE && character_size >= 2){
|
||||
if (keyboard_input[0] == KEY_ESCAPE && character_size >= 2) {
|
||||
/* Escape sequence */
|
||||
ply_buffer_append_bytes (keyboard->line_buffer,
|
||||
keyboard_input, character_size);
|
||||
|
|
@ -284,18 +284,18 @@ on_key_event (ply_keyboard_t *keyboard,
|
|||
|
||||
/* Control Sequence Introducer sequences
|
||||
*/
|
||||
if(bytes_left >= FUNCTION_KEY_SEQUENCE_MINIMUM_LENGTH &&
|
||||
strncmp (bytes + i, FUNCTION_KEY_SEQUENCE_PREFIX,
|
||||
strlen (FUNCTION_KEY_SEQUENCE_PREFIX)) == 0) {
|
||||
if (bytes_left >= FUNCTION_KEY_SEQUENCE_MINIMUM_LENGTH &&
|
||||
strncmp (bytes + i, FUNCTION_KEY_SEQUENCE_PREFIX,
|
||||
strlen (FUNCTION_KEY_SEQUENCE_PREFIX)) == 0) {
|
||||
/* Special case - CSI [ after which the next character
|
||||
* is a function key
|
||||
*/
|
||||
process_keyboard_input (keyboard, bytes + i, 4);
|
||||
i += 4;
|
||||
continue;
|
||||
} else if(bytes_left >= CSI_SEQUENCE_MINIMUM_LENGTH && /* At least CSI + final byte */
|
||||
strncmp (bytes + i, CSI_SEQUENCE_PREFIX,
|
||||
strlen (CSI_SEQUENCE_PREFIX)) == 0) {
|
||||
} else if (bytes_left >= CSI_SEQUENCE_MINIMUM_LENGTH && /* At least CSI + final byte */
|
||||
strncmp (bytes + i, CSI_SEQUENCE_PREFIX,
|
||||
strlen (CSI_SEQUENCE_PREFIX)) == 0) {
|
||||
ssize_t csi_seq_size;
|
||||
csi_seq_size = 0;
|
||||
for (size_t j = strlen (CSI_SEQUENCE_PREFIX); j < bytes_left; j++) {
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@
|
|||
|
||||
struct _ply_pixel_buffer
|
||||
{
|
||||
uint32_t *bytes;
|
||||
uint32_t *bytes;
|
||||
|
||||
ply_rectangle_t area; /* in device pixels */
|
||||
ply_rectangle_t logical_area; /* in logical pixels */
|
||||
ply_list_t *clip_areas; /* in device pixels */
|
||||
ply_rectangle_t area; /* in device pixels */
|
||||
ply_rectangle_t logical_area; /* in logical pixels */
|
||||
ply_list_t *clip_areas; /* in device pixels */
|
||||
|
||||
ply_region_t *updated_areas; /* in device pixels */
|
||||
uint32_t is_opaque : 1;
|
||||
int device_scale;
|
||||
ply_region_t *updated_areas; /* in device pixels */
|
||||
uint32_t is_opaque : 1;
|
||||
int device_scale;
|
||||
|
||||
ply_pixel_buffer_rotation_t device_rotation;
|
||||
};
|
||||
|
|
@ -315,7 +315,7 @@ ply_pixel_buffer_fill_area_with_pixel_value (ply_pixel_buffer_t *buffer,
|
|||
/* If we're filling the entire buffer with a fully opaque color,
|
||||
* then make note of it
|
||||
*/
|
||||
if (memcmp(fill_area, &buffer->area, sizeof(ply_rectangle_t)) == 0 &&
|
||||
if (memcmp (fill_area, &buffer->area, sizeof(ply_rectangle_t)) == 0 &&
|
||||
(pixel_value >> 24) == 0xff) {
|
||||
buffer->is_opaque = true;
|
||||
}
|
||||
|
|
@ -360,7 +360,7 @@ ply_pixel_buffer_new (unsigned long width,
|
|||
unsigned long height)
|
||||
{
|
||||
return ply_pixel_buffer_new_with_device_rotation (
|
||||
width, height, PLY_PIXEL_BUFFER_ROTATE_UPRIGHT);
|
||||
width, height, PLY_PIXEL_BUFFER_ROTATE_UPRIGHT);
|
||||
}
|
||||
|
||||
ply_pixel_buffer_t *
|
||||
|
|
@ -738,29 +738,30 @@ ply_pixel_buffer_fill_with_argb32_data_at_opacity_with_clip_and_scale (ply_pixel
|
|||
return;
|
||||
|
||||
opacity_as_byte = (uint8_t) (opacity * 255.0);
|
||||
scale_factor = (double)scale / buffer->device_scale;
|
||||
scale_factor = (double) scale / buffer->device_scale;
|
||||
x = cropped_area.x;
|
||||
y = cropped_area.y;
|
||||
|
||||
/* column, row are the point we want to write into, in
|
||||
pixel_buffer coordinate space (device pixels)
|
||||
|
||||
scale_factor * (column - fill_area->x), scale_factor * (row - fill_area->y)
|
||||
is the point we want to source from, in the data coordinate
|
||||
space */
|
||||
* pixel_buffer coordinate space (device pixels)
|
||||
*
|
||||
* scale_factor * (column - fill_area->x), scale_factor * (row - fill_area->y)
|
||||
* is the point we want to source from, in the data coordinate
|
||||
* space */
|
||||
for (row = y; row < y + cropped_area.height; row++) {
|
||||
for (column = x; column < x + cropped_area.width; column++) {
|
||||
uint32_t pixel_value;
|
||||
|
||||
if (buffer->device_scale == scale)
|
||||
if (buffer->device_scale == scale) {
|
||||
pixel_value = data[fill_area->width * (row - fill_area->y) +
|
||||
column - fill_area->x];
|
||||
else
|
||||
} else {
|
||||
pixel_value = ply_pixels_interpolate (data,
|
||||
fill_area->width,
|
||||
fill_area->height,
|
||||
scale_factor * column - fill_area->x,
|
||||
scale_factor * row - fill_area->y);
|
||||
}
|
||||
if ((pixel_value >> 24) == 0x00)
|
||||
continue;
|
||||
|
||||
|
|
@ -827,8 +828,9 @@ ply_pixel_buffer_fill_with_argb32_data_with_clip (ply_pixel_buffer_t *buffer,
|
|||
static void
|
||||
ply_pixel_buffer_copy_area (ply_pixel_buffer_t *canvas,
|
||||
ply_pixel_buffer_t *source,
|
||||
int x, int y,
|
||||
ply_rectangle_t *cropped_area)
|
||||
int x,
|
||||
int y,
|
||||
ply_rectangle_t *cropped_area)
|
||||
{
|
||||
unsigned long row;
|
||||
|
||||
|
|
@ -1092,7 +1094,7 @@ ply_pixel_buffer_get_device_rotation (ply_pixel_buffer_t *buffer)
|
|||
}
|
||||
|
||||
void
|
||||
ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
ply_pixel_buffer_rotation_t device_rotation)
|
||||
{
|
||||
if (buffer->device_rotation == device_rotation)
|
||||
|
|
@ -1119,7 +1121,7 @@ ply_pixel_buffer_t *
|
|||
ply_pixel_buffer_rotate_upright (ply_pixel_buffer_t *old_buffer)
|
||||
{
|
||||
ply_pixel_buffer_t *buffer;
|
||||
int x,y, width, height;
|
||||
int x, y, width, height;
|
||||
uint32_t pixel;
|
||||
|
||||
width = old_buffer->area.width;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ typedef enum
|
|||
ply_pixel_buffer_t *ply_pixel_buffer_new (unsigned long width,
|
||||
unsigned long height);
|
||||
ply_pixel_buffer_t *
|
||||
ply_pixel_buffer_new_with_device_rotation (unsigned long width,
|
||||
unsigned long height,
|
||||
ply_pixel_buffer_new_with_device_rotation (unsigned long width,
|
||||
unsigned long height,
|
||||
ply_pixel_buffer_rotation_t device_rotation);
|
||||
void ply_pixel_buffer_free (ply_pixel_buffer_t *buffer);
|
||||
void ply_pixel_buffer_get_size (ply_pixel_buffer_t *buffer,
|
||||
|
|
@ -62,7 +62,7 @@ void ply_pixel_buffer_set_device_scale (ply_pixel_buffer_t *buffer,
|
|||
ply_pixel_buffer_rotation_t
|
||||
ply_pixel_buffer_get_device_rotation (ply_pixel_buffer_t *buffer);
|
||||
/* Note calling this removes all pushed clip-areas */
|
||||
void ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
void ply_pixel_buffer_set_device_rotation (ply_pixel_buffer_t *buffer,
|
||||
ply_pixel_buffer_rotation_t rotation);
|
||||
|
||||
unsigned long ply_pixel_buffer_get_width (ply_pixel_buffer_t *buffer);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ ply_pixel_display_t *ply_pixel_display_new (ply_renderer_t *renderer,
|
|||
|
||||
void ply_pixel_display_free (ply_pixel_display_t *display);
|
||||
|
||||
ply_renderer_t *ply_pixel_display_get_renderer (ply_pixel_display_t *display);
|
||||
ply_renderer_t *ply_pixel_display_get_renderer (ply_pixel_display_t *display);
|
||||
ply_renderer_head_t *ply_pixel_display_get_renderer_head (ply_pixel_display_t *display);
|
||||
|
||||
unsigned long ply_pixel_display_get_width (ply_pixel_display_t *display);
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ typedef struct _ply_renderer_backend ply_renderer_backend_t;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
ply_renderer_backend_t * (*create_backend)(const char *device_name,
|
||||
ply_terminal_t * terminal);
|
||||
ply_renderer_backend_t * (*create_backend)(const char *device_name,
|
||||
ply_terminal_t *terminal);
|
||||
void (*destroy_backend)(ply_renderer_backend_t *backend);
|
||||
bool (*open_device)(ply_renderer_backend_t *backend);
|
||||
void (*close_device)(ply_renderer_backend_t *backend);
|
||||
|
|
@ -51,12 +51,12 @@ typedef struct
|
|||
void (*flush_head)(ply_renderer_backend_t *backend,
|
||||
ply_renderer_head_t *head);
|
||||
|
||||
ply_list_t * (*get_heads)(ply_renderer_backend_t * backend);
|
||||
ply_list_t * (*get_heads)(ply_renderer_backend_t *backend);
|
||||
|
||||
ply_pixel_buffer_t * (*get_buffer_for_head)(ply_renderer_backend_t * backend,
|
||||
ply_renderer_head_t * head);
|
||||
ply_pixel_buffer_t * (*get_buffer_for_head)(ply_renderer_backend_t *backend,
|
||||
ply_renderer_head_t *head);
|
||||
|
||||
ply_renderer_input_source_t * (*get_input_source)(ply_renderer_backend_t * backend);
|
||||
ply_renderer_input_source_t * (*get_input_source)(ply_renderer_backend_t *backend);
|
||||
bool (*open_input_source)(ply_renderer_backend_t *backend,
|
||||
ply_renderer_input_source_t *input_source);
|
||||
|
||||
|
|
|
|||
|
|
@ -277,11 +277,12 @@ ply_renderer_open (ply_renderer_t *renderer)
|
|||
renderer->is_active = false;
|
||||
for (i = 0; known_plugins[i].type != PLY_RENDERER_TYPE_NONE; i++) {
|
||||
if (renderer->type == known_plugins[i].type ||
|
||||
renderer->type == PLY_RENDERER_TYPE_AUTO)
|
||||
renderer->type == PLY_RENDERER_TYPE_AUTO) {
|
||||
if (ply_renderer_open_plugin (renderer, known_plugins[i].path)) {
|
||||
renderer->is_active = true;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ply_trace ("could not find suitable rendering plugin");
|
||||
|
|
@ -312,7 +313,7 @@ ply_renderer_activate (ply_renderer_t *renderer)
|
|||
assert (renderer->plugin_interface != NULL);
|
||||
|
||||
if (renderer->is_active)
|
||||
return;
|
||||
return;
|
||||
|
||||
renderer->plugin_interface->activate (renderer->backend);
|
||||
renderer->is_active = true;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ ply_terminal_parse_keymap_conf (ply_terminal_t *terminal)
|
|||
/* The keymap name in vconsole.conf might be quoted, strip these */
|
||||
if (keymap && keymap[0] == '"' && keymap[strlen (keymap) - 1] == '"') {
|
||||
old_keymap = keymap;
|
||||
keymap = strndup(keymap + 1, strlen (keymap) - 2);
|
||||
keymap = strndup (keymap + 1, strlen (keymap) - 2);
|
||||
free (old_keymap);
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +904,7 @@ ply_terminal_get_capslock_state (ply_terminal_t *terminal)
|
|||
if (ioctl (terminal->fd, KDGETLED, &state) < 0)
|
||||
return false;
|
||||
|
||||
return (state & LED_CAP);
|
||||
return state & LED_CAP;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ out:
|
|||
}
|
||||
free (entries);
|
||||
|
||||
return (ply_array_get_size (animation->frames) > 0);
|
||||
return ply_array_get_size (animation->frames) > 0;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ on_timeout (void *user_data,
|
|||
bool old_is_on = capslock_icon->is_on;
|
||||
|
||||
ply_capslock_icon_update_state (capslock_icon);
|
||||
|
||||
|
||||
if (capslock_icon->is_on != old_is_on)
|
||||
ply_capslock_icon_draw (capslock_icon);
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ ply_capslock_icon_draw_area (ply_capslock_icon_t *capslock_icon,
|
|||
return;
|
||||
|
||||
ply_capslock_icon_update_state (capslock_icon);
|
||||
|
||||
|
||||
if (!capslock_icon->is_on)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,8 @@ ply_entry_draw_area (ply_entry_t *entry,
|
|||
}
|
||||
|
||||
void
|
||||
ply_entry_set_bullet_count (ply_entry_t *entry, int count)
|
||||
ply_entry_set_bullet_count (ply_entry_t *entry,
|
||||
int count)
|
||||
{
|
||||
count = MAX (0, count);
|
||||
if (!entry->is_password || entry->number_of_bullets != count) {
|
||||
|
|
@ -261,7 +262,8 @@ ply_entry_remove_all_bullets (ply_entry_t *entry)
|
|||
}
|
||||
|
||||
void
|
||||
ply_entry_set_text (ply_entry_t *entry, const char *text)
|
||||
ply_entry_set_text (ply_entry_t *entry,
|
||||
const char *text)
|
||||
{
|
||||
if (entry->is_password || strcmp (entry->text, text) != 0) {
|
||||
entry->is_password = false;
|
||||
|
|
|
|||
|
|
@ -55,17 +55,19 @@ struct _ply_image
|
|||
ply_pixel_buffer_t *buffer;
|
||||
};
|
||||
|
||||
struct bmp_file_header {
|
||||
struct bmp_file_header
|
||||
{
|
||||
uint16_t id;
|
||||
uint32_t file_size;
|
||||
uint32_t reserved;
|
||||
uint32_t bitmap_offset;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct bmp_dib_header {
|
||||
struct bmp_dib_header
|
||||
{
|
||||
uint32_t dib_header_size;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
uint16_t planes;
|
||||
uint16_t bpp;
|
||||
uint32_t compression;
|
||||
|
|
@ -136,7 +138,8 @@ transform_to_argb32 (png_struct *png,
|
|||
}
|
||||
|
||||
static bool
|
||||
ply_image_load_png (ply_image_t *image, FILE *fp)
|
||||
ply_image_load_png (ply_image_t *image,
|
||||
FILE *fp)
|
||||
{
|
||||
png_struct *png;
|
||||
png_info *info;
|
||||
|
|
@ -211,7 +214,8 @@ ply_image_load_png (ply_image_t *image, FILE *fp)
|
|||
}
|
||||
|
||||
static bool
|
||||
ply_image_load_bmp (ply_image_t *image, FILE *fp)
|
||||
ply_image_load_bmp (ply_image_t *image,
|
||||
FILE *fp)
|
||||
{
|
||||
uint32_t x, y, src_y, width, height, bmp_pitch, *dst;
|
||||
struct bmp_file_header file_header;
|
||||
|
|
@ -242,7 +246,7 @@ ply_image_load_bmp (ply_image_t *image, FILE *fp)
|
|||
|
||||
if (fseek (fp, file_header.bitmap_offset, SEEK_SET) != 0)
|
||||
goto out;
|
||||
|
||||
|
||||
if (fread (buf, 1, bmp_pitch * height, fp) != bmp_pitch * height)
|
||||
goto out;
|
||||
|
||||
|
|
@ -296,8 +300,8 @@ ply_image_load (ply_image_t *image)
|
|||
if (memcmp (header, png_header, sizeof(png_header)) == 0)
|
||||
ret = ply_image_load_png (image, fp);
|
||||
|
||||
else if (((struct bmp_file_header *)header)->id == 0x4d42 &&
|
||||
((struct bmp_file_header *)header)->reserved == 0)
|
||||
else if (((struct bmp_file_header *) header)->id == 0x4d42 &&
|
||||
((struct bmp_file_header *) header)->reserved == 0)
|
||||
ret = ply_image_load_bmp (image, fp);
|
||||
|
||||
out:
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ ply_keymap_icon_fill_keymap_info (ply_keymap_icon_t *keymap_icon)
|
|||
}
|
||||
|
||||
if (keymap_icon->keymap_offset == -1)
|
||||
ply_trace("Error no pre-rendered text for '%s' keymap", keymap);
|
||||
ply_trace ("Error no pre-rendered text for '%s' keymap", keymap);
|
||||
|
||||
free (keymap);
|
||||
}
|
||||
|
|
@ -155,14 +155,14 @@ ply_keymap_icon_load (ply_keymap_icon_t *keymap_icon)
|
|||
asprintf (&filename, "%s/keyboard.png", keymap_icon->image_dir);
|
||||
icon_image = ply_image_new (filename);
|
||||
success = ply_image_load (icon_image);
|
||||
ply_trace("loading '%s': %s", filename, success ? "success" : "failed");
|
||||
ply_trace ("loading '%s': %s", filename, success ? "success" : "failed");
|
||||
free (filename);
|
||||
|
||||
if (success) {
|
||||
asprintf (&filename, "%s/keymap-render.png", keymap_icon->image_dir);
|
||||
keymap_image = ply_image_new (filename);
|
||||
success = ply_image_load (keymap_image);
|
||||
ply_trace("loading '%s': %s", filename, success ? "success" : "failed");
|
||||
ply_trace ("loading '%s': %s", filename, success ? "success" : "failed");
|
||||
free (filename);
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ ply_keymap_icon_load (ply_keymap_icon_t *keymap_icon)
|
|||
keymap_icon->width =
|
||||
ply_pixel_buffer_get_width (keymap_icon->icon_buffer) +
|
||||
SPACING + keymap_icon->keymap_width;
|
||||
keymap_icon->height = MAX(
|
||||
keymap_icon->height = MAX (
|
||||
ply_pixel_buffer_get_height (keymap_icon->icon_buffer),
|
||||
ply_pixel_buffer_get_height (keymap_icon->keymap_buffer));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,138 +1,139 @@
|
|||
/* This file is autogenerated by running:
|
||||
* scripts/keymap-render.py > src/libply-splash-graphics/ply-keymap-metadata.h
|
||||
*/
|
||||
struct ply_keymap_metadata {
|
||||
struct ply_keymap_metadata
|
||||
{
|
||||
const char *name;
|
||||
int offset;
|
||||
int width;
|
||||
int offset;
|
||||
int width;
|
||||
};
|
||||
|
||||
static struct ply_keymap_metadata ply_keymap_metadata[] = {
|
||||
{ "dvorak", 10, 113 },
|
||||
{ "al", 123, 44 },
|
||||
{ "amiga", 167, 101 },
|
||||
{ "applkey", 268, 126 },
|
||||
{ "at", 394, 46 },
|
||||
{ "atari", 440, 81 },
|
||||
{ "az", 521, 49 },
|
||||
{ "azerty", 570, 104 },
|
||||
{ "ba", 674, 49 },
|
||||
{ "backspace", 723, 157 },
|
||||
{ "bashkir", 880, 119 },
|
||||
{ "be", 999, 50 },
|
||||
{ "bg", 1049, 51 },
|
||||
{ "br", 1100, 48 },
|
||||
{ "by", 1148, 51 },
|
||||
{ "bywin", 1199, 98 },
|
||||
{ "ca", 1297, 47 },
|
||||
{ "carpalx", 1344, 118 },
|
||||
{ "cf", 1462, 45 },
|
||||
{ "ch", 1507, 49 },
|
||||
{ "cm", 1556, 59 },
|
||||
{ "cn", 1615, 49 },
|
||||
{ "croat", 1664, 89 },
|
||||
{ "ctrl", 1753, 65 },
|
||||
{ "cz", 1818, 47 },
|
||||
{ "de", 1865, 51 },
|
||||
{ "defkeymap", 1916, 170 },
|
||||
{ "dk", 2086, 53 },
|
||||
{ "dz", 2139, 50 },
|
||||
{ "ee", 2189, 50 },
|
||||
{ "emacs", 2239, 106 },
|
||||
{ "emacs2", 2345, 122 },
|
||||
{ "en", 2467, 51 },
|
||||
{ "epo", 2518, 68 },
|
||||
{ "es", 2586, 49 },
|
||||
{ "et", 2635, 46 },
|
||||
{ "euro", 2681, 80 },
|
||||
{ "euro1", 2761, 95 },
|
||||
{ "euro2", 2856, 97 },
|
||||
{ "fi", 2953, 38 },
|
||||
{ "fo", 2991, 47 },
|
||||
{ "fr", 3038, 44 },
|
||||
{ "gb", 3082, 53 },
|
||||
{ "ge", 3135, 51 },
|
||||
{ "gh", 3186, 52 },
|
||||
{ "gr", 3238, 49 },
|
||||
{ "hr", 3287, 48 },
|
||||
{ "hu", 3335, 50 },
|
||||
{ "hu101", 3385, 99 },
|
||||
{ "ie", 3484, 42 },
|
||||
{ "il", 3526, 36 },
|
||||
{ "in", 3562, 43 },
|
||||
{ "iq", 3605, 43 },
|
||||
{ "ir", 3648, 40 },
|
||||
{ "is", 3688, 41 },
|
||||
{ "it", 3729, 38 },
|
||||
{ "it2", 3767, 54 },
|
||||
{ "jp", 3821, 46 },
|
||||
{ "jp106", 3867, 96 },
|
||||
{ "kazakh", 3963, 112 },
|
||||
{ "ke", 4075, 49 },
|
||||
{ "keypad", 4124, 114 },
|
||||
{ "kr", 4238, 47 },
|
||||
{ "ky", 4285, 50 },
|
||||
{ "kyrgyz", 4335, 107 },
|
||||
{ "kz", 4442, 48 },
|
||||
{ "la", 4490, 42 },
|
||||
{ "latam", 4532, 97 },
|
||||
{ "lk", 4629, 45 },
|
||||
{ "lt", 4674, 39 },
|
||||
{ "lv", 4713, 44 },
|
||||
{ "ma", 4757, 59 },
|
||||
{ "pl", 4816, 44 },
|
||||
{ "pt", 4860, 46 },
|
||||
{ "se", 4906, 48 },
|
||||
{ "template", 4954, 142 },
|
||||
{ "uk", 5096, 53 },
|
||||
{ "us", 5149, 50 },
|
||||
{ "md", 5199, 61 },
|
||||
{ "me", 5260, 60 },
|
||||
{ "mk", 5320, 62 },
|
||||
{ "mk0", 5382, 79 },
|
||||
{ "ml", 5461, 54 },
|
||||
{ "mm", 5515, 71 },
|
||||
{ "mt", 5586, 56 },
|
||||
{ "ng", 5642, 51 },
|
||||
{ "nl", 5693, 44 },
|
||||
{ "nl2", 5737, 60 },
|
||||
{ "no", 5797, 51 },
|
||||
{ "pc110", 5848, 95 },
|
||||
{ "ph", 5943, 51 },
|
||||
{ "pl1", 5994, 58 },
|
||||
{ "pl2", 6052, 60 },
|
||||
{ "pl3", 6112, 60 },
|
||||
{ "pl4", 6172, 62 },
|
||||
{ "ro", 6234, 46 },
|
||||
{ "rs", 6280, 44 },
|
||||
{ "ru", 6324, 45 },
|
||||
{ "ru1", 6369, 61 },
|
||||
{ "ru2", 6430, 63 },
|
||||
{ "ru3", 6493, 63 },
|
||||
{ "ru4", 6556, 65 },
|
||||
{ "ruwin", 6621, 95 },
|
||||
{ "sg", 6716, 49 },
|
||||
{ "si", 6765, 40 },
|
||||
{ "sk", 6805, 50 },
|
||||
{ "slovene", 6855, 122 },
|
||||
{ "sr", 6977, 46 },
|
||||
{ "sunkeymap", 7023, 174 },
|
||||
{ "sv", 7197, 49 },
|
||||
{ "sy", 7246, 49 },
|
||||
{ "tj", 7295, 38 },
|
||||
{ "tm", 7333, 57 },
|
||||
{ "tr", 7390, 44 },
|
||||
{ "tralt", 7434, 79 },
|
||||
{ "trf", 7513, 55 },
|
||||
{ "trq", 7568, 59 },
|
||||
{ "ttwin", 7627, 90 },
|
||||
{ "tw", 7717, 56 },
|
||||
{ "ua", 7773, 50 },
|
||||
{ "unicode", 7823, 124 },
|
||||
{ "uz", 7947, 50 },
|
||||
{ "vn", 7997, 51 },
|
||||
{ "wangbe", 8048, 126 },
|
||||
{ "wangbe2", 8174, 143 },
|
||||
{ "dvorak", 10, 113 },
|
||||
{ "al", 123, 44 },
|
||||
{ "amiga", 167, 101 },
|
||||
{ "applkey", 268, 126 },
|
||||
{ "at", 394, 46 },
|
||||
{ "atari", 440, 81 },
|
||||
{ "az", 521, 49 },
|
||||
{ "azerty", 570, 104 },
|
||||
{ "ba", 674, 49 },
|
||||
{ "backspace", 723, 157 },
|
||||
{ "bashkir", 880, 119 },
|
||||
{ "be", 999, 50 },
|
||||
{ "bg", 1049, 51 },
|
||||
{ "br", 1100, 48 },
|
||||
{ "by", 1148, 51 },
|
||||
{ "bywin", 1199, 98 },
|
||||
{ "ca", 1297, 47 },
|
||||
{ "carpalx", 1344, 118 },
|
||||
{ "cf", 1462, 45 },
|
||||
{ "ch", 1507, 49 },
|
||||
{ "cm", 1556, 59 },
|
||||
{ "cn", 1615, 49 },
|
||||
{ "croat", 1664, 89 },
|
||||
{ "ctrl", 1753, 65 },
|
||||
{ "cz", 1818, 47 },
|
||||
{ "de", 1865, 51 },
|
||||
{ "defkeymap", 1916, 170 },
|
||||
{ "dk", 2086, 53 },
|
||||
{ "dz", 2139, 50 },
|
||||
{ "ee", 2189, 50 },
|
||||
{ "emacs", 2239, 106 },
|
||||
{ "emacs2", 2345, 122 },
|
||||
{ "en", 2467, 51 },
|
||||
{ "epo", 2518, 68 },
|
||||
{ "es", 2586, 49 },
|
||||
{ "et", 2635, 46 },
|
||||
{ "euro", 2681, 80 },
|
||||
{ "euro1", 2761, 95 },
|
||||
{ "euro2", 2856, 97 },
|
||||
{ "fi", 2953, 38 },
|
||||
{ "fo", 2991, 47 },
|
||||
{ "fr", 3038, 44 },
|
||||
{ "gb", 3082, 53 },
|
||||
{ "ge", 3135, 51 },
|
||||
{ "gh", 3186, 52 },
|
||||
{ "gr", 3238, 49 },
|
||||
{ "hr", 3287, 48 },
|
||||
{ "hu", 3335, 50 },
|
||||
{ "hu101", 3385, 99 },
|
||||
{ "ie", 3484, 42 },
|
||||
{ "il", 3526, 36 },
|
||||
{ "in", 3562, 43 },
|
||||
{ "iq", 3605, 43 },
|
||||
{ "ir", 3648, 40 },
|
||||
{ "is", 3688, 41 },
|
||||
{ "it", 3729, 38 },
|
||||
{ "it2", 3767, 54 },
|
||||
{ "jp", 3821, 46 },
|
||||
{ "jp106", 3867, 96 },
|
||||
{ "kazakh", 3963, 112 },
|
||||
{ "ke", 4075, 49 },
|
||||
{ "keypad", 4124, 114 },
|
||||
{ "kr", 4238, 47 },
|
||||
{ "ky", 4285, 50 },
|
||||
{ "kyrgyz", 4335, 107 },
|
||||
{ "kz", 4442, 48 },
|
||||
{ "la", 4490, 42 },
|
||||
{ "latam", 4532, 97 },
|
||||
{ "lk", 4629, 45 },
|
||||
{ "lt", 4674, 39 },
|
||||
{ "lv", 4713, 44 },
|
||||
{ "ma", 4757, 59 },
|
||||
{ "pl", 4816, 44 },
|
||||
{ "pt", 4860, 46 },
|
||||
{ "se", 4906, 48 },
|
||||
{ "template", 4954, 142 },
|
||||
{ "uk", 5096, 53 },
|
||||
{ "us", 5149, 50 },
|
||||
{ "md", 5199, 61 },
|
||||
{ "me", 5260, 60 },
|
||||
{ "mk", 5320, 62 },
|
||||
{ "mk0", 5382, 79 },
|
||||
{ "ml", 5461, 54 },
|
||||
{ "mm", 5515, 71 },
|
||||
{ "mt", 5586, 56 },
|
||||
{ "ng", 5642, 51 },
|
||||
{ "nl", 5693, 44 },
|
||||
{ "nl2", 5737, 60 },
|
||||
{ "no", 5797, 51 },
|
||||
{ "pc110", 5848, 95 },
|
||||
{ "ph", 5943, 51 },
|
||||
{ "pl1", 5994, 58 },
|
||||
{ "pl2", 6052, 60 },
|
||||
{ "pl3", 6112, 60 },
|
||||
{ "pl4", 6172, 62 },
|
||||
{ "ro", 6234, 46 },
|
||||
{ "rs", 6280, 44 },
|
||||
{ "ru", 6324, 45 },
|
||||
{ "ru1", 6369, 61 },
|
||||
{ "ru2", 6430, 63 },
|
||||
{ "ru3", 6493, 63 },
|
||||
{ "ru4", 6556, 65 },
|
||||
{ "ruwin", 6621, 95 },
|
||||
{ "sg", 6716, 49 },
|
||||
{ "si", 6765, 40 },
|
||||
{ "sk", 6805, 50 },
|
||||
{ "slovene", 6855, 122 },
|
||||
{ "sr", 6977, 46 },
|
||||
{ "sunkeymap", 7023, 174 },
|
||||
{ "sv", 7197, 49 },
|
||||
{ "sy", 7246, 49 },
|
||||
{ "tj", 7295, 38 },
|
||||
{ "tm", 7333, 57 },
|
||||
{ "tr", 7390, 44 },
|
||||
{ "tralt", 7434, 79 },
|
||||
{ "trf", 7513, 55 },
|
||||
{ "trq", 7568, 59 },
|
||||
{ "ttwin", 7627, 90 },
|
||||
{ "tw", 7717, 56 },
|
||||
{ "ua", 7773, 50 },
|
||||
{ "unicode", 7823, 124 },
|
||||
{ "uz", 7947, 50 },
|
||||
{ "vn", 7997, 51 },
|
||||
{ "wangbe", 8048, 126 },
|
||||
{ "wangbe2", 8174, 143 },
|
||||
{ "windowkeys", 8317, 188 },
|
||||
{ NULL, } /* End of array marker */
|
||||
{ NULL, } /* End of array marker */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ struct _ply_throbber
|
|||
uint32_t is_stopped : 1;
|
||||
};
|
||||
|
||||
static void ply_throbber_stop_now (ply_throbber_t *throbber, bool redraw);
|
||||
static void ply_throbber_stop_now (ply_throbber_t *throbber,
|
||||
bool redraw);
|
||||
|
||||
ply_throbber_t *
|
||||
ply_throbber_new (const char *image_dir,
|
||||
|
|
@ -161,7 +162,7 @@ animate_at_time (ply_throbber_t *throbber,
|
|||
* frame and loop around. Clamp it to the last frame.
|
||||
*/
|
||||
if (last_frame_number > throbber->frame_number)
|
||||
throbber->frame_number = number_of_frames - 1;
|
||||
throbber->frame_number = number_of_frames - 1;
|
||||
|
||||
if (throbber->frame_number == number_of_frames - 1)
|
||||
should_continue = false;
|
||||
|
|
@ -281,7 +282,7 @@ out:
|
|||
}
|
||||
free (entries);
|
||||
|
||||
return (ply_array_get_size (throbber->frames) > 0);
|
||||
return ply_array_get_size (throbber->frames) > 0;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -324,7 +325,8 @@ ply_throbber_start (ply_throbber_t *throbber,
|
|||
}
|
||||
|
||||
static void
|
||||
ply_throbber_stop_now (ply_throbber_t *throbber, bool redraw)
|
||||
ply_throbber_stop_now (ply_throbber_t *throbber,
|
||||
bool redraw)
|
||||
{
|
||||
throbber->is_stopped = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ ply_array_steal_uint32_elements (ply_array_t *array)
|
|||
}
|
||||
|
||||
bool
|
||||
ply_array_contains_uint32_element (ply_array_t *array, const uint32_t element)
|
||||
ply_array_contains_uint32_element (ply_array_t *array,
|
||||
const uint32_t element)
|
||||
{
|
||||
uint32_t const *elements;
|
||||
int i, size;
|
||||
|
|
@ -180,9 +181,10 @@ ply_array_contains_uint32_element (ply_array_t *array, const uint32_t element)
|
|||
elements = (uint32_t const *) ply_buffer_get_bytes (array->buffer);
|
||||
size = (ply_buffer_get_size (array->buffer) / sizeof(const uint32_t)) - 1;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
for (i = 0; i < size; i++) {
|
||||
if (elements[i] == element)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,12 +410,13 @@ ply_command_parser_add_options (ply_command_parser_t *parser,
|
|||
|
||||
void
|
||||
ply_command_parser_add_command (ply_command_parser_t *parser,
|
||||
const char *name, const char *description,
|
||||
const char *name,
|
||||
const char *description,
|
||||
ply_command_handler_t handler,
|
||||
void *handler_data,
|
||||
const char *first_variadic_argument, /*
|
||||
* const char *option_description,
|
||||
* ply_command_option_type_t option_type */
|
||||
void *handler_data,
|
||||
const char *first_variadic_argument, /*
|
||||
* const char *option_description,
|
||||
* ply_command_option_type_t option_type */
|
||||
...)
|
||||
{
|
||||
ply_command_t *command;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ typedef struct _ply_fd_watch ply_fd_watch_t;
|
|||
|
||||
typedef enum
|
||||
{
|
||||
PLY_EVENT_LOOP_FD_STATUS_NONE = 0,
|
||||
PLY_EVENT_LOOP_FD_STATUS_HAS_DATA = 0x1,
|
||||
PLY_EVENT_LOOP_FD_STATUS_NONE = 0,
|
||||
PLY_EVENT_LOOP_FD_STATUS_HAS_DATA = 0x1,
|
||||
PLY_EVENT_LOOP_FD_STATUS_HAS_CONTROL_DATA = 0x2,
|
||||
PLY_EVENT_LOOP_FD_STATUS_CAN_TAKE_DATA = 0x4,
|
||||
PLY_EVENT_LOOP_FD_STATUS_CAN_TAKE_DATA = 0x4,
|
||||
} ply_event_loop_fd_status_t;
|
||||
|
||||
typedef void (*ply_event_handler_t) (void *user_data,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#define _(String) dgettext(PACKAGE, String)
|
||||
#define _(String) dgettext (PACKAGE, String)
|
||||
#else
|
||||
#define _(String) (String)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ typedef struct
|
|||
|
||||
struct _ply_key_file
|
||||
{
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
char *filename;
|
||||
FILE *fp;
|
||||
|
||||
ply_hashtable_t *groups;
|
||||
ply_hashtable_t *groups;
|
||||
ply_key_file_group_t *groupless_group;
|
||||
};
|
||||
|
||||
|
|
@ -384,9 +384,9 @@ ply_key_file_get_bool (ply_key_file_t *key_file,
|
|||
return false;
|
||||
|
||||
/* We treat "1", "y" and "yes" and "true" as true, all else is false */
|
||||
if (strcasecmp (raw_value, "1") == 0 ||
|
||||
strcasecmp (raw_value, "y") == 0 ||
|
||||
strcasecmp (raw_value, "yes") == 0 ||
|
||||
if (strcasecmp (raw_value, "1") == 0 ||
|
||||
strcasecmp (raw_value, "y") == 0 ||
|
||||
strcasecmp (raw_value, "yes") == 0 ||
|
||||
strcasecmp (raw_value, "true") == 0)
|
||||
return true;
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ ply_logger_open_file (ply_logger_t *logger,
|
|||
const char *filename)
|
||||
{
|
||||
char header[80];
|
||||
struct tm* tm;
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
int fd;
|
||||
|
||||
|
|
@ -339,8 +339,8 @@ ply_logger_open_file (ply_logger_t *logger,
|
|||
if (tm) {
|
||||
/* This uses uname -v date format */
|
||||
strftime (header, sizeof(header),
|
||||
"------------ %a %b %d %T %Z %Y ------------\n", tm);
|
||||
ply_logger_write (logger, header, strlen(header), true);
|
||||
"------------ %a %b %d %T %Z %Y ------------\n", tm);
|
||||
ply_logger_write (logger, header, strlen (header), true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -365,7 +365,7 @@ ply_logger_set_output_fd (ply_logger_t *logger,
|
|||
assert (logger != NULL);
|
||||
|
||||
logger->output_fd = fd;
|
||||
logger->output_fd_is_terminal = isatty(fd);
|
||||
logger->output_fd_is_terminal = isatty (fd);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ bool ply_logger_is_tracing_to_terminal (ply_logger_t *logger);
|
|||
ply_logger_flush (logger); \
|
||||
snprintf (buf, sizeof(buf), \
|
||||
"%02d:%02d:%02d.%03d %s:%d:%s", \
|
||||
(int)(timespec.tv_sec / 3600), \
|
||||
(int)((timespec.tv_sec / 60) % 60), \
|
||||
(int)(timespec.tv_sec % 60), \
|
||||
(int)(timespec.tv_nsec / 1000000), \
|
||||
(int) (timespec.tv_sec / 3600), \
|
||||
(int) ((timespec.tv_sec / 60) % 60), \
|
||||
(int) (timespec.tv_sec % 60), \
|
||||
(int) (timespec.tv_nsec / 1000000), \
|
||||
__FILE__, __LINE__, __func__); \
|
||||
errno = _old_errno; \
|
||||
ply_logger_inject (logger, \
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ ply_progress_free (ply_progress_t *progress)
|
|||
|
||||
|
||||
static ply_progress_message_t *
|
||||
ply_progress_message_search (ply_list_t *message_list, const char *string)
|
||||
ply_progress_message_search (ply_list_t *message_list,
|
||||
const char *string)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
|
||||
|
|
@ -144,12 +145,14 @@ ply_progress_message_search (ply_list_t *message_list, const char *string)
|
|||
|
||||
|
||||
static ply_progress_message_t *
|
||||
ply_progress_message_search_next (ply_list_t *message_list, double time)
|
||||
ply_progress_message_search_next (ply_list_t *message_list,
|
||||
double time)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
|
||||
node = ply_list_get_first_node (message_list);
|
||||
ply_progress_message_t *best = NULL;
|
||||
|
||||
while (node) {
|
||||
ply_progress_message_t *message = ply_list_node_get_data (node);
|
||||
if (message->time > time && (!best || message->time < best->time))
|
||||
|
|
@ -260,7 +263,8 @@ ply_progress_get_percentage (ply_progress_t *progress)
|
|||
}
|
||||
|
||||
void
|
||||
ply_progress_set_percentage (ply_progress_t *progress, double percentage)
|
||||
ply_progress_set_percentage (ply_progress_t *progress,
|
||||
double percentage)
|
||||
{
|
||||
progress->next_message_percentage = 1;
|
||||
progress->scalar += percentage / (ply_progress_get_time (progress) - progress->dead_time);
|
||||
|
|
|
|||
|
|
@ -39,55 +39,55 @@ struct _ply_rectangle
|
|||
|
||||
typedef enum
|
||||
{
|
||||
PLY_RECTANGLE_OVERLAP_NONE = 0,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE = 1 << 0,
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE = 1 << 1,
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE = 1 << 2,
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE = 1 << 3,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_LEFT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_NONE = 0,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE = 1 << 0,
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE = 1 << 1,
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE = 1 << 2,
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE = 1 << 3,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_LEFT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_RIGHT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_RIGHT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_LEFT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_LEFT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_RIGHT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_RIGHT_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_AND_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_SIDE_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_LEFT_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_LEFT_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_TOP_RIGHT_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_RIGHT_AND_BOTTOM_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_ALL_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_ALL_EDGES =
|
||||
PLY_RECTANGLE_OVERLAP_TOP_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_LEFT_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_BOTTOM_EDGE |
|
||||
PLY_RECTANGLE_OVERLAP_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_NO_EDGES = 1 << 4,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_TOP_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_LEFT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_BOTTOM_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_NO_EDGES = 1 << 4,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_TOP_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_LEFT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_RIGHT_EDGE,
|
||||
PLY_RECTANGLE_OVERLAP_EXACT_BOTTOM_EDGE,
|
||||
} ply_rectangle_overlap_t;
|
||||
|
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
|
||||
|
|
|
|||
|
|
@ -445,7 +445,8 @@ ply_region_get_rectangle_list (ply_region_t *region)
|
|||
}
|
||||
|
||||
static int
|
||||
rectangle_compare_y (void *element_a, void *element_b)
|
||||
rectangle_compare_y (void *element_a,
|
||||
void *element_b)
|
||||
{
|
||||
ply_rectangle_t *rectangle_a = element_a;
|
||||
ply_rectangle_t *rectangle_b = element_b;
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ typedef void (*ply_terminal_session_hangup_handler_t)(void *us
|
|||
|
||||
typedef enum
|
||||
{
|
||||
PLY_TERMINAL_SESSION_FLAGS_NONE = 0x0,
|
||||
PLY_TERMINAL_SESSION_FLAGS_RUN_IN_PARENT = 0x1,
|
||||
PLY_TERMINAL_SESSION_FLAGS_LOOK_IN_PATH = 0x2,
|
||||
PLY_TERMINAL_SESSION_FLAGS_NONE = 0x0,
|
||||
PLY_TERMINAL_SESSION_FLAGS_RUN_IN_PARENT = 0x1,
|
||||
PLY_TERMINAL_SESSION_FLAGS_LOOK_IN_PATH = 0x2,
|
||||
PLY_TERMINAL_SESSION_FLAGS_REDIRECT_CONSOLE = 0x4,
|
||||
} ply_terminal_session_flags_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -460,7 +460,8 @@ ply_free_string_array (char **array)
|
|||
}
|
||||
|
||||
bool
|
||||
ply_string_has_prefix (const char *str, const char *prefix)
|
||||
ply_string_has_prefix (const char *str,
|
||||
const char *prefix)
|
||||
{
|
||||
if (str == NULL || prefix == NULL)
|
||||
return false;
|
||||
|
|
@ -856,8 +857,8 @@ out:
|
|||
void
|
||||
ply_set_device_scale (int device_scale)
|
||||
{
|
||||
overridden_device_scale = device_scale;
|
||||
ply_trace ("Device scale is set to %d", device_scale);
|
||||
overridden_device_scale = device_scale;
|
||||
ply_trace ("Device scale is set to %d", device_scale);
|
||||
}
|
||||
|
||||
/* The minimum resolution at which we turn on a device-scale of 2 */
|
||||
|
|
@ -894,11 +895,11 @@ ply_get_device_scale (uint32_t width,
|
|||
return 1;
|
||||
|
||||
if (width_mm > 0 && height_mm > 0) {
|
||||
dpi_x = (double)width / (width_mm / 25.4);
|
||||
dpi_y = (double)height / (height_mm / 25.4);
|
||||
dpi_x = (double) width / (width_mm / 25.4);
|
||||
dpi_y = (double) height / (height_mm / 25.4);
|
||||
/* We don't completely trust these values so both
|
||||
must be high, and never pick higher ratio than
|
||||
2 automatically */
|
||||
* must be high, and never pick higher ratio than
|
||||
* 2 automatically */
|
||||
if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
|
||||
device_scale = 2;
|
||||
}
|
||||
|
|
@ -954,7 +955,7 @@ ply_get_kernel_command_line (void)
|
|||
const char *
|
||||
ply_kernel_command_line_get_string_after_prefix (const char *prefix)
|
||||
{
|
||||
const char *command_line = ply_get_kernel_command_line();
|
||||
const char *command_line = ply_get_kernel_command_line ();
|
||||
char *argument;
|
||||
|
||||
if (!command_line)
|
||||
|
|
@ -997,7 +998,7 @@ ply_kernel_command_line_get_key_value (const char *key)
|
|||
if (value == NULL || value[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
return strndup(value, strcspn (value, " \n"));
|
||||
return strndup (value, strcspn (value, " \n"));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1008,15 +1009,15 @@ ply_kernel_command_line_override (const char *command_line)
|
|||
kernel_command_line_is_set = true;
|
||||
}
|
||||
|
||||
double ply_strtod(const char *str)
|
||||
double ply_strtod (const char *str)
|
||||
{
|
||||
char *old_locale;
|
||||
double ret;
|
||||
|
||||
/* Ensure strtod uses '.' as decimal separator, as we use this in our cfg files. */
|
||||
old_locale = setlocale(LC_NUMERIC, "C");
|
||||
ret = strtod(str, NULL);
|
||||
setlocale(LC_NUMERIC, old_locale);
|
||||
old_locale = setlocale (LC_NUMERIC, "C");
|
||||
ret = strtod (str, NULL);
|
||||
setlocale (LC_NUMERIC, old_locale);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define CLAMP(a, b, c) (MIN (MAX ((a), (b)), (c)))
|
||||
#endif
|
||||
|
||||
#define PLY_NUMBER_OF_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))
|
||||
#define PLY_NUMBER_OF_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
#define PLY_UTF8_CHARACTER_SIZE_MAX 4
|
||||
|
||||
|
|
@ -85,7 +85,8 @@ bool ply_fd_has_data (int fd);
|
|||
bool ply_set_fd_as_blocking (int fd);
|
||||
char **ply_copy_string_array (const char *const *array);
|
||||
void ply_free_string_array (char **array);
|
||||
bool ply_string_has_prefix (const char *str, const char *prefix);
|
||||
bool ply_string_has_prefix (const char *str,
|
||||
const char *prefix);
|
||||
double ply_get_timestamp (void);
|
||||
|
||||
void ply_save_errno (void);
|
||||
|
|
@ -131,7 +132,7 @@ bool ply_kernel_command_line_has_argument (const char *argument);
|
|||
void ply_kernel_command_line_override (const char *command_line);
|
||||
char *ply_kernel_command_line_get_key_value (const char *key);
|
||||
|
||||
double ply_strtod(const char *str);
|
||||
double ply_strtod (const char *str);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
62
src/main.c
62
src/main.c
|
|
@ -262,9 +262,9 @@ show_messages (state_t *state)
|
|||
}
|
||||
|
||||
static bool
|
||||
get_theme_path (const char *splash_string,
|
||||
const char *configured_theme_dir,
|
||||
char **theme_path)
|
||||
get_theme_path (const char *splash_string,
|
||||
const char *configured_theme_dir,
|
||||
char **theme_path)
|
||||
{
|
||||
const char *paths[] = { PLYMOUTH_RUNTIME_THEME_PATH,
|
||||
configured_theme_dir,
|
||||
|
|
@ -311,18 +311,18 @@ load_settings (state_t *state,
|
|||
if (splash_string != NULL) {
|
||||
char *configured_theme_dir;
|
||||
configured_theme_dir = ply_key_file_get_value (key_file, "Daemon",
|
||||
"ThemeDir");
|
||||
"ThemeDir");
|
||||
get_theme_path (splash_string, configured_theme_dir, theme_path);
|
||||
free (configured_theme_dir);
|
||||
}
|
||||
|
||||
if (isnan (state->splash_delay)) {
|
||||
state->splash_delay = ply_key_file_get_double(key_file, "Daemon", "ShowDelay", NAN);
|
||||
state->splash_delay = ply_key_file_get_double (key_file, "Daemon", "ShowDelay", NAN);
|
||||
ply_trace ("Splash delay is set to %lf", state->splash_delay);
|
||||
}
|
||||
|
||||
if (isnan (state->device_timeout)) {
|
||||
state->device_timeout = ply_key_file_get_double(key_file, "Daemon", "DeviceTimeout", NAN);
|
||||
state->device_timeout = ply_key_file_get_double (key_file, "Daemon", "DeviceTimeout", NAN);
|
||||
ply_trace ("Device timeout is set to %lf", state->device_timeout);
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ on_hide_message (state_t *state,
|
|||
free (list_message);
|
||||
ply_list_remove_node (state->messages, node);
|
||||
if (state->boot_splash != NULL) {
|
||||
ply_boot_splash_hide_message (state->boot_splash, message);
|
||||
ply_boot_splash_hide_message (state->boot_splash, message);
|
||||
}
|
||||
}
|
||||
node = next_node;
|
||||
|
|
@ -666,7 +666,7 @@ on_newroot (state_t *state,
|
|||
chroot (".");
|
||||
chdir ("/");
|
||||
/* Update local now that we have /usr/share/locale available */
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale (LC_ALL, "");
|
||||
ply_progress_load_cache (state->progress, get_cache_file_for_mode (state->mode));
|
||||
if (state->boot_splash != NULL)
|
||||
ply_boot_splash_root_mounted (state->boot_splash);
|
||||
|
|
@ -858,7 +858,7 @@ sh_is_init (state_t *state)
|
|||
if (init_string) {
|
||||
length = strlen (init_string);
|
||||
if (length > 2 && init_string[length - 2] == 's' &&
|
||||
init_string[length - 1] == 'h')
|
||||
init_string[length - 1] == 'h')
|
||||
result = true;
|
||||
|
||||
free (init_string);
|
||||
|
|
@ -1018,25 +1018,25 @@ static void
|
|||
on_keyboard_removed (state_t *state,
|
||||
ply_keyboard_t *keyboard)
|
||||
{
|
||||
ply_trace ("no longer listening for keystrokes");
|
||||
ply_keyboard_remove_input_handler (keyboard,
|
||||
(ply_keyboard_input_handler_t)
|
||||
on_keyboard_input);
|
||||
ply_trace ("no longer listening for escape");
|
||||
ply_keyboard_remove_escape_handler (keyboard,
|
||||
(ply_keyboard_escape_handler_t)
|
||||
on_escape_pressed);
|
||||
ply_trace ("no longer listening for backspace");
|
||||
ply_keyboard_remove_backspace_handler (keyboard,
|
||||
(ply_keyboard_backspace_handler_t)
|
||||
on_backspace);
|
||||
ply_trace ("no longer listening for enter");
|
||||
ply_keyboard_remove_enter_handler (keyboard,
|
||||
(ply_keyboard_enter_handler_t)
|
||||
on_enter);
|
||||
ply_trace ("no longer listening for keystrokes");
|
||||
ply_keyboard_remove_input_handler (keyboard,
|
||||
(ply_keyboard_input_handler_t)
|
||||
on_keyboard_input);
|
||||
ply_trace ("no longer listening for escape");
|
||||
ply_keyboard_remove_escape_handler (keyboard,
|
||||
(ply_keyboard_escape_handler_t)
|
||||
on_escape_pressed);
|
||||
ply_trace ("no longer listening for backspace");
|
||||
ply_keyboard_remove_backspace_handler (keyboard,
|
||||
(ply_keyboard_backspace_handler_t)
|
||||
on_backspace);
|
||||
ply_trace ("no longer listening for enter");
|
||||
ply_keyboard_remove_enter_handler (keyboard,
|
||||
(ply_keyboard_enter_handler_t)
|
||||
on_enter);
|
||||
|
||||
if (state->boot_splash != NULL)
|
||||
ply_boot_splash_unset_keyboard (state->boot_splash);
|
||||
if (state->boot_splash != NULL)
|
||||
ply_boot_splash_unset_keyboard (state->boot_splash);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1227,7 +1227,6 @@ deactivate_console (state_t *state)
|
|||
/* do not let any tty opened where we could write after deactivate */
|
||||
if (ply_kernel_command_line_has_argument ("plymouth.debug"))
|
||||
ply_logger_close_file (ply_logger_get_error_default ());
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1446,11 +1445,12 @@ start_boot_server (state_t *state)
|
|||
}
|
||||
|
||||
static bool
|
||||
validate_input (state_t *state,
|
||||
validate_input (state_t *state,
|
||||
const char *entry_text,
|
||||
const char *add_text)
|
||||
{
|
||||
bool input_valid;
|
||||
|
||||
if (!state->boot_splash)
|
||||
return true;
|
||||
input_valid = ply_boot_splash_validate_input (state->boot_splash, entry_text, add_text);
|
||||
|
|
@ -2069,7 +2069,7 @@ on_crash (int signum)
|
|||
|
||||
ioctl (fd, KDSETMODE, KD_TEXT);
|
||||
|
||||
write (fd, show_cursor_sequence, sizeof (show_cursor_sequence) - 1);
|
||||
write (fd, show_cursor_sequence, sizeof(show_cursor_sequence) - 1);
|
||||
|
||||
tcgetattr (fd, &term_attributes);
|
||||
|
||||
|
|
@ -2172,7 +2172,7 @@ main (int argc,
|
|||
|
||||
/* Initialize the translations if they are available (!initrd) */
|
||||
if (ply_directory_exists (PLYMOUTH_LOCALE_DIRECTORY))
|
||||
setlocale(LC_ALL, "");
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
ply_command_parser_add_options (state.command_parser,
|
||||
"help", "This help message", PLY_COMMAND_OPTION_TYPE_FLAG,
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ init_pango_text_layout (cairo_t *cairo_context,
|
|||
}
|
||||
|
||||
static void
|
||||
size_control (ply_label_plugin_control_t *label, bool force)
|
||||
size_control (ply_label_plugin_control_t *label,
|
||||
bool force)
|
||||
{
|
||||
cairo_t *cairo_context;
|
||||
PangoLayout *pango_layout;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
/* For builds with libdrm < 2.4.89 */
|
||||
#ifndef DRM_MODE_ROTATE_0
|
||||
#define DRM_MODE_ROTATE_0 (1<<0)
|
||||
#define DRM_MODE_ROTATE_0 (1 << 0)
|
||||
#endif
|
||||
|
||||
struct _ply_renderer_head
|
||||
|
|
@ -87,7 +87,7 @@ struct _ply_renderer_head
|
|||
bool uses_hw_rotation;
|
||||
|
||||
int gamma_size;
|
||||
uint16_t *gamma;
|
||||
uint16_t *gamma;
|
||||
};
|
||||
|
||||
struct _ply_renderer_input_source
|
||||
|
|
@ -119,49 +119,49 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
drmModeModeInfo mode;
|
||||
uint32_t connector_id;
|
||||
uint32_t connector_type;
|
||||
uint32_t controller_id;
|
||||
uint32_t possible_controllers;
|
||||
int device_scale;
|
||||
int link_status;
|
||||
drmModeModeInfo mode;
|
||||
uint32_t connector_id;
|
||||
uint32_t connector_type;
|
||||
uint32_t controller_id;
|
||||
uint32_t possible_controllers;
|
||||
int device_scale;
|
||||
int link_status;
|
||||
ply_pixel_buffer_rotation_t rotation;
|
||||
bool tiled;
|
||||
bool connected;
|
||||
bool uses_hw_rotation;
|
||||
bool tiled;
|
||||
bool connected;
|
||||
bool uses_hw_rotation;
|
||||
} ply_output_t;
|
||||
|
||||
struct _ply_renderer_backend
|
||||
{
|
||||
ply_event_loop_t *loop;
|
||||
ply_terminal_t *terminal;
|
||||
ply_event_loop_t *loop;
|
||||
ply_terminal_t *terminal;
|
||||
|
||||
int device_fd;
|
||||
char *device_name;
|
||||
drmModeRes *resources;
|
||||
int device_fd;
|
||||
char *device_name;
|
||||
drmModeRes *resources;
|
||||
|
||||
ply_renderer_input_source_t input_source;
|
||||
ply_list_t *heads;
|
||||
ply_hashtable_t *heads_by_controller_id;
|
||||
ply_renderer_input_source_t input_source;
|
||||
ply_list_t *heads;
|
||||
ply_hashtable_t *heads_by_controller_id;
|
||||
|
||||
ply_hashtable_t *output_buffers;
|
||||
ply_hashtable_t *output_buffers;
|
||||
|
||||
ply_output_t *outputs;
|
||||
int outputs_len;
|
||||
int connected_count;
|
||||
ply_output_t *outputs;
|
||||
int outputs_len;
|
||||
int connected_count;
|
||||
|
||||
int32_t dither_red;
|
||||
int32_t dither_green;
|
||||
int32_t dither_blue;
|
||||
int32_t dither_red;
|
||||
int32_t dither_green;
|
||||
int32_t dither_blue;
|
||||
|
||||
uint32_t is_active : 1;
|
||||
uint32_t requires_explicit_flushing : 1;
|
||||
uint32_t is_active : 1;
|
||||
uint32_t requires_explicit_flushing : 1;
|
||||
|
||||
int panel_width;
|
||||
int panel_height;
|
||||
ply_pixel_buffer_rotation_t panel_rotation;
|
||||
int panel_scale;
|
||||
int panel_width;
|
||||
int panel_height;
|
||||
ply_pixel_buffer_rotation_t panel_rotation;
|
||||
int panel_scale;
|
||||
};
|
||||
|
||||
ply_renderer_plugin_interface_t *ply_renderer_backend_get_interface (void);
|
||||
|
|
@ -399,10 +399,10 @@ destroy_output_buffer (ply_renderer_backend_t *backend,
|
|||
|
||||
static bool
|
||||
get_primary_plane_rotation (ply_renderer_backend_t *backend,
|
||||
uint32_t controller_id,
|
||||
int *primary_id_ret,
|
||||
int *rotation_prop_id_ret,
|
||||
uint64_t *rotation_ret)
|
||||
uint32_t controller_id,
|
||||
int *primary_id_ret,
|
||||
int *rotation_prop_id_ret,
|
||||
uint64_t *rotation_ret)
|
||||
{
|
||||
drmModeObjectPropertiesPtr plane_props;
|
||||
drmModePlaneResPtr plane_resources;
|
||||
|
|
@ -483,7 +483,7 @@ get_primary_plane_rotation (ply_renderer_backend_t *backend,
|
|||
|
||||
static ply_pixel_buffer_rotation_t
|
||||
connector_orientation_prop_to_rotation (drmModePropertyPtr prop,
|
||||
int orientation)
|
||||
int orientation)
|
||||
{
|
||||
const char *name = prop->enums[orientation].name;
|
||||
|
||||
|
|
@ -504,9 +504,9 @@ connector_orientation_prop_to_rotation (drmModePropertyPtr prop,
|
|||
}
|
||||
|
||||
static void
|
||||
ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *backend,
|
||||
drmModeConnector *connector,
|
||||
ply_output_t *output)
|
||||
ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *backend,
|
||||
drmModeConnector *connector,
|
||||
ply_output_t *output)
|
||||
{
|
||||
int i, primary_id, rotation_prop_id;
|
||||
drmModePropertyPtr prop;
|
||||
|
|
@ -548,7 +548,7 @@ ply_renderer_connector_get_rotation_and_tiled (ply_renderer_backend_t *back
|
|||
&primary_id, &rotation_prop_id,
|
||||
&rotation) &&
|
||||
rotation == DRM_MODE_ROTATE_180) {
|
||||
ply_trace("Keeping hw 180° rotation");
|
||||
ply_trace ("Keeping hw 180° rotation");
|
||||
output->rotation = PLY_PIXEL_BUFFER_ROTATE_UPRIGHT;
|
||||
output->uses_hw_rotation = true;
|
||||
}
|
||||
|
|
@ -581,10 +581,10 @@ ply_renderer_head_add_connector (ply_renderer_head_t *head,
|
|||
}
|
||||
|
||||
static ply_renderer_head_t *
|
||||
ply_renderer_head_new (ply_renderer_backend_t *backend,
|
||||
ply_output_t *output,
|
||||
uint32_t console_buffer_id,
|
||||
int gamma_size)
|
||||
ply_renderer_head_new (ply_renderer_backend_t *backend,
|
||||
ply_output_t *output,
|
||||
uint32_t console_buffer_id,
|
||||
int gamma_size)
|
||||
{
|
||||
ply_renderer_head_t *head;
|
||||
int i, step;
|
||||
|
|
@ -774,7 +774,7 @@ ply_renderer_head_remove (ply_renderer_backend_t *backend,
|
|||
static void
|
||||
ply_renderer_head_remove_connector (ply_renderer_backend_t *backend,
|
||||
ply_renderer_head_t *head,
|
||||
uint32_t connector_id)
|
||||
uint32_t connector_id)
|
||||
{
|
||||
int i, size = ply_array_get_size (head->connector_ids);
|
||||
uint32_t *connector_ids;
|
||||
|
|
@ -983,7 +983,6 @@ unload_backend (ply_renderer_backend_t *backend)
|
|||
|
||||
destroy_backend (backend);
|
||||
backend = NULL;
|
||||
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -1114,21 +1113,23 @@ get_preferred_mode (drmModeConnector *connector)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < connector->count_modes; i++)
|
||||
for (i = 0; i < connector->count_modes; i++) {
|
||||
if (connector->modes[i].type & DRM_MODE_TYPE_USERDEF) {
|
||||
ply_trace ("Found user set mode %dx%d at index %d",
|
||||
connector->modes[i].hdisplay,
|
||||
connector->modes[i].vdisplay, i);
|
||||
return &connector->modes[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < connector->count_modes; i++)
|
||||
for (i = 0; i < connector->count_modes; i++) {
|
||||
if (connector->modes[i].type & DRM_MODE_TYPE_PREFERRED) {
|
||||
ply_trace ("Found preferred mode %dx%d at index %d",
|
||||
connector->modes[i].hdisplay,
|
||||
connector->modes[i].vdisplay, i);
|
||||
return &connector->modes[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1181,7 +1182,7 @@ get_output_info (ply_renderer_backend_t *backend,
|
|||
ply_renderer_connector_get_rotation_and_tiled (backend, connector, output);
|
||||
if (output->rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE ||
|
||||
output->rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE)
|
||||
has_90_rotation = true;
|
||||
has_90_rotation = true;
|
||||
|
||||
if (!output->tiled)
|
||||
mode = get_preferred_mode (connector);
|
||||
|
|
@ -1214,7 +1215,6 @@ out:
|
|||
* This repeats until we find an assignment order which results in a controller
|
||||
* for all outputs, or we've tried all possible assignment orders.
|
||||
*/
|
||||
|
||||
static uint32_t
|
||||
find_controller_for_output (ply_renderer_backend_t *backend,
|
||||
const ply_output_t *outputs,
|
||||
|
|
@ -1296,7 +1296,7 @@ setup_outputs (ply_renderer_backend_t *backend,
|
|||
count = count_setup_controllers (new_outputs, outputs_len);
|
||||
if (count > best_count) {
|
||||
if (best_outputs != outputs)
|
||||
free ((void *)best_outputs);
|
||||
free ((void *) best_outputs);
|
||||
best_outputs = new_outputs;
|
||||
best_count = count;
|
||||
} else {
|
||||
|
|
@ -1305,14 +1305,15 @@ setup_outputs (ply_renderer_backend_t *backend,
|
|||
}
|
||||
|
||||
if (best_outputs != outputs)
|
||||
free ((void *)outputs);
|
||||
free ((void *) outputs);
|
||||
|
||||
/* Our caller is allowed to modify outputs, cast-away the const */
|
||||
return (ply_output_t *)best_outputs;
|
||||
return (ply_output_t *) best_outputs;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_output (ply_renderer_backend_t *backend, ply_output_t *output)
|
||||
remove_output (ply_renderer_backend_t *backend,
|
||||
ply_output_t *output)
|
||||
{
|
||||
ply_renderer_head_t *head;
|
||||
|
||||
|
|
@ -1332,7 +1333,7 @@ remove_output (ply_renderer_backend_t *backend, ply_output_t *output)
|
|||
*/
|
||||
static bool
|
||||
check_if_output_has_changed (ply_renderer_backend_t *backend,
|
||||
ply_output_t *new_output)
|
||||
ply_output_t *new_output)
|
||||
{
|
||||
ply_output_t *old_output = NULL;
|
||||
int i;
|
||||
|
|
@ -1347,7 +1348,7 @@ check_if_output_has_changed (ply_renderer_backend_t *backend,
|
|||
if (!old_output || !old_output->controller_id)
|
||||
return false;
|
||||
|
||||
if (memcmp(old_output, new_output, sizeof(ply_output_t)) == 0)
|
||||
if (memcmp (old_output, new_output, sizeof(ply_output_t)) == 0)
|
||||
return false;
|
||||
|
||||
ply_trace ("Output for connector %u changed, removing", old_output->connector_id);
|
||||
|
|
@ -1360,7 +1361,8 @@ check_if_output_has_changed (ply_renderer_backend_t *backend,
|
|||
* Returns true if any heads were modified.
|
||||
*/
|
||||
static bool
|
||||
create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change)
|
||||
create_heads_for_active_connectors (ply_renderer_backend_t *backend,
|
||||
bool change)
|
||||
{
|
||||
int i, j, number_of_setup_outputs, outputs_len;
|
||||
ply_output_t *outputs;
|
||||
|
|
@ -1442,9 +1444,10 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change
|
|||
}
|
||||
outputs = setup_outputs (backend, outputs, outputs_len);
|
||||
}
|
||||
for (i = 0; i < outputs_len; i++)
|
||||
for (i = 0; i < outputs_len; i++) {
|
||||
ply_trace ("Using controller %u for connector %u",
|
||||
outputs[i].controller_id, outputs[i].connector_id);
|
||||
}
|
||||
|
||||
/* Step 5:
|
||||
* Create heads for all valid outputs
|
||||
|
|
@ -1812,10 +1815,10 @@ get_panel_properties (ply_renderer_backend_t *backend,
|
|||
if (!backend->panel_width)
|
||||
return false;
|
||||
|
||||
*width = backend->panel_width;
|
||||
*height = backend->panel_height;
|
||||
*width = backend->panel_width;
|
||||
*height = backend->panel_height;
|
||||
*rotation = backend->panel_rotation;
|
||||
*scale = backend->panel_scale;
|
||||
*scale = backend->panel_scale;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,10 +238,10 @@ create_fullscreen_single_head_setup (ply_renderer_backend_t *backend)
|
|||
GdkRectangle monitor_geometry;
|
||||
int width_mm, height_mm;
|
||||
|
||||
#if GTK_CHECK_VERSION(3,22,0)
|
||||
GdkDisplay* const display = gdk_display_get_default();
|
||||
GdkMonitor* const monitor = gdk_display_get_primary_monitor(display);
|
||||
gdk_monitor_get_geometry(monitor, &monitor_geometry);
|
||||
#if GTK_CHECK_VERSION (3, 22, 0)
|
||||
GdkDisplay * const display = gdk_display_get_default ();
|
||||
GdkMonitor * const monitor = gdk_display_get_primary_monitor (display);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
width_mm = gdk_monitor_get_width_mm (monitor);
|
||||
height_mm = gdk_monitor_get_height_mm (monitor);
|
||||
#else
|
||||
|
|
@ -497,10 +497,10 @@ on_key_event (GtkWidget *widget,
|
|||
ply_buffer_append_bytes (input_source->key_buffer, "\033", 1);
|
||||
} else if (event->keyval == GDK_KEY_BackSpace) { /* Backspace */
|
||||
ply_buffer_append_bytes (input_source->key_buffer, "\177", 1);
|
||||
} else if (GDK_KEY_F1 <= event->keyval &&
|
||||
GDK_KEY_F12 >= event->keyval) { /* F1-F12 */
|
||||
} else if (GDK_KEY_F1 <= event->keyval &&
|
||||
GDK_KEY_F12 >= event->keyval) { /* F1-F12 */
|
||||
const char *key = function_key_escape_sequence[event->keyval - GDK_KEY_F1];
|
||||
ply_buffer_append_bytes (input_source->key_buffer, key, strlen(key));
|
||||
ply_buffer_append_bytes (input_source->key_buffer, key, strlen (key));
|
||||
} else {
|
||||
gchar bytes[7];
|
||||
int byte_count;
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ add_text_display (ply_boot_splash_plugin_t *plugin,
|
|||
|
||||
terminal = ply_text_display_get_terminal (view->display);
|
||||
if (ply_terminal_open (terminal)) {
|
||||
ply_text_display_clear_screen (view->display);
|
||||
ply_text_display_clear_screen (view->display);
|
||||
ply_terminal_activate_vt (terminal);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -280,6 +280,7 @@ start_script_animation (ply_boot_splash_plugin_t *plugin)
|
|||
ply_trace ("executing script file");
|
||||
script_return_t ret = script_execute (plugin->script_state,
|
||||
plugin->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object);
|
||||
if (plugin->keyboard != NULL)
|
||||
ply_keyboard_add_input_handler (plugin->keyboard,
|
||||
|
|
@ -429,7 +430,7 @@ static void
|
|||
system_update (ply_boot_splash_plugin_t *plugin,
|
||||
int progress)
|
||||
{
|
||||
script_lib_plymouth_on_system_update( plugin->script_state,
|
||||
script_lib_plymouth_on_system_update (plugin->script_state,
|
||||
plugin->script_plymouth_lib,
|
||||
progress);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,10 @@ static void script_execute_error (void *element,
|
|||
}
|
||||
|
||||
|
||||
static script_obj_t *script_evaluate_apply_function (script_state_t *state,
|
||||
script_exp_t *exp,
|
||||
script_obj_t *(*function)(script_obj_t *,
|
||||
script_obj_t *))
|
||||
static script_obj_t *script_evaluate_apply_function (script_state_t *state,
|
||||
script_exp_t *exp,
|
||||
script_obj_t *(*function)(script_obj_t *,
|
||||
script_obj_t *))
|
||||
{
|
||||
script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
|
||||
script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
|
||||
|
|
@ -81,10 +81,10 @@ static script_obj_t *script_evaluate_apply_function (script_state_t
|
|||
return obj;
|
||||
}
|
||||
|
||||
static script_obj_t *script_evaluate_apply_function_and_assign (script_state_t *state,
|
||||
script_exp_t *exp,
|
||||
script_obj_t *(*function)(script_obj_t *,
|
||||
script_obj_t *))
|
||||
static script_obj_t *script_evaluate_apply_function_and_assign (script_state_t *state,
|
||||
script_exp_t *exp,
|
||||
script_obj_t *(*function)(script_obj_t *,
|
||||
script_obj_t *))
|
||||
{
|
||||
script_obj_t *script_obj_a = script_evaluate (state, exp->data.dual.sub_a);
|
||||
script_obj_t *script_obj_b = script_evaluate (state, exp->data.dual.sub_b);
|
||||
|
|
@ -335,6 +335,7 @@ static script_obj_t *script_evaluate_func (script_state_t *state,
|
|||
ply_list_t *parameter_data = ply_list_new ();
|
||||
|
||||
ply_list_node_t *node_expression = ply_list_get_first_node (parameter_expressions);
|
||||
|
||||
while (node_expression) {
|
||||
script_exp_t *data_exp = ply_list_node_get_data (node_expression);
|
||||
script_obj_t *data_obj = script_evaluate (state, data_exp);
|
||||
|
|
@ -346,6 +347,7 @@ static script_obj_t *script_evaluate_func (script_state_t *state,
|
|||
script_return_t reply = script_execute_object_with_parlist (state, func_obj, this_obj, parameter_data);
|
||||
|
||||
ply_list_node_t *node_data = ply_list_get_first_node (parameter_data);
|
||||
|
||||
while (node_data) {
|
||||
script_obj_t *data_obj = ply_list_node_get_data (node_data);
|
||||
script_obj_unref (data_obj);
|
||||
|
|
@ -598,6 +600,7 @@ static script_return_t script_execute_function_with_parlist (script_state_t *
|
|||
}
|
||||
|
||||
script_obj_t *count_obj = script_obj_new_number (index);
|
||||
|
||||
script_obj_hash_add_element (arg_obj, count_obj, "count");
|
||||
script_obj_hash_add_element (sub_state->local, arg_obj, "_args");
|
||||
script_obj_unref (count_obj);
|
||||
|
|
@ -607,6 +610,7 @@ static script_return_t script_execute_function_with_parlist (script_state_t *
|
|||
script_obj_hash_add_element (sub_state->local, this, "this");
|
||||
|
||||
script_return_t reply;
|
||||
|
||||
switch (function->type) {
|
||||
case SCRIPT_FUNCTION_TYPE_SCRIPT:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ static script_return_t image_new (script_state_t *state,
|
|||
asprintf (&path_filename, "%s/%s", data->image_dir, filename);
|
||||
}
|
||||
ply_image_t *file_image = ply_image_new (path_filename);
|
||||
|
||||
if (ply_image_load (file_image)) {
|
||||
ply_pixel_buffer_t *buffer = ply_image_convert_to_pixel_buffer (file_image);
|
||||
reply = script_obj_new_native (buffer, data->class);
|
||||
|
|
@ -166,7 +167,7 @@ static script_return_t image_scale (script_state_t *state,
|
|||
}
|
||||
|
||||
static script_return_t image_tile (script_state_t *state,
|
||||
void *user_data)
|
||||
void *user_data)
|
||||
{
|
||||
script_lib_image_data_t *data = user_data;
|
||||
ply_pixel_buffer_t *image = script_obj_as_native_of_class (state->this, data->class);
|
||||
|
|
@ -331,6 +332,7 @@ script_lib_image_data_t *script_lib_image_setup (script_state_t *state,
|
|||
script_obj_unref (image_hash);
|
||||
data->script_main_op = script_parse_string (script_lib_image_string, "script-lib-image.script");
|
||||
script_return_t ret = script_execute (state, data->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object);
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ script_lib_math_data_t *script_lib_math_setup (script_state_t *state)
|
|||
srand ((int) ply_get_timestamp ());
|
||||
|
||||
script_obj_t *math_hash = script_obj_hash_get_element (state->global, "Math");
|
||||
|
||||
script_add_native_function (math_hash,
|
||||
"Cos",
|
||||
script_lib_math_double_from_double_function,
|
||||
|
|
@ -118,6 +119,7 @@ script_lib_math_data_t *script_lib_math_setup (script_state_t *state)
|
|||
|
||||
data->script_main_op = script_parse_string (script_lib_math_string, "script-lib-math.script");
|
||||
script_return_t ret = script_execute (state, data->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object);
|
||||
|
||||
return data;
|
||||
|
|
|
|||
|
|
@ -51,10 +51,11 @@ static script_return_t plymouth_set_function (script_state_t *state,
|
|||
static script_return_t plymouth_set_refresh_rate (script_state_t *state,
|
||||
void *user_data)
|
||||
{
|
||||
script_lib_plymouth_data_t *data = user_data;
|
||||
data->refresh_rate = script_obj_hash_get_number (state->local, "value");
|
||||
script_lib_plymouth_data_t *data = user_data;
|
||||
|
||||
return script_return_obj_null ();
|
||||
data->refresh_rate = script_obj_hash_get_number (state->local, "value");
|
||||
|
||||
return script_return_obj_null ();
|
||||
}
|
||||
|
||||
static script_return_t plymouth_get_mode (script_state_t *state,
|
||||
|
|
@ -92,7 +93,7 @@ static script_return_t plymouth_get_mode (script_state_t *state,
|
|||
|
||||
script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *state,
|
||||
ply_boot_splash_mode_t mode,
|
||||
int refresh_rate)
|
||||
int refresh_rate)
|
||||
{
|
||||
script_lib_plymouth_data_t *data = malloc (sizeof(script_lib_plymouth_data_t));
|
||||
|
||||
|
|
@ -114,6 +115,7 @@ script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *st
|
|||
data->refresh_rate = refresh_rate;
|
||||
|
||||
script_obj_t *plymouth_hash = script_obj_hash_get_element (state->global, "Plymouth");
|
||||
|
||||
script_add_native_function (plymouth_hash,
|
||||
"SetRefreshFunction",
|
||||
plymouth_set_function,
|
||||
|
|
@ -213,6 +215,7 @@ script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *st
|
|||
|
||||
data->script_main_op = script_parse_string (script_lib_plymouth_string, "script-lib-plymouth.script");
|
||||
script_return_t ret = script_execute (state, data->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object); /* Throw anything sent back away */
|
||||
|
||||
return data;
|
||||
|
|
@ -439,7 +442,7 @@ void script_lib_plymouth_on_hide_message (script_state_t *state,
|
|||
|
||||
void script_lib_plymouth_on_system_update (script_state_t *state,
|
||||
script_lib_plymouth_data_t *data,
|
||||
int progress)
|
||||
int progress)
|
||||
{
|
||||
script_obj_t *new_status_obj = script_obj_new_number (progress);
|
||||
script_return_t ret = script_execute_object (state,
|
||||
|
|
@ -447,6 +450,7 @@ void script_lib_plymouth_on_system_update (script_state_t *state,
|
|||
NULL,
|
||||
new_status_obj,
|
||||
NULL);
|
||||
|
||||
script_obj_unref (new_status_obj);
|
||||
script_obj_unref (ret.object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,14 +41,14 @@ typedef struct
|
|||
script_obj_t *script_display_message_func;
|
||||
script_obj_t *script_hide_message_func;
|
||||
script_obj_t *script_quit_func;
|
||||
script_obj_t *script_system_update_func;
|
||||
script_obj_t *script_system_update_func;
|
||||
ply_boot_splash_mode_t mode;
|
||||
int refresh_rate;
|
||||
} script_lib_plymouth_data_t;
|
||||
|
||||
script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *state,
|
||||
ply_boot_splash_mode_t mode,
|
||||
int refresh_rate);
|
||||
int refresh_rate);
|
||||
void script_lib_plymouth_destroy (script_lib_plymouth_data_t *data);
|
||||
|
||||
void script_lib_plymouth_on_refresh (script_state_t *state,
|
||||
|
|
@ -94,7 +94,7 @@ void script_lib_plymouth_on_quit (script_state_t *state,
|
|||
script_lib_plymouth_data_t *data);
|
||||
void script_lib_plymouth_on_system_update (script_state_t *state,
|
||||
script_lib_plymouth_data_t *data,
|
||||
int progress);
|
||||
int progress);
|
||||
|
||||
|
||||
#endif /* SCRIPT_LIB_PLYMOUTH_H */
|
||||
|
|
|
|||
|
|
@ -416,8 +416,8 @@ static script_return_t sprite_window_set_background_bottom_color (script_state_t
|
|||
return script_return_obj_null ();
|
||||
}
|
||||
|
||||
static void script_lib_draw_brackground (ply_pixel_buffer_t *pixel_buffer,
|
||||
ply_rectangle_t *clip_area,
|
||||
static void script_lib_draw_brackground (ply_pixel_buffer_t *pixel_buffer,
|
||||
ply_rectangle_t *clip_area,
|
||||
script_lib_sprite_data_t *data)
|
||||
{
|
||||
if (data->background_color_start == data->background_color_end) {
|
||||
|
|
@ -455,15 +455,15 @@ static void script_lib_sprite_draw_area (script_lib_display_t *display,
|
|||
|
||||
/* Check If the first sprite should be rendered opaque */
|
||||
if (sprite->image && !sprite->remove_me &&
|
||||
ply_pixel_buffer_is_opaque (sprite->image) && sprite->opacity == 1.0) {
|
||||
ply_pixel_buffer_is_opaque (sprite->image) && sprite->opacity == 1.0) {
|
||||
int position_x = sprite->x - display->x;
|
||||
int position_y = sprite->y - display->y;
|
||||
|
||||
/* In that case only draw the background if the sprite doesn't
|
||||
* cover the complete area */
|
||||
if (position_x > x || position_y > y ||
|
||||
((int)ply_pixel_buffer_get_width (sprite->image) + position_x) < (x + width) ||
|
||||
((int)ply_pixel_buffer_get_height (sprite->image) + position_y) < (y + height))
|
||||
((int) ply_pixel_buffer_get_width (sprite->image) + position_x) < (x + width) ||
|
||||
((int) ply_pixel_buffer_get_height (sprite->image) + position_y) < (y + height))
|
||||
script_lib_draw_brackground (pixel_buffer, &clip_area, data);
|
||||
} else {
|
||||
script_lib_draw_brackground (pixel_buffer, &clip_area, data);
|
||||
|
|
@ -560,6 +560,7 @@ script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
|
|||
}
|
||||
|
||||
script_obj_t *sprite_hash = script_obj_hash_get_element (state->global, "Sprite");
|
||||
|
||||
script_add_native_function (sprite_hash,
|
||||
"_New",
|
||||
sprite_new,
|
||||
|
|
@ -624,6 +625,7 @@ script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
|
|||
|
||||
|
||||
script_obj_t *window_hash = script_obj_hash_get_element (state->global, "Window");
|
||||
|
||||
script_add_native_function (window_hash,
|
||||
"GetWidth",
|
||||
sprite_window_get_width,
|
||||
|
|
@ -685,12 +687,14 @@ script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
|
|||
data->background_color_end = 0x000000;
|
||||
data->full_refresh = true;
|
||||
script_return_t ret = script_execute (state, data->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object);
|
||||
return data;
|
||||
}
|
||||
|
||||
static int
|
||||
sprite_compare_z (void *data_a, void *data_b)
|
||||
sprite_compare_z (void *data_a,
|
||||
void *data_b)
|
||||
{
|
||||
sprite_t *sprite_a = data_a;
|
||||
sprite_t *sprite_b = data_b;
|
||||
|
|
@ -714,27 +718,26 @@ region_add_area (ply_region_t *region,
|
|||
ply_region_add_rectangle (region, &rectangle);
|
||||
}
|
||||
|
||||
void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data, ply_pixel_display_t *pixel_display)
|
||||
void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data,
|
||||
ply_pixel_display_t *pixel_display)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
ply_list_node_t *next_node;
|
||||
script_lib_display_t* display;
|
||||
ply_list_node_t *node;
|
||||
ply_list_node_t *next_node;
|
||||
script_lib_display_t *display;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
node = ply_list_get_first_node (data->displays);
|
||||
while (node)
|
||||
{
|
||||
next_node = ply_list_get_next_node (data->displays, node);
|
||||
display = ply_list_node_get_data (node);
|
||||
node = ply_list_get_first_node (data->displays);
|
||||
while (node) {
|
||||
next_node = ply_list_get_next_node (data->displays, node);
|
||||
display = ply_list_node_get_data (node);
|
||||
|
||||
if (display->pixel_display == pixel_display)
|
||||
{
|
||||
ply_list_remove_node (data->displays, node);
|
||||
if (display->pixel_display == pixel_display) {
|
||||
ply_list_remove_node (data->displays, node);
|
||||
}
|
||||
node = next_node;
|
||||
}
|
||||
node = next_node;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -745,7 +748,7 @@ script_lib_sprite_refresh (script_lib_sprite_data_t *data)
|
|||
ply_list_t *rectable_list;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
return;
|
||||
|
||||
region = ply_region_new ();
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ typedef struct
|
|||
|
||||
script_lib_sprite_data_t *script_lib_sprite_setup (script_state_t *state,
|
||||
ply_list_t *displays);
|
||||
void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data, ply_pixel_display_t *pixel_display);
|
||||
void script_lib_sprite_pixel_display_removed (script_lib_sprite_data_t *data,
|
||||
ply_pixel_display_t *pixel_display);
|
||||
void script_lib_sprite_refresh (script_lib_sprite_data_t *data);
|
||||
void script_lib_sprite_destroy (script_lib_sprite_data_t *data);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static script_return_t script_lib_string_char_at (script_state_t *state,
|
|||
char *text = script_obj_as_string (state->this);
|
||||
int index = script_obj_hash_get_number (state->local, "index");
|
||||
int count;
|
||||
char charstring [2];
|
||||
char charstring[2];
|
||||
|
||||
if (!text || index < 0) {
|
||||
free (text);
|
||||
|
|
@ -93,7 +93,8 @@ static script_return_t script_lib_string_length (script_state_t *state,
|
|||
void *user_data)
|
||||
{
|
||||
char *text = script_obj_as_string (state->this);
|
||||
size_t text_length = strlen(text);
|
||||
size_t text_length = strlen (text);
|
||||
|
||||
free (text);
|
||||
return script_return_obj (script_obj_new_number (text_length));
|
||||
}
|
||||
|
|
@ -125,6 +126,7 @@ script_lib_string_data_t *script_lib_string_setup (script_state_t *state)
|
|||
script_obj_unref (string_hash);
|
||||
data->script_main_op = script_parse_string (script_lib_string_string, "script-lib-string.script");
|
||||
script_return_t ret = script_execute (state, data->script_main_op);
|
||||
|
||||
script_obj_unref (ret.object);
|
||||
|
||||
return data;
|
||||
|
|
|
|||
|
|
@ -208,7 +208,8 @@ script_obj_t *script_obj_new_ref (script_obj_t *sub_obj)
|
|||
return obj;
|
||||
}
|
||||
|
||||
script_obj_t *script_obj_new_extend (script_obj_t *obj_a, script_obj_t *obj_b)
|
||||
script_obj_t *script_obj_new_extend (script_obj_t *obj_a,
|
||||
script_obj_t *obj_b)
|
||||
{
|
||||
script_obj_t *obj = malloc (sizeof(script_obj_t));
|
||||
|
||||
|
|
@ -439,11 +440,13 @@ script_obj_t *script_obj_hash_get_element (script_obj_t *hash,
|
|||
|
||||
if (obj) return obj;
|
||||
script_obj_t *realhash = script_obj_as_obj_type (hash, SCRIPT_OBJ_TYPE_HASH);
|
||||
|
||||
if (!realhash) {
|
||||
realhash = script_obj_new_hash (); /* If it wasn't a hash then make it into one */
|
||||
script_obj_assign (hash, realhash);
|
||||
}
|
||||
script_variable_t *variable = malloc (sizeof(script_variable_t));
|
||||
|
||||
variable->name = strdup (name);
|
||||
variable->object = script_obj_new_null ();
|
||||
ply_hashtable_insert (realhash->data.hash, variable->name, variable);
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@
|
|||
typedef enum
|
||||
{
|
||||
SCRIPT_OBJ_CMP_RESULT_EQ = 1 << 1,
|
||||
SCRIPT_OBJ_CMP_RESULT_GT = 1 << 2,
|
||||
SCRIPT_OBJ_CMP_RESULT_LT = 1 << 3,
|
||||
SCRIPT_OBJ_CMP_RESULT_NE = 1 << 4,
|
||||
SCRIPT_OBJ_CMP_RESULT_GT = 1 << 2,
|
||||
SCRIPT_OBJ_CMP_RESULT_LT = 1 << 3,
|
||||
SCRIPT_OBJ_CMP_RESULT_NE = 1 << 4,
|
||||
} script_obj_cmp_result_t;
|
||||
|
||||
|
||||
typedef void *(*script_obj_direct_func_t)(script_obj_t *,
|
||||
void *);
|
||||
void *);
|
||||
|
||||
|
||||
void script_obj_free (script_obj_t *obj);
|
||||
|
|
|
|||
|
|
@ -461,7 +461,9 @@ static script_exp_t *script_parse_exp_pi (script_scan_t *scan)
|
|||
return NULL;
|
||||
}
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
} else { break; }
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
exp = script_parse_new_exp_dual (SCRIPT_EXP_TYPE_HASH, exp, key, &location);
|
||||
}
|
||||
return exp;
|
||||
|
|
@ -483,6 +485,7 @@ static script_exp_t *script_parse_exp_pr (script_scan_t *scan)
|
|||
entry = script_parse_operator_table_entry_lookup (scan, operator_table);
|
||||
if (entry->presedence < 0) return script_parse_exp_pi (scan);
|
||||
script_debug_location_t location = script_scan_get_current_token (scan)->location;
|
||||
|
||||
script_parse_advance_scan_by_string (scan, entry->symbol);
|
||||
return script_parse_new_exp_single (entry->exp_type, script_parse_exp_pr (scan), &location);
|
||||
}
|
||||
|
|
@ -507,7 +510,8 @@ static script_exp_t *script_parse_exp_po (script_scan_t *scan)
|
|||
return exp;
|
||||
}
|
||||
|
||||
static script_exp_t *script_parse_exp_ltr (script_scan_t *scan, int presedence)
|
||||
static script_exp_t *script_parse_exp_ltr (script_scan_t *scan,
|
||||
int presedence)
|
||||
{
|
||||
static const script_parse_operator_table_entry_t operator_table[] =
|
||||
{
|
||||
|
|
@ -536,6 +540,7 @@ static script_exp_t *script_parse_exp_ltr (script_scan_t *scan, int presedence)
|
|||
|
||||
if (presedence > 6) return script_parse_exp_po (scan);
|
||||
script_exp_t *exp = script_parse_exp_ltr (scan, presedence + 1);
|
||||
|
||||
if (!exp) return NULL;
|
||||
|
||||
while (true) {
|
||||
|
|
@ -572,11 +577,14 @@ static script_exp_t *script_parse_exp_as (script_scan_t *scan)
|
|||
if (!lhs) return NULL;
|
||||
|
||||
const script_parse_operator_table_entry_t *entry;
|
||||
|
||||
entry = script_parse_operator_table_entry_lookup (scan, operator_table);
|
||||
if (entry->presedence < 0) return lhs;
|
||||
script_debug_location_t location = script_scan_get_current_token (scan)->location;
|
||||
|
||||
script_parse_advance_scan_by_string (scan, entry->symbol);
|
||||
script_exp_t *rhs = script_parse_exp_as (scan);
|
||||
|
||||
if (!rhs) {
|
||||
script_parse_error (&script_scan_get_current_token (scan)->location,
|
||||
"An invalid RHS of an assign");
|
||||
|
|
@ -610,6 +618,7 @@ static script_op_t *script_parse_op_block (script_scan_t *scan)
|
|||
curtoken = script_scan_get_next_token (scan);
|
||||
|
||||
script_op_t *op = script_parse_new_op_block (sublist, &location);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
@ -625,6 +634,7 @@ static script_op_t *script_parse_if_while (script_scan_t *scan)
|
|||
else return NULL;
|
||||
|
||||
script_debug_location_t location = curtoken->location;
|
||||
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
if (!script_scan_token_is_symbol_of_value (curtoken, '(')) {
|
||||
script_parse_error (&curtoken->location,
|
||||
|
|
@ -634,6 +644,7 @@ static script_op_t *script_parse_if_while (script_scan_t *scan)
|
|||
curtoken = script_scan_get_next_token (scan);
|
||||
|
||||
script_exp_t *cond = script_parse_exp (scan);
|
||||
|
||||
curtoken = script_scan_get_current_token (scan);
|
||||
if (!cond) {
|
||||
script_parse_error (&curtoken->location, "Expected a valid condition expression");
|
||||
|
|
@ -655,6 +666,7 @@ static script_op_t *script_parse_if_while (script_scan_t *scan)
|
|||
else_op = script_parse_op (scan);
|
||||
}
|
||||
script_op_t *op = script_parse_new_op_cond (type, cond, cond_op, else_op, &location);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
@ -665,8 +677,10 @@ static script_op_t *script_parse_do_while (script_scan_t *scan)
|
|||
if (!script_scan_token_is_identifier_of_value (curtoken, "do"))
|
||||
return NULL;
|
||||
script_debug_location_t location = curtoken->location;
|
||||
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
script_op_t *cond_op = script_parse_op (scan);
|
||||
|
||||
curtoken = script_scan_get_current_token (scan);
|
||||
|
||||
if (!script_scan_token_is_identifier_of_value (curtoken, "while")) {
|
||||
|
|
@ -683,6 +697,7 @@ static script_op_t *script_parse_do_while (script_scan_t *scan)
|
|||
}
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
script_exp_t *cond = script_parse_exp (scan);
|
||||
|
||||
curtoken = script_scan_get_current_token (scan);
|
||||
if (!cond) {
|
||||
script_parse_error (&curtoken->location, "Expected a valid condition expression");
|
||||
|
|
@ -701,6 +716,7 @@ static script_op_t *script_parse_do_while (script_scan_t *scan)
|
|||
}
|
||||
script_scan_get_next_token (scan);
|
||||
script_op_t *op = script_parse_new_op_cond (SCRIPT_OP_TYPE_DO_WHILE, cond, cond_op, NULL, &location);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
@ -710,6 +726,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
|
|||
|
||||
if (!script_scan_token_is_identifier_of_value (curtoken, "for")) return NULL;
|
||||
script_debug_location_t location_for = curtoken->location;
|
||||
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
if (!script_scan_token_is_symbol_of_value (curtoken, '(')) {
|
||||
script_parse_error (&curtoken->location,
|
||||
|
|
@ -720,6 +737,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
|
|||
script_debug_location_t location_first = curtoken->location;
|
||||
|
||||
script_exp_t *first = script_parse_exp (scan);
|
||||
|
||||
if (!first) {
|
||||
script_parse_error (&curtoken->location, "Expected a valid first expression");
|
||||
return NULL;
|
||||
|
|
@ -733,6 +751,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
|
|||
script_scan_get_next_token (scan);
|
||||
|
||||
script_exp_t *cond = script_parse_exp (scan);
|
||||
|
||||
if (!cond) {
|
||||
script_parse_error (&curtoken->location, "Expected a valid condition expression");
|
||||
return NULL;
|
||||
|
|
@ -746,6 +765,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
|
|||
script_debug_location_t location_last = curtoken->location;
|
||||
|
||||
script_exp_t *last = script_parse_exp (scan);
|
||||
|
||||
if (!last) {
|
||||
script_parse_error (&curtoken->location, "Expected a valid last expression");
|
||||
return NULL;
|
||||
|
|
@ -763,6 +783,7 @@ static script_op_t *script_parse_for (script_scan_t *scan)
|
|||
script_op_t *op_for = script_parse_new_op_cond (SCRIPT_OP_TYPE_FOR, cond, op_body, op_last, &location_for);
|
||||
|
||||
ply_list_t *op_list = ply_list_new ();
|
||||
|
||||
ply_list_append_data (op_list, op_first);
|
||||
ply_list_append_data (op_list, op_for);
|
||||
|
||||
|
|
@ -777,6 +798,7 @@ static script_op_t *script_parse_function (script_scan_t *scan)
|
|||
|
||||
if (!script_scan_token_is_identifier_of_value (curtoken, "fun")) return NULL;
|
||||
script_debug_location_t location = curtoken->location;
|
||||
|
||||
curtoken = script_scan_get_next_token (scan);
|
||||
if (!script_scan_token_is_identifier (curtoken)) {
|
||||
script_parse_error (&curtoken->location,
|
||||
|
|
@ -788,11 +810,13 @@ static script_op_t *script_parse_function (script_scan_t *scan)
|
|||
curtoken = script_scan_get_next_token (scan); /* FIXME parse any type of exp as target and do an assign*/
|
||||
|
||||
script_function_t *function = script_parse_function_def (scan);
|
||||
|
||||
if (!function) return NULL;
|
||||
script_exp_t *func_exp = script_parse_new_exp_function_def (function, &location);
|
||||
script_exp_t *func_def = script_parse_new_exp_dual (SCRIPT_EXP_TYPE_ASSIGN, name, func_exp, &location);
|
||||
|
||||
script_op_t *op = script_parse_new_op_exp (func_def, &location);
|
||||
|
||||
return op;
|
||||
}
|
||||
|
||||
|
|
@ -813,6 +837,7 @@ static script_op_t *script_parse_return (script_scan_t *scan)
|
|||
curtoken = script_scan_get_next_token (scan);
|
||||
|
||||
script_op_t *op = script_parse_new_op (type, &curtoken->location);
|
||||
|
||||
if (type == SCRIPT_OP_TYPE_RETURN) {
|
||||
op->data.exp = script_parse_exp (scan); /* May be NULL */
|
||||
curtoken = script_scan_get_current_token (scan);
|
||||
|
|
@ -1043,6 +1068,7 @@ script_op_t *script_parse_file (const char *filename)
|
|||
return NULL;
|
||||
}
|
||||
script_op_t *op = script_parse_new_op_block (list, &location);
|
||||
|
||||
script_scan_free (scan);
|
||||
return op;
|
||||
}
|
||||
|
|
@ -1067,6 +1093,7 @@ script_op_t *script_parse_string (const char *string,
|
|||
return NULL;
|
||||
}
|
||||
script_op_t *op = script_parse_new_op_block (list, &location);
|
||||
|
||||
script_scan_free (scan);
|
||||
return op;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ script_scan_t *script_scan_file (const char *filename)
|
|||
|
||||
if (fd < 0) return NULL;
|
||||
script_scan_t *scan = script_scan_new ();
|
||||
|
||||
scan->name = strdup (filename);
|
||||
scan->source.fd = fd;
|
||||
scan->source_is_file = true;
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ void script_add_native_function (script_obj_t *hash,
|
|||
user_data,
|
||||
parameter_list);
|
||||
script_obj_t *obj = script_obj_new_function (function);
|
||||
|
||||
script_obj_hash_add_element (hash, obj, name);
|
||||
script_obj_unref (obj);
|
||||
}
|
||||
|
|
@ -127,7 +128,8 @@ script_state_t *script_state_new (void *user_data)
|
|||
return state;
|
||||
}
|
||||
|
||||
script_state_t *script_state_init_sub (script_state_t *oldstate, script_obj_t *this)
|
||||
script_state_t *script_state_init_sub (script_state_t *oldstate,
|
||||
script_obj_t *this)
|
||||
{
|
||||
script_state_t *newstate = malloc (sizeof(script_state_t));
|
||||
script_obj_t *local_hash = script_obj_new_hash ();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ typedef enum
|
|||
} script_function_type_t;
|
||||
|
||||
typedef script_return_t (*script_native_function_t)(script_state_t *,
|
||||
void *);
|
||||
void *);
|
||||
|
||||
typedef struct script_function_t
|
||||
{
|
||||
|
|
|
|||
|
|
@ -633,7 +633,8 @@ free_sprite (sprite_t *sprite)
|
|||
}
|
||||
|
||||
static int
|
||||
sprite_compare_z (void *data_a, void *data_b)
|
||||
sprite_compare_z (void *data_a,
|
||||
void *data_b)
|
||||
{
|
||||
sprite_t *sprite_a = data_a;
|
||||
sprite_t *sprite_b = data_b;
|
||||
|
|
@ -642,7 +643,9 @@ sprite_compare_z (void *data_a, void *data_b)
|
|||
}
|
||||
|
||||
static void
|
||||
stretch_image (ply_image_t *scaled_image, ply_image_t *orig_image, int width)
|
||||
stretch_image (ply_image_t *scaled_image,
|
||||
ply_image_t *orig_image,
|
||||
int width)
|
||||
{
|
||||
int x, y;
|
||||
int stretched_width = ply_image_get_width (scaled_image);
|
||||
|
|
@ -676,7 +679,9 @@ stretch_image (ply_image_t *scaled_image, ply_image_t *orig_image, int width)
|
|||
}
|
||||
|
||||
static void
|
||||
progress_update (view_t *view, sprite_t *sprite, double time)
|
||||
progress_update (view_t *view,
|
||||
sprite_t *sprite,
|
||||
double time)
|
||||
{
|
||||
progress_t *progress = sprite->data;
|
||||
ply_boot_splash_plugin_t *plugin = view->plugin;
|
||||
|
|
@ -691,7 +696,12 @@ progress_update (view_t *view, sprite_t *sprite, double time)
|
|||
|
||||
|
||||
static inline uint32_t
|
||||
star_bg_gradient_colour (int x, int y, int width, int height, bool star, float time)
|
||||
star_bg_gradient_colour (int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
bool star,
|
||||
float time)
|
||||
{
|
||||
int full_dist = sqrt (width * width + height * height);
|
||||
int my_dist = sqrt (x * x + y * y);
|
||||
|
|
@ -744,7 +754,9 @@ star_bg_gradient_colour (int x, int y, int width, int height, bool star, float t
|
|||
|
||||
|
||||
static void
|
||||
star_bg_update (view_t *view, sprite_t *sprite, double time)
|
||||
star_bg_update (view_t *view,
|
||||
sprite_t *sprite,
|
||||
double time)
|
||||
{
|
||||
star_bg_t *star_bg = sprite->data;
|
||||
int width = ply_image_get_width (sprite->image);
|
||||
|
|
@ -759,7 +771,7 @@ star_bg_update (view_t *view, sprite_t *sprite, double time)
|
|||
x = star_bg->star_x[i];
|
||||
y = star_bg->star_y[i];
|
||||
uint32_t pixel_colour = star_bg_gradient_colour (x, y, width, height, true, time);
|
||||
if (abs ((int)((image_data[x + y * width] >> 16) & 0xff) - (int)((pixel_colour >> 16) & 0xff)) > 8) {
|
||||
if (abs ((int) ((image_data[x + y * width] >> 16) & 0xff) - (int) ((pixel_colour >> 16) & 0xff)) > 8) {
|
||||
image_data[x + y * width] = pixel_colour;
|
||||
star_bg->star_refresh[i] = 1;
|
||||
}
|
||||
|
|
@ -770,7 +782,9 @@ star_bg_update (view_t *view, sprite_t *sprite, double time)
|
|||
}
|
||||
|
||||
static void
|
||||
satellite_move (view_t *view, sprite_t *sprite, double time)
|
||||
satellite_move (view_t *view,
|
||||
sprite_t *sprite,
|
||||
double time)
|
||||
{
|
||||
ply_boot_splash_plugin_t *plugin = view->plugin;
|
||||
satellite_t *satellite = sprite->data;
|
||||
|
|
@ -785,11 +799,13 @@ satellite_move (view_t *view, sprite_t *sprite, double time)
|
|||
|
||||
float distance = sqrt (sprite->z * sprite->z + sprite->y * sprite->y);
|
||||
float angle_zy = atan2 (sprite->y, sprite->z) - M_PI * 0.4;
|
||||
|
||||
sprite->z = distance * cos (angle_zy);
|
||||
sprite->y = distance * sin (angle_zy);
|
||||
|
||||
float angle_offset = atan2 (sprite->x, sprite->y);
|
||||
float cresent_angle = atan2 (sqrt (sprite->x * sprite->x + sprite->y * sprite->y), sprite->z);
|
||||
|
||||
screen_width = ply_pixel_display_get_width (view->display);
|
||||
screen_height = ply_pixel_display_get_height (view->display);
|
||||
|
||||
|
|
@ -896,7 +912,8 @@ sprite_list_sort (view_t *view)
|
|||
}
|
||||
|
||||
static void
|
||||
flare_reset (flare_t *flare, int index)
|
||||
flare_reset (flare_t *flare,
|
||||
int index)
|
||||
{
|
||||
flare->rotate_yz[index] = ((float) (rand () % 1000) / 1000) * 2 * M_PI;
|
||||
flare->rotate_xy[index] = ((float) (rand () % 1000) / 1000) * 2 * M_PI;
|
||||
|
|
@ -908,7 +925,8 @@ flare_reset (flare_t *flare, int index)
|
|||
}
|
||||
|
||||
static void
|
||||
flare_update (sprite_t *sprite, double time)
|
||||
flare_update (sprite_t *sprite,
|
||||
double time)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
|
|
@ -933,6 +951,7 @@ flare_update (sprite_t *sprite, double time)
|
|||
|
||||
|
||||
int b;
|
||||
|
||||
for (b = 0; b < FLARE_COUNT; b++) {
|
||||
int flare_line;
|
||||
flare->stretch[b] += (flare->stretch[b] * flare->increase_speed[b]) * (1 - (1 / (3.01 - flare->stretch[b])));
|
||||
|
|
@ -1025,7 +1044,9 @@ flare_update (sprite_t *sprite, double time)
|
|||
}
|
||||
|
||||
static void
|
||||
sprite_move (view_t *view, sprite_t *sprite, double time)
|
||||
sprite_move (view_t *view,
|
||||
sprite_t *sprite,
|
||||
double time)
|
||||
{
|
||||
sprite->oldx = sprite->x;
|
||||
sprite->oldy = sprite->y;
|
||||
|
|
@ -1049,7 +1070,8 @@ sprite_move (view_t *view, sprite_t *sprite, double time)
|
|||
}
|
||||
|
||||
static void
|
||||
view_animate_attime (view_t *view, double time)
|
||||
view_animate_attime (view_t *view,
|
||||
double time)
|
||||
{
|
||||
ply_list_node_t *node;
|
||||
ply_boot_splash_plugin_t *plugin;
|
||||
|
|
|
|||
|
|
@ -117,14 +117,14 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
bool suppress_messages;
|
||||
bool progress_bar_show_percent_complete;
|
||||
bool use_progress_bar;
|
||||
bool use_animation;
|
||||
bool use_end_animation;
|
||||
bool use_firmware_background;
|
||||
char *title;
|
||||
char *subtitle;
|
||||
bool suppress_messages;
|
||||
bool progress_bar_show_percent_complete;
|
||||
bool use_progress_bar;
|
||||
bool use_animation;
|
||||
bool use_end_animation;
|
||||
bool use_firmware_background;
|
||||
char *title;
|
||||
char *subtitle;
|
||||
} mode_settings_t;
|
||||
|
||||
struct _ply_boot_splash_plugin
|
||||
|
|
@ -197,7 +197,8 @@ static void display_message (ply_boot_splash_plugin_t *plugin,
|
|||
const char *message);
|
||||
static void become_idle (ply_boot_splash_plugin_t *plugin,
|
||||
ply_trigger_t *idle_trigger);
|
||||
static void view_show_message (view_t *view, const char *message);
|
||||
static void view_show_message (view_t *view,
|
||||
const char *message);
|
||||
|
||||
static view_t *
|
||||
view_new (ply_boot_splash_plugin_t *plugin,
|
||||
|
|
@ -323,25 +324,26 @@ view_load_end_animation (view_t *view)
|
|||
}
|
||||
|
||||
static bool
|
||||
get_bgrt_sysfs_info(int *x_offset, int *y_offset,
|
||||
ply_pixel_buffer_rotation_t *rotation)
|
||||
get_bgrt_sysfs_info (int *x_offset,
|
||||
int *y_offset,
|
||||
ply_pixel_buffer_rotation_t *rotation)
|
||||
{
|
||||
bool ret = false;
|
||||
char buf[64];
|
||||
int status;
|
||||
FILE *f;
|
||||
|
||||
f = fopen("/sys/firmware/acpi/bgrt/status", "r");
|
||||
f = fopen ("/sys/firmware/acpi/bgrt/status", "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
if (!fgets(buf, sizeof(buf), f))
|
||||
if (!fgets (buf, sizeof(buf), f))
|
||||
goto out;
|
||||
|
||||
if (sscanf(buf, "%d", &status) != 1)
|
||||
if (sscanf (buf, "%d", &status) != 1)
|
||||
goto out;
|
||||
|
||||
fclose(f);
|
||||
fclose (f);
|
||||
|
||||
switch (status & BGRT_STATUS_ORIENTATION_OFFSET_MASK) {
|
||||
case BGRT_STATUS_ORIENTATION_OFFSET_0:
|
||||
|
|
@ -358,31 +360,31 @@ get_bgrt_sysfs_info(int *x_offset, int *y_offset,
|
|||
break;
|
||||
}
|
||||
|
||||
f = fopen("/sys/firmware/acpi/bgrt/xoffset", "r");
|
||||
f = fopen ("/sys/firmware/acpi/bgrt/xoffset", "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
if (!fgets(buf, sizeof(buf), f))
|
||||
if (!fgets (buf, sizeof(buf), f))
|
||||
goto out;
|
||||
|
||||
if (sscanf(buf, "%d", x_offset) != 1)
|
||||
if (sscanf (buf, "%d", x_offset) != 1)
|
||||
goto out;
|
||||
|
||||
fclose(f);
|
||||
fclose (f);
|
||||
|
||||
f = fopen("/sys/firmware/acpi/bgrt/yoffset", "r");
|
||||
f = fopen ("/sys/firmware/acpi/bgrt/yoffset", "r");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
if (!fgets(buf, sizeof(buf), f))
|
||||
if (!fgets (buf, sizeof(buf), f))
|
||||
goto out;
|
||||
|
||||
if (sscanf(buf, "%d", y_offset) != 1)
|
||||
if (sscanf (buf, "%d", y_offset) != 1)
|
||||
goto out;
|
||||
|
||||
ret = true;
|
||||
out:
|
||||
fclose(f);
|
||||
fclose (f);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -411,8 +413,8 @@ view_set_bgrt_background (view_t *view)
|
|||
if (!view->plugin->background_bgrt_image)
|
||||
return;
|
||||
|
||||
if (!get_bgrt_sysfs_info(&sysfs_x_offset, &sysfs_y_offset,
|
||||
&bgrt_rotation)) {
|
||||
if (!get_bgrt_sysfs_info (&sysfs_x_offset, &sysfs_y_offset,
|
||||
&bgrt_rotation)) {
|
||||
ply_trace ("get bgrt sysfs info failed");
|
||||
return;
|
||||
}
|
||||
|
|
@ -440,7 +442,7 @@ view_set_bgrt_background (view_t *view)
|
|||
if (have_panel_props &&
|
||||
(panel_rotation == PLY_PIXEL_BUFFER_ROTATE_CLOCKWISE ||
|
||||
panel_rotation == PLY_PIXEL_BUFFER_ROTATE_COUNTER_CLOCKWISE) &&
|
||||
(panel_width - view->plugin->background_bgrt_raw_width) / 2 != sysfs_x_offset &&
|
||||
(panel_width - view->plugin->background_bgrt_raw_width) / 2 != sysfs_x_offset &&
|
||||
(panel_height - view->plugin->background_bgrt_raw_width) / 2 == sysfs_x_offset)
|
||||
bgrt_rotation = panel_rotation;
|
||||
|
||||
|
|
@ -458,7 +460,7 @@ view_set_bgrt_background (view_t *view)
|
|||
*/
|
||||
if (bgrt_rotation != PLY_PIXEL_BUFFER_ROTATE_UPRIGHT) {
|
||||
if (bgrt_rotation != panel_rotation) {
|
||||
ply_trace ("bgrt orientation mismatch, bgrt_rot %d panel_rot %d", (int)bgrt_rotation, (int)panel_rotation);
|
||||
ply_trace ("bgrt orientation mismatch, bgrt_rot %d panel_rot %d", (int) bgrt_rotation, (int) panel_rotation);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -543,7 +545,7 @@ view_set_bgrt_background (view_t *view)
|
|||
* yoffset perfectly center the image and in that case we use them.
|
||||
*/
|
||||
if (!have_panel_props && screen_scale == 1 &&
|
||||
(screen_width - width ) / 2 == sysfs_x_offset &&
|
||||
(screen_width - width) / 2 == sysfs_x_offset &&
|
||||
(screen_height - height) / 2 == sysfs_y_offset) {
|
||||
x_offset = sysfs_x_offset;
|
||||
y_offset = sysfs_y_offset;
|
||||
|
|
@ -599,9 +601,9 @@ view_load (view_t *view)
|
|||
screen_width = ply_pixel_display_get_width (view->display);
|
||||
screen_height = ply_pixel_display_get_height (view->display);
|
||||
|
||||
buffer = ply_renderer_get_buffer_for_head(
|
||||
ply_pixel_display_get_renderer (view->display),
|
||||
ply_pixel_display_get_renderer_head (view->display));
|
||||
buffer = ply_renderer_get_buffer_for_head (
|
||||
ply_pixel_display_get_renderer (view->display),
|
||||
ply_pixel_display_get_renderer_head (view->display));
|
||||
screen_scale = ply_pixel_buffer_get_device_scale (buffer);
|
||||
|
||||
view_set_bgrt_background (view);
|
||||
|
|
@ -673,7 +675,7 @@ view_load (view_t *view)
|
|||
|
||||
if (plugin->mode_settings[plugin->mode].title) {
|
||||
ply_label_set_text (view->title_label,
|
||||
_(plugin->mode_settings[plugin->mode].title));
|
||||
_ (plugin->mode_settings[plugin->mode].title));
|
||||
title_height = ply_label_get_height (view->title_label);
|
||||
} else {
|
||||
ply_label_hide (view->title_label);
|
||||
|
|
@ -681,7 +683,7 @@ view_load (view_t *view)
|
|||
|
||||
if (plugin->mode_settings[plugin->mode].subtitle) {
|
||||
ply_label_set_text (view->subtitle_label,
|
||||
_(plugin->mode_settings[plugin->mode].subtitle));
|
||||
_ (plugin->mode_settings[plugin->mode].subtitle));
|
||||
subtitle_height = ply_label_get_height (view->subtitle_label);
|
||||
} else {
|
||||
ply_label_hide (view->subtitle_label);
|
||||
|
|
@ -927,18 +929,18 @@ view_show_prompt (view_t *view,
|
|||
view->dialog_area = view->box_area;
|
||||
} else {
|
||||
view->dialog_area.width = view->lock_area.width + entry_width;
|
||||
view->dialog_area.height = MAX(view->lock_area.height, entry_height);
|
||||
view->dialog_area.height = MAX (view->lock_area.height, entry_height);
|
||||
view->dialog_area.x = (screen_width - view->dialog_area.width) * plugin->dialog_horizontal_alignment;
|
||||
view->dialog_area.y = (screen_height - view->dialog_area.height) * plugin->dialog_vertical_alignment;
|
||||
}
|
||||
|
||||
view->lock_area.x =
|
||||
view->dialog_area.x +
|
||||
(view->dialog_area.width -
|
||||
(view->lock_area.width + entry_width)) / 2.0;
|
||||
view->dialog_area.x +
|
||||
(view->dialog_area.width -
|
||||
(view->lock_area.width + entry_width)) / 2.0;
|
||||
view->lock_area.y =
|
||||
view->dialog_area.y +
|
||||
(view->dialog_area.height - view->lock_area.height) / 2.0;
|
||||
view->dialog_area.y +
|
||||
(view->dialog_area.height - view->lock_area.height) / 2.0;
|
||||
|
||||
x = view->lock_area.x + view->lock_area.width;
|
||||
y = view->dialog_area.y +
|
||||
|
|
@ -976,7 +978,7 @@ view_show_prompt (view_t *view,
|
|||
if (show_keyboard_indicators) {
|
||||
keyboard_indicator_width =
|
||||
ply_keymap_icon_get_width (view->keymap_icon);
|
||||
keyboard_indicator_height = MAX(
|
||||
keyboard_indicator_height = MAX (
|
||||
ply_capslock_icon_get_height (view->capslock_icon),
|
||||
ply_keymap_icon_get_height (view->keymap_icon));
|
||||
|
||||
|
|
@ -1775,7 +1777,7 @@ update_progress_animation (ply_boot_splash_plugin_t *plugin,
|
|||
ply_progress_bar_set_fraction_done (view->progress_bar, fraction_done);
|
||||
if (!ply_progress_bar_is_hidden (view->progress_bar) &&
|
||||
plugin->mode_settings[plugin->mode].progress_bar_show_percent_complete) {
|
||||
snprintf (buf, sizeof(buf), _("%d%% complete"), (int)(fraction_done * 100));
|
||||
snprintf (buf, sizeof(buf), _ ("%d%% complete"), (int) (fraction_done * 100));
|
||||
view_show_message (view, buf);
|
||||
}
|
||||
|
||||
|
|
@ -1923,7 +1925,7 @@ hide_prompt (ply_boot_splash_plugin_t *plugin)
|
|||
|
||||
static void
|
||||
view_show_message (view_t *view,
|
||||
const char *message)
|
||||
const char *message)
|
||||
{
|
||||
ply_boot_splash_plugin_t *plugin = view->plugin;
|
||||
int x, y, width, height;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
#include <unistd.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
signal (SIGTERM, SIG_IGN);
|
||||
|
||||
|
|
@ -12,7 +13,8 @@ main(int argc, char **argv)
|
|||
*/
|
||||
argv[0][0] = '@';
|
||||
|
||||
while (pause());
|
||||
while (pause ()) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,7 +281,8 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
remove_instance_internal (ply_upstart_monitor_job_t *job, const char *path)
|
||||
remove_instance_internal (ply_upstart_monitor_job_t *job,
|
||||
const char *path)
|
||||
{
|
||||
ply_upstart_monitor_instance_t *instance;
|
||||
ply_list_node_t *node;
|
||||
|
|
@ -408,7 +409,9 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
free_job_instance (void *key, void *data, void *user_data)
|
||||
free_job_instance (void *key,
|
||||
void *data,
|
||||
void *user_data)
|
||||
{
|
||||
const char *path = key;
|
||||
ply_upstart_monitor_instance_t *instance = data;
|
||||
|
|
@ -427,7 +430,8 @@ free_job_instance (void *key, void *data, void *user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
remove_job_internal (ply_upstart_monitor_t *monitor, const char *path)
|
||||
remove_job_internal (ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
ply_upstart_monitor_job_t *job;
|
||||
ply_list_node_t *node;
|
||||
|
|
@ -457,7 +461,8 @@ remove_job_internal (ply_upstart_monitor_t *monitor, const char *path)
|
|||
}
|
||||
|
||||
static void
|
||||
add_job (ply_upstart_monitor_t *monitor, const char *path)
|
||||
add_job (ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
ply_upstart_monitor_job_t *job;
|
||||
DBusMessage *message;
|
||||
|
|
@ -515,7 +520,8 @@ add_job (ply_upstart_monitor_t *monitor, const char *path)
|
|||
}
|
||||
|
||||
static void
|
||||
remove_job (ply_upstart_monitor_t *monitor, const char *path)
|
||||
remove_job (ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
ply_trace ("removing job: %s", path);
|
||||
|
||||
|
|
@ -597,8 +603,10 @@ job_removed_handler (DBusConnection *connection,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
instance_added_handler (DBusConnection *connection, DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor, const char *path)
|
||||
instance_added_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
DBusError error;
|
||||
const char *signal_path;
|
||||
|
|
@ -618,8 +626,10 @@ instance_added_handler (DBusConnection *connection, DBusMessage *message,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
instance_removed_handler (DBusConnection *connection, DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor, const char *path)
|
||||
instance_removed_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
DBusError error;
|
||||
const char *signal_path;
|
||||
|
|
@ -639,8 +649,10 @@ instance_removed_handler (DBusConnection *connection, DBusMessage *message,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
goal_changed_handler (DBusConnection *connection, DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor, const char *path)
|
||||
goal_changed_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
DBusError error;
|
||||
const char *goal;
|
||||
|
|
@ -665,8 +677,10 @@ goal_changed_handler (DBusConnection *connection, DBusMessage *message,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
state_changed_handler (DBusConnection *connection, DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor, const char *path)
|
||||
state_changed_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
DBusError error;
|
||||
const char *state;
|
||||
|
|
@ -706,8 +720,10 @@ state_changed_handler (DBusConnection *connection, DBusMessage *message,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
failed_handler (DBusConnection *connection, DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor, const char *path)
|
||||
failed_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
ply_upstart_monitor_t *monitor,
|
||||
const char *path)
|
||||
{
|
||||
DBusError error;
|
||||
ply_upstart_monitor_instance_t *instance;
|
||||
|
|
@ -738,7 +754,9 @@ failed_handler (DBusConnection *connection, DBusMessage *message,
|
|||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
message_handler (DBusConnection *connection, DBusMessage *message, void *data)
|
||||
message_handler (DBusConnection *connection,
|
||||
DBusMessage *message,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
const char *path;
|
||||
|
|
@ -857,7 +875,8 @@ ply_upstart_monitor_free (ply_upstart_monitor_t *monitor)
|
|||
}
|
||||
|
||||
static void
|
||||
read_watch_handler (void *data, int fd)
|
||||
read_watch_handler (void *data,
|
||||
int fd)
|
||||
{
|
||||
DBusWatch *watch = data;
|
||||
|
||||
|
|
@ -867,7 +886,8 @@ read_watch_handler (void *data, int fd)
|
|||
}
|
||||
|
||||
static void
|
||||
write_watch_handler (void *data, int fd)
|
||||
write_watch_handler (void *data,
|
||||
int fd)
|
||||
{
|
||||
DBusWatch *watch = data;
|
||||
|
||||
|
|
@ -877,7 +897,8 @@ write_watch_handler (void *data, int fd)
|
|||
}
|
||||
|
||||
static dbus_bool_t
|
||||
add_watch (DBusWatch *watch, void *data)
|
||||
add_watch (DBusWatch *watch,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
unsigned int flags;
|
||||
|
|
@ -923,7 +944,8 @@ add_watch (DBusWatch *watch, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
remove_watch (DBusWatch *watch, void *data)
|
||||
remove_watch (DBusWatch *watch,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
ply_fd_watch_t *watch_event;
|
||||
|
|
@ -941,7 +963,8 @@ remove_watch (DBusWatch *watch, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
toggled_watch (DBusWatch *watch, void *data)
|
||||
toggled_watch (DBusWatch *watch,
|
||||
void *data)
|
||||
{
|
||||
if (dbus_watch_get_enabled (watch))
|
||||
add_watch (watch, data);
|
||||
|
|
@ -950,7 +973,8 @@ toggled_watch (DBusWatch *watch, void *data)
|
|||
}
|
||||
|
||||
static ply_upstart_monitor_timeout_t *
|
||||
timeout_user_data_new (ply_upstart_monitor_t *monitor, DBusTimeout *timeout)
|
||||
timeout_user_data_new (ply_upstart_monitor_t *monitor,
|
||||
DBusTimeout *timeout)
|
||||
{
|
||||
ply_upstart_monitor_timeout_t *monitor_timeout;
|
||||
|
||||
|
|
@ -970,7 +994,8 @@ timeout_user_data_free (void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
timeout_handler (void *data, ply_event_loop_t *loop)
|
||||
timeout_handler (void *data,
|
||||
ply_event_loop_t *loop)
|
||||
{
|
||||
ply_upstart_monitor_timeout_t *monitor_timeout = data;
|
||||
|
||||
|
|
@ -980,7 +1005,8 @@ timeout_handler (void *data, ply_event_loop_t *loop)
|
|||
}
|
||||
|
||||
static dbus_bool_t
|
||||
add_timeout (DBusTimeout *timeout, void *data)
|
||||
add_timeout (DBusTimeout *timeout,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
int interval;
|
||||
|
|
@ -1005,7 +1031,8 @@ add_timeout (DBusTimeout *timeout, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
remove_timeout (DBusTimeout *timeout, void *data)
|
||||
remove_timeout (DBusTimeout *timeout,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
ply_upstart_monitor_timeout_t *monitor_timeout;
|
||||
|
|
@ -1024,7 +1051,8 @@ remove_timeout (DBusTimeout *timeout, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
toggled_timeout (DBusTimeout *timeout, void *data)
|
||||
toggled_timeout (DBusTimeout *timeout,
|
||||
void *data)
|
||||
{
|
||||
if (dbus_timeout_get_enabled (timeout))
|
||||
add_timeout (timeout, data);
|
||||
|
|
@ -1033,8 +1061,9 @@ toggled_timeout (DBusTimeout *timeout, void *data)
|
|||
}
|
||||
|
||||
static void
|
||||
dispatch_status (DBusConnection *connection, DBusDispatchStatus new_status,
|
||||
void *data)
|
||||
dispatch_status (DBusConnection *connection,
|
||||
DBusDispatchStatus new_status,
|
||||
void *data)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
uint64_t event_payload;
|
||||
|
|
@ -1050,7 +1079,8 @@ dispatch_status (DBusConnection *connection, DBusDispatchStatus new_status,
|
|||
}
|
||||
|
||||
static void
|
||||
dispatch (void *data, int fd)
|
||||
dispatch (void *data,
|
||||
int fd)
|
||||
{
|
||||
ply_upstart_monitor_t *monitor = data;
|
||||
uint64_t event_payload;
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ main (int argc,
|
|||
|
||||
/* Don't bail on dummy/hardcopy terminals */
|
||||
int errret = 0;
|
||||
|
||||
setupterm (NULL, STDOUT_FILENO, &errret);
|
||||
|
||||
is_connected = ply_boot_client_connect (state.client,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue