util/gfx/win.c File Reference

Graphical Window system. More...

#include <stdint.h>
#include <stdlib.h>
#include "assert.h"
#include "gfx/win.h"
#include <membag.h>
#include <ring.h>
#include <workqueue.h>

Go to the source code of this file.

Data Structures

struct  win_window
 Window control data. More...
struct  win_event_queue
 Event queue control struct. More...

Functions

static bool win_is_visible (const struct win_window *win)
 Return true if this window and all parents and grand parents are visible.
static void win_draw (const struct win_window *win, const struct win_area *dirty_area)
 Draw the parts of the window covered by dirty_area, and all covering windows.
static void win_draw_parent (const struct win_window *child, const struct win_area *dirty_area)
 Draw parent window, with all child windows, but limited to dirty area.
static void win_draw_contents (const struct win_window *win, const struct win_clip_region *clip)
 Draw window background and contents, including children, limited to clip.
static void win_draw_child (const struct win_window *child, const struct win_clip_region *parentClip)
 Draw a child window, automatically translating clipping region from parent.
static bool win_translate_area_to_parent (struct win_area *area, const struct win_window *parent)
 Translate an area to coordinates relative to parent's origin.
static void win_destroy_children (struct win_window *win)
 Destroy child windows, freeing allocated memory.
static void win_unlink (struct win_window *win)
 Remove window from parent's linked list.
static void win_add_top_child (struct win_window *parent, struct win_window *child)
 Add child window at the start of parent's linked list.
static void win_process_pointer_event (struct win_pointer_event *event)
 Helper function to process pointer event, called from win_process_events().
static bool win_handle_pointer_event (struct win_window *win, const struct win_pointer_event *event, const struct win_point *pos)
 Ask window to process pointer event, or pass it on to correct child.
static bool win_handle_event (struct win_window *win, enum win_event_type type, const void *data)
 Call window event handler if any, return value from handler, or false.
static void win_queue_event (const struct win_event *event)
 Add an event to the internal queue.
static void win_event_worker (struct workqueue_task *task)
 Worker function to be added to main work queue, calls win_process_events().
void win_init (void)
 Initialize window system, set up root window, hook into touch driver.
struct win_windowwin_get_root (void)
 Get pointer to root window, i.e. desktop window.
struct win_windowwin_get_parent (const struct win_window *win)
 Get pointer to parent window, or NULL for root window.
void win_reset_root_geometry (void)
 Reset root window geometry to fullscreen, in case screen orientation change.
void win_set_attributes (struct win_window *win, const struct win_attributes *new_attributes, win_attribute_mask_t attribute_mask)
 Update window attributes, selected by the attribute mask.
void win_set_area (struct win_window *win, const struct win_area *new_area, win_attribute_mask_t attribute_mask)
 Update window position and/or size.
struct win_attributeswin_get_attributes (const struct win_window *win)
 Get a pointer to the window attribute struct.
struct win_areawin_get_area (const struct win_window *win)
 Get a pointer to the window area struct.
void * win_get_custom_data (const struct win_window *win)
 Get window custom data.
struct win_windowwin_create (struct win_window *parent, const struct win_attributes *attributes)
 Create a window and return its pointer. Use win_destroy() to free memory.
void win_destroy (struct win_window *win)
 Destroy a window and its contents including children, freeing up memory.
void win_reparent (struct win_window *child, struct win_window *new_parent)
 Change a window's parent.
void win_show (struct win_window *win)
 Show window. Will draw it on screen if parent is visible as well.
void win_redraw (const struct win_window *win)
 Redraw window and its contents, if visible.
void win_hide (struct win_window *win)
 Hide a window, removing it from screen if is was visible.
void win_raise (struct win_window *win)
 Raise window to top of all its siblings.
void win_lower (struct win_window *win)
 Lower window to bottom of all its siblings.
void win_queue_pointer_event (const struct win_pointer_event *event)
 Add a pointer event to the internal event queue.
void win_queue_keyboard_event (const struct win_keyboard_event *event)
 Add a keyboard event to the internal event queue.
void win_queue_command_event (const struct win_command_event *event)
 Add a command event to the internal event queue.
static void win_process_keyboard_event (struct win_keyboard_event *kevent)
 Process a keyboard event.
static void win_process_command_event (struct win_command_event *cevent)
 Process a command event.
void win_process_events (void)
 Process all pending events from the internal queue.
void win_set_keyboard_focus (struct win_window *win)
 Set keyboard focus window or NULL, i.e. receiver of keyboard events.
void win_grab_pointer (struct win_window *win)
 Set pointer focus window or NULL, i.e. override pointer event receiver.
bool win_is_inside_clip (const struct win_clip_region *clip, const struct win_point *point)
 Return true if point is inside clipping region.
bool win_is_inside_area (const struct win_area *area, const struct win_point *point)
 Return true if point is inside area.
bool win_is_inside_window (const struct win_window *win, const struct win_point *point)
 Return true if global point is inside window.
void win_compute_union (struct win_area *area, const struct win_area *merge)
 Compute smallest box containing both areas, update first parameter.
bool win_compute_intersection (struct win_clip_region *clip, const struct win_area *area)
 Compute the intersection of clipping region and area, update clip.
bool win_compute_clipping (const struct win_window *win, const struct win_area *dirty_area, struct win_clip_region *clip)
 Compute clipping region in absolute coordinates from window and dirty area.
void win_translate_win_to_root (struct win_window const *start_win, struct win_point *return_pos)
 Compute window position on root window.

Variables

static struct win_window win_root
 Root window, i.e. desktop window.
static struct win_event_queue win_event_queue
 Window event queue.
static uint32_t win_num_dropped_events
 Diagnostic value counting number of dropped events due to event queue full.
static struct win_windowwin_pointer_grabber
 Current pointer grabbing window, or NULL. Grabber gets all pointer events.
static struct win_windowwin_keyboard_focus
 Current keyboard focus, or NULL. Keyboard focus gets all keyboard events.
static struct win_point win_last_pointer_pos
 Stores last pointer event position, in absolute coordinates.
static struct gfx_bitmap win_root_background
 Frame background bitmap.

Detailed Description

Graphical Window system.

Copyright (C) 2009 Atmel Corporation. All rights reserved.

Definition in file win.c.

Generated on Thu Apr 29 15:18:22 2010 for display-training by  doxygen 1.6.3