1464 int flip_book_udelay = 0;
1474 XNextEvent(
dpy, &event);
1478 (flip_book_frams_sec) ? 1000000 / flip_book_frams_sec : 0;
1481 for ( img = img_info; img < &img_info[n]; img++ )
1482 if ( img->
window == event.xany.window )
1485 switch (event.type) {
1488 i =
event.xbutton.button - Button1;
1493 action =
flip_action[
i][
event.xbutton.state & ShiftMask];
1514 if (XQueryPointer(
dpy, img->
window, &foo, &poo,
1515 &rx, &ry, &x, &y, &mask))
1517 if (!(mask&(Button1Mask|Button2Mask|Button3Mask)))
1525 if ((first || x != lx || y != ly) &&
1526 (x >= 0 && x < img->w &&
1527 y >= 0 && y < img->h)) {
1529 first = 0; lx =
x; ly =
y;
1546 s = flip_book_frams_sec;
1551 int rx, ry,
x,
y, inc;
1554 if (XQueryPointer(
dpy, img->
window, &foo, &poo,
1555 &rx, &ry, &x, &y, &mask)) {
1556 if (!(mask&(Button1Mask|Button2Mask|Button3Mask)))
1561 inc = (ly -
y) * 100 / height;
1564 if ((first || flip_book_frams_sec + inc != s ) ) {
1565 s = flip_book_frams_sec + inc;
1566 s = (s < 0) ? 0 : s;
1567 s = (s > 100) ? 100 : s;
1575 flip_book_frams_sec =
s;
1583 n, ButtonPressMask|KeyPressMask,
1584 &event, &found_event);
1588 flip_forward = False;
1595 n, ButtonPressMask|KeyPressMask,
1596 &event, &found_event);
1600 flip_forward = True;
1607 if ( flip_forward ) {
1608 if ( flip_frame == &img_info[n-1] )
1611 img = flip_frame = flip_frame + 1;
1614 if ( flip_frame == img_info )
1615 img = flip_frame = &img_info[n-1];
1617 img = flip_frame = flip_frame - 1;
1628 ( img, img_info, n, flip_forward, flip_book_udelay );
1636 img = (* (flip_forward ?
1640 n, ButtonPressMask |KeyPressMask,
1641 &
event, &found_event);
1643 flip_forward = !flip_forward;
1645 img = (flip_forward) ? img + 1 : img - 1;
1648 }
while( !found_event );
1656 mag_pan ( img, action, event.xbutton.
x, event.xbutton.y,
1660 mag_pan ( img, action, event.xbutton.
x, event.xbutton.y,
1664 mag_pan ( img, action, event.xbutton.
x, event.xbutton.y,
1669 mag_pan ( img, action, event.xbutton.
x, event.xbutton.y,
1681 event.xexpose.width, event.xexpose.height,
1686 case ConfigureNotify:
1688 int new_w =
event.xconfigure.width;
1689 int new_h =
event.xconfigure.height;
1691 if ( !flip_book && (img->
win_w != new_w || img->
win_h != new_h )) {
1705 char *symstr, *XKeysymToString( );
1708 XComposeStatus stat;
1712 length = XLookupString( (XKeyEvent *)&event,
string, 256, &keysym, &stat );
1713 string [length] =
'\0';
1714 symstr = XKeysymToString( keysym );
1715 shifted_key =
event.xkey.state & ShiftMask;
1717 if ( length == 1 && (
string[0] ==
'q' ||
string[0] ==
'Q' ||
1718 string[0] ==
'\003' ))
1724 case '1':
case '2':
case '3':
case '4':
1725 case '5':
case '6':
case '7':
case '8':
1735 img = (* (flip_forward ?
1739 n, ButtonPressMask |KeyPressMask,
1740 &
event, &found_event);
1742 flip_forward = !flip_forward;
1744 img = (flip_forward) ? img + 1 : img - 1;
1747 }
while( !found_event );
1755 flip_forward = (
string[0] ==
'c');
1757 (img, img_info, n, flip_forward, flip_book_udelay);
1763 4, 20,
"hi there", strlen (
"hi there") );
1773 for (img = flip_frame; img < &img_info[n]; img++ )
1776 if ( flip_forward ) {
1777 if ( flip_frame == &img_info[n] )
1783 if ( flip_frame == img_info )
1784 img = flip_frame = &img_info[n-1];
1786 img = flip_frame = flip_frame - 1;
1795 if ( flip_forward ) {
1796 if ( flip_frame == &img_info[n-1] )
1799 img = flip_frame = flip_frame + 1;
1802 if ( flip_frame == img_info )
1803 img = flip_frame = &img_info[n-1];
1805 img = flip_frame = flip_frame - 1;
1816 if ( !flip_forward ) {
1817 if ( flip_frame == &img_info[n-1] )
1820 img = flip_frame = flip_frame + 1;
1823 if ( flip_frame == img_info )
1824 img = flip_frame = &img_info[n-1];
1826 img = flip_frame = flip_frame - 1;
1841 if (
string[0] ==
'i' )
1848 handled_key = False;
1850 else handled_key = False;
1852 DPRINTF(stderr,
"%s %x, %s String '%s' - %d\n", symstr, keysym,
1853 ( shifted_key )?
"shifted":
"unshifted",
string, length );
1862 if ( !strcmp( symstr,
"Left" ) || !strcmp( symstr,
"F30" ) )
1865 if ( !strcmp( symstr,
"Up" ) || !strcmp( symstr,
"F28" ) )
1868 if ( !strcmp( symstr,
"Right" ) || !strcmp( symstr,
"F32" ) )
1870 (shifted_key ? img->
win_w-1 :
1873 if ( !strcmp( symstr,
"Down" ) || !strcmp( symstr,
"F34" ) )
1875 (shifted_key ? img->
win_h-1 :
1882 case VisibilityNotify:
1888 case ReparentNotify:
1889 case ConfigureRequest:
1893 XRefreshKeyboardMapping( &event.xmapping );
1897 fprintf(stderr,
"%s: Event type %x?\n",
progname, event.type);
1921 XFreeGC(
dpy, img->
gc );
1925 dead_window = img->
window;
1931 for ( ; img < &img_info[n]; img++ )
1936 if ( img_info[0].
window == dead_window )
1938 #ifdef X_SHARED_MEMORY
1939 for ( img = &img_info[0] ; img < &img_info[n]; img++ )
1941 if ( img->
shm_pix.shmid >= 0 )
unsigned char * scan_data
#define ACTION_FLIP_BACKWARD
void set_circle_cursor(Window window)
void free_X_pixmap(image_information *img, Pixmap pix)
#define ACTION_CYCLE_TO_AND_FRO
static int flip_action[3][2]
void free_image_colors(image_information *img)
void set_left_ptr_cursor(Window window)
int resize_window(image_information *img, int new_w, int new_h)
static struct NewWindow window
image_information * action_flip_book_cycle(image_information *img, image_information *img_info, int n, Boolean flip_forward, int flip_book_udelay)
void DrawSpeedWindow(image_information *img, int s)
static int button_action[3][2]
#define ACTION_FLIP_SPEED
void handle_exposure(image_information *img, int x, int y, int width, int height, int img_h)
#define ACTION_PIXEL_INFO
#define ACTION_SWITCH_MAG_MODE
static void mag_pan(image_information *img, int action, int bx, int by, int new_mag_fact)
void destroy_X_image(image_information *img, XImage *image)
image_information * action_flip_forward(image_information *img, image_information *img_info, int flip_book_udelay, int n, unsigned long mask, XEvent *event, Boolean *found_event)
#define ACTION_FLIP_FORWARD
image_information * img_info
#define COUNT_OF(_array_)
void UnmapPixWindow(image_information *img)
void DrawPixWindow(image_information *img, int x, int y)
image_information * action_flip_backward(image_information *img, image_information *img_info, int flip_book_udelay, int n, unsigned long mask, XEvent *event, Boolean *found_event)
void MapPixWindow(image_information *img, int use_top)