Go to the source code of this file.
<File description>="">
Depending on the configure value "cursor-used" the e-reader specific cursor code will be enabled/disabled
Definition in file cursor.h.
#define FBIO_DISPLAY _IOW(FBIO_IOCTL_BASE, 1, struct display_update_info) |
#define FBIO_DRAW_BRUSH _IOW(FBIO_IOCTL_BASE, 4, struct brush_draw_info_obsolete) |
#define FBIO_DRAW_BRUSH_GENERIC _IOW(FBIO_IOCTL_BASE, 9, struct brush_draw_info) |
#define FBIO_DRAW_BUBBLE _IOW(FBIO_IOCTL_BASE, 8, struct brush_draw_info_obsolete) |
#define FBIO_DRAWPIXELS _IOW(FBIO_IOCTL_BASE, 3, struct transfer_buffer) |
#define FBIO_ERASE_WHITE _IOW(FBIO_IOCTL_BASE, 2, struct display_update_info) |
#define FBIO_REDRAW _IOW(FBIO_IOCTL_BASE, 5, struct display_update_info) |
#define FBIO_UPLOAD_WAVEFORM _IOC(_IOC_WRITE, FBIO_IOCTL_BASE, 6, WAVEFORM_SIZE) |
#define PROGRESS_STEP_JIFFIES (ESTIMATED_BOOT_JIFFIES / (BOOT_PROGRESS_STEPS - BOOT_PROGRESS_START_STEP)) |
enum cursor_state_t |
Definition at line 164 of file cursor.h.
00165 { 00166 e_cursor_hide = 0, 00167 e_cursor_show, 00168 e_cursor_blink, 00169 e_cursor_undefined 00170 } cursor_state_t;
void cursor_destroy | ( | ) |
Free resources used by cursor
- |
Definition at line 404 of file cursor.c.
00405 { 00406 close(g_framebuffer_device); 00407 }
void cursor_hide_all | ( | void | ) |
Hide cursor for all lister items
-- |
Definition at line 229 of file cursor.c.
00230 { 00231 int rc; 00232 int pos; 00233 struct brush_draw_info drawinfo; 00234 GtkWidget* listItem = NULL; 00235 00236 CL_CURSORPRINTF("entry"); 00237 00238 // stop blink handler 00239 cursor_blink_handler_stop(); 00240 g_cursor_num_blinking = 0; 00241 g_cursor_x_pos_blink = g_cursor_x_pos; 00242 00243 // hide all cursors (i.e. paint white) 00244 drawinfo.sourcex = WHITE_CURSOR_X; 00245 drawinfo.sourcey = WHITE_CURSOR_Y; 00246 drawinfo.sizex = WHITE_CURSOR_SIZE_X; 00247 drawinfo.sizey = WHITE_CURSOR_SIZE_Y; 00248 drawinfo.brushlsb = WHITE; 00249 for (pos = 0 ; pos < MAX_ITEMS_ON_ONE_PAGE ; pos++) 00250 { 00251 drawinfo.destx = cursor_info[pos].y_pos; 00252 00253 cursor_info[pos].state = e_cursor_hide; 00254 00255 // hide gtk cursor 00256 listItem = lsGetListerItem(g_contentLister->lister, pos); 00257 gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listItem), FALSE); 00258 00259 // write the brush/drawing for standard location to framebuffer (in-memory) 00260 drawinfo.desty = SCREEN_WIDTH - g_cursor_x_pos; 00261 if (display_update_get_level() < NO_DISPLAY_UPDATE_LEVEL) 00262 { 00263 CL_CURSORPRINTF("FBIO_DRAW_BRUSH location %dx%d color %d", drawinfo.desty, drawinfo.destx, drawinfo.brushlsb); 00264 rc = ioctl(g_framebuffer_device, FBIO_DRAW_BRUSH_GENERIC, &drawinfo); 00265 if (rc != 0) 00266 { 00267 CL_ERRORPRINTF("Error drawing brush (err=0x%x)", rc); 00268 } 00269 } 00270 00271 // write the brush/drawing for alternative location to framebuffer (in-memory) 00272 drawinfo.desty = SCREEN_WIDTH - g_cursor_x_pos_alt; 00273 if (display_update_get_level() < NO_DISPLAY_UPDATE_LEVEL) 00274 { 00275 CL_CURSORPRINTF("FBIO_DRAW_BRUSH location %dx%d color %d", drawinfo.desty, drawinfo.destx, drawinfo.brushlsb); 00276 rc = ioctl(g_framebuffer_device, FBIO_DRAW_BRUSH_GENERIC, &drawinfo); 00277 if (rc != 0) 00278 { 00279 CL_ERRORPRINTF("Error drawing brush (err=0x%x)", rc); 00280 } 00281 } 00282 g_cursor_needs_update = TRUE; 00283 } 00284 }
int cursor_init | ( | ContentLister * | theContentLister | ) |
Load bitmap, open framebuffer_device, init values...
Definition at line 89 of file cursor.c.
00090 { 00091 int i; 00092 00093 g_contentLister = theContentLister; 00094 00095 // open framebuffer device 00096 g_framebuffer_device = open("/dev/fb0", O_RDWR); 00097 if (g_framebuffer_device == -1) 00098 { 00099 CL_ERRORPRINTF("Error opening framebufferdevice. # mknod /dev/fb0 c 29 0"); 00100 return -1; // -1 = error 00101 } 00102 00103 // determine X coordinate 00104 g_cursor_x_pos = CURSOR_X; 00105 g_cursor_x_pos_alt = g_cursor_x_pos - BLACK_CURSOR_SIZE_Y; 00106 if (g_cursor_x_pos_alt < BLACK_CURSOR_SIZE_Y + 3) 00107 { 00108 g_cursor_x_pos_alt = BLACK_CURSOR_SIZE_Y + 3; 00109 } 00110 g_cursor_x_pos_blink = g_cursor_x_pos; 00111 00112 // determine Y coordinate 00113 for (i = 0 ; i < MAX_ITEMS_ON_ONE_PAGE ; i++) 00114 { 00115 cursor_info[i].y_pos = CURSOR_START_Y + i * CURSOR_STEP; 00116 cursor_info[i].state = e_cursor_hide; 00117 } 00118 00119 // set waveform parameters 00120 updateinfo.waveform = WAVEFORM_FAST_BLACK_WHITE; 00121 updateinfo.sequence = 0; 00122 00123 return 0; // 0 = ok 00124 }
void cursor_redraw | ( | void | ) |
Redraw cursur, when needed
-- |
Definition at line 286 of file cursor.c.
00287 { 00288 CL_CURSORPRINTF("entry"); 00289 00290 int rc; 00291 00292 if ( g_cursor_needs_update 00293 && display_update_get_level() < NO_DISPLAY_UPDATE_LEVEL ) 00294 { 00295 // display the modification on screen 00296 CL_CURSORPRINTF("FBIO_REDRAW waveform %d - sequence %d", updateinfo.waveform, updateinfo.sequence); 00297 rc = ioctl(g_framebuffer_device, FBIO_REDRAW, &updateinfo); 00298 if (rc != 0) 00299 { 00300 CL_ERRORPRINTF("Error sending FBIO_REDRAW: %x", rc); 00301 } 00302 g_cursor_needs_update = FALSE; 00303 } 00304 }
int cursor_set_state | ( | const int | pos, | |
const cursor_state_t | state | |||
) |
Show/hide/blink cursor at lister-item position
pos | - index of lister item (0 ..) | |
state | - new state of cursor |
Definition at line 130 of file cursor.c.
00131 { 00132 int retVal = 0; // 0 = ok 00133 00134 if (pos == -1) 00135 { 00136 return 0; // 0 = ok 00137 } 00138 CL_CURSORPRINTF("entry: pos [%d] new_state [%d]", pos, new_state); 00139 g_return_val_if_fail((pos >= 0 && pos < MAX_ITEMS_ON_ONE_PAGE), -1); 00140 00141 int rc; 00142 struct brush_draw_info drawinfo; 00143 cursor_state_t old_state = cursor_info[pos].state; 00144 GtkWidget* listItem = lsGetListerItem(g_contentLister->lister, pos); 00145 00146 if (new_state == e_cursor_hide) 00147 { 00148 gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listItem), FALSE); 00149 00150 // remove cursor (i.e. paint white) 00151 drawinfo.sourcex = WHITE_CURSOR_X; 00152 drawinfo.sourcey = WHITE_CURSOR_Y; 00153 drawinfo.sizex = WHITE_CURSOR_SIZE_X; 00154 drawinfo.sizey = WHITE_CURSOR_SIZE_Y; 00155 drawinfo.destx = cursor_info[pos].y_pos; 00156 drawinfo.desty = SCREEN_WIDTH - ((old_state == e_cursor_blink) ? g_cursor_x_pos_blink : g_cursor_x_pos); 00157 drawinfo.brushlsb = WHITE; 00158 } 00159 else 00160 { 00161 gtk_content_list_item_show_cursor(GTK_CONTENT_LIST_ITEM(listItem), TRUE); 00162 00163 // show cursor (black) 00164 drawinfo.sourcex = BLACK_CURSOR_X; 00165 drawinfo.sourcey = BLACK_CURSOR_Y; 00166 drawinfo.sizex = BLACK_CURSOR_SIZE_X; 00167 drawinfo.sizey = BLACK_CURSOR_SIZE_Y; 00168 drawinfo.destx = cursor_info[pos].y_pos; 00169 drawinfo.desty = SCREEN_WIDTH - ((new_state == e_cursor_blink) ? g_cursor_x_pos_blink : g_cursor_x_pos); 00170 drawinfo.brushlsb = BLACK; 00171 } 00172 cursor_info[pos].state = new_state; 00173 00174 // write the brush/drawing to framebuffer (in-memory) 00175 if (display_update_get_level() < NO_DISPLAY_UPDATE_LEVEL) 00176 { 00177 CL_CURSORPRINTF("FBIO_DRAW_BRUSH location %dx%d color %d", drawinfo.desty, drawinfo.destx, drawinfo.brushlsb); 00178 rc = ioctl(g_framebuffer_device, FBIO_DRAW_BRUSH_GENERIC, &drawinfo); 00179 if (rc != 0) 00180 { 00181 CL_ERRORPRINTF("Error drawing brush (err=0x%x)", rc); 00182 retVal = -1; // -1 = error 00183 } 00184 } 00185 00186 // set blinking parameters 00187 // adjust number of blinking cursors 00188 if (old_state == e_cursor_blink && g_cursor_num_blinking > 0) 00189 { 00190 g_cursor_num_blinking--; 00191 } 00192 if (new_state == e_cursor_blink) 00193 { 00194 g_cursor_num_blinking++; 00195 } 00196 g_cursor_num_blinking = g_cursor_num_blinking; 00197 // start/stop blink timeout handler 00198 if (g_cursor_num_blinking == 0) 00199 { 00200 if (g_cursor_blink_handler != 0) 00201 { 00202 cursor_blink_handler_stop(); 00203 g_cursor_x_pos_blink = g_cursor_x_pos; 00204 } 00205 } 00206 else 00207 { 00208 if (g_cursor_blink_handler == 0) 00209 { 00210 g_cursor_blink_handler = g_timeout_add(800, cursor_blink, NULL); 00211 } 00212 } 00213 00214 // screen update needed except when blink 00215 if ( (new_state == e_cursor_blink && g_cursor_num_blinking > 1) 00216 || (old_state == e_cursor_blink && g_cursor_num_blinking > 0) ) 00217 { 00218 // wait for next blink timer to do screen update 00219 } 00220 else 00221 { 00222 // do screen update now 00223 g_cursor_needs_update = TRUE; 00224 } 00225 00226 return retVal; 00227 }
void start_progress_indicator | ( | void | ) |
Start progress indicator (knight rider)
- |
Definition at line 409 of file cursor.c.
00410 { 00411 int framebuffer_device; 00412 00413 // start the timer now, the viewer has been launched 00414 if (display_update_get_level() < NO_DISPLAY_UPDATE_LEVEL) 00415 { 00416 framebuffer_device = open("/dev/fb0", O_RDWR); 00417 if ((ioctl(framebuffer_device, FBIO_START_PROGRESS_BAR)) != 0) 00418 { 00419 CL_ERRORPRINTF("einkfb IOCTL failed"); 00420 } 00421 close(framebuffer_device); 00422 } 00423 }