Back to index

tetex-bin  3.0
Classes | Defines | Typedefs | Enumerations | Functions
events.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  xio
struct  xchild
struct  xtimer
struct  xdvi_action

Defines

#define EV_IDLE   (1<<0) /* 1 - non-event */
#define EV_CURSOR   (1<<1) /* 2 - cursor needs to revert back to ready */
#define EV_EXPOSE   (1<<2) /* 4 - expose occurred somewhere */
#define EV_MAG_MOVE   (1<<3) /* 8 - magnifier moved */
#define EV_MAG_GONE   (1<<4) /* 16 - magnifier gone while being drawn */
#define EV_ACK   (1<<5) /* 32 - used internally */
#define EV_SRC   (1<<6) /* 64 - source special operation is pending */
#define EV_ANCHOR   (1<<7) /* 128 - anchor search is pending - should maybe move this up? */
#define EV_FIND   (1<<8) /* 256 - string search */
#define EV_FIND_CANCEL   (1<<9) /* 512 - string search cancelled */
#define EV_FILEHIST_GOTO_PAGE   (1<<10) /* 1024 - get page from file history */
#define EV_PAGEHIST_INSERT   (1<<11) /* 2048 - get page from file history */
#define EV_NEWPAGE   (1<<12) /* 4096 - new page requested */
#define EV_PS_TOGGLE   (1<<13) /* 8192 - PostScript toggled on or off */
#define EV_RELOAD   (1<<14) /* 16384 - reload dvi file */
#define EV_NEWDOC   (1<<15) /* 32768 - new dvi file requested */
#define EV_TERM   (1<<16) /* 65536 - quit */
#define EV_MAXPLUS1   (1<<17) /* 131072 - marker for highest element */
#define EV_GE_IDLE   (EV_MAXPLUS1 - EV_IDLE)
#define EV_GT_IDLE   (EV_MAXPLUS1 - EV_CURSOR)
#define EV_GE_CURSOR   (EV_MAXPLUS1 - EV_CURSOR)
#define EV_GE_EXPOSE   (EV_MAXPLUS1 - EV_EXPOSE)
#define EV_GE_MAG_MOVE   (EV_MAXPLUS1 - EV_MAG_MOVE)
#define EV_GE_MAG_GONE   (EV_MAXPLUS1 - EV_MAG_GONE)
#define EV_GE_ACK   (EV_MAXPLUS1 - EV_ACK)
#define EV_GE_FIND   (EV_MAXPLUS1 - EV_FIND)
#define EV_GE_FIND_CANCEL   (EV_MAXPLUS1 - EV_FIND_CANCEL)
#define EV_GE_NEWPAGE   (EV_MAXPLUS1 - EV_NEWPAGE)
#define EV_GE_PS_TOGGLE   (EV_MAXPLUS1 - EV_PS_TOGGLE)
#define EV_GE_NEWDOC   (EV_MAXPLUS1 - EV_NEWDOC)
#define EV_GE_RELOAD   (EV_MAXPLUS1 - EV_RELOAD)
#define EV_GE_TERM   (EV_MAXPLUS1 - EV_TERM)
#define EV_NOWAIT   EV_GE_IDLE

Typedefs

typedef void(* childProcT )(int exitval, struct xchild *this)
typedef enum xtimerT_ xtimerT
typedef void(* home_proc )(wide_bool)

Enumerations

enum  xtimerT_ { XTM_DEFAULT = 0, XTM_STATUSLINE, XTM_HREF }
enum  textSelectionT { TEXT_SEL_MOVE, TEXT_SEL_CLEAR, TEXT_SEL_REDRAW, TEXT_SEL_ERASE }

Functions

void set_timer (struct xtimer *tp, int ms)
void cancel_timer (struct xtimer *tp)
int get_num_actions (void)
XtActionsRec * get_actions (void)
int atopix (const char *, Boolean)
int check_goto_page (int pageno)
Boolean get_int_arg (String *param, Cardinal *num_params, int *res)
Boolean toggle_arg (int arg, String *param, Cardinal *num_params)
void clearexpose (struct WindowRec *windowrec, int x, int y, unsigned w, unsigned h)
void expose (struct WindowRec *windowrec, int x, int y, unsigned int w, unsigned int h)
void home (wide_bool)
int set_bar_value (Widget bar, int value, int max)
void reconfig (void)
void redraw (struct WindowRec *windowrec)
void handle_resize (Widget, XtPointer, XEvent *, Boolean *)
void handle_expose (Widget, XtPointer, XEvent *, Boolean *)
void handle_property_change (Widget, XtPointer, XEvent *, Boolean *)
void handle_command (Widget widget, XtPointer client_data, XtPointer call_data)
void showmessage (const char *)
void set_chld (struct xchild *)
void clear_chld (struct xchild *)
void set_io (struct xio *)
void clear_io (struct xio *)
unsigned int read_events (unsigned int)
void goto_page (int page, home_proc proc, Boolean force)
void setup_sigalarm (void)
void setup_signal_handlers (void)
int shrink_to_fit (void)
void do_pages (void)
void do_set_density (double newgamma, Boolean force, Boolean update_resource)
void do_toggle_color (Boolean update_resource)
void Act_recent_files (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_htex_back (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_htex_forward (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_set_keep_flag (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_back_page (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_forward_page (Widget w, XEvent *event, String *params, Cardinal *num_params)
void do_set_shrinkfactor (int arg, Boolean set_resource)
void Act_set_shrink_factor (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_shrink_to_dpi (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_set_expert_mode (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_use_tex_pages (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_ruler_mode (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_switch_mode (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_pagehistory_clear (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_pagehistory_back (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_pagehistory_forward (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_pagehistory_delete_backward (Widget w, XEvent *event, String *params, Cardinal *num_params)
void Act_pagehistory_delete_forward (Widget w, XEvent *event, String *params, Cardinal *num_params)
void null_mouse (XEvent *ignored)
void block_next_mouse_event (void)
Boolean block_this_mouse_event (void)
void text_motion (XEvent *event)
Boolean dragging_text_selection (void)
void text_change_region (textSelectionT mode, XEvent *event)
void text_selection_start (XEvent *event)
struct xdvi_actioncompile_action (const char *str)
void watch_file_cb (XtPointer client_data, XtIntervalId *id)
void redraw_page (void)
void handle_x_scroll (Widget w, XtPointer closure, XEvent *ev, Boolean *cont)
void handle_y_scroll (Widget w, XtPointer closure, XEvent *ev, Boolean *cont)
void xdvi_exit_callback (Widget w, XtPointer client_data, XtPointer call_data)

Class Documentation

struct xchild

Definition at line 85 of file events.h.

Collaboration diagram for xchild:
Class Members
void * data
struct xio * io
Boolean killable
char * name
struct xchild * next
pid_t pid
childProcT proc
struct xdvi_action

Definition at line 221 of file events.h.

Collaboration diagram for xdvi_action:
Class Members
struct xdvi_action * next
Cardinal num_params
String param
XtActionProc proc

Define Documentation

#define EV_ACK   (1<<5) /* 32 - used internally */

Definition at line 36 of file events.h.

#define EV_ANCHOR   (1<<7) /* 128 - anchor search is pending - should maybe move this up? */

Definition at line 38 of file events.h.

#define EV_CURSOR   (1<<1) /* 2 - cursor needs to revert back to ready */

Definition at line 32 of file events.h.

#define EV_EXPOSE   (1<<2) /* 4 - expose occurred somewhere */

Definition at line 33 of file events.h.

#define EV_FILEHIST_GOTO_PAGE   (1<<10) /* 1024 - get page from file history */

Definition at line 41 of file events.h.

#define EV_FIND   (1<<8) /* 256 - string search */

Definition at line 39 of file events.h.

#define EV_FIND_CANCEL   (1<<9) /* 512 - string search cancelled */

Definition at line 40 of file events.h.

#define EV_GE_ACK   (EV_MAXPLUS1 - EV_ACK)

Definition at line 56 of file events.h.

Definition at line 52 of file events.h.

Definition at line 53 of file events.h.

#define EV_GE_FIND   (EV_MAXPLUS1 - EV_FIND)

Definition at line 57 of file events.h.

Definition at line 58 of file events.h.

#define EV_GE_IDLE   (EV_MAXPLUS1 - EV_IDLE)

Definition at line 50 of file events.h.

Definition at line 55 of file events.h.

Definition at line 54 of file events.h.

Definition at line 61 of file events.h.

Definition at line 59 of file events.h.

Definition at line 60 of file events.h.

Definition at line 62 of file events.h.

#define EV_GE_TERM   (EV_MAXPLUS1 - EV_TERM)

Definition at line 63 of file events.h.

#define EV_GT_IDLE   (EV_MAXPLUS1 - EV_CURSOR)

Definition at line 51 of file events.h.

#define EV_IDLE   (1<<0) /* 1 - non-event */

Definition at line 31 of file events.h.

#define EV_MAG_GONE   (1<<4) /* 16 - magnifier gone while being drawn */

Definition at line 35 of file events.h.

#define EV_MAG_MOVE   (1<<3) /* 8 - magnifier moved */

Definition at line 34 of file events.h.

#define EV_MAXPLUS1   (1<<17) /* 131072 - marker for highest element */

Definition at line 48 of file events.h.

#define EV_NEWDOC   (1<<15) /* 32768 - new dvi file requested */

Definition at line 46 of file events.h.

#define EV_NEWPAGE   (1<<12) /* 4096 - new page requested */

Definition at line 43 of file events.h.

#define EV_NOWAIT   EV_GE_IDLE

Definition at line 65 of file events.h.

#define EV_PAGEHIST_INSERT   (1<<11) /* 2048 - get page from file history */

Definition at line 42 of file events.h.

#define EV_PS_TOGGLE   (1<<13) /* 8192 - PostScript toggled on or off */

Definition at line 44 of file events.h.

#define EV_RELOAD   (1<<14) /* 16384 - reload dvi file */

Definition at line 45 of file events.h.

#define EV_SRC   (1<<6) /* 64 - source special operation is pending */

Definition at line 37 of file events.h.

#define EV_TERM   (1<<16) /* 65536 - quit */

Definition at line 47 of file events.h.


Typedef Documentation

typedef void(* childProcT)(int exitval, struct xchild *this)

Definition at line 83 of file events.h.

typedef void(* home_proc)(wide_bool)

Definition at line 152 of file events.h.

typedef enum xtimerT_ xtimerT

Enumeration Type Documentation

Enumerator:
TEXT_SEL_MOVE 
TEXT_SEL_CLEAR 
TEXT_SEL_REDRAW 
TEXT_SEL_ERASE 

Definition at line 203 of file events.h.

enum xtimerT_
Enumerator:
XTM_DEFAULT 
XTM_STATUSLINE 
XTM_HREF 

Definition at line 102 of file events.h.


Function Documentation

void Act_back_page ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 1507 of file events.c.

{
    int arg;
    Boolean clear_statusline = False;
    
    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg))
       arg = 1;
    else
       clear_statusline = True;
    
    arg = current_page - arg;

    if (current_page == 0) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT, "First page of DVI file");
       return;
    }

    goto_page(check_goto_page(arg), resource.keep_flag ? NULL : home, False);
    if (clear_statusline)
       statusline_clear();
    search_signal_page_changed();
}

Here is the call graph for this function:

void Act_forward_page ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 1467 of file events.c.

{
    int arg;
    Boolean clear_statusline = False;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg))
       arg = 1;
    else
       clear_statusline = True;
    
    arg += current_page;

    if (arg == current_page) { /* zero argument -> redraw page */
       globals.src.fwd_box_page = -1;
       search_reset_info();
       globals.ev.flags |= EV_NEWPAGE;
       XFlush(DISP);
       statusline_print(STATUS_SHORT, "Page redrawn.");
       return;
    }
    else if (current_page >= total_pages - 1) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT, "Last page of DVI file");
       return;
    }
    
    goto_page(check_goto_page(arg), resource.keep_flag ? NULL : home, False);
    if (clear_statusline)
       statusline_clear();
    search_signal_page_changed();
}

Here is the call graph for this function:

void Act_htex_back ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 2761 of file events.c.

{
    UNUSED(w);
    UNUSED(event);
    UNUSED(params);
    UNUSED(num_params);

    if (block_this_mouse_event())
       return;
    
    htex_back();
}

Here is the call graph for this function:

void Act_htex_forward ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 2776 of file events.c.

{
    UNUSED(w);
    UNUSED(event);
    UNUSED(params);
    UNUSED(num_params);

    if (block_this_mouse_event())
       return;
    
    htex_forward();
}

Here is the call graph for this function:

void Act_pagehistory_back ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 5550 of file events.c.

{
    int arg;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg)) {
       arg = 1;
    }
    page_history_move(-arg);
}

Here is the call graph for this function:

void Act_pagehistory_clear ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 5582 of file events.c.

{
    UNUSED(w);
    UNUSED(event);
    UNUSED(params);
    UNUSED(num_params);

    if (block_this_mouse_event())
       return;
    
    page_history_clear();
}

Here is the call graph for this function:

void Act_pagehistory_delete_backward ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 5595 of file events.c.

{
    int arg;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg)) {
       arg = 1;
    }
    page_history_delete(-arg);
}

Here is the call graph for this function:

void Act_pagehistory_delete_forward ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 5611 of file events.c.

{
    int arg;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg)) {
       arg = 1;
    }
    page_history_delete(arg);
}

Here is the call graph for this function:

void Act_pagehistory_forward ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 5566 of file events.c.

{
    int arg;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg)) {
       arg = 1;
    }
    page_history_move(arg);
}

Here is the call graph for this function:

void Act_recent_files ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 1412 of file events.c.

{
    UNUSED(w);
    UNUSED(event);
    UNUSED(params);
    UNUSED(num_params);
}

Here is the caller graph for this function:

void Act_ruler_mode ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 3534 of file events.c.

{
    char *ptr;
    
    UNUSED(w);
    UNUSED(params);
    UNUSED(num_params);

    if (block_this_mouse_event())
       return;

    if ((ptr = btn1_no_magnifier_binding()) != NULL) {
       XBell(DISP, 0);
       statusline_print(STATUS_MEDIUM,
                      "Cannot switch modes: Action list for Btn1Down (%s) "
                      "does not contain magnifier() action.", ptr);
       return;
    }
    
    if (resource.mouse_mode == MOUSE_RULER_MODE) {
       resource.mouse_mode++;
       if (resource.mouse_mode >= MOUSE_MAX_MODE)
           resource.mouse_mode = MOUSE_MAGNIFIER_MODE;
    }
    else
       resource.mouse_mode = MOUSE_RULER_MODE;
    
    if (resource.mouse_mode == MOUSE_RULER_MODE) {
       XDefineCursor(DISP, CURSORWIN, globals.cursor.rule);
       statusline_print(STATUS_SHORT, "Ruler mode on; use Mouse-1 to set/drag ruler");
       show_ruler(event);
       show_distance_from_ruler(event, False);
    }
    else {
       if (globals.cursor.flags & CURSOR_LINK) {
           XDefineCursor(DISP, CURSORWIN, globals.cursor.link);
       }
       else {
           XDefineCursor(DISP, CURSORWIN, globals.cursor.ready);
       }
       statusline_print(STATUS_SHORT, "Ruler mode off");
       clear_ruler();
       mouse_motion = mouse_release = null_mouse;
    }
#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&resource.mouse_mode, Act_switch_mode, check_int);
#else
    toggle_menu(resource.mouse_mode, Act_switch_mode);
#endif /* NEW_MENU_CREATION || MOTIF */
}

Here is the call graph for this function:

void Act_set_expert_mode ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 3771 of file events.c.

{
    int arg;
    Boolean clear_statusline = False;

    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    if (!get_int_arg(params, num_params, &arg))
       arg = -1;
    else
       clear_statusline = True;
    
    switch(arg) {
    case 1:
       resource.expert_mode ^= XPRT_SHOW_STATUSLINE;
       toggle_statusline();
       update_expert_mode();
       break;
    case 2:
#ifndef MOTIF
       /* show this warning only when not toggling global expert mode
          (that's why it can't be inside toggle_scrollbars) */
       if (BROKEN_RECONFIG) {
           popup_message(globals.widgets.top_level,
                       MSG_WARN,
                       NULL,
                       "Sorry - cannot toggle scrollbars with this X Version.\n"
                       "This version of XFree has a broken implementation of the viewportWidget, "
                       "which would break the layout if the scrollbars are toggled. "
                       "Versions that are known to work have a VendorRelease version below 4000 or above 4002. "
                       "You will need to update your XFree server to fix this.");
           return;
       }
#endif
       resource.expert_mode ^= XPRT_SHOW_SCROLLBARS;
       toggle_scrollbars();
       update_expert_mode();
       break;
       
#ifdef MOTIF
    case 3:
       resource.expert_mode ^= XPRT_SHOW_PAGELIST;
       toggle_pagelist();
       update_expert_mode();
       break;
       
    case 4: /* toolbar */
       resource.expert_mode ^= XPRT_SHOW_TOOLBAR;
       toggle_toolbar();
       update_expert_mode();
       break;
       
    case 5:
       resource.expert_mode ^= XPRT_SHOW_MENUBAR;
       toggle_menubar();
       update_expert_mode();
       break;
#else
    case 3:
/*     fprintf(stderr, "sidebar\n"); */
       resource.expert_mode ^= XPRT_SHOW_BUTTONS;
       toggle_buttons();
       update_expert_mode();
       break;
#endif
    default:
       /* warn 'em */
       if (
#ifdef MOTIF
           arg > 5
#else
           arg > 3
#endif
           ) {
           statusline_print(STATUS_SHORT, "Number %d too large for `set-expert-mode', using 0 (= toggle) instead.",
                          arg);
       }
       /* toggle all items */
       resource.expert = !resource.expert;
       if (resource.expert)
           resource.expert_mode = XPRT_SHOW_NONE;
       else
           resource.expert_mode = XPRT_SHOW_ALL;
       
       toggle_statusline();
#ifndef MOTIF
       if (!BROKEN_RECONFIG)
           toggle_scrollbars();
#else
       toggle_scrollbars();
#endif
       
#ifdef MOTIF
       toggle_pagelist();
       toggle_toolbar();
       toggle_menubar();
#else
       toggle_buttons();
#endif
    }

#ifdef MOTIF
    update_preferences_expert();
#endif

    store_preference(NULL, "expertMode", "%d", resource.expert_mode);
    
    if (clear_statusline)
       statusline_clear();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Act_set_keep_flag ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 1760 of file events.c.

{
    if (block_this_mouse_event())
       return;
    
    UNUSED(event);
    UNUSED(w);
    
    if (*num_params == 0) {
       if (m_have_arg) {
           resource.keep_flag = (m_number != 0);
           m_have_arg = False;
           m_number = 0;
           m_sign = 1;
       }
       else {
           resource.keep_flag = !resource.keep_flag;
       }
    }
    else
       resource.keep_flag = (**params == 't'
                           ? !resource.keep_flag : atoi(*params));
    if (resource.keep_flag) {
       statusline_print(STATUS_SHORT, "Keeping position when switching pages");
    }
    else {
       statusline_print(STATUS_SHORT,
                      "Not keeping position when switching pages");
    }

    store_preference(NULL, "keepPosition", "%s", resource.keep_flag ? "True" : "False");
    
#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&resource.keep_flag, Act_set_keep_flag, check_toggle);
#else
    toggle_menu(resource.keep_flag,  Act_set_keep_flag);
#endif /* NEW_MENU_CREATION */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Act_set_shrink_factor ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 2182 of file events.c.

{
    int arg;
    /* Set a limit to the shrink factors allowed; otherwise xdvi may
       consume a lot of memory (even run out of memory in malloc) in
       the allocation for the subpixel lookup table pixeltbl,
       dvi-draw.c. The `correct' solution would be to recognize that at a
       certain shrink, the only pixel for a character will be always
       set to `on' anyway, so that we could do without the lookup table for
       very large shrink factors ... */
    static const int SHRINK_MAX = 999;
     
    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    warn_num_params("set-shrink-factor()", params, *num_params, 1);

    if (*num_params > 0) {
       if (**params == 'a')
           arg = shrink_to_fit();
       else if (**params == '-')
           arg = mane.shrinkfactor + 1;
       else if (**params == '+')
           arg = mane.shrinkfactor - 1;
       else
           arg = atoi(*params);
    }
    else if (!get_prefix_arg(&arg)) {
       arg = shrink_to_fit();
    }

    if (arg <= 0) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT,
                      "No more enlarging possible");
       return;
    }
    
    if (arg > SHRINK_MAX) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT,
                      "Shrink factor %d too large (maximum: %d)", arg, SHRINK_MAX);
       return;
    }
    
    /* SU: added clearing the window here, else old window content
       will survive changing shrink
    */
    if (globals.pausing.flag) {
       XClearWindow(DISP, mane.win);
    }
    
    statusline_print(STATUS_SHORT, "shrink factor: %d", arg);
#if 0
    /* Uncommented this, otherwise selecting `shrink to fit' with same value as
       current mane.shrinkfactor will clear the canvas (only fixed by changing shrink
       factor again). That bug is also present in xdvik-22.48-alpha3. */
    if (arg == mane.shrinkfactor) {
       return;
    }
#endif

    do_set_shrinkfactor(arg, True);

#if MOTIF    
    /* note: mustn't do that inside do_set_shrinkfactor(),
       or we get into an endless loop! */
    update_preferences_shrink();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Act_shrink_to_dpi ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 2258 of file events.c.

{
    int arg, arg_bak;
    Boolean clear_statusline = False;
    
    if (block_this_mouse_event())
       return;
    
    UNUSED(w);
    UNUSED(event);

    warn_num_params("shrink-to-dpi()", params, *num_params, 1);
    
    if (!get_int_arg(params, num_params, &arg))
       arg = 0;
    else
       clear_statusline = True;
    
    arg_bak = arg;
    
    if (arg > 0)
       arg = (double)resource.pixels_per_inch / arg + 0.5;

    if (arg <= 0) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT,
                      "shrink-to-dpi requires a positive argument");
       return;
    }

    /* like elsewhere */
    if (globals.pausing.flag) {
       XClearWindow(DISP, mane.win);
    }
#if 0
    /* Uncommented this, otherwise selecting `shrink to fit' with same value as
       current mane.shrinkfactor will clear the canvas (only fixed by changing shrink
       factor again). That bug is also present in xdvik-22.48-alpha3. */
    if (arg == mane.shrinkfactor)
       return;
#endif
    do_set_shrinkfactor(arg, True);

#if MOTIF    
    /* note: mustn't do that inside do_set_shrinkfactor(),
       or we get into an endless loop! */
    update_preferences_shrink();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Act_switch_mode ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 3203 of file events.c.

{
    mouseModeT prev_mode = resource.mouse_mode;
    int arg = -1;
    char *ptr;
    
    if (block_this_mouse_event())
       return;
    
    UNUSED(w);

    if ((ptr = btn1_no_magnifier_binding()) != NULL) {
       XBell(DISP, 0);
       statusline_print(STATUS_MEDIUM,
                      "Cannot switch modes: Action list for Btn1Down (%s) "
                      "does not contain magnifier() action.", ptr);
       return;
    }
    
/*      fprintf(stderr, "prev mode: %d\n", prev_mode); */
    
    if (get_int_arg(params, num_params, &arg)) {
       if (arg < MOUSE_MAGNIFIER_MODE || arg >= MOUSE_MAX_MODE) {
           statusline_print(STATUS_SHORT, "Argument for Act_switch_mode outside of range from %d to %d",
                          MOUSE_MAGNIFIER_MODE, MOUSE_MAX_MODE - 1);
           resource.mouse_mode++;
       }
       else
           resource.mouse_mode = (mouseModeT)arg;
    }
    else
       resource.mouse_mode++;

    /* check if wrapped */
    if (resource.mouse_mode >= MOUSE_MAX_MODE)
       resource.mouse_mode = MOUSE_MAGNIFIER_MODE;

    /* undo effects of previous mode */
    switch (prev_mode) {
    case MOUSE_RULER_MODE:
       clear_ruler();
       mouse_motion = mouse_release = null_mouse;
       break;
    case MOUSE_TEXT_MODE:
       text_change_region(TEXT_SEL_CLEAR, NULL);
       mouse_motion = mouse_release = null_mouse;
       break;
    default: /* magnifier, nothing to do */
           break;
    }
    
    if (resource.mouse_mode == MOUSE_RULER_MODE) {
       XDefineCursor(DISP, CURSORWIN, globals.cursor.rule);
       statusline_print(STATUS_SHORT, "Ruler mode; click Mouse-1 to set ruler");
       show_ruler(event);
       show_distance_from_ruler(event, False);
    }
    else if (resource.mouse_mode == MOUSE_TEXT_MODE) {
       statusline_print(STATUS_SHORT, "Text selection mode; click and drag Mouse-1 to select a region");
    }
    else { /* default: MOUSE_MAGNIFIER_MODE */
       statusline_print(STATUS_SHORT, "Magnifier mode; click Mouse-1 to magnify text");
       mouse_motion = mouse_release = null_mouse;
    }
    
    globals.ev.flags |= EV_CURSOR;
    XFlush(DISP);
    
#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&resource.mouse_mode, Act_switch_mode, check_int);
#else
    toggle_menu(resource.mouse_mode, Act_switch_mode);
#endif /* NEW_MENU_CREATION */
    store_preference(NULL, "mouseMode", "%d", resource.mouse_mode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Act_use_tex_pages ( Widget  w,
XEvent *  event,
String params,
Cardinal *  num_params 
)

Definition at line 1422 of file events.c.

{
    UNUSED(w);
    UNUSED(event);

    if (block_this_mouse_event())
       return;
    
    if (*num_params == 0) {
       if (m_have_arg) {
           resource.use_tex_pages = (m_number != 0);
           m_have_arg = False;
           m_number = 0;
           m_sign = 1;
       }
       else {
           resource.use_tex_pages = !resource.use_tex_pages;
       }
    }
    else
       resource.use_tex_pages = (**params == 't' ? !resource.use_tex_pages : atoi(*params));
    
    if (resource.use_tex_pages) {
       statusline_print(STATUS_SHORT, "Using TeX page numbers for \"g\", goto-page()");
    }
    else {
       statusline_print(STATUS_SHORT, "Using physical page numbers for \"g\", goto-page()");
    }

    store_preference(NULL, "useTeXPages", "%s", resource.use_tex_pages ? "True" : "False");
    
#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&resource.use_tex_pages, Act_use_tex_pages, check_toggle);
#else
#ifdef MOTIF
   set_use_tex_option();
#else
    toggle_menu(resource.use_tex_pages,  Act_use_tex_pages);
#endif
#endif /* NEW_MENU_CREATION */
    refresh_pagelist(total_pages, current_page);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int atopix ( const char *  ,
Boolean   
)

Definition at line 1106 of file xdvi.c.

{
    int len = strlen(arg);
    const char *arg_end = arg;
    char tmp[11];
    double factor;

    if (allow_minus && *arg_end == '-')
       ++arg_end;
    while ((*arg_end >= '0' && *arg_end <= '9') || *arg_end == '.')
       if (arg_end >= arg + XtNumber(tmp) - 1)
           return 0;
       else
           ++arg_end;
    memcpy(tmp, arg, arg_end - arg);
    tmp[arg_end - arg] = '\0';

#if A4
    factor = 1.0 / 2.54;    /* cm */
#else
    factor = 1.0;    /* inches */
#endif
    if (len > 2)
       switch (arg[len - 2] << 8 | arg[len - 1]) {
#if A4
       case 'i' << 8 | 'n':
           factor = 1.0;
           break;
#else
       case 'c' << 8 | 'm':
           factor = 1.0 / 2.54;
           break;
#endif
       case 'm' << 8 | 'm':
           factor = 1.0 / 25.4;
           break;
       case 'p' << 8 | 't':
           factor = 1.0 / 72.27;
           break;
       case 'p' << 8 | 'c':
           factor = 12.0 / 72.27;
           break;
       case 'b' << 8 | 'p':
           factor = 1.0 / 72.0;
           break;
       case 'd' << 8 | 'd':
           factor = 1238.0 / 1157.0 / 72.27;
           break;
       case 'c' << 8 | 'c':
           factor = 12 * 1238.0 / 1157.0 / 72.27;
           break;
       case 's' << 8 | 'p':
           factor = 1.0 / 72.27 / 65536;
           break;
       }

    return factor * atof(tmp) * resource.pixels_per_inch + 0.5;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 310 of file events.c.

Here is the caller graph for this function:

Definition at line 315 of file events.c.

                             {
    if (m_block_mouse_event == True) {
       m_block_mouse_event = False;
       return True;
    }
    return False;
}
void cancel_timer ( struct xtimer tp)

Definition at line 4587 of file events.c.

{
    struct xtimer    **tpp;

    if (globals.debug & DBG_EVENT)
       show_timers("beginning of cancel_timer");
    
    if (timers == NULL) {
       fprintf(stderr, "%s:%d: BUG? timers == NULL!\n", __FILE__, __LINE__);
       return;
    }

    if (globals.debug & DBG_EVENT)
       fprintf(stderr, "%s:%d: cancel_timer %p from %p\n", __FILE__, __LINE__, (void *)&timers, (void *)tp);

    ASSERT(timers != NULL, "timers in cancel_timer() mustn't be NULL");
    for (tpp = &timers; ; ) {             /* remove from list */
       
       if (*tpp == tp)
           break;
       tpp = &(*tpp)->next;
    }

    *tpp = (*tpp)->next;    /* unlink it */

    if (timers == NULL) {   /* cancel SIGALRM */
       itv.it_value.tv_sec = itv.it_value.tv_usec = 0;
       setitimer(ITIMER_REAL, &itv, NULL);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int check_goto_page ( int  pageno)

Definition at line 943 of file events.c.

{
    int retval;
    if (pageno < 0) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT, "Can't go to page %d, going to first page instead", pageno + 1);
       retval = 0;
    }
    else if (pageno >= total_pages) {
       XBell(DISP, 0);
       statusline_print(STATUS_SHORT,
                      "Can't go to page %d, going to last page (%d) instead",
                      pageno + 1, total_pages);
       retval = total_pages - 1;
    }
    else
       retval = pageno;

    page_history_insert(retval);
    return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void clear_chld ( struct xchild )

Definition at line 4283 of file events.c.

{
    struct xchild    **cpp;
    struct xchild    *cp2;

    if (child_recs == NULL) {
       if (globals.debug & DBG_EVENT)
           fprintf(stderr, "child_recs: %p\n", (void *)child_recs);
       return;
    }
    for (cpp = &child_recs;;) {
       cp2 = *cpp;
       if (cp2 == cp)
           break;
       cpp = &cp2->next;
    }
    *cpp = cp->next;
}

Here is the call graph for this function:

void clear_io ( struct xio )

Definition at line 4404 of file events.c.

{
    struct xio       **ipp;

    for (ipp = &iorecs;;) {
       struct xio *ip2;

       ip2 = *ipp;
       if (ip2 == ip) break;
       ipp = &ip2->next;
    }
    *ipp = ip->next;

#if HAVE_POLL
    --num_fds;
    io_dirty = True;
#else
# if FLAKY_SIGPOLL
    numfds = ConnectionNumber(DISP);
# else
    numfds = (event_freq < 0 ? -1 : ConnectionNumber(DISP));
# endif
    for (ip = iorecs; ip != NULL; ip = ip->next)
       if (ip->fd > numfds)
           numfds = ip->fd;
    ++numfds;
#endif /* !HAVE_POLL */
}

Here is the caller graph for this function:

void clearexpose ( struct WindowRec windowrec,
int  x,
int  y,
unsigned  w,
unsigned  h 
)

Definition at line 545 of file events.c.

{
    XClearArea(DISP, windowrec->win, x, y, w, h, False);
    expose(windowrec, x, y, w, h);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct xdvi_action* compile_action ( const char *  str) [read]

Definition at line 577 of file events.c.

{
    const char *p, *p1, *p2;
    XtActionsRec *actp;
    struct xdvi_action *ap;

    while (*str == ' ' || *str == '\t')
       ++str;

    if (*str == '\0' || *str == '\n')
       return NULL;

    p = str;

    /* find end of command name */
    while (isalnum((int)*p) || *p == '-' || *p == '_')
       ++p;

    for (actp = m_actions; ; ++actp) {
       if (actp >= m_actions + XtNumber(m_actions)) {
           const char *tmp = strchr(str, '\0');
           if (tmp == NULL) {
              tmp = p;
           }
           XDVI_WARNING((stderr, "Cannot compile action \"%.*s\".", (int)(tmp - str), str));

           return NULL;
       }
       if (memcmp(str, actp->string, p - str) == 0 && actp->string[p - str] == '\0')
           break;
    }

    while (*p == ' ' || *p == '\t')
       ++p;
    if (*p != '(') {
       while (*p != '\0' && *p != '\n')
           ++p;
       XDVI_WARNING((stderr, "Syntax error in action %.*s.", (int)(p - str), str));

       return NULL;
    }
    ++p;
    while (*p == ' ' || *p == '\t')
       ++p;
    for (p1 = p;; ++p1) {
       if (*p1 == '\0' || *p1 == '\n') {
           XDVI_WARNING((stderr, "Syntax error in action %.*s.", (int)(p1 - str), str));
           return NULL;
       }
       if (*p1 == ')')
           break;
    }

    ap = xmalloc(sizeof *ap);
    ap->proc = actp->proc;
    for (p2 = p1;; --p2) {
       if (p2 <= p) {       /* if no args */
           ap->num_params = 0;
           ap->param = NULL;
           break;
       }
       else if (p2[-1] != ' ' && p2[-1] != '\t') {
           char *arg;

           arg = xmalloc(p2 - p + 1);
           memcpy(arg, p, p2 - p);
           arg[p2 - p] = '\0';
           ap->num_params = 1;
           ap->param = arg;
           break;
       }
    }
    
    ap->next = compile_action(p1 + 1);

    return ap;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5268 of file events.c.

{
    if (globals.debug & DBG_BATCH) {
       
       (void)read_events(EV_GT_IDLE);
       for (current_page = 0; current_page < total_pages; ++current_page) {
           if (resource.keep_flag) {
              home_action = NULL;
           }
           else {
              home_action = home;
           }
           globals.warn_spec_now = resource.warn_spec;
#if PS_GS
           for (;;) {
              redraw_page();
              (void) read_events(EV_NOWAIT);
              if (!(globals.ev.flags & (EV_NEWPAGE | EV_NEWDOC | EV_RELOAD)))
                  break;
              globals.ev.flags = EV_IDLE;
           }
#else
           redraw_page();
#endif
       }
       xdvi_exit(EXIT_SUCCESS);
    }
    else {
       for (;;) {    /* normal operation */
           (void) read_events(EV_GT_IDLE);
           TRACE_EVENTS((stderr, "globals.ev.flags: %d; ev_newpage: %d, ev_newdoc: %d, ev_reload: %d\n",
                       globals.ev.flags, EV_NEWPAGE, EV_NEWDOC, EV_RELOAD));
           /* NOTE: reloading must be checked first! */
           if (globals.ev.flags & (EV_NEWPAGE | EV_NEWDOC | EV_RELOAD | EV_PS_TOGGLE)) {
              TRACE_EVENTS((stderr, "EV_NEWPAGE | ..."));
              globals.ev.flags &= ~(EV_NEWPAGE | EV_EXPOSE | EV_PS_TOGGLE);
              if (globals.ev.flags & EV_RELOAD) {
                  dviErrFlagT errflag;

                  globals.ev.flags &= ~EV_RELOAD;
                  if (load_dvi_file(True, &errflag)) {
#if PS
                     ps_clear_cache();
#if PS_GS
                     if (resource.gs_alpha) {
                         /* restart gs so that user has a method for fixing GS artifacts with gs_alpha
                            by using `reload' (see also GS_PIXMAP_CLEARING_HACK) */
                         ps_destroy();
                     }
#endif
#endif
                     statusline_print(STATUS_SHORT, "File reloaded.");
                  }
/*                else { */
/*                   statusline_print(STATUS_MEDIUM, "File corrupted, not reloading."); */
/*                } */
              }
              if (globals.ev.flags & EV_NEWDOC) {
                  dviErrFlagT errflag;
                  TRACE_EVENTS((stderr, "EV_NEWDOC!"));
/*                fprintf(stderr, "newdoc!\n"); */
                  TRACE_FILES((stderr, "current page: %d", current_page));
/*                file_history_set_page(current_page); */
                  globals.ev.flags &= ~EV_NEWDOC;
                  if (load_dvi_file(True, &errflag)) {
                     statusline_append(STATUS_SHORT, "Opened ", "Opened \"%s\"", globals.dvi_name);
/*                   statusline_print(STATUS_SHORT, "Opened \"%s\"", globals.dvi_name); */
                     TRACE_FILES((stderr, "Adding to history: |%s|\n", globals.dvi_name));
                     if (file_history_push(globals.dvi_name)) { /* it's a new file, add to history */
                         TRACE_FILES((stderr, "New entry!"));
                         filehist_menu_add_entry(globals.dvi_name);
                     }
                     else { /* only need to move existing elements to new positions */
                         TRACE_FILES((stderr, "Existing entry!\n"));
                         filehist_menu_refresh();
                     }
                  }
              }

              can_exposures(&mane);
              can_exposures(&magnifier);

#if PS && PS_GS && GS_PIXMAP_CLEARING_HACK
              if (had_ps_specials && !MAGNIFIER_ACTIVE) {
                  erasepage_gs();
                  had_ps_specials = False;
              }
#endif /* PS && PS_GS && GS_PIXMAP_CLEARING_HACK */

              if (globals.dvi_file.bak_fp != NULL) {
                  TRACE_EVENTS((stderr, "redraw_page()"));
                  redraw_page();
              }
              else {
                  TRACE_EVENTS((stderr, "dvi_file_changed()"));
                  (void)dvi_file_changed();
              }
           }
           else if (globals.ev.flags & EV_FILEHIST_GOTO_PAGE) {
              int pageno;
              globals.ev.flags &= ~EV_FILEHIST_GOTO_PAGE;
              pageno = file_history_get_page();
              goto_page(pageno, resource.keep_flag ? NULL : home, False);
              TRACE_FILES((stderr, "got page: %d", pageno));
           }
           else if (globals.ev.flags & EV_PAGEHIST_INSERT) {
              globals.ev.flags &= ~EV_PAGEHIST_INSERT;
              page_history_insert(current_page);
           }
           else if (globals.ev.flags & EV_FIND_CANCEL) {
              /* NOTE: This must be done before checking for expose() */
              globals.ev.flags &= ~EV_FIND_CANCEL;
           }
           else if (globals.ev.flags & EV_ANCHOR) {
              /*
               * Similar to forward search: search for a htex anchor.
               * This needs to come before the next case which does the redraw_page(),
               * otherwise anchors for the current page might not be drawn at all:
               * anchor_search() sets the info later used by htex_draw_anchormarkers(),
               * which is invoked by redraw_page().
               */
              
              /* switch off the link cursor */
              globals.cursor.flags &= ~CURSOR_LINK;

              if (dvi_file_changed())
                  continue;
              
              anchor_search(g_anchor_pos);
              globals.ev.flags &= ~EV_ANCHOR;
           }
           else if (globals.ev.flags & EV_SRC) {
              /*
               * Source special operations are deferred to here because
               * they call geom_scan(), which may call define_font(),
               * which may call makefont(), which may call read_events()
               * recursively.
               */
              if (globals.src.fwd_string != NULL) {
                  const char *s = globals.src.fwd_string;

                  if (dvi_file_changed())
                     continue;
                  
                  source_forward_search(s);
                  globals.ev.flags &= ~EV_SRC;
                  globals.src.fwd_string = NULL;

                  /* de-iconify window if needed, and raise it */
                  XMapRaised(XtDisplay(globals.widgets.top_level), XtWindow(globals.widgets.top_level));
                  raise_message_windows();
              }
              else if (source_reverse_x != -1) {
                  if (dvi_file_changed())
                     continue;
                  
                  source_reverse_search(source_reverse_x, source_reverse_y, True);
                  globals.ev.flags &= ~EV_SRC;
              }
              else {
                  source_special_show(source_show_all);
                  globals.ev.flags &= ~EV_SRC;
              }
           }
           /* support for `-findstring' */
           else if (globals.ev.flags & EV_FIND) {
              if (dvi_file_changed())
                  continue;

              if (resource.find_string != NULL) { /* not first call */
                  dvi_find_string(resource.find_string, False);
                  resource.find_string = NULL;
              }
              else { /* actually should never arrive here?? */
                  dvi_find_string(NULL, True);
              }
              globals.ev.flags &= ~EV_FIND;
           }
           else if (globals.ev.flags & EV_MAG_MOVE) {
              MYTRACE((stderr, "moving mag!"));
              move_magnifier();
           }
           else if (globals.ev.flags & EV_EXPOSE) {
              if (magnifier.min_x < MAXDIM) {
/*                fprintf(stderr, "magnifier < maxdim!\n"); */
                  if (mane.min_x >= MAXDIM) {
/*                   fprintf(stderr, "mane >= maxdim!\n"); */
                     globals.ev.flags &= ~EV_EXPOSE;
                  }
                  redraw(&magnifier);
              }
              else {
                  /* see comment in mag.c */
                  globals.ev.flags &= ~EV_EXPOSE;
                  if (mane.min_x < MAXDIM) {
                     redraw(&mane);
                  }
              }
           }
           else if (globals.ev.flags & EV_CURSOR) {
              /*
               * This code eliminates unnecessary calls to XDefineCursor,
               * since this is a slow operation on some hardware (e.g., S3
               * chips).
               */
              XSync(DISP, False);
              if (!XtPending()) {
                  Cursor curr;
                     
                  if (globals.cursor.flags & CURSOR_DRAG_V)
                     curr = globals.cursor.drag_v;
                  else if (globals.cursor.flags & CURSOR_DRAG_H)
                     curr = globals.cursor.drag_h;
                  else if (globals.cursor.flags & CURSOR_DRAG_A)
                     curr = globals.cursor.drag_a;
                  else if (resource.mouse_mode == MOUSE_RULER_MODE)
                     curr = globals.cursor.rule;
                  else if (resource.mouse_mode == MOUSE_TEXT_MODE && !(globals.cursor.flags & CURSOR_LINK))
                     curr = globals.cursor.text;
                  else if (globals.cursor.flags & CURSOR_LINK)
                     curr = globals.cursor.link;
                  else if (globals.cursor.flags & CURSOR_MAG)
                     curr = globals.cursor.mag;
                  else if (globals.cursor.flags & CURSOR_CORRUPTED)
                     curr = globals.cursor.corrupted;
                  else if (globals.pausing.flag)
                     curr = globals.cursor.pause;
                  else
                     curr = globals.cursor.ready;
                  XDefineCursor(DISP, CURSORWIN, curr);
                  globals.ev.flags &= ~EV_CURSOR;
              }
           }
           XFlush(DISP);
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_set_density ( double  newgamma,
Boolean  force,
Boolean  update_resource 
)

Definition at line 2310 of file events.c.

{
    
    /* like elsewhere */
    if (globals.pausing.flag) {
       XClearWindow(DISP, mane.win);
    }

#ifdef GREY
    if (resource.use_grey) {
       if (newgamma == resource.gamma && !force) {
           statusline_print(STATUS_SHORT, "density value: %.3f", newgamma);
           return;
       }
       resource.gamma = newgamma;
       if (update_resource)
           globals.curr_gamma = resource.gamma;
       
#if COLOR
       fg_active = NULL;
       reset_colors();
#else
       init_pix();
       if (G_visual->class != TrueColor) {
           return;
       }
       reset_fonts();
#endif /* COLOR */
       statusline_print(STATUS_SHORT, "density value: %.3f", newgamma);
    } else
#endif /* GREY */
    {
       reset_fonts();
       if (mane.shrinkfactor == 1) {
           statusline_print(STATUS_SHORT,
                  "set-density ignored at magnification 1");
           return;
       }
       statusline_print(STATUS_SHORT, "density value: %.3f", newgamma);
    }

    store_preference(NULL, "gamma", "%f", resource.gamma);

    globals.ev.flags |= EV_NEWPAGE;
    XFlush(DISP);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_set_shrinkfactor ( int  arg,
Boolean  set_resource 
)

Definition at line 2132 of file events.c.

{
    static int shrink_bak = -1;
    
    /* We don't store this as preference since it may affect initial window geometry. */
    /*  store_preference(NULL, "shrinkFactor", "%d", arg); */
    
    if (resource.mouse_mode == MOUSE_TEXT_MODE) {
       text_change_region(TEXT_SEL_CLEAR, NULL);
    }
    
    mane.shrinkfactor = arg;
    if (set_resource)
       resource.shrinkfactor = mane.shrinkfactor;
    
#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&arg, Act_set_shrink_factor, check_int);
#if HAVE_XMP
    tb_set_zoom_sensitivity(arg != 1);
#endif
#else
    toggle_menu(arg, Act_set_shrink_factor);
#endif /* NEW_MENU_CREATION */
    if (arg != 1 && arg != shrink_bak) {
       shrink_bak = arg;
#if GREY
#if COLOR
       if (resource.use_grey)
           fg_active = NULL;
#else 
       if (resource.use_grey)
           init_pix();
#endif
#endif /* GREY */
       reset_fonts();
    }
    init_page();
    reconfig();

    htex_resize_page();

    /* this seems unneccessary */
/*     if (!resource.keep_flag) */
/*     home(False); */

    globals.ev.flags |= EV_NEWPAGE;
    XFlush(DISP);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void do_toggle_color ( Boolean  update_resource)

Definition at line 2901 of file events.c.

{
    MYTRACE((stderr, "dragging selection? %d", mouse_motion == text_motion));
    return mouse_motion == text_motion;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void expose ( struct WindowRec windowrec,
int  x,
int  y,
unsigned int  w,
unsigned int  h 
)

Definition at line 528 of file events.c.

{
    if (windowrec->min_x > x)
       windowrec->min_x = x;
    if (windowrec->max_x < (int)(x + w))
       windowrec->max_x = x + w;
    if (windowrec->min_y > y)
       windowrec->min_y = y;
    if (windowrec->max_y < (int)(y + h))
       windowrec->max_y = y + h;

    globals.ev.flags |= EV_EXPOSE;
}

Here is the caller graph for this function:

XtActionsRec* get_actions ( void  )

Definition at line 475 of file events.c.

{
    return m_actions;
}

Here is the caller graph for this function:

Boolean get_int_arg ( String param,
Cardinal *  num_params,
int res 
)

Definition at line 1027 of file events.c.

{
    if (*num_params > 0) {
       *res = atoi(*param);
       return True;
    }
    else {
       if (get_prefix_arg(res)) { /* prefix argument? */
           return True;
       }
    }
    return False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 470 of file events.c.

{
    return XtNumber(m_actions);
}

Here is the caller graph for this function:

void goto_page ( int  page,
home_proc  proc,
Boolean  force 
)

Definition at line 1323 of file events.c.

{
    /* SU: added clearing the window here, else old window content
       will survive switching pages as long as globals.pausing.flag is active
       (i.e. when inadvertedly changing page instead of unpausing)
    */
    if (globals.pausing.flag) {
       XClearWindow(DISP, mane.win);
    }
           
    if (globals.dvi_file.bak_fp == NULL) {
       current_page = new_page; /* so that xdvi gets the page change */
       return;
    }

    ASSERT(new_page >= 0 && new_page < total_pages, "new_page in goto_page() out of range");   
    if (current_page != new_page || force) {
       globals.cursor.flags &= ~CURSOR_LINK; /* disable link cursor if needed */

       current_page = new_page;
       home_action = proc;
       globals.warn_spec_now = resource.warn_spec;
    /* this seems unneccessary */
/*     if (!resource.keep_flag) */
/*         home(False); */
#if defined(MOTIF) && HAVE_XPM
       tb_check_navigation_sensitivity(current_page);
/*     page_history_update_toolbar_navigation(); */
#endif
       maybe_scroll_pagelist(current_page, False);

       if (globals.pausing.num_save)
           globals.pausing.num = globals.pausing.num_save[new_page];
       else
           globals.pausing.num = 0;
       /* Control-L (and changing the page) clears this box */
       globals.src.fwd_box_page = -1;

       globals.ev.flags |= EV_NEWPAGE;
       XFlush(DISP);       
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_command ( Widget  widget,
XtPointer  client_data,
XtPointer  call_data 
)

Definition at line 656 of file events.c.

{
    struct xdvi_action *actp;

    UNUSED(call_data);

    /* call all actions registered for this event */
    for (actp = (struct xdvi_action *)client_data; actp != NULL; actp = actp->next) {
       if (globals.debug & DBG_EVENT)
           fprintf(stderr, "calling action with param: %s\n", actp->param);
       (actp->proc) (widget, NULL, &actp->param, &actp->num_params);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_expose ( Widget  ,
XtPointer  ,
XEvent *  ,
Boolean  
)

Definition at line 3941 of file events.c.

{
    struct WindowRec *windowrec = (struct WindowRec *)closure;

    UNUSED(w);
    UNUSED(cont);

    if (windowrec == &magnifier) {
       if (magnifier_stat < 0) { /* destroy upon exposure */
           magnifier_stat = 0;
           mag_release(ev);
           return;
       }
       else
           magnifier_stat = 0;
    }

    do_update_property = False;

    if (have_src_specials && !MAGNIFIER_ACTIVE) {
       do_update_property = True;
    }

    MYTRACE((stderr, "Expose!"));
    expose(windowrec, (&(ev->xexpose))->x, (&(ev->xexpose))->y,
          (unsigned int)(&(ev->xexpose))->width, (unsigned int)(&(ev->xexpose))->height);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_property_change ( Widget  ,
XtPointer  ,
XEvent *  ,
Boolean  
)

Definition at line 3971 of file events.c.

{
    char *prop_ret;
    size_t prop_len;

    UNUSED(w);
    UNUSED(junk);
    UNUSED(cont);

    if ((&(ev->xproperty))->window != XtWindow(globals.widgets.top_level)) /* if spurious event */
       return;
    
    if ((&(ev->xproperty))->atom == atom_src_goto()) {
       /* forward search requested */
       if ((prop_len = property_get_data(XtWindow(globals.widgets.top_level), atom_src_goto(),
                                     &prop_ret,
                                     XGetWindowProperty)) == 0) {
           TRACE_CLIENT((stderr, "property_get_data() failed for atom_src_goto()!"));
           return;
       }
       TRACE_CLIENT((stderr, "got back atom_src_goto: |%s|", prop_ret));
       globals.src.fwd_string = prop_ret;
       globals.ev.flags |= EV_SRC;
    }
    else if ((&(ev->xproperty))->atom == atom_find_string()) {
       /* string search requested */
       if ((prop_len = property_get_data(XtWindow(globals.widgets.top_level), atom_find_string(),
                                     &prop_ret,
                                     XGetWindowProperty)) == 0) {
           TRACE_CLIENT((stderr, "property_get_data() failed for atom_find_string()!"));
           return;
       }
       TRACE_FIND((stderr, "got back atom_find_string: |%s|", prop_ret));
       resource.find_string = prop_ret;
       globals.ev.flags |= EV_FIND;
    }
    else if ((&(ev->xproperty))->atom == atom_reload()) {
       /* like do_sigusr(); there's no data in this case. */
       TRACE_CLIENT((stderr, "atom_reload()"));
       globals.ev.flags |= EV_RELOAD;
    }
    else if ((&(ev->xproperty))->atom == atom_newdoc()) {
       /* loading a new file */
       FILE *new_fp;
       if ((prop_len = property_get_data(XtWindow(globals.widgets.top_level), atom_newdoc(),
                                     &prop_ret,
                                     XGetWindowProperty)) == 0) {
           TRACE_CLIENT((stderr, "property_get_data() returned zero length for atom_newdoc()"));
           /* just raise it in this case */
           XMapRaised(XtDisplay(globals.widgets.top_level), XtWindow(globals.widgets.top_level));
           raise_message_windows();
           return;
       }
       TRACE_CLIENT((stderr, "got back atom_newdoc: |%s|", prop_ret));
       if ((new_fp = XFOPEN(prop_ret, "r")) == NULL) {
           popup_message(globals.widgets.top_level,
                       MSG_ERR, NULL, "Loading %s failed: %s",
                       prop_ret, strerror(errno));
           return;
       }
       set_dvi_name_expand(prop_ret);
       /*FIXME: Here we would like to insert the first page of the new file
         into the page history:
         
         page_history_insert(0);
         
         However, if the commandline had been:
         xdvi -unique +5 file.dvi
         then the following property change will change to page 5 and insert
         page 5, so in this case two pages will be inserted by the xdvi invocation.
         I guess to fix this we'd need a bitmask instead of 2 atoms to set both
         features at the same time ...
       */
       globals.ev.flags |= EV_NEWDOC;
    }
    else if ((&(ev->xproperty))->atom == atom_newpage()) {
       /* jumping to a different page */
       int newpage;
       char *testptr;
       if ((prop_len = property_get_data(XtWindow(globals.widgets.top_level), atom_newpage(),
                                     &prop_ret,
                                     XGetWindowProperty)) == 0) {
           TRACE_CLIENT((stderr, "property_get_data() failed for atom_newpage(): |%s|", prop_ret));
           return;
       }
       TRACE_CLIENT((stderr, "got back atom_newpage: |%s|", prop_ret));
       if (strcmp(prop_ret, "+") == 0) { /* special case: treat `+' as last page */
           newpage = total_pages - 1;
       }
       else {
           newpage = strtol(prop_ret, &testptr, 10) - 1;
           if (*testptr != '\0') {
              XDVI_FATAL((stderr, "Invalid page number: `%s'.", prop_ret));
           }
       }

       if (newpage == total_pages - 1) { /* as in Act_goto_page() */
           goto_page(check_goto_page(newpage), resource.keep_flag ? NULL : home, False);
           search_signal_page_changed();
       }
       else {
           goto_page(check_goto_tex_page(newpage), resource.keep_flag ? NULL : home, False);
           search_signal_page_changed();
       }
    }
    else if ((&(ev->xproperty))->atom == atom_raise()) {
       XMapRaised(XtDisplay(globals.widgets.top_level), XtWindow(globals.widgets.top_level));
       raise_message_windows();
    }
    else if ((&(ev->xproperty))->atom == atom_reread_prefs()) {
       read_user_preferences(globals.widgets.top_level, ".xdvirc.tmp");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_resize ( Widget  ,
XtPointer  ,
XEvent *  ,
Boolean  
)

Definition at line 891 of file events.c.

{
    UNUSED(widget);
    UNUSED(junk);
    UNUSED(event);
    UNUSED(cont);
    
    resized = True;
#ifndef MOTIF
    handle_statusline_resize();
    handle_pagelist_resize();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_x_scroll ( Widget  w,
XtPointer  closure,
XEvent *  ev,
Boolean cont 
)

Definition at line 3891 of file events.c.

{
#ifndef MOTIF
    Dimension get_x = 0;
#endif

    UNUSED(w);
    UNUSED(closure);
    UNUSED(ev);
    UNUSED(cont);

    if (/* !resource.keep_flag || */ globals.widgets.x_bar == NULL)
       return;

#ifdef MOTIF
    XtVaGetValues(globals.widgets.x_bar, XmNvalue, &m_x_scroll, NULL);
#else
    get_xy();
    XtVaGetValues(globals.widgets.clip_widget, XtNx, &get_x, NULL);
    m_x_scroll = get_x - window_x;
    scroll_x_panner(m_x_scroll);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_y_scroll ( Widget  w,
XtPointer  closure,
XEvent *  ev,
Boolean cont 
)

Definition at line 3916 of file events.c.

{
#ifndef MOTIF
    Dimension get_y = 0;
#endif
    
    UNUSED(w);
    UNUSED(closure);
    UNUSED(ev);
    UNUSED(cont);
    
    if (/* !resource.keep_flag || */ globals.widgets.y_bar == NULL)
       return;
    
#ifdef MOTIF
    XtVaGetValues(globals.widgets.y_bar, XmNvalue, &m_y_scroll, NULL);
#else
    get_xy();
    XtVaGetValues(globals.widgets.clip_widget, XtNy, &get_y, NULL);
    m_y_scroll = get_y - window_y;
    scroll_y_panner(m_y_scroll);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 691 of file events.c.

{
    if (!scrl)
       XUnmapWindow(DISP, mane.win);
# ifdef MOTIF
    {
       int value;

       value = (globals.page.w - mane.width) / 2;
       if (value > resource.sidemargin_int / mane.shrinkfactor)
           value = resource.sidemargin_int / mane.shrinkfactor;
       (void)set_bar_value(globals.widgets.x_bar, value, (int)(globals.page.w - mane.width));

       value = (globals.page.h - mane.height) / 2;
       if (value > resource.topmargin_int / mane.shrinkfactor)
           value = resource.topmargin_int / mane.shrinkfactor;
       (void)set_bar_value(globals.widgets.y_bar, value, (int)(globals.page.h - mane.height));
    }
# else
    get_xy();
    if (globals.widgets.x_bar != NULL) {
       int coord = (globals.page.w - mane.width) / 2;

       if (coord > resource.sidemargin_int / mane.shrinkfactor)
           coord = resource.sidemargin_int / mane.shrinkfactor;
       XtCallCallbacks(globals.widgets.x_bar, XtNscrollProc, (XtPointer) (window_x + coord));
    }
    if (globals.widgets.y_bar != NULL) {
       int coord = (globals.page.h - mane.height) / 2;

       if (coord > resource.topmargin_int / mane.shrinkfactor)
           coord = resource.topmargin_int / mane.shrinkfactor;
       XtCallCallbacks(globals.widgets.y_bar, XtNscrollProc, (XtPointer) (window_y + coord));
    }
# endif /* MOTIF */
    if (!scrl) {
       XMapWindow(DISP, mane.win);
       /* Wait for the server to catch up---this eliminates flicker. */
       XSync(DISP, False);
    }
    handle_x_scroll(NULL, NULL, NULL, NULL);
    handle_y_scroll(NULL, NULL, NULL, NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void null_mouse ( XEvent *  ignored)

Definition at line 324 of file events.c.

{
    UNUSED(event);
}

Here is the caller graph for this function:

unsigned int read_events ( unsigned  int)

Definition at line 4845 of file events.c.

{
    XEvent event;

#if !HAVE_POLL
    if (numfds == 0)
       numfds = ConnectionNumber(DISP) + 1;
#endif

    if (globals.debug & DBG_EVENT)
       fprintf(stderr, "%s:%d: read_events %u\n", __FILE__, __LINE__, ret_mask);
    for (;;) {
       globals.ev.ctr = event_freq;
       /*
        * The above line clears the flag indicating that an event is
        * pending.  So if an event comes in right now, the flag will be
        * set again needlessly, but we just end up making an extra call.
        * Also, be careful about destroying the magnifying glass while
        * drawing on it.
        */

#if !FLAKY_SIGPOLL

       if (event_freq < 0) {       /* if SIGPOLL works */
           if (!XtPending()) {
              sigset_t oldsig;

              (void) sigprocmask(SIG_BLOCK, &all_signals, &oldsig);
              for (;;) {
#ifdef SHOW_SIG_FLAGS
                  /* this gives HUGE output ... */
                  if (globals.debug & DBG_EVENT)
                     fprintf(stderr, "%s:%d: sig_flags = %d\n",
                            __FILE__, __LINE__, sig_flags);
#endif
                  while (sig_flags) {
                     flags_to_sigproc[sig_flags]();
                  }

                  if (XtPending())
                     break;

                  if (globals.ev.flags & ret_mask) {
                     (void) sigprocmask(SIG_SETMASK, &oldsig, (sigset_t *) NULL);
                     return globals.ev.flags;
                  }
                  (void) sigsuspend(&oldsig);
              }
              (void) sigprocmask(SIG_SETMASK, &oldsig, (sigset_t *) NULL);
           }
       }
       else

#endif /* not FLAKY_SIGPOLL */

           {
              for (;;) {
                  struct xio       *ip;

                  if (globals.debug & DBG_EVENT)
                     fprintf(stderr, "%s:%d: (flaky) sig_flags = %d\n",
                            __FILE__, __LINE__, sig_flags);
                  while (sig_flags) {
                     sigset_t oldsig;

                     (void) sigprocmask(SIG_BLOCK, &all_signals, &oldsig);

                     while (sig_flags) {
                         flags_to_sigproc[sig_flags]();
                     }

                     (void) sigprocmask(SIG_SETMASK, &oldsig,
                                      (sigset_t *) NULL);
                  }

                  if (XtPending())
                     break;

                  if (globals.ev.flags & ret_mask)
                     return globals.ev.flags;

                  /* If a SIGUSR1 signal comes right now, then it will wait
                     until an X event or another SIGUSR1 signal arrives. */

#if HAVE_POLL
                  if (globals.debug & DBG_EVENT)
                     fprintf(stderr, "%s:%d: have_poll!\n",
                            __FILE__, __LINE__);
                  if (io_dirty) {
                     struct pollfd *fp;

                     if (num_fds > max_fds) {
                         if (fds != NULL) free(fds);
                         fds = xmalloc(num_fds * sizeof *fds);
                         max_fds = num_fds;
                         fds->fd = ConnectionNumber(DISP);
                         fds->events = POLLIN;
                     }
                     fp = fds + 1;
                     for (ip = iorecs; ip != NULL; ip = ip->next) {
                         fp->fd = ip->fd;
                         fp->events = ip->xio_events;
                         ip->pfd = fp;
                         ++fp;
                     }
                     io_dirty = False;
                  }

                  for (;;) {
                     if (poll(fds, num_fds, -1) >= 0) {
                         for (ip = iorecs; ip != NULL; ip = ip->next) {
                            int revents = ip->pfd->revents;

                            if (revents & POLLIN && ip->read_proc != NULL)
                                (ip->read_proc)(ip->fd);
                            if (revents & POLLOUT && ip->write_proc != NULL)
                                (ip->write_proc)(ip->fd);
                         }
                         break;
                     }

                     if (errno == EINTR)
                         break;

                     if (errno != EAGAIN) {
                         perror("xdvi: poll");
                         break;
                     }
                  }
#else /* HAVE_POLL */
                  if (globals.debug & DBG_EVENT)
                     fprintf(stderr, "%s:%d: NOT have_poll!\n",
                            __FILE__, __LINE__);
                  FD_ZERO(&readfds);
                  FD_ZERO(&writefds);
                  FD_SET(ConnectionNumber(DISP), &readfds);
                  for (ip = iorecs; ip != NULL; ip = ip->next) {
                     if (ip->xio_events & XIO_IN)
                         FD_SET(ip->fd, &readfds);
                     if (ip->xio_events & XIO_OUT)
                         FD_SET(ip->fd, &writefds);
                  }

                  for (;;) {
                     if (select(numfds, &readfds, &writefds, (fd_set *) NULL,
                               (struct timeval *) NULL) >= 0) {
                         for (ip = iorecs; ip != NULL; ip = ip->next) {
                            if (FD_ISSET(ip->fd, &readfds) && ip->read_proc != NULL) {
                                if (globals.debug & DBG_EVENT)
                                   fprintf(stderr, "%s:%d: reading from %d\n",
                                          __FILE__, __LINE__, ip->fd);
                                (ip->read_proc)(ip->fd);
                            }
                            if (FD_ISSET(ip->fd, &writefds) && ip->write_proc != NULL) {
                                if (globals.debug & DBG_EVENT)
                                   fprintf(stderr, "%s:%d: writing to %d\n",
                                          __FILE__, __LINE__, ip->fd);
                                (ip->write_proc)(ip->fd);
                            }
                         }
                         break;
                     }

                     if (errno == EINTR)
                         break;

                     if (errno != EAGAIN) {
                         perror("xdvi: select");
                         break;
                     }
                  }
#endif /* HAVE_POLL */
              }
           }
       XtAppNextEvent(app, &event);
#ifdef MOTIF
       if ((resource.expert_mode & XPRT_SHOW_TOOLBAR) != 0)
           TipAppHandle(app, &event);
#endif

       if (resized)
           get_geom();

       if (event.xany.window == magnifier.win && event.type == Expose) {
           handle_expose((Widget) NULL, (XtPointer) &magnifier, &event,
                       (Boolean *) NULL);
           continue;
       }
       else if (globals.broken_motif_event_handling &&
               (resource.mouse_mode == MOUSE_RULER_MODE ||
                resource.mouse_mode == MOUSE_TEXT_MODE)) {
           /* In this case, Act_motion() and Act_release() are not called properly
            * for updating the ruler/text selection (it works with the magnifier though),
            * so we need to invoke them ourselves here: */
           if (event.type == MotionNotify)
              Act_motion(NULL, &event, NULL, NULL);
           else if (event.type == ButtonRelease)
              Act_release(NULL, &event, NULL, NULL);
       }

#ifdef MOTIF
       if (XtIsRealized(globals.widgets.top_level)
           && event.xany.window == XtWindow(globals.widgets.clip_widget)
           && event.type == KeyPress) { /* workaround for #610206 */
           motif_translations_hack();
       }
#else
       if (resource.expert_mode & XPRT_SHOW_BUTTONS)
           SubMenuHandleEvent(app, &event);
#endif
       XtDispatchEvent(&event);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 906 of file events.c.

{
/*      Dimension x, y; */

    if (globals.dvi_file.bak_fp == NULL)
       return;
    
#ifndef MOTIF
    XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)False, NULL);
#endif
    TRACE_GUI((stderr, "globals.widgets.draw_widget: w %d, h %d", globals.page.w, globals.page.h));
    XtVaSetValues(globals.widgets.draw_widget, XtNwidth, (XtArgVal)globals.page.w, XtNheight, (XtArgVal)globals.page.h, NULL);
    
#ifdef TEST_SCROLLING
/*     XtVaSetValues(globals.widgets.draw_background, XtNwidth, (XtArgVal)globals.page.w, XtNheight, (XtArgVal)globals.page.h, NULL); */
#endif
    
#ifndef MOTIF
    handle_statusline_resize(); /* without this, statusline will disappear */
    /* following not needed? */
    /*     handle_pagelist_resize(); */
#endif
    
    get_geom();

/*     set_windowsize(&x, &y */
/* #ifndef MOTIF */
/*               , get_panel_width() */
/* #endif */
/*               ); */
/*     XResizeWindow(DISP, XtWindow(globals.widgets.top_level), x, y); */
/*      reconfigure_window(False, x, y, True); */
/*      reconfig_window(); */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void redraw ( struct WindowRec windowrec)

Definition at line 5072 of file events.c.

{
    currwin = *windowrec;
    globals.win_expose.min_x = currwin.min_x + currwin.base_x;
    globals.win_expose.min_y = currwin.min_y + currwin.base_y;
    globals.win_expose.max_x = currwin.max_x + currwin.base_x;
    globals.win_expose.max_y = currwin.max_y + currwin.base_y;
    can_exposures(windowrec);

    /* fix for bug #619070 - the complicated flags (and do_update_property)
       are needed to avoid too many updates at exposures, especially for
       a window of another xdvi instance when the magnifier intersects with
       that window.
    */
    if (have_src_specials && do_update_property
       && globals.win_expose.min_x != 1 && globals.win_expose.max_y - globals.win_expose.min_y != 1
       && currwin.base_x == 0 && currwin.base_y == 0) {
       update_window_property(XtWindow(globals.widgets.top_level), True);
    }

    TRACE_EVENTS((stderr, "Redraw %d x %d at (%d, %d) (base=%d,%d)",
                globals.win_expose.max_x - globals.win_expose.min_x,
                globals.win_expose.max_y - globals.win_expose.min_y,
                globals.win_expose.min_x, globals.win_expose.min_y,
                currwin.base_x, currwin.base_y));

    /* can't use ev_cursor here, since the event loop might not see this change quick enough */
    if (!(globals.ev.flags & EV_CURSOR)) {
       TRACE_EVENTS((stderr, "Cursor: %ld", globals.cursor.flags));
       if (!(globals.cursor.flags & (CURSOR_DRAG_H | CURSOR_DRAG_V | CURSOR_DRAG_A))) {
           if (resource.mouse_mode == MOUSE_RULER_MODE)
              XDefineCursor(DISP, CURSORWIN, globals.cursor.rule);
           else
              XDefineCursor(DISP, CURSORWIN, globals.cursor.wait);
           XFlush(DISP);
       }
       globals.ev.flags |= EV_CURSOR;
    }

    /* No longer needed since windows are correctly transient now */
    /*      raise_message_windows(); */
    raise_file_selector();
    draw_page();
    globals.warn_spec_now = False;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5120 of file events.c.

{
#if COLOR
    const struct rgb *rgbp;
#endif
    TRACE_FILES((stderr, "Redraw page on %p", (void *)globals.dvi_file.bak_fp));

    if (globals.dvi_file.bak_fp == NULL)
       return;

    if (scanned_page < current_page) {
       TRACE_FILES((stderr, "redraw_page: scanned_page = %d, current_page = %d, prescanning %p\n",
                   scanned_page, current_page, (void *)globals.dvi_file.bak_fp));

       prescan(globals.dvi_file.bak_fp);

       if (globals.ev.flags & EV_GE_NEWPAGE) {   /* if we need to re-prescan */
           return;
       }
    }

    TRACE_FILES((stderr, "redraw_page: current_page = %d", current_page));
    if (pageinfo_get_window_width(current_page) != globals.page.unshrunk_w
       || pageinfo_get_window_height(current_page) != globals.page.unshrunk_h) {
       TRACE_FILES((stderr, "NEW SIZE: %dx%d",
                   pageinfo_get_window_width(current_page), pageinfo_get_window_height(current_page)));
       init_page();
       reconfig();
    }
    
    /* We can't call home() without proper unshrunk_page_*, which requires
     * prescan(), which can't be done from within read_events() */

    /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BUG ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       There's some complicated interaction with Postscript specials
       here: if home_action check comes before the gs stuff, psp.drawfile
       might not get initialized correctly, resulting in empty PS figures
       (bounding box instead of figure). This is different in xdvi, due to
       different handling of the home_action stuff, but at the moment I can't
       remember the reason for this ...
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BUG ALERT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    */
#if PS_GS
    if (gs_postpone_prescan) {
       if (!setjmp(globals.ev.canit)) {
           gs_resume_prescan();
       }
       else
           return;
    }
#endif
    if (home_action != NULL) {
       home_action(False);
       home_action = NULL;
       /* This discards the expose event generated by home()
          (1 for each page) */
       if (read_events(EV_NOWAIT) & EV_GE_NEWPAGE) {
           return;
       }

       can_exposures(&mane);
    }

#if COLOR
    rgbp = &bg_initial;
    if (page_colors.stack != NULL) {
       ASSERT(current_page < (int)page_colors.size, "page_colors.size too small");
       rgbp = &page_colors.stack[current_page].bg;
    }

    /* Set background color */
    if (bg_current == NULL
       || rgbp->r != bg_current->color.r
       || rgbp->g != bg_current->color.g
       || rgbp->b != bg_current->color.b) {
       struct bgrec **bgpp;

       for (bgpp = &bg_head;;) {
           bg_current = *bgpp;
           if (bg_current == NULL) {      /* if bg is not in list */
              bg_current = *bgpp = xmalloc(sizeof *bg_current);
              bg_current->next = NULL;
              bg_current->color = *rgbp;
              bg_current->fg_head = NULL;
              bg_current->pixel_good = False;
              break;
           }
           if (bg_current->color.r == rgbp->r
              && bg_current->color.g == rgbp->g
              && bg_current->color.b == rgbp->b)
              break;
           bgpp = &bg_current->next;
       }
       fg_current = NULL;   /* force change of foreground color */
       /* globals.gc.high is only used in XDrawRectangle, so its background color
          doesn't need to be changed.  */
       if (globals.debug & DBG_DVI)
           printf("Changing background color to %5d %5d %5d\n",
                 bg_current->color.r, bg_current->color.g,
                 bg_current->color.b);

       if (!bg_current->pixel_good) {
           bg_current->pixel = alloc_color(&bg_current->color,
                                       color_data[1].pixel);
           bg_current->pixel_good = True;
       }
       XSetWindowBackground(DISP, mane.win, bg_current->pixel);
#if MOTIF && !FIXED_FLUSHING_PAGING
       XtVaSetValues(XtParent(globals.widgets.draw_widget), XtNbackground, bg_current->pixel, NULL);
#endif
/*     XSetWindowBackground(DISP, mane.win, bg_current->pixel); */
/*     XClearWindow(DISP, mane.win); */
#if 0 /* don't recolor the cursor - gives too low contrast on color backgrounds,
        and bad appearance when part of the background is white and cursor mask
        is colored */
       {
           XColor    bg_Color;
           bg_Color.pixel = bg_current->pixel;
           XQueryColor(DISP, G_colormap, &bg_Color);
           XRecolorCursor(DISP, globals.cursor.ready, &globals.cr_color, &bg_Color);
           XRecolorCursor(DISP, globals.cursor.wait, &globals.cr_color, &bg_Color);
       }
#endif
    }
#endif /* COLOR */
    
    if (!globals.pausing.flag) {
       XClearWindow(DISP, mane.win);
    }

    if (G_backing_store != NotUseful) {
       mane.min_x = mane.min_y = 0;
       mane.max_x = globals.page.w;
       mane.max_y = globals.page.h;
    }
    else {
       get_xy();
       mane.min_x = -window_x;
       mane.max_x = -window_x + mane.width;
       mane.min_y = -window_y;
       mane.max_y = -window_y + mane.height;
    }

/*      update_TOC(); */
    redraw(&mane);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int set_bar_value ( Widget  bar,
int  value,
int  max 
)

Here is the caller graph for this function:

void set_chld ( struct xchild )

Definition at line 4276 of file events.c.

{
    cp->next = child_recs;
    child_recs = cp;
}

Here is the caller graph for this function:

void set_io ( struct xio )

Definition at line 4382 of file events.c.

{
    ip->next = iorecs;
    iorecs = ip;

#if HAVE_POLL
    ++num_fds;
    if (!io_dirty && num_fds <= max_fds) {
       fds[num_fds - 1].fd = ip->fd;
       fds[num_fds - 1].events = ip->xio_events;
       ip->pfd = &fds[num_fds - 1];
    }
    else {
       ip->pfd = NULL;
       io_dirty = True;
    }
#else
    if (numfds <= ip->fd) numfds = ip->fd + 1;
#endif
}

Here is the caller graph for this function:

void set_timer ( struct xtimer tp,
int  ms 
)

Definition at line 4550 of file events.c.

{
    struct xtimer    **tpp;
    struct xtimer    *tp2;

    if (globals.debug & DBG_EVENT)
       fprintf(stderr, "%s:%d: set_timer\n", __FILE__, __LINE__);

    gettimeofday(&tp->when, NULL);
    itv.it_value.tv_sec = ms / 1000;
    itv.it_value.tv_usec = (ms % 1000) * 1000;
    tp->when.tv_sec += itv.it_value.tv_sec;
    tp->when.tv_usec += itv.it_value.tv_usec;
    if (tp->when.tv_usec >= 1000000) {
       tp->when.tv_usec -= 1000000;
       ++tp->when.tv_sec;
    }

    for (tpp = &timers;;) {        /* add timer to list */
       tp2 = *tpp;
       if (tp2 == NULL || timercmp(&tp->when, &tp2->when, <))
           break;
       tpp = &tp2->next;
    }
    tp->next = tp2;
    *tpp = tp;

    if (tpp == &timers) {
       setitimer(ITIMER_REAL, &itv, NULL);
       if (ms == 0)
           sig_flags |= SF_ALRM;
    }
    if (globals.debug & DBG_EVENT)
       show_timers("after set_timer");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4150 of file events.c.

{
#if HAVE_SIGACTION
    struct sigaction a;

    a.sa_handler = handle_sigalrm;
    (void) sigemptyset(&a.sa_mask);
    (void) sigaddset(&a.sa_mask, SIGALRM);
    a.sa_flags = 0;
    sigaction(SIGALRM, &a, NULL);
#else /* not HAVE_SIGACTION */
    (void) signal(SIGALRM, handle_sigalrm);
#endif /* not HAVE_SIGACTION */

    sigalarm_initialized = True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4171 of file events.c.

{
#ifndef FLAKY_SIGPOLL
    int       sock_fd       = ConnectionNumber(DISP);
#endif
#if HAVE_SIGACTION
    struct sigaction a;
#endif

#ifndef FLAKY_SIGPOLL
#if HAVE_SIGACTION
    /* Subprocess handling, e.g., MakeTeXPK, fails on the Alpha without
       this, because SIGPOLL interrupts the call of system(3), since OSF/1
       doesn't retry interrupted wait calls by default.  From code by
       maj@cl.cam.ac.uk.  */
    a.sa_handler = handle_sigpoll;
    (void) sigemptyset(&a.sa_mask);
    (void) sigaddset(&a.sa_mask, SIGPOLL);
    a.sa_flags = SA_RESTART;
    sigaction(SIGPOLL, &a, NULL);
#else /* not HAVE_SIGACTION */
    (void) signal(SIGPOLL, handle_sigpoll);
#endif /* not HAVE_SIGACTION */

    prep_fd(sock_fd, False);
#endif /* not FLAKY_SIGPOLL */

#if HAVE_SIGACTION
    a.sa_handler = handle_sigterm;
    (void) sigemptyset(&a.sa_mask);
    (void) sigaddset(&a.sa_mask, SIGINT);
    (void) sigaddset(&a.sa_mask, SIGQUIT);
    (void) sigaddset(&a.sa_mask, SIGTERM);
    (void) sigaddset(&a.sa_mask, SIGHUP);
    a.sa_flags = SA_RESETHAND;
    sigaction(SIGINT, &a, NULL);
    sigaction(SIGQUIT, &a, NULL);
    sigaction(SIGTERM, &a, NULL);
    sigaction(SIGHUP, &a, NULL);
    a.sa_handler = handle_sigsegv;
    (void)sigemptyset(&a.sa_mask);
    (void)sigaddset(&a.sa_mask, SIGSEGV);
    a.sa_flags = 0;
    sigaction(SIGSEGV, &a, NULL);
#else /* not HAVE_SIGACTION */
    (void) signal(SIGINT, handle_sigterm);
    (void) signal(SIGQUIT, handle_sigterm);
    (void) signal(SIGTERM, handle_sigterm);
    (void) signal(SIGHUP, handle_sigterm);
    (void)signal(SIGSEGV, handle_sigsegv);
#endif /* not HAVE_SIGACTION */

#if HAVE_SIGACTION
    a.sa_handler = handle_sigchld;
    (void) sigemptyset(&a.sa_mask);
    (void) sigaddset(&a.sa_mask, SIGCHLD);
    a.sa_flags = 0;
    sigaction(SIGCHLD, &a, NULL);
#else /* not HAVE_SIGACTION */
    (void) signal(SIGCHLD, handle_sigchld);
#endif /* not HAVE_SIGACTION */

#if HAVE_SIGACTION
    a.sa_handler = handle_sigusr;
    (void) sigemptyset(&a.sa_mask);
    (void) sigaddset(&a.sa_mask, SIGUSR1);
    a.sa_flags = 0;
    sigaction(SIGUSR1, &a, NULL);
#else /* not HAVE_SIGACTION */
    (void) signal(SIGUSR1, handle_sigusr);
#endif /* not HAVE_SIGACTION */

    (void)sigemptyset(&all_signals);
    (void)sigaddset(&all_signals, SIGPOLL);
    (void)sigaddset(&all_signals, SIGINT);
    (void)sigaddset(&all_signals, SIGQUIT);
    (void)sigaddset(&all_signals, SIGTERM);
    (void)sigaddset(&all_signals, SIGHUP);
    (void)sigaddset(&all_signals, SIGCHLD);
    (void)sigaddset(&all_signals, SIGALRM);
    (void)sigaddset(&all_signals, SIGUSR1);
    (void)sigaddset(&all_signals, SIGSEGV);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void showmessage ( const char *  )

Definition at line 2089 of file events.c.

{
    int value1;
    int value2;
    static Dimension window_w;
#ifndef MOTIF
    static Dimension window_h;
#endif
    
    static Arg arg_wh[] = {
       {XtNwidth, (XtArgVal) &window_w}
#ifndef MOTIF
       , {XtNheight, (XtArgVal) &window_h}
#endif
    };

    
#ifdef MOTIF
    XtGetValues(globals.widgets.main_window, arg_wh, XtNumber(arg_wh));
#else
    XtGetValues(globals.widgets.vport_widget, arg_wh, XtNumber(arg_wh));
#endif
    
    value1 = ROUNDUP(globals.page.unshrunk_w, window_w - 2);

#ifdef  MOTIF
    {  /* account for menubar */
       static Dimension new_h;

       /* get rid of scrollbar */
       XtVaSetValues(globals.widgets.draw_widget, XtNwidth, (XtArgVal)1, XtNheight, (XtArgVal)1, NULL);
       XtVaGetValues(globals.widgets.clip_widget, XtNheight, &new_h, NULL);
       value2 = ROUNDUP(globals.page.unshrunk_h, new_h - 2);
    }
#else
    /* FIXME: value seems too small here! */
    value2 = ROUNDUP(globals.page.unshrunk_h, window_h - 2);
#endif

    return value1 > value2 ? value1 : value2;
}

Here is the caller graph for this function:

void text_change_region ( textSelectionT  mode,
XEvent *  event 
)

Definition at line 3010 of file events.c.

{
    static GC bboxGC = 0;
    static GC redrawGC = 0; /* needed since bboxGC is clipped to diff of old and new region */

    MYTRACE((stderr, "text_change_region: %d", mode));
    
    if (bboxGC == 0) {
       XGCValues values;
       unsigned long valuemask;

       values.function = GXinvert; /* as in search code */
       if (values.function == GXinvert) {
           valuemask = GCFunction;
       }
       else {
           values.foreground = WhitePixelOfScreen(SCRN) ^ BlackPixelOfScreen(SCRN);
           /*               fprintf(stderr, "foreground: 0x%lx, white pixel: 0x%lx, black pixel: 0x%lx\n", */
           /*                      values.foreground, WhitePixelOfScreen(SCRN), BlackPixelOfScreen(SCRN)); */
           valuemask = GCFunction | GCForeground;
       }
       values.line_width = 1;
       valuemask |= GCLineWidth;
       bboxGC = XCreateGC(DISP, XtWindow(globals.widgets.top_level), valuemask, &values);
       redrawGC = XCreateGC(DISP, XtWindow(globals.widgets.top_level), valuemask, &values);
    }

    MYTRACE((stderr, "text_change_region: after bboxGC"));
    switch (mode) {
    case TEXT_SEL_MOVE:
       {
           int x, y;
           
           Window dummy;

           XRectangle redraw = { -1, -1, 0, 0 };

           ASSERT(event != NULL, "event in text_change_region() musn't be NULL for TEXT_SEL_MOVE");

           (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win,
                                   event->xkey.x, event->xkey.y,
                                   &x, &y,
                                   &dummy);

           crop_to_window(&x, &y);

           get_rectangle(&redraw, x, y, drag_last_x, drag_last_y);

           /*
            * If we have an old region, we want to clip the GC to the area:
            *
            * (clip \cup redraw) - (clip \cap redraw)
            *
            * and redraw both rectangle areas; otherwise, just draw the redraw area.
            */

           if (text_last_x != -1 && text_last_y != -1) {

              XRectangle clip = { -1, -1, 0, 0 };
              
              Region clip_region = XCreateRegion();
              Region redraw_region = XCreateRegion();
              Region union_region = XCreateRegion();
              Region intersect_region = XCreateRegion();

              get_rectangle(&clip, text_last_x, text_last_y, drag_last_x, drag_last_y);

              XUnionRectWithRegion(&clip, clip_region, clip_region);
              XUnionRectWithRegion(&redraw, redraw_region, redraw_region);

              XUnionRegion(clip_region, redraw_region, union_region);
              XIntersectRegion(clip_region, redraw_region, intersect_region);
              
              XSubtractRegion(union_region, intersect_region, redraw_region);

              XSetRegion(DISP, bboxGC, redraw_region);

              XDestroyRegion(clip_region);
              XDestroyRegion(redraw_region); 
              XDestroyRegion(union_region); 
              XDestroyRegion(intersect_region); 
              
              XFillRectangle(DISP, mane.win, bboxGC, clip.x, clip.y, clip.width, clip.height);
           }
           
           XFillRectangle(DISP, mane.win, bboxGC, redraw.x, redraw.y, redraw.width, redraw.height);

           text_last_x = x;
           text_last_y = y;
           text_last_page = current_page;
       }
       break;
    case TEXT_SEL_CLEAR:
       unset_selection(globals.widgets.top_level);
    case TEXT_SEL_ERASE:
    case TEXT_SEL_REDRAW:
       if (text_last_page == current_page
           && text_last_x != -1 && text_last_y != -1
           && drag_last_x != -1 && drag_last_y != -1) {

           XRectangle clear = { -1, -1, 0, 0 };

           get_rectangle(&clear, text_last_x, text_last_y, drag_last_x, drag_last_y);
           
           if (mode == TEXT_SEL_CLEAR) {
              text_last_x = text_last_y = drag_last_x = drag_last_y = -1;
              text_last_page = -1;
              /* Note ZLB: the region is erased instead of inverted to avoid
               * multiple inverting problem. An exposure is generated to
               * make the region redrawn */
              clearexpose(&mane, clear.x, clear.y, clear.width, clear.height);
           }
           else if (clip_region_to_rect(&clear)) {
              if (mode == TEXT_SEL_ERASE) {
                  /* If width or height are 0, XClearArea will clear entire window
                   * from coordinates x, y, so check for that: */
                  if (clear.width > 0 && clear.height > 0)
                     XClearArea(DISP, mane.win, clear.x, clear.y, clear.width, clear.height, False);
              }
              else
                  XFillRectangle(DISP, mane.win, redrawGC, clear.x, clear.y, clear.width, clear.height);
           }
       }
       break;
    }
    MYTRACE((stderr, "text_change_region: done"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void text_motion ( XEvent *  event)

Definition at line 2981 of file events.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void text_selection_start ( XEvent *  event)

Definition at line 3139 of file events.c.

{
    int x, y;
    Window dummy;

    /* erase existing region */
    text_change_region(TEXT_SEL_CLEAR, NULL);

    (void)XTranslateCoordinates(DISP, event->xkey.window, mane.win,
                            event->xkey.x, event->xkey.y,
                            &x, &y,
                            &dummy);      /* throw away last argument */

    crop_to_window(&x, &y);
    
    drag_last_x = x;
    drag_last_y = y;

    text_last_x = text_last_y = -1;

    MYTRACE((stderr, "selection start; mouse_release: %p; null: %p!",
            (void *)mouse_release, (void *)null_mouse));
    if (mouse_release == null_mouse) {
       MYTRACE((stderr, "init text_motion!"));
       mouse_motion = text_motion;
       mouse_release = text_release;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Boolean toggle_arg ( int  arg,
String param,
Cardinal *  num_params 
)

Definition at line 1043 of file events.c.

{
    if (*num_params > 0) {
       if (**param != 't' && (atoi(*param) != 0) == arg)
           return False;
    }
    else {
       if (m_have_arg) {
           int       tmparg = m_number;

           m_have_arg = False;
           m_number = 0;
           m_sign = 1;

           if ((tmparg != 0) == arg)
              return False;
       }
    }
    return True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void watch_file_cb ( XtPointer  client_data,
XtIntervalId *  id 
)

Definition at line 5528 of file events.c.

{
    static XtIntervalId timer = 0;
    
    UNUSED(client_data);
    UNUSED(id);

    if (resource.watch_file > 0.0) {
       unsigned long watch_time_ms;

       (void)dvi_file_changed();
    
       if (timer) {
           XtRemoveTimeOut(timer);
           timer = (XtIntervalId)(XtIntervalId)0;
       }

       watch_time_ms = (unsigned long)(resource.watch_file * 1000);
       timer = XtAppAddTimeOut(app, watch_time_ms, watch_file_cb, (XtPointer)NULL);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xdvi_exit_callback ( Widget  w,
XtPointer  client_data,
XtPointer  call_data 
)

Definition at line 513 of file events.c.

{
    UNUSED(w);
    UNUSED(client_data);
    UNUSED(call_data);

    sig_flags |= SF_TERM;
}

Here is the caller graph for this function: