commit a477625912c7d842e5e0de4df63195bfb10eb381
parent 3db5d4af71a86b85bf994e32827dc325e167e7de
Author: Kyle Milz <krwmilz@gmail.com>
Date: Sat, 11 Sep 2021 23:45:17 +0000
Remove DBG_BATCH
Diffstat:
M | events.c | | | 100 | ++++++++++++++++++++++++++++++++----------------------------------------------- |
M | events.h | | | 2 | +- |
M | xdvi.c | | | 4 | ++-- |
M | xdvi.h | | | 3 | +-- |
4 files changed, 45 insertions(+), 64 deletions(-)
diff --git a/events.c b/events.c
@@ -1880,76 +1880,58 @@ redraw_page()
void
do_pages()
{
- if (debug & DBG_BATCH) {
- int i;
+ (void) read_events(EV_GT_IDLE);
- (void) read_events(EV_GT_IDLE);
-
- for (i = 0; i < total_pages; ++i) {
- goto_page(i, home);
- redraw_page();
- }
-
- exit(0);
- }
- else
- for (;;) { /* normal operation */
-
- (void) read_events(EV_GT_IDLE);
-
- if (ev_flags & (EV_NEWPAGE | EV_NEWDOC | EV_PS_TOGGLE)) {
- ev_flags &= ~(EV_NEWPAGE | EV_EXPOSE | EV_PS_TOGGLE);
- if (ev_flags & EV_NEWDOC) {
+ if (ev_flags & (EV_NEWPAGE | EV_NEWDOC | EV_PS_TOGGLE)) {
+ ev_flags &= ~(EV_NEWPAGE | EV_EXPOSE | EV_PS_TOGGLE);
+ if (ev_flags & EV_NEWDOC) {
ev_flags &= ~EV_NEWDOC;
- if (!reload_dvi_file())
- warning_popup("Bad DVI document", "OK", NULL);
- }
- can_exposures(&mane);
- can_exposures(&alt);
+ if (reload_dvi_file() == False)
+ warning_popup("Bad DVI document", "OK", NULL);
+ }
+ can_exposures(&mane);
+ can_exposures(&alt);
- if (dvi_file != NULL)
+ if (dvi_file != NULL)
redraw_page();
- else
+ else
(void) check_dvi_file();
- }
-
- else if (ev_flags & EV_MAG_MOVE) {
- if (alt.win == (Window) 0) ev_flags &= ~EV_MAG_MOVE;
- else if (abs(new_mag_x - mag_x) >
- 2 * abs(new_mag_y - mag_y))
- movemag(new_mag_x, mag_y);
- else if (abs(new_mag_y - mag_y) >
- 2 * abs(new_mag_x - mag_x))
- movemag(mag_x, new_mag_y);
- else movemag(new_mag_x, new_mag_y);
- }
-
- else if (ev_flags & EV_EXPOSE) {
- if (alt.min_x < MAXDIM) {
- if (mane.min_x >= MAXDIM) ev_flags &= ~EV_EXPOSE;
+ }
+ else if (ev_flags & EV_MAG_MOVE) {
+ if (alt.win == (Window) 0)
+ ev_flags &= ~EV_MAG_MOVE;
+ else if (abs(new_mag_x - mag_x) > 2 * abs(new_mag_y - mag_y))
+ movemag(new_mag_x, mag_y);
+ else if (abs(new_mag_y - mag_y) > 2 * abs(new_mag_x - mag_x))
+ movemag(mag_x, new_mag_y);
+ else
+ movemag(new_mag_x, new_mag_y);
+ }
+ else if (ev_flags & EV_EXPOSE) {
+ if (alt.min_x < MAXDIM) {
+ if (mane.min_x >= MAXDIM)
+ ev_flags &= ~EV_EXPOSE;
redraw(&alt);
- }
- else {
+ }
+ else {
ev_flags &= ~EV_EXPOSE;
if (mane.min_x < MAXDIM)
- redraw(&mane);
- }
+ redraw(&mane);
}
-
- else if (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()) {
+ }
+ else if (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()) {
ev_flags &= ~EV_CURSOR;
if (!dragcurs)
- XDefineCursor(DISP, CURSORWIN, ready_cursor);
- }
+ XDefineCursor(DISP, CURSORWIN, ready_cursor);
}
+ }
- XFlush(DISP);
- }
+ XFlush(DISP);
}
diff --git a/events.h b/events.h
@@ -144,7 +144,7 @@ int min_x, max_x, min_y, max_y;
Bool compile_action(const char *, struct xdvi_action **);
void do_color_change(void);
-void do_pages(void) __attribute__((__noreturn__));
+void do_pages(void);
void enable_intr(void);
void handle_expose(Widget, XtPointer, XEvent *, Boolean *);
void handle_resize(Widget, XtPointer, XEvent *, Boolean *);
diff --git a/xdvi.c b/xdvi.c
@@ -1194,6 +1194,6 @@ main(int argc, char **argv)
ready_cursor = XCreateFontCursor(DISP, XC_cross);
redraw_cursor = XCreateFontCursor(DISP, XC_watch);
- do_pages();
- /* NOTREACHED */
+ for(;;) /* normal operation */
+ do_pages();
}
diff --git a/xdvi.h b/xdvi.h
@@ -180,12 +180,11 @@ int debug = 0;
#define DBG_BITMAP 1
#define DBG_DVI 2
#define DBG_PK 4
-#define DBG_BATCH 8
#define DBG_EVENT 16
#define DBG_OPEN 32
#define DBG_PS 64
#define DBG_CLIENT 128
-#define DBG_ALL (~DBG_BATCH)
+#define DBG_ALL (~0)
int offset_x, offset_y;
unsigned int unshrunk_paper_w, unshrunk_paper_h;