#include #include #include "list.h" #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif typedef enum { WS_WINDOW_SIZE_CHANGED = (1 << 0), WS_WINDOW_POSITION_CHANGED = (1 << 1) } ws_window_configure_type_t; typedef struct ws_t ws_t; typedef struct drawable_t drawable_t; typedef struct window_t window_t; typedef struct surfade_t surface_t; typedef union ws_event_t ws_event_t; typedef enum { WS_CONFIGURE, // FIXME: rename to USER_POSITION? WS_MOTION, WS_BUTTON_DOWN, WS_BUTTON_UP } ws_event_type_t; typedef struct { link_t link; ws_event_type_t type; } ws_event_common_t; union ws_event_t { ws_event_common_t common; struct { ws_event_common_t common; ws_window_configure_type_t configure_type; window_t * window; } configure; struct { ws_event_common_t common; window_t * window; int x; int y; int root_x; int root_y; } motion; struct { ws_event_common_t common; window_t * window; int button; int x; int y; int root_x; int root_y; } button, button_up, button_down; }; typedef void (* ws_event_func_t) (window_t *window, ws_event_t *event, void *data); /* Window system */ ws_t * ws_open (void); int ws_get_width (ws_t *ws); int ws_get_height (ws_t *ws); int ws_get_fd (ws_t *ws); void ws_process (ws_t *ws); pixman_bool_t ws_pending (ws_t *ws); /* Window */ window_t *ws_create_window (ws_t *ws, int x, int y, int width, int height); void ws_window_set_callback (window_t *window, ws_event_func_t func, void * data); void ws_window_ref (window_t *window); void ws_window_unref (window_t *window); void ws_window_show (window_t *window); void ws_window_hide (window_t *window); void ws_window_move (window_t *window, int x, int y); int ws_window_get_width (window_t *window); int ws_window_get_height (window_t *window); int ws_window_get_x (window_t *window); int ws_window_get_y (window_t *window); void ws_window_resize (window_t *window, int w, int h); void ws_window_copy_area (window_t *window, int src_x, int src_y, int dst_x, int dst_y, int width, int height); void ws_window_copy_from_image (window_t *window, pixman_image_t *image, int image_x, int image_y, int win_x, int win_y, int width, int height); void ws_window_copy_to_image (window_t *window, pixman_image_t *image, int image_x, int image_y, int win_x, int win_y, int width, int height); void ws_window_finish (window_t **windows, int n_windows);