#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <time.h>
#include <pthread.h>
#include <rfb/rfb.h>
#include "scale.h"
#include "timeutil.h"
#include "execsh.h"
#include "lang.h"
#include "display.h"
#include "cover.h"
#include "vnc.h"
#include "img.h"
#include "keys.h"
#include "xmlint.h"
#include "theme.h"
Data Structures | |
struct | screen_data |
Data of a VNC screen. More... | |
struct | client_data |
Data of a VNC client. More... | |
Defines | |
#define | VNC_JAVA_CLASSES_DIR "/opt/veronica/classes" |
#define | VNC_MOUSE_BT_LEFT 1 |
#define | VNC_MOUSE_BT_MIDDLE 2 |
#define | VNC_MOUSE_BT_RIGHT 4 |
#define | VNC_MOUSE_WHEEL_UP 8 |
#define | VNC_MOUSE_WHEEL_DOWN 16 |
#define | VNC_HALT_DELAY_SEC 2.0f |
#define | VNC_COVER_LOOKUP_MSEC 1000 |
#define | VNC_DEFER_UPDATE_USEC 10000 |
#define | VNC_COLOR_BPP 4 |
#define | VNC_CURSOR_WIDTH 11 |
#define | VNC_CURSOR_HEIGHT 17 |
Functions | |
static void | vnc_client_gone (rfbClientPtr client_ctx) |
static enum rfbNewClientAction | vnc_new_client (rfbClientPtr client_ctx) |
static int | vnc_check_ptr_over_btn_region (struct theme_button *button, int x, int y) |
static int | vnc_check_ptr_over_region (int x1, int y1, int x2, int y2, int x, int y) |
static int | vnc_check_ptr_transparency (struct img_bitmap *bitmap, int x, int y) |
static void | vnc_check_screensaver () |
static void | vnc_blit_button (struct theme *theme, struct theme_button *button, rfbScreenInfoPtr screen) |
static void | vnc_check_button_events (struct theme_button *button, int button_mask, rfbClientPtr client_ctx) |
static void | vnc_check_nonbutton_events (int button_mask, rfbClientPtr client_ctx) |
static void | vnc_check_wheel_events (int button_mask, rfbClientPtr client_ctx) |
static void | vnc_do_ptr (int button_mask, int x, int y, rfbClientPtr client_ctx) |
static void | vnc_do_key (rfbBool down, rfbKeySym key, rfbClientPtr client_ctx) |
static rfbScreenInfoPtr | vnc_init_screen (int argc, char **argv, struct config *config, int index) |
static void | vnc_update_display_region (rfbScreenInfoPtr screen, unsigned char *display_buffer, int x1, int y1, int x2, int y2) |
static void | vnc_update_cover (rfbScreenInfoPtr screen, struct img_bitmap *cover) |
static void | vnc_cleanup_screen (rfbScreenInfoPtr screen) |
void * | vnc_process_events (void *arg) |
static void | vnc_termination_handler (int sig) |
void | vnc_startup (int argc, char **argv, struct config *config) |
Variables | |
static char | x_cursor [] |
static int | keep_going = 1 |
static int | signal_caught = 0 |
static int | screensaver_mode = 0 |
#define VNC_JAVA_CLASSES_DIR "/opt/veronica/classes" |
Java classes directory.
#define VNC_MOUSE_BT_LEFT 1 |
Bitmask of left mouse button (see vnc_do_ptr).
#define VNC_MOUSE_BT_MIDDLE 2 |
Bitmask of middle mouse button (see vnc_do_ptr).
#define VNC_MOUSE_BT_RIGHT 4 |
Bitmask of right mouse button (see vnc_do_ptr).
#define VNC_MOUSE_WHEEL_UP 8 |
Bitmask of mouse wheel up action (see vnc_do_ptr).
#define VNC_MOUSE_WHEEL_DOWN 16 |
Bitmask of mouse wheel down action (see vnc_do_ptr).
#define VNC_HALT_DELAY_SEC 2.0f |
Controls the 'halt' button behaviour.
If the button is released within VNC_HALT_DELAY_SEC seconds the Hifidelio performs a standby. Otherwise, a shutdown is performed.
#define VNC_COVER_LOOKUP_MSEC 1000 |
Cover art lookup interval in milliseconds.
#define VNC_DEFER_UPDATE_USEC 10000 |
VNC event handling interval in microseconds.
#define VNC_COLOR_BPP 4 |
Color depth of VNC screen (bytes per pixel).
#define VNC_CURSOR_WIDTH 11 |
VNC cursor width (see x_cursor).
#define VNC_CURSOR_HEIGHT 17 |
VNC cursor height (see x_cursor).
static void vnc_client_gone | ( | rfbClientPtr | client_ctx | ) | [static] |
Called if a client quits the connection.
client_ctx | client context |
static enum rfbNewClientAction vnc_new_client | ( | rfbClientPtr | client_ctx | ) | [static] |
Called if a new client connects to the VNC server.
client_ctx | client context |
static int vnc_check_ptr_over_btn_region | ( | struct theme_button * | button, | |
int | x, | |||
int | y | |||
) | [static] |
Determines whether the pointer touches a button region.
button | button data | |
x | x-position of pointer | |
y | y-position of pointer |
static int vnc_check_ptr_over_region | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | x, | |||
int | y | |||
) | [static] |
Determines whether the pointer touches a given region.
x1 | upper left x-coordinate of region | |
y1 | upper left y-coordinate of region | |
x2 | lower right x-coordinate of region | |
y2 | lower right y-coordinate of region | |
x | x-position of pointer | |
y | y-position of pointer |
static int vnc_check_ptr_transparency | ( | struct img_bitmap * | bitmap, | |
int | x, | |||
int | y | |||
) | [static] |
Determines whether the pointer touches a transparent region in a bitmap.
bitmap | bitmap data | |
x | x-position of pointer | |
y | y-position of pointer |
static void vnc_check_screensaver | ( | ) | [static] |
Checks if the Hifidelio screensaver is active and sends a dummy keypress if necessary.
static void vnc_blit_button | ( | struct theme * | theme, | |
struct theme_button * | button, | |||
rfbScreenInfoPtr | screen | |||
) | [static] |
static void vnc_check_button_events | ( | struct theme_button * | button, | |
int | button_mask, | |||
rfbClientPtr | client_ctx | |||
) | [static] |
Checks the mouse button events for the given button and sends commands to the XML interface according to the user's actions.
button | button data | |
button_mask | current mouse button mask | |
client_ctx | client context |
static void vnc_check_nonbutton_events | ( | int | button_mask, | |
rfbClientPtr | client_ctx | |||
) | [static] |
Checks mouse button events if the pointer doesn't touch a button region in the current theme.
Pressing the left mouse button acts as cursor-left and pressing the right button as cursor-right in this case.
button_mask | current mouse button mask | |
client_ctx | client context |
static void vnc_check_wheel_events | ( | int | button_mask, | |
rfbClientPtr | client_ctx | |||
) | [static] |
Checks mouse wheel events and generates key-events (cursor-up, cursor-down) if necessary.
button_mask | current mouse button mask | |
client_ctx | client context |
static void vnc_do_ptr | ( | int | button_mask, | |
int | x, | |||
int | y, | |||
rfbClientPtr | client_ctx | |||
) | [static] |
Handles pointer events.
button_mask | mouse button mask | |
x | x-coordinate of pointer | |
y | y-coordinate of pointer | |
client_ctx | client context |
static void vnc_do_key | ( | rfbBool | down, | |
rfbKeySym | key, | |||
rfbClientPtr | client_ctx | |||
) | [static] |
Handles keyboard events and sends commands to the XML interface according to the user's actions.
down | key state flag; 1: pressed, 0: released | |
key | keyboard code | |
client_ctx | client context |
static rfbScreenInfoPtr vnc_init_screen | ( | int | argc, | |
char ** | argv, | |||
struct config * | config, | |||
int | index | |||
) | [static] |
Initializes a VNC screen.
Performs the following tasks:
argc | command line argument count | |
argv | command line arguments | |
config | VNC configuration | |
index,: | VNC screen index |
static void vnc_update_display_region | ( | rfbScreenInfoPtr | screen, | |
unsigned char * | display_buffer, | |||
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2 | |||
) | [static] |
Updates a display region in the screen's framebuffer.
screen | screen context | |
display_buffer | display buffer | |
x1 | upper left x-coordinate | |
y1 | upper left y-coordinate | |
x2 | lower right x-coordinate | |
y2 | lower right y-coordinate |
static void vnc_update_cover | ( | rfbScreenInfoPtr | screen, | |
struct img_bitmap * | cover | |||
) | [static] |
Updates the cover region.
Displays the background if no cover is available.
screen | screen context | |
cover | cover art bitmap |
static void vnc_cleanup_screen | ( | rfbScreenInfoPtr | screen | ) | [static] |
VNC screen cleanup.
Frees allocated memory.
screen | VNC screen data |
void* vnc_process_events | ( | void * | arg | ) |
Thread function that controls the event loop for a vnc screen.
arg | VNC screen data |
static void vnc_termination_handler | ( | int | sig | ) | [static] |
Program termination signal handler.
sig | signal caught |
void vnc_startup | ( | int | argc, | |
char ** | argv, | |||
struct config * | config | |||
) |
Launches VNC screens and controls the refresh loop.
argc | command line argument count | |
argv | command line arguments | |
config | VNC configuration data |
char x_cursor[] [static] |
Initial value:
" " " x " " xx " " xxx " " xxxx " " xxxxx " " xxxxxx " " xxxxxxx " " xxxxxxxx " " xxxxxxxxx " " xxxxxx " " xxxxxx " " xx xxx " " x xxx " " xxx " " xx " " "
int keep_going = 1 [static] |
Global flag that keeps the VNC server running.
int signal_caught = 0 [static] |
Last signal handled in vnc_termination_handler.
int screensaver_mode = 0 [static] |
Hifidelio screensaver mode (1 = active, 0 = off).
This value gets updated with every display refresh.