mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 01:34:21 +00:00
Move hourglass machinery to RIF.
* dispextern.h (struct redisplay_interface): New members show_hourglass and hide_hourglass. Indent comments. (show_hourglass, hide_hourglass): Remove prototypes. * nsterm.m (show_hourgass, hide_hourglass): Refactor to ... (ns_show_hourglass, ns_hide_hourglass): ... new no-ops. (ns_redisplay_interface): Add them. * w32fns.c (show_hourglass, hide_hourglass): Refactor to ... * w32term.c (w32_show_hourglass, w32_hide_hourglass): ... these. (w32_arrow_cursor): New function to hack around non-GUI frames. (w32_redisplay_interface): Add new functions. * w32term.h (w32_arror_cursor): Add prototype. * xdisp.c (show_hourglass): New function, refactored out from platform-dependend code. (cancel_hourglass): Now call to RIF function. * xfns.c (show_hourglass, hide_hourglass): Refactor to ... * xterm.c (x_show_hourglass, x_hide_hourglass): ... these. (x_redisplay_interface): Add new functions.
This commit is contained in:
parent
934eeab5ff
commit
88cd403ca7
9 changed files with 201 additions and 222 deletions
|
|
@ -1,3 +1,24 @@
|
|||
2014-07-25 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Move hourglass machinery to RIF.
|
||||
* dispextern.h (struct redisplay_interface): New members
|
||||
show_hourglass and hide_hourglass. Indent comments.
|
||||
(show_hourglass, hide_hourglass): Remove prototypes.
|
||||
* nsterm.m (show_hourgass, hide_hourglass): Refactor to ...
|
||||
(ns_show_hourglass, ns_hide_hourglass): ... new no-ops.
|
||||
(ns_redisplay_interface): Add them.
|
||||
* w32fns.c (show_hourglass, hide_hourglass): Refactor to ...
|
||||
* w32term.c (w32_show_hourglass, w32_hide_hourglass): ... these.
|
||||
(w32_arrow_cursor): New function to hack around non-GUI frames.
|
||||
(w32_redisplay_interface): Add new functions.
|
||||
* w32term.h (w32_arror_cursor): Add prototype.
|
||||
* xdisp.c (show_hourglass): New function, refactored out from
|
||||
platform-dependend code.
|
||||
(cancel_hourglass): Now call to RIF function.
|
||||
* xfns.c (show_hourglass, hide_hourglass): Refactor to ...
|
||||
* xterm.c (x_show_hourglass, x_hide_hourglass): ... these.
|
||||
(x_redisplay_interface): Add new functions.
|
||||
|
||||
2014-07-24 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Fix error reported by Angelo Graziosi <angelo.graziosi@alice.it> in
|
||||
|
|
|
|||
|
|
@ -2821,45 +2821,51 @@ struct redisplay_interface
|
|||
int h, int wd);
|
||||
void (*destroy_fringe_bitmap) (int which);
|
||||
|
||||
/* Compute left and right overhang of glyph string S.
|
||||
A NULL pointer if platform does not support this. */
|
||||
/* Compute left and right overhang of glyph string S.
|
||||
A NULL pointer if platform does not support this. */
|
||||
void (*compute_glyph_string_overhangs) (struct glyph_string *s);
|
||||
|
||||
/* Draw a glyph string S. */
|
||||
/* Draw a glyph string S. */
|
||||
void (*draw_glyph_string) (struct glyph_string *s);
|
||||
|
||||
/* Define cursor CURSOR on frame F. */
|
||||
/* Define cursor CURSOR on frame F. */
|
||||
void (*define_frame_cursor) (struct frame *f, Cursor cursor);
|
||||
|
||||
/* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */
|
||||
/* Clear the area at (X,Y,WIDTH,HEIGHT) of frame F. */
|
||||
void (*clear_frame_area) (struct frame *f, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
/* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
|
||||
at row GLYPH_ROW on window W if ON_P is true. If ON_P is
|
||||
false, don't draw cursor. If ACTIVE_P is true, system caret
|
||||
should track this cursor (when applicable). */
|
||||
/* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
|
||||
at row GLYPH_ROW on window W if ON_P is true. If ON_P is
|
||||
false, don't draw cursor. If ACTIVE_P is true, system caret
|
||||
should track this cursor (when applicable). */
|
||||
void (*draw_window_cursor) (struct window *w,
|
||||
struct glyph_row *glyph_row,
|
||||
int x, int y,
|
||||
enum text_cursor_kinds cursor_type,
|
||||
int cursor_width, bool on_p, bool active_p);
|
||||
|
||||
/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
|
||||
/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
|
||||
void (*draw_vertical_window_border) (struct window *w,
|
||||
int x, int y_0, int y_1);
|
||||
|
||||
/* Draw window divider for window W from (X_0, Y_0) to (X_1, ,Y_1). */
|
||||
/* Draw window divider for window W from (X_0, Y_0) to (X_1, ,Y_1). */
|
||||
void (*draw_window_divider) (struct window *w,
|
||||
int x_0, int x_1, int y_0, int y_1);
|
||||
|
||||
/* Shift display of frame F to make room for inserted glyphs.
|
||||
The area at pixel (X,Y) of width WIDTH and height HEIGHT is
|
||||
shifted right by SHIFT_BY pixels. */
|
||||
/* Shift display of frame F to make room for inserted glyphs.
|
||||
The area at pixel (X,Y) of width WIDTH and height HEIGHT is
|
||||
shifted right by SHIFT_BY pixels. */
|
||||
void (*shift_glyphs_for_insert) (struct frame *f,
|
||||
int x, int y, int width,
|
||||
int height, int shift_by);
|
||||
|
||||
/* Start display hourglass cursor on frame F. */
|
||||
void (*show_hourglass) (struct frame *f);
|
||||
|
||||
/* Cancel hourglass cursor on frame F. */
|
||||
void (*hide_hourglass) (struct frame *f);
|
||||
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
};
|
||||
|
||||
|
|
@ -3396,10 +3402,6 @@ extern bool hourglass_shown_p;
|
|||
an hourglass cursor on all frames. */
|
||||
extern struct atimer *hourglass_atimer;
|
||||
|
||||
/* Each GUI implements these. FIXME: move into RIF. */
|
||||
extern void show_hourglass (struct atimer *);
|
||||
extern void hide_hourglass (void);
|
||||
|
||||
/* Returns the background color of IMG, calculating one heuristically if
|
||||
necessary. If non-zero, XIMG is an existing XImage object to use for
|
||||
the heuristic. */
|
||||
|
|
|
|||
36
src/nsterm.m
36
src/nsterm.m
|
|
@ -2594,38 +2594,18 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
|
|||
ns_unfocus (f);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
show_hourglass (struct atimer *timer)
|
||||
static void
|
||||
ns_show_hourglass (struct frame *f)
|
||||
{
|
||||
if (hourglass_shown_p)
|
||||
return;
|
||||
|
||||
block_input ();
|
||||
|
||||
/* TODO: add NSProgressIndicator to selected frame (see macfns.c) */
|
||||
|
||||
hourglass_shown_p = 1;
|
||||
unblock_input ();
|
||||
/* TODO: add NSProgressIndicator to all frames. */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hide_hourglass (void)
|
||||
static void
|
||||
ns_hide_hourglass (struct frame *f)
|
||||
{
|
||||
if (!hourglass_shown_p)
|
||||
return;
|
||||
|
||||
block_input ();
|
||||
|
||||
/* TODO: remove NSProgressIndicator from all frames */
|
||||
|
||||
hourglass_shown_p = 0;
|
||||
unblock_input ();
|
||||
/* TODO: remove NSProgressIndicator from all frames. */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ==========================================================================
|
||||
|
||||
Glyph drawing operations
|
||||
|
|
@ -4114,7 +4094,9 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
|
|||
ns_draw_window_cursor,
|
||||
ns_draw_vertical_window_border,
|
||||
ns_draw_window_divider,
|
||||
ns_shift_glyphs_for_insert
|
||||
ns_shift_glyphs_for_insert,
|
||||
ns_show_hourglass,
|
||||
ns_hide_hourglass
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
61
src/w32fns.c
61
src/w32fns.c
|
|
@ -5488,67 +5488,6 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
|
||||
#endif /* TODO */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
Busy cursor
|
||||
***********************************************************************/
|
||||
|
||||
/* Display an hourglass cursor. Set the hourglass_p flag in display info
|
||||
to indicate that an hourglass cursor is shown. */
|
||||
|
||||
void
|
||||
show_hourglass (struct atimer *timer)
|
||||
{
|
||||
hourglass_atimer = NULL;
|
||||
|
||||
if (!hourglass_shown_p)
|
||||
{
|
||||
Lisp_Object tail, frame;
|
||||
|
||||
block_input ();
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_W32_P (f) && !menubar_in_use && !current_popup_menu)
|
||||
{
|
||||
f->output_data.w32->hourglass_p = 1;
|
||||
SetCursor (f->output_data.w32->hourglass_cursor);
|
||||
}
|
||||
}
|
||||
unblock_input ();
|
||||
hourglass_shown_p = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide the hourglass cursor on all frames, if it is currently shown. */
|
||||
|
||||
void
|
||||
hide_hourglass (void)
|
||||
{
|
||||
if (hourglass_shown_p)
|
||||
{
|
||||
Lisp_Object tail, frame;
|
||||
|
||||
block_input ();
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_W32_P (f))
|
||||
{
|
||||
f->output_data.w32->hourglass_p = 0;
|
||||
SetCursor (f->output_data.w32->current_cursor);
|
||||
}
|
||||
else
|
||||
/* No cursors on non GUI frames - restore to stock arrow cursor. */
|
||||
SetCursor (w32_load_cursor (IDC_ARROW));
|
||||
}
|
||||
unblock_input ();
|
||||
hourglass_shown_p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Tool tips
|
||||
***********************************************************************/
|
||||
|
|
|
|||
|
|
@ -6180,8 +6180,40 @@ x_check_font (struct frame *f, struct font *font)
|
|||
|
||||
#endif /* GLYPH_DEBUG */
|
||||
|
||||
/* Show hourglass cursor on frame F. */
|
||||
|
||||
static void
|
||||
w32_show_hourglass (struct frame *f)
|
||||
{
|
||||
if (!menubar_in_use && !current_popup_menu)
|
||||
{
|
||||
struct w32_output *w32 = FRAME_X_OUTPUT (f);
|
||||
|
||||
w32->hourglass_p = 1;
|
||||
SetCursor (w32->hourglass_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide hourglass cursor on frame F. */
|
||||
|
||||
static void
|
||||
w32_hide_hourglass (struct frame *f)
|
||||
{
|
||||
struct w32_output *w32 = FRAME_X_OUTPUT (f);
|
||||
|
||||
w32->hourglass_p = 0;
|
||||
SetCursor (w32->current_cursor);
|
||||
}
|
||||
|
||||
/* FIXME: old code did that, but I don't know why. Anyway,
|
||||
this is used for non-GUI frames (see cancel_hourglass). */
|
||||
|
||||
void
|
||||
w32_arrow_cursor (void)
|
||||
{
|
||||
SetCursor (w32_load_cursor (IDC_ARROW));
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
Initialization
|
||||
***********************************************************************/
|
||||
|
|
@ -6297,7 +6329,9 @@ static struct redisplay_interface w32_redisplay_interface =
|
|||
w32_draw_window_cursor,
|
||||
w32_draw_vertical_window_border,
|
||||
w32_draw_window_divider,
|
||||
w32_shift_glyphs_for_insert
|
||||
w32_shift_glyphs_for_insert,
|
||||
w32_show_hourglass,
|
||||
w32_hide_hourglass
|
||||
};
|
||||
|
||||
static void x_delete_terminal (struct terminal *term);
|
||||
|
|
|
|||
|
|
@ -780,6 +780,7 @@ typedef char guichar_t;
|
|||
#define GUI_SDATA(x) ((guichar_t*) SDATA (x))
|
||||
|
||||
extern Lisp_Object w32_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
|
||||
extern void w32_arrow_cursor (void);
|
||||
|
||||
extern void syms_of_w32term (void);
|
||||
extern void syms_of_w32menu (void);
|
||||
|
|
|
|||
56
src/xdisp.c
56
src/xdisp.c
|
|
@ -30730,7 +30730,38 @@ init_xdisp (void)
|
|||
|
||||
/* Platform-independent portion of hourglass implementation. */
|
||||
|
||||
/* Timer function of hourglass_atimer. */
|
||||
|
||||
static void
|
||||
show_hourglass (struct atimer *timer)
|
||||
{
|
||||
/* The timer implementation will cancel this timer automatically
|
||||
after this function has run. Set hourglass_atimer to null
|
||||
so that we know the timer doesn't have to be canceled. */
|
||||
hourglass_atimer = NULL;
|
||||
|
||||
if (!hourglass_shown_p)
|
||||
{
|
||||
Lisp_Object tail, frame;
|
||||
|
||||
block_input ();
|
||||
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_LIVE_P (f) && FRAME_WINDOW_P (f)
|
||||
&& FRAME_RIF (f)->show_hourglass)
|
||||
FRAME_RIF (f)->show_hourglass (f);
|
||||
}
|
||||
|
||||
hourglass_shown_p = 1;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Cancel a currently active hourglass timer, and start a new one. */
|
||||
|
||||
void
|
||||
start_hourglass (void)
|
||||
{
|
||||
|
|
@ -30753,9 +30784,9 @@ start_hourglass (void)
|
|||
show_hourglass, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Cancel the hourglass cursor timer if active, hide a busy cursor if
|
||||
shown. */
|
||||
|
||||
void
|
||||
cancel_hourglass (void)
|
||||
{
|
||||
|
|
@ -30766,7 +30797,28 @@ cancel_hourglass (void)
|
|||
}
|
||||
|
||||
if (hourglass_shown_p)
|
||||
hide_hourglass ();
|
||||
{
|
||||
Lisp_Object tail, frame;
|
||||
|
||||
block_input ();
|
||||
|
||||
FOR_EACH_FRAME (tail, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_LIVE_P (f) && FRAME_WINDOW_P (f)
|
||||
&& FRAME_RIF (f)->hide_hourglass)
|
||||
FRAME_RIF (f)->hide_hourglass (f);
|
||||
#ifdef HAVE_NTGUI
|
||||
/* No cursors on non GUI frames - restore to stock arrow cursor. */
|
||||
else if (!FRAME_W32_P (f))
|
||||
w32_arrow_cursor ();
|
||||
#endif
|
||||
}
|
||||
|
||||
hourglass_shown_p = 0;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
|
|
|
|||
110
src/xfns.c
110
src/xfns.c
|
|
@ -4735,116 +4735,6 @@ no value of TYPE (always string in the MS Windows case). */)
|
|||
return prop_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
Busy cursor
|
||||
***********************************************************************/
|
||||
|
||||
/* Timer function of hourglass_atimer. TIMER is equal to
|
||||
hourglass_atimer.
|
||||
|
||||
Display an hourglass pointer on all frames by mapping the frames'
|
||||
hourglass_window. Set the hourglass_p flag in the frames'
|
||||
output_data.x structure to indicate that an hourglass cursor is
|
||||
shown on the frames. */
|
||||
|
||||
void
|
||||
show_hourglass (struct atimer *timer)
|
||||
{
|
||||
/* The timer implementation will cancel this timer automatically
|
||||
after this function has run. Set hourglass_atimer to null
|
||||
so that we know the timer doesn't have to be canceled. */
|
||||
hourglass_atimer = NULL;
|
||||
|
||||
if (!hourglass_shown_p)
|
||||
{
|
||||
Lisp_Object rest, frame;
|
||||
|
||||
block_input ();
|
||||
|
||||
FOR_EACH_FRAME (rest, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_LIVE_P (f) && FRAME_X_P (f) && FRAME_X_DISPLAY (f))
|
||||
{
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
#ifdef USE_X_TOOLKIT
|
||||
if (f->output_data.x->widget)
|
||||
#else
|
||||
if (FRAME_OUTER_WINDOW (f))
|
||||
#endif
|
||||
{
|
||||
f->output_data.x->hourglass_p = 1;
|
||||
|
||||
if (!f->output_data.x->hourglass_window)
|
||||
{
|
||||
unsigned long mask = CWCursor;
|
||||
XSetWindowAttributes attrs;
|
||||
#ifdef USE_GTK
|
||||
Window parent = FRAME_X_WINDOW (f);
|
||||
#else
|
||||
Window parent = FRAME_OUTER_WINDOW (f);
|
||||
#endif
|
||||
attrs.cursor = f->output_data.x->hourglass_cursor;
|
||||
|
||||
f->output_data.x->hourglass_window
|
||||
= XCreateWindow (dpy, parent,
|
||||
0, 0, 32000, 32000, 0, 0,
|
||||
InputOnly,
|
||||
CopyFromParent,
|
||||
mask, &attrs);
|
||||
}
|
||||
|
||||
XMapRaised (dpy, f->output_data.x->hourglass_window);
|
||||
XFlush (dpy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hourglass_shown_p = 1;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Hide the hourglass pointer on all frames, if it is currently
|
||||
shown. */
|
||||
|
||||
void
|
||||
hide_hourglass (void)
|
||||
{
|
||||
if (hourglass_shown_p)
|
||||
{
|
||||
Lisp_Object rest, frame;
|
||||
|
||||
block_input ();
|
||||
FOR_EACH_FRAME (rest, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (frame);
|
||||
|
||||
if (FRAME_X_P (f)
|
||||
/* Watch out for newly created frames. */
|
||||
&& f->output_data.x->hourglass_window)
|
||||
{
|
||||
XUnmapWindow (FRAME_X_DISPLAY (f),
|
||||
f->output_data.x->hourglass_window);
|
||||
/* Sync here because XTread_socket looks at the
|
||||
hourglass_p flag that is reset to zero below. */
|
||||
XSync (FRAME_X_DISPLAY (f), False);
|
||||
f->output_data.x->hourglass_p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
hourglass_shown_p = 0;
|
||||
unblock_input ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
Tool tips
|
||||
***********************************************************************/
|
||||
|
|
|
|||
62
src/xterm.c
62
src/xterm.c
|
|
@ -2952,8 +2952,64 @@ x_clear_frame (struct frame *f)
|
|||
unblock_input ();
|
||||
}
|
||||
|
||||
/* RIF: Show hourglass cursor on frame F. */
|
||||
|
||||
static void
|
||||
x_show_hourglass (struct frame *f)
|
||||
{
|
||||
Display *dpy = FRAME_X_DISPLAY (f);
|
||||
|
||||
if (dpy)
|
||||
{
|
||||
struct x_output *x = FRAME_X_OUTPUT (f);
|
||||
#ifdef USE_X_TOOLKIT
|
||||
if (x->widget)
|
||||
#else
|
||||
if (FRAME_OUTER_WINDOW (f))
|
||||
#endif
|
||||
{
|
||||
x->hourglass_p = 1;
|
||||
|
||||
if (!x->hourglass_window)
|
||||
{
|
||||
unsigned long mask = CWCursor;
|
||||
XSetWindowAttributes attrs;
|
||||
#ifdef USE_GTK
|
||||
Window parent = FRAME_X_WINDOW (f);
|
||||
#else
|
||||
Window parent = FRAME_OUTER_WINDOW (f);
|
||||
#endif
|
||||
attrs.cursor = x->hourglass_cursor;
|
||||
|
||||
x->hourglass_window = XCreateWindow
|
||||
(dpy, parent, 0, 0, 32000, 32000, 0, 0,
|
||||
InputOnly, CopyFromParent, mask, &attrs);
|
||||
}
|
||||
|
||||
XMapRaised (dpy, x->hourglass_window);
|
||||
XFlush (dpy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* RIF: Cancel hourglass cursor on frame F. */
|
||||
|
||||
static void
|
||||
x_hide_hourglass (struct frame *f)
|
||||
{
|
||||
struct x_output *x = FRAME_X_OUTPUT (f);
|
||||
|
||||
/* Watch out for newly created frames. */
|
||||
if (x->hourglass_window)
|
||||
{
|
||||
XUnmapWindow (FRAME_X_DISPLAY (f), x->hourglass_window);
|
||||
/* Sync here because XTread_socket looks at the
|
||||
hourglass_p flag that is reset to zero below. */
|
||||
XSync (FRAME_X_DISPLAY (f), False);
|
||||
x->hourglass_p = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Invert the middle quarter of the frame for .15 sec. */
|
||||
|
||||
static void
|
||||
|
|
@ -10431,7 +10487,9 @@ static struct redisplay_interface x_redisplay_interface =
|
|||
x_draw_window_cursor,
|
||||
x_draw_vertical_window_border,
|
||||
x_draw_window_divider,
|
||||
x_shift_glyphs_for_insert
|
||||
x_shift_glyphs_for_insert,
|
||||
x_show_hourglass,
|
||||
x_hide_hourglass
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue