[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117569: Move hourglass machinery to RIF.
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] trunk r117569: Move hourglass machinery to RIF. |
Date: |
Fri, 25 Jul 2014 06:04:48 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117569
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2014-07-25 10:01:39 +0400
message:
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.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/dispextern.h
dispextern.h-20091113204419-o5vbwnq5f7feedwu-218
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
src/w32fns.c w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
src/w32term.c w32term.c-20091113204419-o5vbwnq5f7feedwu-950
src/w32term.h w32term.h-20091113204419-o5vbwnq5f7feedwu-954
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
src/xfns.c xfns.c-20091113204419-o5vbwnq5f7feedwu-274
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-07-24 05:49:14 +0000
+++ b/src/ChangeLog 2014-07-25 06:01:39 +0000
@@ -1,3 +1,24 @@
+2014-07-25 Dmitry Antipov <address@hidden>
+
+ 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 <address@hidden>
Fix error reported by Angelo Graziosi <address@hidden> in
=== modified file 'src/dispextern.h'
--- a/src/dispextern.h 2014-07-16 05:44:05 +0000
+++ b/src/dispextern.h 2014-07-25 06:01:39 +0000
@@ -2821,45 +2821,51 @@
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 @@
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. */
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2014-07-21 06:03:08 +0000
+++ b/src/nsterm.m 2014-07-25 06:01:39 +0000
@@ -2594,37 +2594,17 @@
ns_unfocus (f);
}
-
-void
-show_hourglass (struct atimer *timer)
-{
- if (hourglass_shown_p)
- return;
-
- block_input ();
-
- /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */
-
- hourglass_shown_p = 1;
- unblock_input ();
-}
-
-
-void
-hide_hourglass (void)
-{
- if (!hourglass_shown_p)
- return;
-
- block_input ();
-
- /* TODO: remove NSProgressIndicator from all frames */
-
- hourglass_shown_p = 0;
- unblock_input ();
-}
-
-
+static void
+ns_show_hourglass (struct frame *f)
+{
+ /* TODO: add NSProgressIndicator to all frames. */
+}
+
+static void
+ns_hide_hourglass (struct frame *f)
+{
+ /* TODO: remove NSProgressIndicator from all frames. */
+}
/* ==========================================================================
@@ -4114,7 +4094,9 @@
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
};
=== modified file 'src/w32fns.c'
--- a/src/w32fns.c 2014-07-12 17:53:29 +0000
+++ b/src/w32fns.c 2014-07-25 06:01:39 +0000
@@ -5488,67 +5488,6 @@
#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
***********************************************************************/
=== modified file 'src/w32term.c'
--- a/src/w32term.c 2014-07-18 06:02:19 +0000
+++ b/src/w32term.c 2014-07-25 06:01:39 +0000
@@ -6180,8 +6180,40 @@
#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 @@
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);
=== modified file 'src/w32term.h'
--- a/src/w32term.h 2014-05-28 13:53:22 +0000
+++ b/src/w32term.h 2014-07-25 06:01:39 +0000
@@ -780,6 +780,7 @@
#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);
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2014-07-21 06:03:08 +0000
+++ b/src/xdisp.c 2014-07-25 06:01:39 +0000
@@ -30730,7 +30730,38 @@
/* 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 @@
show_hourglass, NULL);
}
-
/* Cancel the hourglass cursor timer if active, hide a busy cursor if
shown. */
+
void
cancel_hourglass (void)
{
@@ -30766,7 +30797,28 @@
}
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 */
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2014-07-22 13:55:04 +0000
+++ b/src/xfns.c 2014-07-25 06:01:39 +0000
@@ -4735,116 +4735,6 @@
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
***********************************************************************/
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2014-07-22 13:55:04 +0000
+++ b/src/xterm.c 2014-07-25 06:01:39 +0000
@@ -2952,8 +2952,64 @@
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 @@
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
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117569: Move hourglass machinery to RIF.,
Dmitry Antipov <=